From 70d2d969bc4ba562792580f10e8c382691fa5881 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 27 Feb 2014 11:17:10 -0600 Subject: Get teh greeter proxy and control it --- src/media-player-user.vala | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/media-player-user.vala') 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 properties_queued = new HashTable(str_hash, str_equal); uint properties_timeout = 0; @@ -45,6 +46,14 @@ public class MediaPlayerUser : MediaPlayer { null, new_proxy); }); + + Bus.get_proxy.begin ( + 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 -- cgit v1.2.3