f-spot r4020 - in trunk: extensions/BeagleService src src/Extensions



Author: sdelcroix
Date: Fri May 30 12:01:58 2008
New Revision: 4020
URL: http://svn.gnome.org/viewvc/f-spot?rev=4020&view=rev

Log:
new Service ExtensionPoint, create a skeleton to move BeagleNotifier as a service

Added:
   trunk/extensions/BeagleService/
   trunk/extensions/BeagleService/Makefile
   trunk/src/Extensions/IService.cs
   trunk/src/Extensions/ServiceNode.cs
Modified:
   trunk/src/FSpot.addin.xml
   trunk/src/Makefile.am
   trunk/src/main.cs

Added: trunk/extensions/BeagleService/Makefile
==============================================================================
--- (empty file)
+++ trunk/extensions/BeagleService/Makefile	Fri May 30 12:01:58 2008
@@ -0,0 +1,32 @@
+NAME = BeagleService
+
+SOURCES = \
+	BeagleService.cs
+
+PACKAGES = \
+	-pkg:f-spot
+
+ASSEMBLIES = \
+
+RESOURCES = \
+	-resource:$(NAME).addin.xml
+
+ASSEMBLY = $(NAME).dll
+
+all: $(ASSEMBLY)
+
+install: all
+	mkdir -p ~/.gnome2/f-spot/addins/
+	cp *.dll ~/.gnome2/f-spot/addins/
+
+mpack: $(ASSEMBLY)
+	mautil p $(ASSEMBLY)
+
+$(ASSEMBLY): $(SOURCES) $(NAME).addin.xml
+	gmcs -target:library -o:$(ASSEMBLY) $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
+
+clean:
+	rm -f *.dll *~ *.bak .mpack
+
+PHONY:
+	install clean all mpack

Added: trunk/src/Extensions/IService.cs
==============================================================================
--- (empty file)
+++ trunk/src/Extensions/IService.cs	Fri May 30 12:01:58 2008
@@ -0,0 +1,17 @@
+/*
+ * FSpot.Extensions.IService.cs
+ *
+ * Author(s):
+ * 	Stephane Delcroix  <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+namespace FSpot.Extensions
+{
+	public interface IService
+	{
+		bool Start ();
+		bool Stop ();
+	}
+}

Added: trunk/src/Extensions/ServiceNode.cs
==============================================================================
--- (empty file)
+++ trunk/src/Extensions/ServiceNode.cs	Fri May 30 12:01:58 2008
@@ -0,0 +1,42 @@
+/*
+ * FSpot.Extensions.ServiceNodea.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix  <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ *
+ */
+
+using System;
+using Mono.Addins;
+
+namespace FSpot.Extensions
+{
+	public class ServiceNode : ExtensionNode
+	{	
+		[NodeAttribute ("class", true)]
+		protected string class_name;
+
+		IService service = null;
+
+		public void Initialize ()
+		{
+			service = Addin.CreateInstance (class_name) as IService;
+		}
+
+		public bool Start ()
+		{
+			if (service == null)
+				throw new Exception ("Service not initialized. Call Initialize () prior to Start() or Stop()");
+			return service.Start ();
+		}
+
+		public bool Stop ()
+		{
+			if (service == null)
+				throw new Exception ("Service not initialized. Call Initialize () prior to Start() or Stop()");
+			return service.Stop ();
+		}
+	}
+}

Modified: trunk/src/FSpot.addin.xml
==============================================================================
--- trunk/src/FSpot.addin.xml	(original)
+++ trunk/src/FSpot.addin.xml	Fri May 30 12:01:58 2008
@@ -1,6 +1,6 @@
 <Addin namespace = "FSpot" 
        id = "Core" 
-       version = "0.4.4.0"
+       version = "0.4.4.2"
        compatVersion = "0.4.4.0" 
        isroot="true">
 
@@ -12,6 +12,10 @@
 		<ExtensionNode type="FSpot.Extensions.SubmenuNode"/>
 	</ExtensionPoint>
 
+	<ExtensionPoint path = "/FSpot/Services">
+		<ExtensionNode name="Service" type="FSpot.Extensions.ServiceNode"/>
+	</ExtensionPoint>
+
 	<Extension path = "/FSpot/Menus">
 		<Menu id="Exports" _label="Export to" />
 	</Extension>
@@ -24,7 +28,7 @@
 		<Menu id = "PhotoPopup" />
 	</Extension>
 
-    <ConditionType id="PhotoSelection" type="FSpot.Extensions.PhotoSelectionCondition" />
+	<ConditionType id="PhotoSelection" type="FSpot.Extensions.PhotoSelectionCondition" />
 
 	<Extension path = "/FSpot/Menus/PhotoPopup">
 		<Command id = "CopyLocation" _label = "Copy Photo Locat_ion" command_type = "FSpot.Extensions.CopyLocation" />

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri May 30 12:01:58 2008
@@ -95,12 +95,14 @@
 	$(srcdir)/Extensions/IExporter.cs	\
 	$(srcdir)/Extensions/ICommand.cs	\
 	$(srcdir)/Extensions/IMenuGenerator.cs	\
+	$(srcdir)/Extensions/IService.cs	\
 	$(srcdir)/Extensions/MenuNode.cs	\
 	$(srcdir)/Extensions/OpenWithMenu.cs	\
 	$(srcdir)/Extensions/CommandMenuItemNode.cs	\
 	$(srcdir)/Extensions/ComplexMenuItemNode.cs	\
 	$(srcdir)/Extensions/PhotoSelectionCondition.cs	\
 	$(srcdir)/Extensions/PopupCommands.cs	\
+	$(srcdir)/Extensions/ServiceNode.cs	\
 	$(srcdir)/Fader.cs			\
 	$(srcdir)/FileImportBackend.cs		\
 	$(srcdir)/FileBrowsableItem.cs		\

Modified: trunk/src/main.cs
==============================================================================
--- trunk/src/main.cs	(original)
+++ trunk/src/main.cs	Fri May 30 12:01:58 2008
@@ -12,6 +12,7 @@
 using Mono.Addins.Setup;
 using FSpot.Utils;
 using FSpot.UI.Dialog;
+using FSpot.Extensions;
 
 namespace FSpot 
 {
@@ -192,6 +193,12 @@
 				}
 			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;



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