[banshee] [hal] Start the HAL dbus service if needed



commit c9976c73c8c63a0e7872fa0e38c5568829f4101c
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Mar 23 20:30:12 2010 -0700

    [hal] Start the HAL dbus service if needed

 src/Backends/Banshee.Hal/Hal/Manager.cs |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/Backends/Banshee.Hal/Hal/Manager.cs b/src/Backends/Banshee.Hal/Hal/Manager.cs
index 64621a1..6544251 100644
--- a/src/Backends/Banshee.Hal/Hal/Manager.cs
+++ b/src/Backends/Banshee.Hal/Hal/Manager.cs
@@ -31,6 +31,7 @@ using System.Collections;
 using System.Collections.Generic;
 
 using NDesk.DBus;
+using org.freedesktop.DBus;
 
 namespace Hal
 {
@@ -120,7 +121,17 @@ namespace Hal
         public Manager()
         {
             if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) {
-                throw new ApplicationException("Could not find org.freedesktop.Hal");
+                // try to start it
+                Console.WriteLine ("About to try to start HAL service");
+                var reply = Bus.System.StartServiceByName ("org.freedesktop.Hal");
+                if (reply != StartReply.Success && reply != StartReply.AlreadyRunning) {
+                    throw new ApplicationException("Could not start org.freedesktop.Hal");
+                }
+
+                // If still not started, we're done
+                if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) {
+                    throw new ApplicationException("Could not find org.freedesktop.Hal");
+                }
             }
 
             manager = Bus.System.GetObject<IManager>("org.freedesktop.Hal",



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