expand tree rows on double-click



Hi,

The attached patch (against the gnome-2-4 branch) makes the directory
tree rows expand when the user double clicks on a folder. This makes the
directory tree more convenient to use imo. Is it ok to commit?

Christophe
? treeview.diff
Index: components/tree/nautilus-tree-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/tree/nautilus-tree-view.c,v
retrieving revision 1.141
diff -u -r1.141 nautilus-tree-view.c
--- components/tree/nautilus-tree-view.c	29 Aug 2003 12:03:49 -0000	1.141
+++ components/tree/nautilus-tree-view.c	9 Oct 2003 14:54:09 -0000
@@ -318,13 +318,26 @@
 }
 
 static void
+row_activated_callback (GtkTreeView *treeview, GtkTreePath *path, 
+			GtkTreeViewColumn *column, NautilusTreeView *view)
+{
+	if (gtk_tree_view_row_expanded (view->details->tree_widget, path)) {
+		gtk_tree_view_collapse_row (view->details->tree_widget, path);
+	} else {
+		gtk_tree_view_expand_row (view->details->tree_widget, 
+					  path, FALSE);
+	}
+}
+
+
+static void
 selection_changed_callback (GtkTreeSelection *selection,
 			    NautilusTreeView *view)
 {
 	NautilusFileAttributes attributes;
 	GtkTreeIter iter;
 
-        cancel_activation (view);
+	cancel_activation (view);
 
 	if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
 		return;
@@ -583,6 +596,10 @@
 
 	g_signal_connect_object (gtk_tree_view_get_selection (GTK_TREE_VIEW (view->details->tree_widget)), "changed",
 				 G_CALLBACK (selection_changed_callback), view, 0);
+
+	g_signal_connect (G_OBJECT (view->details->tree_widget), 
+			  "row-activated", G_CALLBACK (row_activated_callback),
+			  view);
 
 	schedule_show_selection (view);
 }


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