[rygel] external: No need to pass 'host_ip' around everywhere



commit cad79796c150156e0ac660cf8d2ecb4873c6b761
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Dec 23 17:14:10 2010 +0200

    external: No need to pass 'host_ip' around everywhere

 .../external/rygel-external-album-art-factory.vala |    8 +--
 src/plugins/external/rygel-external-container.vala |    6 ---
 .../external/rygel-external-item-factory.vala      |   46 +++++++-------------
 src/plugins/external/rygel-external-plugin.vala    |    1 -
 .../external/rygel-external-thumbnail-factory.vala |    8 +--
 5 files changed, 22 insertions(+), 47 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-album-art-factory.vala b/src/plugins/external/rygel-external-album-art-factory.vala
index 95fd55c..5a9b662 100644
--- a/src/plugins/external/rygel-external-album-art-factory.vala
+++ b/src/plugins/external/rygel-external-album-art-factory.vala
@@ -29,8 +29,7 @@ using FreeDesktop;
  */
 public class Rygel.External.AlbumArtFactory {
     public async Thumbnail create (string service_name,
-                                   string object_path,
-                                   string host_ip) throws IOError {
+                                   string object_path) throws IOError {
         Properties props = yield Bus.get_proxy
                                         (BusType.SESSION,
                                          service_name,
@@ -39,11 +38,10 @@ public class Rygel.External.AlbumArtFactory {
 
         var item_props = yield props.get_all (MediaItemProxy.IFACE);
 
-        return this.create_from_props (item_props, host_ip);
+        return this.create_from_props (item_props);
     }
 
-    private Thumbnail create_from_props (HashTable<string,Variant> props,
-                                         string                    host_ip) {
+    private Thumbnail create_from_props (HashTable<string,Variant> props) {
         var thumbnail = new Thumbnail ();
 
         var value = props.lookup ("MIMEType");
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index 41425e3..95d8707 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -33,7 +33,6 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                                         Rygel.SearchableContainer {
     public MediaContainerProxy actual_container;
 
-    public string host_ip;
     public string service_name;
 
     private ItemFactory item_factory;
@@ -47,12 +46,10 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                       bool       searchable,
                       string     service_name,
                       string     path,
-                      string     host_ip,
                       Container? parent = null) throws IOError {
         base (id, parent, title, (int) child_count);
 
         this.service_name = service_name;
-        this.host_ip = host_ip;
         this.item_factory = new ItemFactory ();
         this.containers = new ArrayList<Container> ();
 
@@ -171,7 +168,6 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                                          actual_object.display_name,
                                          props,
                                          this.service_name,
-                                         this.host_ip,
                                          parent_container);
         }
 
@@ -223,7 +219,6 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                                          title,
                                          props,
                                          this.service_name,
-                                         this.host_ip,
                                          parent_container);
                 }
             }
@@ -261,7 +256,6 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                                            searchable,
                                            this.service_name,
                                            path,
-                                           this.host_ip,
                                            this);
             this.containers.add (container);
         }
diff --git a/src/plugins/external/rygel-external-item-factory.vala b/src/plugins/external/rygel-external-item-factory.vala
index 7b684ae..6a607d8 100644
--- a/src/plugins/external/rygel-external-item-factory.vala
+++ b/src/plugins/external/rygel-external-item-factory.vala
@@ -34,7 +34,6 @@ public class Rygel.External.ItemFactory {
                                    string                    title,
                                    HashTable<string,Variant> props,
                                    string                    service_name,
-                                   string                    host_ip,
                                    MediaContainer            parent)
                                    throws GLib.Error {
         MediaItem item;
@@ -42,34 +41,28 @@ public class Rygel.External.ItemFactory {
         if (type.has_prefix ("audio")) {
             item = new AudioItem (id, parent, title);
 
-            this.set_audio_metadata (item as AudioItem,
-                                     props,
-                                     service_name,
-                                     host_ip);
+            this.set_audio_metadata (item as AudioItem, props, service_name);
         } else if (type.has_prefix ("music")) {
             item = new MusicItem (id, parent, title);
 
             yield this.set_music_metadata (item as MusicItem,
                                            props,
-                                           service_name,
-                                           host_ip);
+                                           service_name);
         } else if (type.has_prefix ("video")) {
             item = new VideoItem (id, parent, title);
 
             yield this.set_video_metadata (item as VideoItem,
                                            props,
-                                           service_name,
-                                           host_ip);
+                                           service_name);
         } else {
             item = new ImageItem (id, parent, title);
 
             yield this.set_visual_metadata (item as VisualItem,
                                             props,
-                                            service_name,
-                                            host_ip);
+                                            service_name);
         }
 
-        this.set_generic_metadata (item, props, service_name, host_ip);
+        this.set_generic_metadata (item, props, service_name);
 
         if (parent is DummyContainer) {
             item.parent_ref = parent;
@@ -81,8 +74,7 @@ public class Rygel.External.ItemFactory {
     private async void set_music_metadata
                                         (MusicItem                 music,
                                          HashTable<string,Variant> props,
-                                         string                    service_name,
-                                         string                    host_ip)
+                                         string                    service_name)
                                          throws GLib.Error {
         music.artist = this.get_string (props, "Artist");
         music.album = this.get_string (props, "Album");
@@ -93,17 +85,15 @@ public class Rygel.External.ItemFactory {
             var cover_factory = new AlbumArtFactory ();
 
             music.album_art = yield cover_factory.create ((string) value,
-                                                          service_name,
-                                                          host_ip);
+                                                          service_name);
         }
 
-        this.set_audio_metadata (music, props, service_name, host_ip);
+        this.set_audio_metadata (music, props, service_name);
     }
 
     private void set_audio_metadata (AudioItem                 audio,
                                      HashTable<string,Variant> props,
-                                     string                    service_name,
-                                     string                    host_ip)
+                                     string                    service_name)
                                      throws GLib.Error {
         audio.duration = this.get_int (props, "Duration");
         audio.bitrate = this.get_int (props, "Bitrate");
@@ -114,8 +104,7 @@ public class Rygel.External.ItemFactory {
     private async void set_visual_metadata
                                         (VisualItem                visual,
                                          HashTable<string,Variant> props,
-                                         string                    service_name,
-                                         string                    host_ip)
+                                         string                    service_name)
                                          throws GLib.Error {
         visual.width = this.get_int (props, "Width");
         visual.height = this.get_int (props, "Height");
@@ -126,9 +115,8 @@ public class Rygel.External.ItemFactory {
         var value = props.lookup ("Thumbnail");
         if (value != null) {
             var factory = new ThumbnailFactory ();
-            var thumbnail = yield factory.create ((string) value,
-                                                  service_name,
-                                                  host_ip);
+            var thumbnail = yield factory.create ((string) value, service_name);
+
             visual.thumbnails.add (thumbnail);
         }
     }
@@ -136,17 +124,15 @@ public class Rygel.External.ItemFactory {
     private async void set_video_metadata
                                         (VideoItem                 video,
                                          HashTable<string,Variant> props,
-                                         string                    service_name,
-                                         string                    host_ip)
+                                         string                    service_name)
                                          throws GLib.Error {
-        yield this.set_visual_metadata (video, props, service_name, host_ip);
-        this.set_audio_metadata (video, props, service_name, host_ip);
+        yield this.set_visual_metadata (video, props, service_name);
+        this.set_audio_metadata (video, props, service_name);
     }
 
     private void set_generic_metadata (MediaItem                 item,
                                        HashTable<string,Variant> props,
-                                       string                    service_name,
-                                       string                    host_ip) {
+                                       string                    service_name) {
         item.mime_type = this.get_string (props, "MIMEType");
 
         var uris = (string[]) props.lookup ("URLs");
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index 1d782cf..78716fa 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -61,7 +61,6 @@ public class Rygel.External.Plugin : Rygel.MediaServerPlugin {
                                             this.searchable,
                                             this.service_name,
                                             this.root_object,
-                                            context.host_ip,
                                             null);
         } catch (IOError err) {
             critical ("Failed to connect to session bus: %s", err.message);
diff --git a/src/plugins/external/rygel-external-thumbnail-factory.vala b/src/plugins/external/rygel-external-thumbnail-factory.vala
index c8f8da2..8916814 100644
--- a/src/plugins/external/rygel-external-thumbnail-factory.vala
+++ b/src/plugins/external/rygel-external-thumbnail-factory.vala
@@ -29,8 +29,7 @@ using FreeDesktop;
  */
 public class Rygel.External.ThumbnailFactory {
     public async Thumbnail create (string service_name,
-                                   string object_path,
-                                   string host_ip)
+                                   string object_path)
                                    throws GLib.Error {
         Properties props = yield Bus.get_proxy
                                         (BusType.SESSION,
@@ -40,11 +39,10 @@ public class Rygel.External.ThumbnailFactory {
 
         var item_props = yield props.get_all (MediaItemProxy.IFACE);
 
-        return this.create_from_props (item_props, host_ip);
+        return this.create_from_props (item_props);
     }
 
-    private Thumbnail create_from_props (HashTable<string,Variant> props,
-                                         string                    host_ip) {
+    private Thumbnail create_from_props (HashTable<string,Variant> props) {
         var thumbnail = new Thumbnail ();
 
         thumbnail.mime_type = this.get_string (props, "MIMEType");



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