banshee r4205 - in trunk/banshee: . src/Extensions/Banshee.Daap/Banshee.Daap



Author: gburt
Date: Thu Jun 26 22:03:01 2008
New Revision: 4205
URL: http://svn.gnome.org/viewvc/banshee?rev=4205&view=rev

Log:
2008-06-26  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs: Make the
	service a DelayedInitializeService.  Seems to fix most (all?) of the
	problems finding shares on startup.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs	Thu Jun 26 22:03:01 2008
@@ -38,7 +38,7 @@
 
 namespace Banshee.Daap
 {
-    public class DaapService : IExtensionService, IDisposable
+    public class DaapService : IExtensionService, IDisposable, IDelayedInitializeService
     {
         private ServiceLocator locator;
         private static DaapProxyWebServer proxy_server;
@@ -52,23 +52,6 @@
         
         void IExtensionService.Initialize ()
         {
-            // Add the source, even though its empty, so that the user sees the
-            // plugin is enabled, just no child sources yet.
-            source_map = new Dictionary<string, DaapSource> ();
-            container = new DaapContainerSource ();
-            
-            // Now start looking for services.
-            // We do this after creating the source because if we do it before
-            // there's a race condition where we get a service before the source
-            // is added.
-            locator = new ServiceLocator ();
-            locator.Found += OnServiceFound;
-            locator.Removed += OnServiceRemoved;
-            locator.ShowLocalServices = true;
-            locator.Start ();
-            
-            proxy_server = new DaapProxyWebServer ();
-            proxy_server.Start ();
         }
         
         public void Dispose ()
@@ -134,6 +117,27 @@
                 ServiceManager.SourceManager.RemoveSource (container);
             }
         }
+
+        public void DelayedInitialize ()
+        {
+            // Add the source, even though its empty, so that the user sees the
+            // plugin is enabled, just no child sources yet.
+            source_map = new Dictionary<string, DaapSource> ();
+            container = new DaapContainerSource ();
+            
+            // Now start looking for services.
+            // We do this after creating the source because if we do it before
+            // there's a race condition where we get a service before the source
+            // is added.
+            locator = new ServiceLocator ();
+            locator.Found += OnServiceFound;
+            locator.Removed += OnServiceRemoved;
+            locator.ShowLocalServices = true;
+            locator.Start ();
+            
+            proxy_server = new DaapProxyWebServer ();
+            proxy_server.Start ();
+        }
         
         string IService.ServiceName {
             get { return "DaapService"; }



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