[rygel] core,plugins: Load D-Bus properties only when needed



commit 7ebfcbd5d4759e2b73fa7cceb31cf4eb2ce30cd2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 15 15:59:20 2010 +0200

    core,plugins: Load D-Bus properties only when needed
    
    Don't load properties on D-Bus proxy creation if not needed.

 .../external/rygel-external-album-art-factory.vala |    8 +++++---
 src/plugins/external/rygel-external-container.vala |   16 ++++++++++------
 .../external/rygel-external-icon-factory.vala      |    8 +++++---
 .../external/rygel-external-plugin-factory.vala    |   16 ++++++++++------
 .../external/rygel-external-thumbnail-factory.vala |    8 +++++---
 src/plugins/mpris/rygel-mpris-plugin-factory.vala  |   16 ++++++++++------
 src/plugins/mpris/rygel-mpris-plugin.vala          |   15 +++++++++------
 .../rygel-tracker-category-all-container.vala      |    8 +++++---
 .../tracker/rygel-tracker-metadata-values.vala     |    8 +++++---
 .../tracker/rygel-tracker-plugin-factory.vala      |    5 +++--
 .../tracker/rygel-tracker-search-container.vala    |    8 +++++---
 src/rygel/rygel-dbus-service.vala                  |    8 +++++---
 src/rygel/rygel-user-config.vala                   |   11 +++++++----
 13 files changed, 84 insertions(+), 51 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-album-art-factory.vala b/src/plugins/external/rygel-external-album-art-factory.vala
index 4d657fe..2c2ef91 100644
--- a/src/plugins/external/rygel-external-album-art-factory.vala
+++ b/src/plugins/external/rygel-external-album-art-factory.vala
@@ -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);
 
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index 9e20ff0..2d2744e 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -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);
 
diff --git a/src/plugins/external/rygel-external-icon-factory.vala b/src/plugins/external/rygel-external-icon-factory.vala
index 9af5884..c8f67b0 100644
--- a/src/plugins/external/rygel-external-icon-factory.vala
+++ b/src/plugins/external/rygel-external-icon-factory.vala
@@ -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);
 
diff --git a/src/plugins/external/rygel-external-plugin-factory.vala b/src/plugins/external/rygel-external-plugin-factory.vala
index f7683d6..b618cee 100644
--- a/src/plugins/external/rygel-external-plugin-factory.vala
+++ b/src/plugins/external/rygel-external-plugin-factory.vala
@@ -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;
diff --git a/src/plugins/external/rygel-external-thumbnail-factory.vala b/src/plugins/external/rygel-external-thumbnail-factory.vala
index eefb2e8..7966f17 100644
--- a/src/plugins/external/rygel-external-thumbnail-factory.vala
+++ b/src/plugins/external/rygel-external-thumbnail-factory.vala
@@ -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);
 
diff --git a/src/plugins/mpris/rygel-mpris-plugin-factory.vala b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
index cec7f94..4284470 100644
--- a/src/plugins/mpris/rygel-mpris-plugin-factory.vala
+++ b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
@@ -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);
 
diff --git a/src/plugins/mpris/rygel-mpris-plugin.vala b/src/plugins/mpris/rygel-mpris-plugin.vala
index 141d09e..9e79798 100644
--- a/src/plugins/mpris/rygel-mpris-plugin.vala
+++ b/src/plugins/mpris/rygel-mpris-plugin.vala
@@ -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);
         }
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index 6950f5c..9f4c220 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -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);
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index bf8733f..ee08061 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -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) {
diff --git a/src/plugins/tracker/rygel-tracker-plugin-factory.vala b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
index db5d57e..720402b 100644
--- a/src/plugins/tracker/rygel-tracker-plugin-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
@@ -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 ();
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 0a0aa98..7986e6e 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -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) {
diff --git a/src/rygel/rygel-dbus-service.vala b/src/rygel/rygel-dbus-service.vala
index 6bf79e2..1efac35 100644
--- a/src/rygel/rygel-dbus-service.vala
+++ b/src/rygel/rygel-dbus-service.vala
@@ -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) !=
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index d59d881..773f29b 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -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 ();
                 }



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