PATCH: Busy cursor for gconf-editor



Hi, Anders,

It takes a little time for gconf-editor to read the available nodes when
you open a branch in the tree.  Here is a tiny patch to add a busy
cursor while the branch gets opened.  I tested it a little and it makes
gconf-editor much more pleasant to use... the delay even seems smaller
now that you get feedback that it is doing something :)

Is it OK to commit?

  Federico
? autom4te.cache
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gconf-editor/ChangeLog,v
retrieving revision 1.131
diff -u -r1.131 ChangeLog
--- ChangeLog	23 Oct 2003 08:12:37 -0000	1.131
+++ ChangeLog	28 Oct 2003 18:40:28 -0000
@@ -1,3 +1,13 @@
+2003-10-28  Federico Mena Quintero  <federico ximian com>
+
+	* src/gconf-editor-window.c (gconf_editor_window_test_expand_row):
+	New callback, set the cursor to GDK_WATCH while we are figuring
+	out the child nodes.
+	(gconf_editor_window_row_expanded): New callback, reset the cursor
+	to normal.
+	(gconf_editor_window_init): Install signal handlers for the
+	callbacks above.
+
 2003-10-23 Mark Finlay <sisob tuxfamilyDOTorg>
 
 	* src/gconf-editor-window.c:
Index: src/gconf-editor-window.c
===================================================================
RCS file: /cvs/gnome/gconf-editor/src/gconf-editor-window.c,v
retrieving revision 1.44
diff -u -r1.44 gconf-editor-window.c
--- src/gconf-editor-window.c	23 Oct 2003 08:12:38 -0000	1.44
+++ src/gconf-editor-window.c	28 Oct 2003 18:40:29 -0000
@@ -488,6 +488,42 @@
 	gconf_editor_popup_window_edit_key (window, 0, NULL);
 }
 
+static gboolean
+gconf_editor_window_test_expand_row (GtkTreeView       *tree_view,
+				     GtkTreeIter       *iter,
+				     GtkTreePath       *path,
+				     gpointer           data)
+{
+  GConfEditorWindow *gconfwindow = GCONF_EDITOR_WINDOW (data);
+  GdkCursor *cursor;
+
+  if (!GTK_WIDGET_REALIZED (gconfwindow))
+    return FALSE;
+
+  cursor = gdk_cursor_new (GDK_WATCH);
+  gdk_window_set_cursor (GTK_WIDGET (gconfwindow)->window, cursor);
+  gdk_cursor_unref (cursor);
+
+  gdk_display_flush (gtk_widget_get_display (GTK_WIDGET (gconfwindow)));
+
+  return FALSE;
+}
+
+static void
+gconf_editor_window_row_expanded (GtkTreeView       *tree_view,
+				  GtkTreeIter       *iter,
+				  GtkTreePath       *path,
+				  gpointer           data)
+{
+  GConfEditorWindow *gconfwindow = GCONF_EDITOR_WINDOW (data);
+
+  if (!GTK_WIDGET_REALIZED (gconfwindow))
+    return;
+
+  gdk_window_set_cursor (GTK_WIDGET (gconfwindow)->window, NULL);
+  gdk_display_flush (gtk_widget_get_display (GTK_WIDGET (gconfwindow)));
+}
+
 static void
 gconf_editor_popup_window_set_as_default (gpointer callback_data, guint action, GtkWidget *widget)
 {
@@ -1063,6 +1099,12 @@
 			  G_CALLBACK (gconf_editor_window_selection_changed), window);
 	g_signal_connect (G_OBJECT (window->tree_view), "row-activated", 
 			  G_CALLBACK (gconf_editor_window_row_activated),
+			  window);
+	g_signal_connect (window->tree_view, "test-expand-row",
+			  G_CALLBACK (gconf_editor_window_test_expand_row),
+			  window);
+	g_signal_connect (window->tree_view, "row-expanded",
+			  G_CALLBACK (gconf_editor_window_row_expanded),
 			  window);
 	g_object_unref (G_OBJECT (window->tree_model));
 


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