[rygel] core: Explicitly start service by name



commit dbb6607277b6e15327bc634d5257d7c8d2689891
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Oct 4 13:24:18 2010 +0300

    core: Explicitly start service by name
    
    Instead of creating a proxy to Rygel's D-Bus object to start the service,
    use standard D-Bus interface directly to explicitly start service by name.

 src/rygel/Makefile.am                        |    3 ++-
 src/rygel/rygel-free-desktop-interfaces.vala |    4 +++-
 src/rygel/rygel-user-config.vala             |   12 ++++++------
 3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index 751f786..68be7c6 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -157,7 +157,8 @@ librygel_configuration_a_SOURCES = rygel-configuration.c \
 				   rygel-meta-config.c \
 				   rygel-cmdline-config.c \
 				   rygel-environment-config.c \
-				   rygel-dbus-interface.c
+				   rygel-dbus-interface.c \
+				   rygel-free-desktop-interfaces.c
 
 MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES)
 EXTRA_DIST = rygel-build-config.vapi \
diff --git a/src/rygel/rygel-free-desktop-interfaces.vala b/src/rygel/rygel-free-desktop-interfaces.vala
index 7f3eabf..d09c78c 100644
--- a/src/rygel/rygel-free-desktop-interfaces.vala
+++ b/src/rygel/rygel-free-desktop-interfaces.vala
@@ -39,9 +39,11 @@ public interface FreeDesktop.DBusObject: Object {
                                                     string old_owner,
                                                     string new_owner);
 
-    // FIXME: This method should be async
+    // FIXME: These methods should be async
     public abstract uint32 request_name (string name, uint32 flags)
                                          throws IOError;
+    public abstract uint32 start_service_by_name (string name, uint32 flags)
+                                                  throws IOError;
     public abstract async string[] list_names () throws IOError;
     public abstract async string[] list_activatable_names () throws IOError;
 }
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index 4394d2f..d90ee07 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -22,6 +22,8 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+using FreeDesktop;
+
 /**
  * Manages the user configuration for Rygel.
  */
@@ -292,12 +294,10 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
 
             if (enable) {
                 // Creating the proxy starts the service
-                DBusInterface rygel_proxy = Bus.get_proxy_sync
-                                        (BusType.SESSION,
-                                         DBusInterface.SERVICE_NAME,
-                                         DBusInterface.OBJECT_PATH);
-                // Just to satisfy valac
-                rygel_proxy.get_object_path ();
+                DBusObject dbus = Bus.get_proxy_sync (BusType.SESSION,
+                                                      DBUS_SERVICE,
+                                                      DBUS_OBJECT);
+                dbus.start_service_by_name (DBusInterface.SERVICE_NAME, 0);
 
                 // Then symlink the desktop file to user's autostart dir
                 var source_path = Path.build_filename (BuildConfig.DESKTOP_DIR,



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