[f-spot/cleanup-backend: 19/23] Change SelectedPhotos() of MainWindow to return IBrowseableItems



commit 8c0f045244a992a9be1d019768b5d5b439f3c33d
Author: Mike Gemünde <mike gemuende de>
Date:   Fri Jul 16 16:55:24 2010 +0200

    Change SelectedPhotos() of MainWindow to return IBrowseableItems
    
    This should introduce some regressions and break some features
    like reparanting or deleting/removing of photos. They will come
    back in the new backend.

 src/MainWindow.cs |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index b9fb4a8..950a9b8 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -860,18 +860,18 @@ namespace FSpot
 		// Selection Interface
 		//
 	
-		private Photo [] SelectedPhotos (int [] selected_ids)
+		private IBrowsableItem [] SelectedPhotos (int [] selected_ids)
 		{
-			Photo [] photo_list = new Photo [selected_ids.Length];
+			IBrowsableItem [] photo_list = new IBrowsableItem [selected_ids.Length];
 		
 			int i = 0;
 			foreach (int num in selected_ids)
-				photo_list [i ++] = query [num] as Photo;
+				photo_list [i ++] = query [num];
 			
 			return photo_list;
 		}
 	
-		public Photo [] SelectedPhotos () 
+		public IBrowsableItem [] SelectedPhotos ()
 		{
 			return SelectedPhotos (SelectedIds ());
 		}
@@ -1036,7 +1036,7 @@ namespace FSpot
 	
 		public void HandleIconViewDragBegin (object sender, DragBeginArgs args)
 		{
-			Photo [] photos = SelectedPhotos ();
+			IBrowsableItem [] photos = SelectedPhotos ();
 			
 			if (photos.Length > 0) {
 				int len = Math.Min (photos.Length, 4);
@@ -1094,7 +1094,7 @@ namespace FSpot
 			}
 			
 			if (args.Info == DragDropTargets.PhotoListEntry.Info) {
-				args.SelectionData.SetPhotosData (SelectedPhotos (), args.Context.Targets[0]);
+				args.SelectionData.SetPhotosData (SelectedPhotos () as Photo [], args.Context.Targets[0]);
 				return;
 			}
 			
@@ -1212,11 +1212,11 @@ namespace FSpot
 					if (query.Selection.Contains (p_item)) //We don't want to reparent ourselves!
 						return;
 					PhotoVersionCommands.Reparent cmd = new PhotoVersionCommands.Reparent ();				
-					Photo[] photos_to_reparent = SelectedPhotos ();
+					Photo[] photos_to_reparent = SelectedPhotos () as Photo [];
 					// Give feedback to user that something happened, and leave the parent selected after reparenting
 					query.Selection.Select (p_item);
                     query.Selection.FocusedIndex = p_item;
-					cmd.Execute (Database.Photos, photos_to_reparent, query.Photos [p_item], GetToplevel (null));
+					cmd.Execute (Database.Photos, photos_to_reparent, query [p_item] as Photo, GetToplevel (null));
 					UpdateQuery ();
 				}
 				Gtk.Drag.Finish (args.Context, true, false, args.Time);
@@ -2085,7 +2085,7 @@ namespace FSpot
 				return;
 			}
 			
-	   		Photo[] photos = SelectedPhotos();
+	   		Photo[] photos = SelectedPhotos() as Photo [];
 	   		string header = Catalog.GetPluralString ("Delete the selected photo permanently?", 
 									    "Delete the {0} selected photos permanently?", 
 									    photos.Length);
@@ -2125,7 +2125,7 @@ namespace FSpot
 				return;
 			}
 	
-	   		Photo[] photos = SelectedPhotos();
+	   		Photo[] photos = SelectedPhotos() as Photo [];
 			if (photos.Length == 0) 
 				return;
 	
@@ -2742,7 +2742,7 @@ namespace FSpot
 		public void HandleOpenWith (object sender, ApplicationActivatedEventArgs e)
 		{
 			GLib.AppInfo application = e.AppInfo;
-			Photo[] selected = SelectedPhotos ();
+			Photo[] selected = SelectedPhotos () as Photo [];
 	
 			if (selected == null || selected.Length < 1)
 				return;



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