changeset 2263:cd32117e507a

Feature Request #70 Navigation menu option and button for parent directory This request was made some years ago: https://sourceforge.net/p/geeqie/feature-requests/70/ I have attached a patch which implements this. Also, keyboard-only users will be able to use keyboard-accelerators to map a key to the Up function. Unfortunately there is a usability problem. If the configuration file geeqirc.xml exists (which it will except for first-time installations) geeqie will not look at the programmed defaults, but will create the toolbar from the config file - and the Up icon will not be displayed. If the user first executes a command such as this: sed -i '/toolitem action = "Back"/a <toolitem action = "Up" />' ~/.config/geeqie/geeqierc.xml then all will be well. This is not ideal, but I see no other solution. Colin Clark
author Colin Clark <cclark@mcb.net>
date Tue, 02 Feb 2016 13:15:49 +0000
parents 540934ac0b5a
children d30109a4e36d
files src/layout_util.c src/view_dir_list.c
diffstat 2 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout_util.c	Fri Sep 18 18:49:43 2015 +0100
+++ b/src/layout_util.c	Tue Feb 02 13:15:49 2016 +0000
@@ -1066,6 +1066,25 @@
 		}
 }
 
+static void layout_menu_up_cb(GtkAction *action, gpointer data)
+{
+	LayoutWindow *lw = data;
+	ViewDir *vd = lw->vd;
+	gchar *path;
+
+	if (!vd->dir_fd || strcmp(vd->dir_fd->path, G_DIR_SEPARATOR_S) == 0) return;
+	path = remove_level_from_path(vd->dir_fd->path);
+
+	if (vd->select_func)
+		{
+		FileData *fd = file_data_new_dir(path);
+		vd->select_func(vd, fd, vd->select_data);
+		file_data_unref(fd);
+		}
+
+	g_free(path);
+}
+
 
 /*
  *-----------------------------------------------------------------------------
@@ -1275,6 +1294,7 @@
   { "LastImage",	GTK_STOCK_GOTO_BOTTOM,	N_("_Last Image"),			"End",			N_("Last Image"),			CB(layout_menu_image_last_cb) },
   { "Back",		GTK_STOCK_GO_BACK,	N_("_Back"),				NULL,			N_("Back"),				CB(layout_menu_back_cb) },
   { "Home",		GTK_STOCK_HOME,		N_("_Home"),				NULL,			N_("Home"),				CB(layout_menu_home_cb) },
+  { "Up",		GTK_STOCK_GO_UP,		N_("_Up"),				NULL,			N_("Up"),				CB(layout_menu_up_cb) },
 
   { "NewWindow",	GTK_STOCK_NEW,		N_("New _window"),			"<control>N",		N_("New window"),			CB(layout_menu_new_window_cb) },
   { "NewCollection",	GTK_STOCK_INDEX,	N_("_New collection"),			"C",			N_("New collection"),			CB(layout_menu_new_cb) },
@@ -1466,6 +1486,7 @@
 "      <menuitem action='LastImage'/>"
 "      <separator/>"
 "      <menuitem action='Back'/>"
+"      <menuitem action='Up'/>"
 "      <menuitem action='Home'/>"
 "      <separator/>"
 "    </menu>"
@@ -2152,6 +2173,7 @@
 		case TOOLBAR_MAIN:
 			layout_toolbar_add(lw, type, "Thumbnails");
 			layout_toolbar_add(lw, type, "Back");
+			layout_toolbar_add(lw, type, "Up");
 			layout_toolbar_add(lw, type, "Home");
 			layout_toolbar_add(lw, type, "Refresh");
 			layout_toolbar_add(lw, type, "ZoomIn");
--- a/src/view_dir_list.c	Fri Sep 18 18:49:43 2015 +0100
+++ b/src/view_dir_list.c	Tue Feb 02 13:15:49 2016 +0000
@@ -146,15 +146,7 @@
 	ret = filelist_read(vd->dir_fd, NULL, &VDLIST(vd)->list);
 	VDLIST(vd)->list = filelist_sort(VDLIST(vd)->list, sort_type, sort_ascend);
 
-	/* add . and .. */
-
-	if (strcmp(vd->dir_fd->path, G_DIR_SEPARATOR_S) != 0)
-		{
-		filepath = g_build_filename(vd->dir_fd->path, "..", NULL);
-		fd = file_data_new_dir(filepath);
-		VDLIST(vd)->list = g_list_prepend(VDLIST(vd)->list, fd);
-		g_free(filepath);
-		}
+	/* add . */
 
 	if (options->file_filter.show_dot_directory)
 		{