[Bf-blender-cvs] [4fb9cc2] master: Fix (unreported): Filebrowser key navigation entry did not change caption correctly

Thomas Beck noreply at git.blender.org
Wed Sep 16 22:11:07 CEST 2015


Commit: 4fb9cc24a8b9bd37e2a668f8466976b0d24ed8dc
Author: Thomas Beck
Date:   Wed Sep 16 22:03:06 2015 +0200
Branches: master
https://developer.blender.org/rB4fb9cc24a8b9bd37e2a668f8466976b0d24ed8dc

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!

===================================================================

M	source/blender/editors/space_file/file_draw.c

===================================================================

diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index dac9124..a77375a2 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -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, "");




More information about the Bf-blender-cvs mailing list