Hi,

I made a small patch in the form of an enhancement request in Bugzilla
(including the patch as an attachment):
https://bugzilla.gnome.org/show_bug.cgi?id=639688

Could some of the maintainers please review if the patch is any good?

Regards,

  Markus T. Vartiainen

---
(Text of the enhancement request:)

Jump to parent with left arrow key on collapsed row

Background

When browsing a hierarchy of folders in the list view with arrow keys, it is
troublesome to get back to higher level from a long list of files or
sub-folders inside a parent folder. This decreases the value of arrow key-based
navigation, since it is easier to just scroll to the parent and collapse it
with mouse click than to hit an up-arrow key repeatedly to reach the parent.

Solution proposal

Left-arrow key is currently used only for collapsing expanded folders. On
collapsed folders and files it doesn't have any effect. In that case, instead
of doing nothing, pressing left-arrow key could select (jump to) the parent
folder of the current item. This would make collapsing current parent folder
trivial by pressing left-arrow two times: first to reach the parent folder and
then to collapse it. (If the current item would be an expanded folder, it would
take three presses of left-arrow: first to collapse current folder and then to
jump to and collapse the parent folder. This is almost equally trivial.)

Patch included

I wrote a small patch as an attempt to provide this functionality. Maintainers,
please review it if it's worth including to mainline. The patch is based on
gnome-2-32 branch.

---
(The patch, unfortunately somewhat mangled by my e-mail client - see
correct version in Bugzilla:)

>From e9f8cc51f4382c117cdef214a71d1a97a874e2bc Mon Sep 17 00:00:00 2001
From: Markus T. Vartiainen <mtvartia ... gmail.com>
Date: Sun, 16 Jan 2011 17:03:35 +0200
Subject: [PATCH] fm-list-view: Jump to parent with left arrow key on
collapsed row

On collapsed (or childless) row, jump to the parent row. This enables
browsing a hierarchy of folders very fast using only arrow keys.
---
 src/file-manager/fm-list-view.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 3f59959..423d0d8 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1008,7 +1008,11 @@ key_press_callback (GtkWidget *widget,
GdkEventKey *event, gpointer callback_dat
        case GDK_Left:
                gtk_tree_view_get_cursor (tree_view, &path, NULL);
                if (path) {
-                       gtk_tree_view_collapse_row (tree_view, path);
+                       if (!gtk_tree_view_collapse_row (tree_view, path)) {
+                               if ((gtk_tree_path_get_depth (path) >
1) && gtk_tree_path_up (path)) {
+                                       gtk_tree_view_set_cursor
(tree_view, path, NULL, FALSE);
+                               }
+                       }
                        gtk_tree_path_free (path);
                }
                handled = TRUE;
-- 
1.7.1
-- 
nautilus-list mailing list
nautilus-list@gnome.org
http://mail.gnome.org/mailman/listinfo/nautilus-list

Reply via email to