f-spot r4023 - in trunk: extensions/BeagleService src



Author: sdelcroix
Date: Fri May 30 13:38:18 2008
New Revision: 4023
URL: http://svn.gnome.org/viewvc/f-spot?rev=4023&view=rev

Log:
this should complete the port to the extension, modulo the auto-fu parts

Modified:
   trunk/extensions/BeagleService/BeagleService.addin.xml
   trunk/extensions/BeagleService/BeagleService.cs
   trunk/src/FSpot.addin.xml
   trunk/src/MainWindow.cs
   trunk/src/main.cs

Modified: trunk/extensions/BeagleService/BeagleService.addin.xml
==============================================================================
--- trunk/extensions/BeagleService/BeagleService.addin.xml	(original)
+++ trunk/extensions/BeagleService/BeagleService.addin.xml	Fri May 30 13:38:18 2008
@@ -1,6 +1,6 @@
 <Addin namespace="FSpot"
 	id="BeagleService"
-	version="0.1"
+	version="0.4.3.9"
 	description="Notify Beagle on image changes"
 	author="Stephane Delcroix"
 	url="http://f-spot.org/Extensions";

Modified: trunk/extensions/BeagleService/BeagleService.cs
==============================================================================
--- trunk/extensions/BeagleService/BeagleService.cs	(original)
+++ trunk/extensions/BeagleService/BeagleService.cs	Fri May 30 13:38:18 2008
@@ -9,6 +9,7 @@
  */
 
 using System;
+using FSpot;
 using FSpot.Extensions;
 using FSpot.Utils;
 
@@ -18,6 +19,11 @@
 		public bool Start ()
 		{
 			uint timer = Log.InformationTimerStart ("Starting BeagleService");
+			try {
+				Core.Database.Photos.ItemsChanged += HandleDbItemsChanged;
+			} catch {
+				Log.Warning ("unable to hook the BeagleNotifier. are you running --view mode?");
+			}
 			Log.DebugTimerPrint (timer, "BeagleService startup took {0}");
 			return true;
 		}
@@ -28,5 +34,16 @@
 			Log.DebugTimerPrint (timer, "BeagleService startup took {0}");	
 			return true;
 		}
+
+		private void HandleDbItemsChanged (object sender, DbItemEventArgs args)
+		{
+			Log.Warning ("Notifying beagle");
+#if ENABLE_BEAGLE
+			foreach (DbItem item in args.Items) {
+				if (item as Photo != null)
+					BeagleNotifier.SendUpdate (item as Photo);
+			}
+#endif
+		}
 	}
 }

Modified: trunk/src/FSpot.addin.xml
==============================================================================
--- trunk/src/FSpot.addin.xml	(original)
+++ trunk/src/FSpot.addin.xml	Fri May 30 13:38:18 2008
@@ -1,6 +1,6 @@
 <Addin namespace = "FSpot" 
        id = "Core" 
-       version = "0.4.4.2"
+       version = "0.4.4.4"
        compatVersion = "0.4.4.0" 
        isroot="true">
 

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Fri May 30 13:38:18 2008
@@ -586,9 +586,6 @@
 			Photo p = item as Photo;
 			if (p == null)
 				continue;
-#if ENABLE_BEAGLE
-			BeagleNotifier.SendUpdate (p);
-#endif
 			if (write_metadata)
 				FSpot.Jobs.SyncMetadataJob.Create (db.Jobs, p);
 		}

Modified: trunk/src/main.cs
==============================================================================
--- trunk/src/main.cs	(original)
+++ trunk/src/main.cs	Fri May 30 13:38:18 2008
@@ -194,11 +194,7 @@
 			setupService.Repositories.RegisterRepository (null, "http://addins.f-spot.org/"; + maj_version, false);
 			Log.DebugTimerPrint (ma_timer, "Mono.Addins Initialization took {0}");
 			
-			foreach (ServiceNode service in AddinManager.GetExtensionNodes ("/FSpot/Services")) {
-				service.Initialize ();
-				service.Start ();
-			}
-			
+		
 
 			bool create = true;
 			int retry_count = 0;
@@ -240,8 +236,7 @@
 
 						core = new Core (view);
 						core.RegisterServer ();
-						
-						
+
 						empty = view || Core.Database.Empty;
 						control = core;
 					}
@@ -298,6 +293,11 @@
 			if (import_uri != null || !view) {
 				control.Organize ();
 				Gdk.Global.NotifyStartupComplete ();
+						foreach (ServiceNode service in AddinManager.GetExtensionNodes ("/FSpot/Services")) {
+							service.Initialize ();
+							service.Start ();
+						}		
+
 			}			
 
 			if (program != null)



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