[nautilus] list-view: jump to parent with left key on collapsed rows (#639688)



commit 9eee9ff6ca3e93d5d363725282d8ba393a1e6d01
Author: Markus T. Vartiainen <mtvartia gmail com>
Date:   Tue Jan 18 14:37:05 2011 +0100

    list-view: jump to parent with left key on collapsed rows (#639688)

 src/nautilus-list-view.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 92f02c5..b6ee0b9 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1009,7 +1009,15 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat
 	case GDK_KEY_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 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]