[banshee] [hal] Fix fallback from UDisks to DeviceKit



commit 586664837d544f77dd8cbce89d335c9beca8b78f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Mar 23 20:49:46 2010 -0700

    [hal] Fix fallback from UDisks to DeviceKit

 .../Banshee.Hal/Banshee.HalBackend/DkDisk.cs       |   22 ++++++++++++++-----
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs
index 8b3a42a..0843377 100644
--- a/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs
+++ b/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs
@@ -124,14 +124,24 @@ namespace Banshee.HalBackend
         static DkDisk ()
         {
             try {
-                udisks_finder = Bus.System.GetObject<UDisksFinder>(udisks_bus_name, new ObjectPath("/org/freedesktop/UDisks"));
-                props_iface = "org.freedesktop.UDisks.Device";
+                if (Bus.System.NameHasOwner (udisks_bus_name)) {
+                    udisks_finder = Bus.System.GetObject<UDisksFinder>(udisks_bus_name, new ObjectPath("/org/freedesktop/UDisks"));
+                    props_iface = "org.freedesktop.UDisks.Device";
+                }
             } catch {
+                udisks_finder = null;
+            }
+
+            if (udisks_finder == null) {
                 try {
-                    dk_finder = Bus.System.GetObject<DkFinder>(dk_bus_name,
-                        new ObjectPath("/org/freedesktop/DeviceKit/Disks"));
-                    props_iface = "org.freedesktop.DeviceKit.Disks.Device";
-                } catch {}
+                    if (Bus.System.NameHasOwner (dk_bus_name)) {
+                        dk_finder = Bus.System.GetObject<DkFinder>(dk_bus_name,
+                            new ObjectPath("/org/freedesktop/DeviceKit/Disks"));
+                        props_iface = "org.freedesktop.DeviceKit.Disks.Device";
+                    }
+                } catch {
+                    dk_finder = null;
+                }
             }
         }
 



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