diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-01-09 09:22:16 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-01-09 09:22:16 +0000 |
commit | 9dc6c636a4ae4c117afa2973c7dc32c72d22abd0 (patch) | |
tree | b0c48d8dcd69a33ba03ea328ee1e866a67e40330 | |
parent | 9f10c1e5b7a7ceac671d23cdfef2176d4ac8e74d (diff) | |
download | ayatana-indicator-sound-9dc6c636a4ae4c117afa2973c7dc32c72d22abd0.tar.gz ayatana-indicator-sound-9dc6c636a4ae4c117afa2973c7dc32c72d22abd0.tar.bz2 ayatana-indicator-sound-9dc6c636a4ae4c117afa2973c7dc32c72d22abd0.zip |
introspection happening nicely
-rw-r--r-- | src/mpris2-watcher.vala | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mpris2-watcher.vala b/src/mpris2-watcher.vala index f572ab7..fa4207a 100644 --- a/src/mpris2-watcher.vala +++ b/src/mpris2-watcher.vala @@ -77,13 +77,14 @@ public class Mpris2Watcher : GLib.Object MprisRoot? mpris2_root = this.create_mpris_root(name); if (mpris2_root == null) return; - + if (previous_owner != "" && current_owner == "") { debug ("Client '%s' gone down", name); client_disappeared (name); } else if (previous_owner == "" && current_owner != "") { debug ("Client '%s' has appeared", name); + bool use_playlists = this.supports_playlists ( name ); client_appeared (mpris2_root.DesktopEntry, name); } } @@ -101,7 +102,6 @@ public class Mpris2Watcher : GLib.Object e.message ); } } - this.supports_playlists(name); return mpris2_root; } @@ -125,6 +125,7 @@ public class Mpris2Watcher : GLib.Object private bool parse_interfaces( string interface_info ) { //parse the document from path + bool result = false; debug ("attempting to parse %s", interface_info); Xml.Doc* xml_doc = Parser.parse_doc (interface_info); if (xml_doc == null) { @@ -143,13 +144,19 @@ public class Mpris2Watcher : GLib.Object //let's parse those nodes for (Xml.Node* iter = root_node->children; iter != null; iter = iter->next) { //spaces btw. tags are also nodes, discard them - if (iter->type != ElementType.ELEMENT_NODE) - continue; - string node_name = iter->name; //get the node's name - debug ( "this dbus object has interface %s ", node_name ); + if (iter->type != ElementType.ELEMENT_NODE){ + continue; + } + Xml.Attr* attributes = iter->properties; //get the node's name + string interface_name = attributes->children->content; + debug ( "this dbus object has interface %s ", interface_name ); + if ( interface_name == MPRIS_PREFIX.concat("Playlists")){ + result = true; + } + delete attributes; } delete xml_doc; - return false; + return result; } // At startup check to see if there are clients up that we are interested in |