Fix (unreported): Filebrowser key navigation entry did not change caption correctly

As of this release we're able to navigate with the keyboard in the filebrowsing area. The button caption is changing to an appropriate string whenever a new entry is selected. In @Severins original code a different method was used to determine if a directory was choosen or not, but this got lost while merging the filebrowser rework.

Thanks to @mont29 for review!
This commit is contained in:
Thomas Beck 2015-09-16 22:03:06 +02:00
parent 9d087ad0b5
commit 4fb9cc24a8
1 changed files with 12 additions and 3 deletions

View File

@ -232,9 +232,18 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Execute / cancel buttons. */
if (loadbutton) {
const struct FileDirEntry *file = sfile->files ? filelist_file(sfile->files, params->active_file) : NULL;
const char *str_exec = (file && (file->typeflag & FILE_TYPE_FOLDER)) ?
/* params->title is already translated! */
IFACE_("Open Directory") : params->title;
char const *str_exec;
if (file) {
const bool is_parent_dir = (FILENAME_IS_PARENT(file->relpath));
if (is_parent_dir){
str_exec = IFACE_("Parent Directory");
} else if (file->typeflag & FILE_TYPE_DIR) {
str_exec = IFACE_("Open Directory");
}
} else {
str_exec = params->title; /* params->title is already translated! */
}
uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, str_exec,
max_x - loadbutton, line1_y, loadbutton, btn_h, "");