[f-spot: 15/40] drop PhotoChangedHandler for EventHandler



commit e400720e7381b679267e09d0e9179ee5de354a97
Author: Stephane Delcroix <stephane delcroix org>
Date:   Sun Jun 21 14:34:42 2009 +0200

    drop PhotoChangedHandler for EventHandler
    
    * PhotoImageView.cs: there's no need for a custom delegate if it's possible ot use EventHandler.

 src/PhotoImageView.cs |   10 ++++++----
 src/PhotoView.cs      |    3 ++-
 src/TagCommands.cs    |    2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/PhotoImageView.cs b/src/PhotoImageView.cs
index 697790a..f9ff681 100644
--- a/src/PhotoImageView.cs
+++ b/src/PhotoImageView.cs
@@ -1,6 +1,8 @@
 //
 // FSpot.Widgets.PhotoImageView.cs
 //
+// Copyright (c) 2004-2009 Novell, Inc.
+//
 // Author(s)
 //	Larry Ewing  <lewing novell com>
 //	Stephane Delcroix  <stephane delcroix org>
@@ -22,8 +24,7 @@ namespace FSpot.Widgets {
 	}
 
 	public class PhotoImageView : ImageView {
-		public delegate void PhotoChangedHandler (PhotoImageView view);
-		public event PhotoChangedHandler PhotoChanged;
+		public event EventHandler PhotoChanged;
 		
 		protected BrowsablePointer item;
 		protected FSpot.Loupe loupe;
@@ -296,8 +297,9 @@ namespace FSpot.Widgets {
 			
 			Selection = Gdk.Rectangle.Zero;
 
-			if (PhotoChanged != null)
-				PhotoChanged (this);
+			EventHandler eh = PhotoChanged;
+			if (eh != null)
+				eh (this, EventArgs.Empty);
 		}
 		
 
diff --git a/src/PhotoView.cs b/src/PhotoView.cs
index 43453a8..19776af 100644
--- a/src/PhotoView.cs
+++ b/src/PhotoView.cs
@@ -221,8 +221,9 @@ namespace FSpot {
 			tag_view.QueueDraw ();
 		}
 	
-		private void HandlePhotoChanged (PhotoImageView view)
+		void HandlePhotoChanged (object sender, EventArgs e)
 		{
+			PhotoImageView view = sender as PhotoImageView;
 			if (query is PhotoQuery) {
 				CommitPendingChanges ();
 			}
diff --git a/src/TagCommands.cs b/src/TagCommands.cs
index f22bc8e..c5e177c 100644
--- a/src/TagCommands.cs
+++ b/src/TagCommands.cs
@@ -446,7 +446,7 @@ public class TagCommands {
 			}
 		}
 
-		public void HandlePhotoChanged (PhotoImageView sender)
+		public void HandlePhotoChanged (object sender, EventArgs e)
 		{
 			int item = image_view.Item.Index;
 			photo_label.Text = String.Format (Catalog.GetString ("Photo {0} of {1}"), 



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