[banshee] SoundMenu: Don't call BlacklistMediaPlayer on startup (bgo#642717)



commit fe9968993aa5095cc7408cd47626aff9f01fefad
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Tue Feb 22 22:07:06 2011 +0100

    SoundMenu: Don't call BlacklistMediaPlayer on startup (bgo#642717)
    
    With the new registration process, we don't need to do anything on
    startup. In fact calling the BlacklistMediaPlayer d-bus on startup
    triggers exceptions in ndesk-dbus.

 .../Banshee.SoundMenu/SoundMenuProxy.cs            |    8 +++++---
 .../Banshee.SoundMenu/SoundMenuService.cs          |    4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuProxy.cs b/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuProxy.cs
index 5f7b6e1..83585f9 100644
--- a/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuProxy.cs
+++ b/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuProxy.cs
@@ -73,10 +73,10 @@ namespace Banshee.SoundMenu
         }
 
 
-        public void Register ()
+        public void Register (bool startup)
         {
-            Log.Debug ("Registering with sound indicator");
 #if HAVE_INDICATESHARP
+            Log.Debug ("Registering with sound indicator through libindicate");
             var server = Indicate.Server.RefDefault ();
             server.SetType ("music.banshee");
             string desktop_file = Paths.Combine (Paths.InstalledApplicationDataRoot,
@@ -84,8 +84,10 @@ namespace Banshee.SoundMenu
             server.DesktopFile (desktop_file);
             server.Show ();
 #endif
-            if (SoundMenu != null) {
+            if (SoundMenu != null && !startup) {
+                // We don't have to do anything to register on startup
                 try {
+                    Log.Debug ("Adding ourselves to the sound indicator");
                     SoundMenu.BlacklistMediaPlayer (desktop_name, false);
                 } catch (Exception e) {
                     Log.Exception (e);
diff --git a/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuService.cs b/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuService.cs
index 00ea129..2b971a1 100644
--- a/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuService.cs
+++ b/src/Extensions/Banshee.SoundMenu/Banshee.SoundMenu/SoundMenuService.cs
@@ -126,7 +126,7 @@ namespace Banshee.SoundMenu
             InstallPreferences ();
             sound_menu = new SoundMenuProxy ();
             if (Enabled) {
-                sound_menu.Register ();
+                sound_menu.Register (true);
             }
 
             ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
@@ -379,7 +379,7 @@ namespace Banshee.SoundMenu
             get { return EnabledSchema.Get (); }
             set {
                 if (value) {
-                    sound_menu.Register ();
+                    sound_menu.Register (false);
                     RegisterCloseHandler ();
                 } else {
                     sound_menu.Unregister ();



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