aboutsummaryrefslogtreecommitdiff
path: root/src/media-player-user.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-02-27 11:17:10 -0600
committerTed Gould <ted@gould.cx>2014-02-27 11:17:10 -0600
commit70d2d969bc4ba562792580f10e8c382691fa5881 (patch)
tree95af2489a4d3d77409de4750a8b37c03faaabda0 /src/media-player-user.vala
parent948e2a727ebd214752a7b9ecc863ed613cc110d2 (diff)
downloadayatana-indicator-sound-70d2d969bc4ba562792580f10e8c382691fa5881.tar.gz
ayatana-indicator-sound-70d2d969bc4ba562792580f10e8c382691fa5881.tar.bz2
ayatana-indicator-sound-70d2d969bc4ba562792580f10e8c382691fa5881.zip
Get teh greeter proxy and control it
Diffstat (limited to 'src/media-player-user.vala')
-rw-r--r--src/media-player-user.vala30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/media-player-user.vala b/src/media-player-user.vala
index 798c8c8..6545cef 100644
--- a/src/media-player-user.vala
+++ b/src/media-player-user.vala
@@ -22,6 +22,7 @@ public class MediaPlayerUser : MediaPlayer {
string username;
Act.User? actuser = null;
AccountsServiceSoundSettings? proxy = null;
+ GreeterBroadcast? greeter = null;
HashTable<string, bool> properties_queued = new HashTable<string, bool>(str_hash, str_equal);
uint properties_timeout = 0;
@@ -45,6 +46,14 @@ public class MediaPlayerUser : MediaPlayer {
null,
new_proxy);
});
+
+ Bus.get_proxy.begin<GreeterBroadcast> (
+ BusType.SYSTEM,
+ "com.canonical.Unity.Greeter.Broadcast",
+ "/com/canonical/Unity/Greeter/Broadcast",
+ DBusProxyFlags.NONE,
+ null,
+ greeter_proxy_new);
}
~MediaPlayerUser () {
@@ -205,18 +214,33 @@ public class MediaPlayerUser : MediaPlayer {
set { }
}
+ void greeter_proxy_new (GLib.Object? obj, AsyncResult res) {
+ try {
+ this.greeter = Bus.get_proxy.end (res);
+ } catch (Error e) {
+ this.greeter = null;
+ warning("Unable to get greeter proxy: %s", e.message);
+ }
+ }
+
/* Control functions through unity-greeter-session-broadcast */
public override void activate () {
/* TODO: */
}
public override void play_pause () {
- /* TODO: */
+ if (this.greeter != null) {
+ this.greeter.SoundPlayPause(this.username);
+ }
}
public override void next () {
- /* TODO: */
+ if (this.greeter != null) {
+ this.greeter.SoundNext(this.username);
+ }
}
public override void previous () {
- /* TODO: */
+ if (this.greeter != null) {
+ this.greeter.SoundPrev(this.username);
+ }
}
/* Play list functions are all null as we don't support the