Patch: set watch cursor while updating PhotoView



This patch makes the toplevel window set a watch cursor while the
PhotoView is getting updated.  What do you think?

  Federico
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/f-spot/ChangeLog,v
retrieving revision 1.127
diff -u -r1.127 ChangeLog
--- ChangeLog	29 Jun 2004 12:58:48 -0000	1.127
+++ ChangeLog	29 Jun 2004 13:56:14 -0000
@@ -1,3 +1,17 @@
+2004-06-29  Federico Mena Quintero  <federico ximian com>
+
+	* src/PhotoView.cs (CurrentPhoto.set): Don't do anything if we are
+	trying to set the same photo as the one we have.
+	(UpdateStarted): New event.
+	(UpdateFinished): New event.
+	(Update): Emit the UpdateStarted and UpdateFinished notifications.
+	
+	* src/MainWindow.cs (MainWindow): Add event handlers to the
+	photo_view UpdateStarted and UpdateFinished.
+	(HandlePhotoViewUpdateStarted): New event handler; set the cursor
+	to a watch.
+	(HandlePhotoViewUpdateFinished): New event handler; unset the cursor.
+
 2004-06-29  Larry Ewing  <lewing ximian com>
 
 	* src/PixbufLoader.cs: make the queue act in as last in first out
Index: src/MainWindow.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/MainWindow.cs,v
retrieving revision 1.44
diff -u -r1.44 MainWindow.cs
--- src/MainWindow.cs	28 Jun 2004 08:55:47 -0000	1.44
+++ src/MainWindow.cs	29 Jun 2004 13:56:14 -0000
@@ -166,6 +166,8 @@
 		photo_box.Add (photo_view);
 		photo_view.PhotoChanged += new PhotoView.PhotoChangedHandler (HandlePhotoViewPhotoChanged);
 		photo_view.ButtonPressEvent += new ButtonPressEventHandler (HandlePhotoViewButtonPressEvent);
+		photo_view.UpdateStarted += new PhotoView.UpdateStartedHandler (HandlePhotoViewUpdateStarted);
+		photo_view.UpdateFinished += new PhotoView.UpdateFinishedHandler (HandlePhotoViewUpdateFinished);
 
 		Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table, 
 				  DragAction.Copy | DragAction.Move); 
@@ -441,6 +443,20 @@
 	{
 		if (args.Event.Type == EventType.TwoButtonPress && args.Event.Button == 1)
 			SwitchToIconViewMode ();
+	}
+
+	void HandlePhotoViewUpdateStarted (PhotoView sender)
+	{
+		main_window.GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Watch);
+		// FIXME: use gdk_display_flush() when available
+		main_window.GdkWindow.Display.Sync ();
+	}
+
+	void HandlePhotoViewUpdateFinished (PhotoView sender)
+	{
+		main_window.GdkWindow.Cursor = null;
+		// FIXME: use gdk_display_flush() when available
+		main_window.GdkWindow.Display.Sync ();
 	}
 
 	//
Index: src/PhotoView.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/PhotoView.cs,v
retrieving revision 1.17
diff -u -r1.17 PhotoView.cs
--- src/PhotoView.cs	28 Jun 2004 08:55:47 -0000	1.17
+++ src/PhotoView.cs	29 Jun 2004 13:56:14 -0000
@@ -13,6 +13,9 @@
 		}
 
 		set {
+			if (current_photo == value)
+				return;
+
 			current_photo = value;
 			Update ();
 		}
@@ -75,6 +78,11 @@
 	public delegate void PhotoChangedHandler (PhotoView me);
 	public event PhotoChangedHandler PhotoChanged;
 
+	public delegate void UpdateStartedHandler (PhotoView view);
+	public event UpdateStartedHandler UpdateStarted;
+
+	public delegate void UpdateFinishedHandler (PhotoView view);
+	public event UpdateFinishedHandler UpdateFinished;
 
 	// Selection constraints.
 
@@ -260,10 +268,16 @@
 
 	public void Update ()
 	{
+		if (UpdateStarted != null)
+			UpdateStarted (this);
+
 		UpdateImageView ();
 		UpdateButtonSensitivity ();
 		UpdateCountLabel ();
 		UpdateDescriptionEntry ();
+
+		if (UpdateFinished != null)
+			UpdateFinished (this);
 	}
 
 


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