core,plugins: Load D-Bus properties only when needed
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 15 Nov 2010 13:59:20 +0000 (15:59 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 17 Nov 2010 13:45:15 +0000 (15:45 +0200)
Don't load properties on D-Bus proxy creation if not needed.

13 files changed:
src/plugins/external/rygel-external-album-art-factory.vala
src/plugins/external/rygel-external-container.vala
src/plugins/external/rygel-external-icon-factory.vala
src/plugins/external/rygel-external-plugin-factory.vala
src/plugins/external/rygel-external-thumbnail-factory.vala
src/plugins/mpris/rygel-mpris-plugin-factory.vala
src/plugins/mpris/rygel-mpris-plugin.vala
src/plugins/tracker/rygel-tracker-category-all-container.vala
src/plugins/tracker/rygel-tracker-metadata-values.vala
src/plugins/tracker/rygel-tracker-plugin-factory.vala
src/plugins/tracker/rygel-tracker-search-container.vala
src/rygel/rygel-dbus-service.vala
src/rygel/rygel-user-config.vala

index 4d657fe..2c2ef91 100644 (file)
@@ -31,9 +31,11 @@ public class Rygel.External.AlbumArtFactory {
     public async Thumbnail create (string service_name,
                                    string object_path,
                                    string host_ip) throws IOError {
-        Properties props = Bus.get_proxy_sync (BusType.SESSION,
-                                               service_name,
-                                               object_path);
+        Properties props = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         object_path,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         var item_props = yield props.get_all (MediaItemProxy.IFACE);
 
index 9e20ff0..2d2744e 100644 (file)
@@ -56,9 +56,11 @@ public class Rygel.External.Container : Rygel.MediaContainer {
         this.containers = new ArrayList<Container> ();
 
         // Create proxy to MediaContainer iface
-        this.actual_container = Bus.get_proxy_sync (BusType.SESSION,
-                                                    this.service_name,
-                                                    path);
+        this.actual_container = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         this.service_name,
+                                         path,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         this.update_container.begin (true);
     }
@@ -155,9 +157,11 @@ public class Rygel.External.Container : Rygel.MediaContainer {
                                          0,
                                          null);
 
-            Properties props_iface = Bus.get_proxy_sync (BusType.SESSION,
-                                                         this.service_name,
-                                                         id);
+            Properties props_iface = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                        this.service_name,
+                                        id,
+                                        DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
             var props = yield props_iface.get_all (MediaItemProxy.IFACE);
 
index 9af5884..c8f67b0 100644 (file)
@@ -37,9 +37,11 @@ public class Rygel.External.IconFactory {
         }
 
         var icon_path = (string) value;
-        Properties props = Bus.get_proxy_sync (BusType.SESSION,
-                                               service_name,
-                                               icon_path);
+        Properties props = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         icon_path,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         var item_props = yield props.get_all (ITEM_IFACE);
 
index f7683d6..b618cee 100644 (file)
@@ -48,9 +48,11 @@ public class Rygel.External.PluginFactory {
     public PluginFactory (PluginLoader loader) throws IOError {
         this.icon_factory = new IconFactory ();
 
-        this.dbus_obj = Bus.get_proxy_sync (BusType.SESSION,
-                                            DBUS_SERVICE,
-                                            DBUS_OBJECT);
+        this.dbus_obj = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         DBUS_SERVICE,
+                                         DBUS_OBJECT,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         this.loader = loader;
 
         this.load_plugins.begin ();
@@ -123,9 +125,11 @@ public class Rygel.External.PluginFactory {
         var root_object = "/" + service_name.replace (".", "/");
 
         // Create proxy to MediaObject iface to get the display name through
-        Properties props = Bus.get_proxy_sync (BusType.SESSION,
-                                               service_name,
-                                               root_object);
+        Properties props = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         root_object,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         HashTable<string,Variant> object_props;
         HashTable<string,Variant> container_props;
index eefb2e8..7966f17 100644 (file)
@@ -32,9 +32,11 @@ public class Rygel.External.ThumbnailFactory {
                                    string object_path,
                                    string host_ip)
                                    throws GLib.Error {
-        Properties props = Bus.get_proxy_sync (BusType.SESSION,
-                                               service_name,
-                                               object_path);
+        Properties props = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         object_path,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         var item_props = yield props.get_all (MediaItemProxy.IFACE);
 
index cec7f94..4284470 100644 (file)
@@ -48,9 +48,11 @@ public class Rygel.MPRIS.PluginFactory {
     PluginLoader loader;
 
     public PluginFactory (PluginLoader loader) throws IOError {
-        this.dbus_obj = Bus.get_proxy_sync (BusType.SESSION,
-                                            DBUS_SERVICE,
-                                            DBUS_OBJECT);
+        this.dbus_obj = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         DBUS_SERVICE,
+                                         DBUS_OBJECT,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         this.loader = loader;
 
         this.load_plugins.begin ();
@@ -115,9 +117,11 @@ public class Rygel.MPRIS.PluginFactory {
 
     private async void load_plugin (string service_name) throws IOError {
         // Create proxy to MediaObject iface to get the display name through
-        Properties props = Bus.get_proxy_sync (BusType.SESSION,
-                                               service_name,
-                                               MEDIA_PLAYER_PATH);
+        Properties props = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         MEDIA_PLAYER_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         var props_hash = yield props.get_all (MediaPlayerProxy.IFACE);
 
index 141d09e..9e79798 100644 (file)
@@ -46,13 +46,16 @@ public class Rygel.MPRIS.Plugin : Rygel.MediaRendererPlugin {
 
         try {
             // Create proxy to MediaPlayer.Player iface
-            this.actual_player = Bus.get_proxy_sync (BusType.SESSION,
-                                                     service_name,
-                                                     MEDIA_PLAYER_PATH);
+            this.actual_player = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         MEDIA_PLAYER_PATH);
             // Create proxy to FreeDesktop.Properties iface
-            this.properties = Bus.get_proxy_sync (BusType.SESSION,
-                                                  service_name,
-                                                  MEDIA_PLAYER_PATH);
+            this.properties = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         service_name,
+                                         MEDIA_PLAYER_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         } catch (GLib.Error err) {
             critical ("Failed to connect to session bus: %s", err.message);
         }
index 6950f5c..9f4c220 100644 (file)
@@ -46,9 +46,11 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
         this.create_classes.add (item_factory.upnp_class);
 
         try {
-            this.resources = Bus.get_proxy_sync (BusType.SESSION,
-                                                 TRACKER_SERVICE,
-                                                 RESOURCES_PATH);
+            this.resources = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         TRACKER_SERVICE,
+                                         RESOURCES_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         } catch (IOError io_error) {
             critical (_("Failed to create D-Bus proxies: %s"),
                       io_error.message);
index bf8733f..ee08061 100644 (file)
@@ -182,9 +182,11 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
     }
 
     private void create_proxies () throws IOError {
-        this.resources = Bus.get_proxy_sync (BusType.SESSION,
-                                             TRACKER_SERVICE,
-                                             RESOURCES_PATH);
+        this.resources = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         TRACKER_SERVICE,
+                                         RESOURCES_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
     }
 
     private bool is_child_id_unique (string child_id) {
index db5d57e..720402b 100644 (file)
@@ -46,8 +46,9 @@ public class Rygel.Tracker.PluginFactory {
 
     public PluginFactory (PluginLoader loader) throws IOError {
         this.stats = Bus.get_proxy_sync (BusType.SESSION,
-                                          TRACKER_SERVICE,
-                                          STATISTICS_OBJECT);
+                                         TRACKER_SERVICE,
+                                         STATISTICS_OBJECT,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         this.loader = loader;
 
         this.stats.get_statistics ();
index 0a0aa98..7986e6e 100644 (file)
@@ -93,9 +93,11 @@ public class Rygel.Tracker.SearchContainer : Rygel.MediaContainer {
                                          MODIFIED_VARIABLE);
 
         try {
-            this.resources = Bus.get_proxy_sync (BusType.SESSION,
-                                                 TRACKER_SERVICE,
-                                                 RESOURCES_PATH);
+            this.resources = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         TRACKER_SERVICE,
+                                         RESOURCES_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
             this.get_children_count.begin ();
         } catch (IOError error) {
index 6bf79e2..1efac35 100644 (file)
@@ -30,9 +30,11 @@ public class Rygel.DBusService : Object, DBusInterface {
     public DBusService (Main main) throws IOError {
         this.main = main;
 
-        DBusObject bus = Bus.get_proxy_sync (BusType.SESSION,
-                                             DBUS_SERVICE,
-                                             DBUS_OBJECT);
+        DBusObject bus = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         DBUS_SERVICE,
+                                         DBUS_OBJECT,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
         // try to register service in session bus
         if (bus.request_name (DBusInterface.SERVICE_NAME, 0) !=
index d59d881..773f29b 100644 (file)
@@ -311,9 +311,11 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
 
             if (enable) {
                 // Creating the proxy starts the service
-                DBusObject dbus = Bus.get_proxy_sync (BusType.SESSION,
-                                                      DBUS_SERVICE,
-                                                      DBUS_OBJECT);
+                DBusObject dbus = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         DBUS_SERVICE,
+                                         DBUS_OBJECT,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
                 dbus.start_service_by_name (DBusInterface.SERVICE_NAME, 0);
 
                 // Then symlink the desktop file to user's autostart dir
@@ -331,7 +333,8 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
                     DBusInterface rygel_proxy = Bus.get_proxy_sync
                                         (BusType.SESSION,
                                          DBusInterface.SERVICE_NAME,
-                                         DBusInterface.OBJECT_PATH);
+                                         DBusInterface.OBJECT_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
                     rygel_proxy.shutdown ();
                 }