[rygel] Update the API usage according to latest spec.
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] Update the API usage according to latest spec.
- Date: Fri, 22 May 2009 11:15:00 -0400 (EDT)
commit daed550f482282c9fa5301fa7574fdb0bf67505c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue May 19 18:19:17 2009 +0300
Update the API usage according to latest spec.
---
src/plugins/external/rygel-external-container.vala | 45 ++++++++++++-------
src/plugins/external/rygel-external-item.vala | 11 +++--
src/plugins/external/rygel-external-plugin.vala | 2 +-
3 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index 1b2c998..ea7e3fb 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -38,6 +38,7 @@ public class Rygel.ExternalContainer : MediaContainer {
private const string ITEM_IFACE = "org.Rygel.MediaItem1";
public dynamic DBus.Object actual_container;
+ public dynamic DBus.Object props;
public string host_ip;
@@ -63,11 +64,11 @@ public class Rygel.ExternalContainer : MediaContainer {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
// Create proxy to MediaObject iface to get the display name through
- dynamic DBus.Object props = connection.get_object (service_name,
- object_path,
- PROPS_IFACE);
+ this.props = connection.get_object (service_name,
+ object_path,
+ PROPS_IFACE);
Value value;
- props.Get (OBJECT_IFACE, "display-name", out value);
+ this.props.Get (OBJECT_IFACE, "DisplayName", out value);
this.title = this.substitute_keywords (value.get_string ());
// Now proxy to MediaContainer iface for the rest of the stuff
@@ -157,21 +158,31 @@ public class Rygel.ExternalContainer : MediaContainer {
}
private void fetch_media_objects () throws GLib.Error {
- ObjectPath[] object_paths = null;
-
- object_paths = this.actual_container.GetContainers ();
- foreach (var object_path in object_paths) {
- this.media_objects.add (new ExternalContainer (object_path,
- this.service_name,
- (string) object_path,
- this.host_ip,
- this));
+ HashTable<string,Value?> all_props =
+ this.props.GetAll (CONTAINER_IFACE);
+
+ var value = all_props.lookup ("Containers");
+ unowned PtrArray obj_paths = (PtrArray) value.get_boxed ();
+ if (obj_paths.len > 0) {
+ for (var i = 0; i < obj_paths.len; i++) {
+ var obj_path = (ObjectPath) obj_paths.pdata[i];
+ var container = new ExternalContainer (obj_path,
+ this.service_name,
+ obj_path,
+ this.host_ip,
+ this);
+ this.media_objects.add (container);
+ }
}
- object_paths = this.actual_container.GetItems ();
- foreach (var object_path in object_paths) {
- this.media_objects.add (new ExternalItem ((string) object_path,
- this));
+ value = all_props.lookup ("Items");
+ obj_paths = (PtrArray) value.get_boxed ();
+ if (obj_paths.len > 0) {
+ for (var i = 0; i < obj_paths.len; i++) {
+ var obj_path = (ObjectPath) obj_paths.pdata[i];
+ this.media_objects.add (new ExternalItem (obj_path,
+ this));
+ }
}
this.child_count = this.media_objects.size;
diff --git a/src/plugins/external/rygel-external-item.vala b/src/plugins/external/rygel-external-item.vala
index 467c9a5..02ddf55 100644
--- a/src/plugins/external/rygel-external-item.vala
+++ b/src/plugins/external/rygel-external-item.vala
@@ -50,12 +50,13 @@ public class Rygel.ExternalItem : MediaItem {
HashTable<string,Value?> object_props = props.GetAll (OBJECT_IFACE);
- var value = object_props.lookup ("display-name");
+ var value = object_props.lookup ("DisplayName");
this.title = parent.substitute_keywords (value.get_string ());
- HashTable<string,Value?> item_props = props.GetAll (ITEM_IFACE);
+ HashTable<string,Value?> item_props;
+ props.GetAll (ITEM_IFACE, out item_props);
- value = item_props.lookup ("type");
+ value = item_props.lookup ("Type");
string type = value.get_string ();
if (type == "audio") {
this.upnp_class = MediaItem.AUDIO_CLASS;
@@ -67,10 +68,10 @@ public class Rygel.ExternalItem : MediaItem {
this.upnp_class = MediaItem.IMAGE_CLASS;
}
- value = item_props.lookup ("mime-type");
+ value = item_props.lookup ("MIMEType");
this.mime_type = value.get_string ();
- value = item_props.lookup ("urls");
+ value = item_props.lookup ("URLs");
weak string[] uris = (string[]) value.get_boxed ();
for (var i = 0; uris[i] != null; i++) {
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index a827e12..eaca0ed 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -42,7 +42,7 @@ public class ExternalPlugin : Plugin {
root_object,
PROPS_IFACE);
Value value;
- props.Get (OBJECT_IFACE, "display-name", out value);
+ props.Get (OBJECT_IFACE, "DisplayName", out value);
var title = value.get_string ();
base (service_name, title);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]