diff options
author | Ted Gould <ted@gould.cx> | 2014-02-24 16:30:49 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2014-02-24 16:30:49 -0600 |
commit | abe2227e7dfecdec4c28c9447e2b2d298ba8eb89 (patch) | |
tree | cac9bcf28c9149c86bbee80c9f8b45484edea8bd /src/media-player-user.vala | |
parent | faa10b31c7868206156c33fc3bc0b2d6c726e63d (diff) | |
download | ayatana-indicator-sound-abe2227e7dfecdec4c28c9447e2b2d298ba8eb89.tar.gz ayatana-indicator-sound-abe2227e7dfecdec4c28c9447e2b2d298ba8eb89.tar.bz2 ayatana-indicator-sound-abe2227e7dfecdec4c28c9447e2b2d298ba8eb89.zip |
Get out the dbus properties
Diffstat (limited to 'src/media-player-user.vala')
-rw-r--r-- | src/media-player-user.vala | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/media-player-user.vala b/src/media-player-user.vala index bd9bc92..c4d0e42 100644 --- a/src/media-player-user.vala +++ b/src/media-player-user.vala @@ -23,6 +23,8 @@ public class MediaPlayerUser : MediaPlayer { Act.User? actuser = null; AccountsServiceSoundSettings? proxy = null; + /* Grab the user from the Accounts service and, when it is loaded then + set up a proxy to its sound settings */ public MediaPlayerUser(string user) { username = user; @@ -42,11 +44,47 @@ public class MediaPlayerUser : MediaPlayer { }); } + void queue_property_notification (string dbus_property_name) { + switch (dbus_property_name) { + case "Timestamp": + break; + case "PlayerName": + break; + case "PlayerIcon": + break; + case "State": + break; + case "Title": + break; + case "Artist": + break; + case "Album": + break; + case "ArtUrl": + break; + } + } + void new_proxy (GLib.Object? obj, AsyncResult res) { try { this.proxy = Bus.get_proxy.end (res); + + var gproxy = this.proxy as DBusProxy; + gproxy.g_properties_changed.connect ((proxy, changed, invalidated) => { + string key = ""; + Variant value; + VariantIter iter = new VariantIter(changed); + + while (iter.next("{sv}", &key, &value)) { + queue_property_notification(key); + } + + foreach (var invalid in invalidated) { + queue_property_notification(invalid); + } + }); + /* TODO: Update settings */ - /* TODO: Setup setting notification */ } catch (Error e) { this.proxy = null; warning("Unable to get proxy to user '%s' sound settings: %s", username, e.message); @@ -70,6 +108,7 @@ public class MediaPlayerUser : MediaPlayer { get { return username; } } + /* These values come from the proxy */ string name_cache; public override string name { get { @@ -104,11 +143,16 @@ public class MediaPlayerUser : MediaPlayer { } } } + + /* Placeholder */ public override string dbus_name { get { return ""; } } + /* If it's shown externally it's running */ public override bool is_running { get { return proxy_is_valid(); } } + /* A bit weird. Not sure how we should handle this. */ public override bool can_raise { get { return false; } } + /* Fill out the track based on the values in the proxy */ MediaPlayer.Track track_cache; public override MediaPlayer.Track? current_track { get { |