f-spot r4092 - in trunk: . src



Author: rubenv
Date: Tue Jun 24 20:07:17 2008
New Revision: 4092
URL: http://svn.gnome.org/viewvc/f-spot?rev=4092&view=rev

Log:
2008-06-24  Ruben Vermeersch  <ruben savanne be>

	* PhotoQuery.cs: Make sure PhotoQuery gets notified of all updates in the
	PhotoStore. This ensures that PhotoQuery is always up-to-date. Changed the
	MarkChanged event chain to trigger on the PhotoStore events.


Modified:
   trunk/ChangeLog
   trunk/src/PhotoQuery.cs

Modified: trunk/src/PhotoQuery.cs
==============================================================================
--- trunk/src/PhotoQuery.cs	(original)
+++ trunk/src/PhotoQuery.cs	Tue Jun 24 20:07:17 2008
@@ -29,6 +29,7 @@
 			// 	 photos that were added or removed over dbus
 			this.store.ItemsAddedOverDBus += delegate { RequestReload(); };
 			this.store.ItemsRemovedOverDBus += delegate { RequestReload(); };
+			this.store.ItemsChanged += MarkChanged;
 
 			photos = store.Query ((Tag [])null, null, Range, RollSet, RatingRange);
 		}
@@ -188,7 +189,22 @@
 		{
 			foreach (int index in indexes)
 				store.Commit (photos[index]);
-			MarkChanged (indexes);
+		}
+
+		private void MarkChanged (object sender, DbItemEventArgs args)
+		{
+			List<int> indexes = new List<int>();
+			foreach (DbItem item in args.Items) {
+				Photo photo = item as Photo;
+				int index = IndexOf (photo);
+
+				// Ignore photos that are not in the query
+				if (index > -1) 
+					indexes.Add (index);
+			}
+
+			if (indexes.Count > 0) 
+				MarkChanged (indexes.ToArray ());
 		}
 
 		public void MarkChanged (int index)



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