summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-08-24 15:19:37 +0300
committerMonsta <[email protected]>2015-08-24 15:19:37 +0300
commita050471613f5b7092bce1c0ae87026e91c8e23b4 (patch)
tree77212f62b7b451aedb7e37bd5c6be9e45bb229b8
parent17d512792703739148a6ebe216790eaa73a76f9f (diff)
downloadcaja-a050471613f5b7092bce1c0ae87026e91c8e23b4.tar.bz2
caja-a050471613f5b7092bce1c0ae87026e91c8e23b4.tar.xz
list view: jump to parent with left key on collapsed rows
fixes https://github.com/mate-desktop/caja/issues/452 from https://github.com/GNOME/nautilus/commit/9eee9ff6ca3e93d5d363725282d8ba393a1e6d01
-rw-r--r--src/file-manager/fm-list-view.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 294159a0..7e1b5e73 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1124,7 +1124,15 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat
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 the row is already collapsed or doesn't have any children,
+ * jump to the parent row instead.
+ */
+ 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;