[rygel] external: ItemFactory.create() gets MediaObject props



commit d31bb04dd7bbe448eb3d99dcc3901590fef02fdb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jun 16 16:55:55 2010 +0300

    external: ItemFactory.create() gets MediaObject props
    
    We already have the MediaObject props so we just pass them as params to
    ItemFactory.create() rather than it getting them again from Value inside a
    Hashtable.

 src/plugins/external/rygel-external-container.vala |    5 ++++-
 .../external/rygel-external-item-factory.vala      |   11 ++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index b999c23..f4631e3 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -157,8 +157,9 @@ public class Rygel.ExternalContainer : Rygel.MediaContainer {
             }
 
             if (media_object == null) {
+                var title = props.lookup ("DisplayName").get_string ();
+
                 if (type == "container") {
-                    var title = props.lookup ("DisplayName").get_string ();
                     var child_count = props.lookup ("ChildCount").get_uint ();
 
                     media_object = new ExternalDummyContainer (
@@ -170,6 +171,8 @@ public class Rygel.ExternalContainer : Rygel.MediaContainer {
                     // Its an item then
                     media_object = yield this.item_factory.create (
                                         id,
+                                        type,
+                                        title,
                                         props,
                                         this.service_name,
                                         this.host_ip,
diff --git a/src/plugins/external/rygel-external-item-factory.vala b/src/plugins/external/rygel-external-item-factory.vala
index ce467c0..9ca7579 100644
--- a/src/plugins/external/rygel-external-item-factory.vala
+++ b/src/plugins/external/rygel-external-item-factory.vala
@@ -31,6 +31,8 @@ using FreeDesktop;
  */
 public class Rygel.ExternalItemFactory {
     public async MediaItem create (string                   id,
+                                   string                   type,
+                                   string                   title,
                                    HashTable<string,Value?> props,
                                    string                   service_name,
                                    string                   host_ip,
@@ -40,14 +42,9 @@ public class Rygel.ExternalItemFactory {
 
         var item = new MediaItem (id,
                                   parent,
-                                  "Unknown",  /* Title Unknown atm */
+                                  title,
                                   "Unknown"); /* UPnP Class Unknown atm */
 
-        var value = props.lookup ("DisplayName");
-        item.title = value.get_string ();
-
-        value = props.lookup ("Type");
-        string type = value.get_string ();
         if (type.has_prefix ("audio")) {
             item.upnp_class = MediaItem.AUDIO_CLASS;
         } else if (type.has_prefix ("music")) {
@@ -58,7 +55,7 @@ public class Rygel.ExternalItemFactory {
             item.upnp_class = MediaItem.IMAGE_CLASS;
         }
 
-        value = props.lookup ("MIMEType");
+        var value = props.lookup ("MIMEType");
         item.mime_type = value.get_string ();
 
         // FIXME: Get this value through the props until bug#602003 is fixed



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