[f-spot/cleanup-backend: 6/23] Remove implementation of interface IBrowseableItem from IconView.SelectionCollection



commit 27750c5db72f4c1eb857b44dd557aa702481837f
Author: Mike Gemünde <mike gemuende de>
Date:   Thu Jul 15 15:50:37 2010 +0200

    Remove implementation of interface IBrowseableItem from IconView.SelectionCollection

 src/MainWindow.cs                 |    5 ++-
 src/SingleView.cs                 |    8 +++---
 src/UI.Dialog/AdjustTimeDialog.cs |    6 ++--
 src/UI.Dialog/ImportDialog.cs     |    2 +-
 src/Widgets/IconView.cs           |   45 ++----------------------------------
 5 files changed, 14 insertions(+), 52 deletions(-)
---
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index 60d36ea..d0e9e9d 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -716,9 +716,10 @@ namespace FSpot
 			{
 				this.win = win;
 				win.icon_view.Selection.Changed += HandleSelectionChanged;
-				win.icon_view.Selection.ItemsChanged += HandleSelectionItemsChanged;
+				//win.icon_view.Selection.FocusChanged += HandleSelectionItemsChanged;
 				win.photo_view.PhotoChanged += HandlePhotoChanged;
 				win.query.ItemsChanged += HandleQueryItemsChanged;
+                win.query.ItemsChanged += HandleSelectionItemsChanged;
 			}
 			
 			public int Count {
@@ -817,7 +818,7 @@ namespace FSpot
 					Changed (this);
 			}
 	
-			public void HandleSelectionChanged (IBrowsableCollection collection)
+			public void HandleSelectionChanged (object sender, EventArgs e)
 			{
 				if (win.ViewMode == ModeType.IconView && Changed != null)
 					Changed (this);
diff --git a/src/SingleView.cs b/src/SingleView.cs
index ccc9b4a..daa3497 100644
--- a/src/SingleView.cs
+++ b/src/SingleView.cs
@@ -251,11 +251,11 @@ namespace FSpot {
 				collection.MarkChanged (image_view.Item.Index, FullInvalidate.Instance);
 		}		
 
-		private void HandleSelectionChanged (FSpot.IBrowsableCollection selection) 
+		private void HandleSelectionChanged (object sender, EventArgs e)
 		{
-			
-			if (selection.Count > 0) {
-				image_view.Item.Index = ((FSpot.Widgets.IconView.SelectionCollection)selection).Ids[0];
+
+			if (directory_view.Selection.Count > 0) {
+				image_view.Item.Index = (directory_view.Selection).Ids[0];
 
 				zoom_scale.Value = image_view.NormalizedZoom;
 			}
diff --git a/src/UI.Dialog/AdjustTimeDialog.cs b/src/UI.Dialog/AdjustTimeDialog.cs
index 5bdab38..ad93bae 100644
--- a/src/UI.Dialog/AdjustTimeDialog.cs
+++ b/src/UI.Dialog/AdjustTimeDialog.cs
@@ -251,10 +251,10 @@ namespace FSpot.UI.Dialog {
 			view.Item.MovePrevious ();
 		}
 
-		void HandleSelectionChanged (IBrowsableCollection sender)
+		void HandleSelectionChanged (object sender, EventArgs e)
 		{
-			if (sender.Count > 0) {
-				view.Item.Index = ((FSpot.Widgets.IconView.SelectionCollection)sender).Ids[0];
+			if (tray.Selection.Count > 0) {
+				view.Item.Index = (tray.Selection).Ids[0];
 
 			}
 		}
diff --git a/src/UI.Dialog/ImportDialog.cs b/src/UI.Dialog/ImportDialog.cs
index 189f209..fd8a61e 100644
--- a/src/UI.Dialog/ImportDialog.cs
+++ b/src/UI.Dialog/ImportDialog.cs
@@ -59,7 +59,7 @@ namespace FSpot.UI.Dialog
             GtkUtil.ModifyColors (photo_view);
 
             var tray = new ScalingIconView (Controller.Photos);
-            tray.Selection.Changed += (c) => {
+            tray.Selection.Changed += delegate {
                 if (tray.Selection.Count > 0)
                     photo_view.Item.Index = tray.Selection.Ids[0];
             };
diff --git a/src/Widgets/IconView.cs b/src/Widgets/IconView.cs
index d1c4cfd..7573ae3 100644
--- a/src/Widgets/IconView.cs
+++ b/src/Widgets/IconView.cs
@@ -253,12 +253,12 @@ namespace FSpot.Widgets
 			collection.ItemsChanged += HandleItemsChanged;
 
 			selection.Changed += HandleSelectionChanged;
-            selection.FocusChanged +=  delegate {
+            selection.FocusChanged += delegate {
                 QueueDraw ();
             };;
 		}
 
-		private void HandleSelectionChanged (FSpot.IBrowsableCollection collection)
+		private void HandleSelectionChanged (object sender, EventArgs e)
 		{
 			QueueDraw ();
 		}
@@ -301,7 +301,7 @@ namespace FSpot.Widgets
 		// FIXME right now a selection change triggers a complete view redraw
 		// This should be optimized away by directly notifyiing the view of changed
 		// indexes rather than having the view connect to the collection.Changed event.
-		public class SelectionCollection : Hyena.Collections.Selection, IBrowsableCollection {
+		public class SelectionCollection : Hyena.Collections.Selection {
 			IBrowsableCollection parent;
 			BitArray bit_array;
 			int [] selection;
@@ -313,12 +313,6 @@ namespace FSpot.Widgets
 				this.parent = collection;
 				this.bit_array = new BitArray (this.parent.Count);
 				this.parent.Changed += HandleParentChanged;
-				this.parent.ItemsChanged += HandleParentItemsChanged;
-
-                base.Changed += delegate {
-                    if (this.Changed != null)
-                        this.Changed (this);
-                };
             }
 
 			private void HandleParentChanged (IBrowsableCollection collection)
@@ -327,36 +321,6 @@ namespace FSpot.Widgets
                 Clear ();
 			}
 
-			public void MarkChanged (int item, IBrowsableItemChanges changes)
-			{
-				// Forward the change event up to our parent
-				// we'll fire the event when the parent calls us back
-				//parent.MarkChanged ((int) selected_cells [item], changes);
-			}
-
-			private void HandleParentItemsChanged (IBrowsableCollection collection, BrowsableEventArgs args)
-			{
-				if (this.ItemsChanged == null)
-					return;
-
-				ArrayList local_ids = new ArrayList ();
-				foreach (int parent_index in args.Items) {
-					// If the item isn't part of the selection ignore it
-					if (!this.Contains (collection [parent_index]))
-						return;
-
-					int local_index = this.IndexOf (parent_index);
-					if (local_index >= 0)
-						local_ids.Add (local_index);
-				}
-
-				if (local_ids.Count == 0)
-					return;
-
-				int [] items = (int [])local_ids.ToArray (typeof (int));
-				ItemsChanged (this, new BrowsableEventArgs (items, args.Changes));
-			}
-
 			public BitArray ToBitArray () {
 				return bit_array;
 			}
@@ -505,9 +469,6 @@ namespace FSpot.Widgets
 					}
 			}
 
-
-			public event IBrowsableCollectionChangedHandler Changed;
-			public event IBrowsableCollectionItemsChangedHandler ItemsChanged;
 		}
 
 		// Updating.



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