[PATCH] Show watch cursor when loading directory in browser mode



From bug 97887 [1]:

"It would be nice if nautilus changed the mouse pointer when loading
folders (especially for us who do not use the toolbar)."
"This seems fixed for spatilus."

[1] http://bugzilla.gnome.org/show_bug.cgi?id=97887

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-spatial-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.c,v
retrieving revision 1.447
diff -u -p -r1.447 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	6 Jul 2005 20:25:52 -0000	1.447
+++ src/nautilus-spatial-window.c	10 Jul 2005 14:01:29 -0000
@@ -186,28 +186,6 @@ nautilus_spatial_window_unrealize (GtkWi
 	}
 }
 
-
-static void
-nautilus_spatial_window_realize (GtkWidget *widget)
-{
-	NautilusSpatialWindow *window;
-
-	window = NAUTILUS_SPATIAL_WINDOW (widget);
-
-	GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
-	if (window->loading) {
-		GdkCursor *cursor;
-
-		cursor = gdk_cursor_new (GDK_WATCH);
-		gdk_window_set_cursor (widget->window, cursor);
-		gdk_cursor_unref (cursor);
-	} else {
-		gdk_window_set_cursor (widget->window, NULL);
-	}
-}
-
-
 static void
 nautilus_spatial_window_destroy (GtkObject *object)
 {
@@ -392,26 +370,6 @@ real_get_default_size (NautilusWindow *w
 static void
 real_set_throbber_active (NautilusWindow *window, gboolean active)
 {
-	NautilusSpatialWindow *spatial;
-
-	spatial = NAUTILUS_SPATIAL_WINDOW (window);
-	spatial->loading = active;
-	
-	if (!GTK_WIDGET_REALIZED (GTK_WIDGET (window)))
-		return;
-
-	if (active) {
-		GdkCursor *cursor;
-
-		cursor = gdk_cursor_new (GDK_WATCH);
-		gdk_window_set_cursor (GTK_WIDGET (window)->window,
-				       cursor);
-		gdk_cursor_unref (cursor);
-		
-	} else {
-		gdk_window_set_cursor (GTK_WIDGET (window)->window,
-				       NULL);
-	}
 }
 
 static void
@@ -892,7 +850,6 @@ nautilus_spatial_window_class_init (Naut
 	GTK_WIDGET_CLASS (class)->show = nautilus_spatial_window_show;
 	GTK_WIDGET_CLASS (class)->configure_event = nautilus_spatial_window_configure_event;
 	GTK_WIDGET_CLASS (class)->unrealize = nautilus_spatial_window_unrealize;
-	GTK_WIDGET_CLASS (class)->realize = nautilus_spatial_window_realize;
 
 	NAUTILUS_WINDOW_CLASS (class)->prompt_for_location = 
 		real_prompt_for_location;
Index: src/nautilus-spatial-window.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.h,v
retrieving revision 1.112
diff -u -p -r1.112 nautilus-spatial-window.h
--- src/nautilus-spatial-window.h	21 Jun 2004 18:33:43 -0000	1.112
+++ src/nautilus-spatial-window.h	10 Jul 2005 14:01:29 -0000
@@ -47,7 +47,6 @@ struct _NautilusSpatialWindow {
         NautilusWindow parent_object;
 
         gboolean affect_spatial_window_on_next_location_change;
-	gboolean loading;
         
         NautilusSpatialWindowDetails *details;
 };
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.451
diff -u -p -r1.451 nautilus-window.c
--- src/nautilus-window.c	7 Jul 2005 10:16:41 -0000	1.451
+++ src/nautilus-window.c	10 Jul 2005 14:01:30 -0000
@@ -299,6 +299,20 @@ nautilus_window_allow_up (NautilusWindow
 			 set_allow_up, (window, allow));
 }
 
+static void
+update_cursor (NautilusWindow *window)
+{
+	GdkCursor *cursor;
+
+	if (window->details->allow_stop) {
+		cursor = gdk_cursor_new (GDK_WATCH);
+		gdk_window_set_cursor (GTK_WIDGET (window)->window, cursor);
+		gdk_cursor_unref (cursor);
+	} else {
+		gdk_window_set_cursor (GTK_WIDGET (window)->window, NULL);
+	}
+}
+
 void
 nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
 {
@@ -309,6 +323,14 @@ nautilus_window_allow_stop (NautilusWind
 	action = gtk_action_group_get_action (window->details->main_action_group,
 					      NAUTILUS_ACTION_STOP);
 	gtk_action_set_sensitive (action, allow);
+
+	if (window->details->allow_stop != allow) {
+		window->details->allow_stop = allow;
+
+		if (GTK_WIDGET_REALIZED (GTK_WIDGET (window))) {
+			update_cursor (window);
+		}
+	}
 	
 	EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
 			 set_throbber_active, (window, allow));
@@ -641,6 +663,12 @@ nautilus_window_size_request (GtkWidget	
 	}
 }
 
+static void
+nautilus_window_realize (GtkWidget *widget)
+{
+	GTK_WIDGET_CLASS (nautilus_window_parent_class)->realize (widget);
+	update_cursor (NAUTILUS_WINDOW (widget));
+}
 
 /*
  * Main API
@@ -1445,6 +1473,7 @@ nautilus_window_class_init (NautilusWind
 	GTK_OBJECT_CLASS (class)->destroy = nautilus_window_destroy;
 	GTK_WIDGET_CLASS (class)->show = nautilus_window_show;
 	GTK_WIDGET_CLASS (class)->size_request = nautilus_window_size_request;
+	GTK_WIDGET_CLASS (class)->realize = nautilus_window_realize;
 	class->add_current_location_to_history_list = real_add_current_location_to_history_list;
 	class->get_title = real_get_title;
 	class->set_title = real_set_title;
Index: src/nautilus-window-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-private.h,v
retrieving revision 1.109
diff -u -p -r1.109 nautilus-window-private.h
--- src/nautilus-window-private.h	8 Jul 2005 11:25:51 -0000	1.109
+++ src/nautilus-window-private.h	10 Jul 2005 14:01:30 -0000
@@ -70,6 +70,7 @@ struct NautilusWindowDetails
 	char *title;
 	NautilusFile *viewed_file;
         gboolean viewed_file_seen;
+	gboolean allow_stop;
 
         /* New location. */
         NautilusLocationChangeType location_change_type;

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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