From a050471613f5b7092bce1c0ae87026e91c8e23b4 Mon Sep 17 00:00:00 2001 From: Monsta Date: Mon, 24 Aug 2015 15:19:37 +0300 Subject: 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 --- src/file-manager/fm-list-view.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.1