diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2010-07-08 21:32:29 +0200 |
|---|---|---|
| committer | Bazaar Package Importer <james.westby@ubuntu.com> | 2010-07-08 21:32:29 +0200 |
| commit | 9c00e0247f69c00c1e855a42e82bfd767b16b607 (patch) | |
| tree | 96f0afd879fb0d4f0a54847793761671db4437b0 /src/mpris-controller.vala | |
| parent | fa918259b9164e6d4c9c3c774f6ea37ad0c9d705 (diff) | |
| parent | 1584af2971970dfb3484329a5307e5e770b34094 (diff) | |
| download | ayatana-indicator-sound-9c00e0247f69c00c1e855a42e82bfd767b16b607.tar.gz ayatana-indicator-sound-9c00e0247f69c00c1e855a42e82bfd767b16b607.tar.bz2 ayatana-indicator-sound-9c00e0247f69c00c1e855a42e82bfd767b16b607.zip | |
* New upstream release:
-New transport widget integrated
-New title widget integrated which allows the user
to launch familiar app directly from the menu
- UI tidied
- Each player that registers with the menu will be stored in the
cache file allowing the menu to show the application even if it has
not been launched.
Diffstat (limited to 'src/mpris-controller.vala')
| -rw-r--r-- | src/mpris-controller.vala | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index beaf02c..2194d44 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -27,9 +27,9 @@ public class MprisController : GLib.Object private PlayerController controller; struct status { public int32 playback; - public int32 shuffle; - public int32 repeat; - public int32 endless; + //public int32 shuffle; // Not used just yet + //public int32 repeat; + //public int32 endless; } public MprisController(string name, PlayerController controller, string mpris_interface="org.freedesktop.MediaPlayer"){ @@ -65,16 +65,35 @@ public class MprisController : GLib.Object * TRUE => Playing * FALSE => Paused **/ - public void toggle_playback(bool state) + public void transport_event(TransportMenuitem.action command) { - if(state == true){ - debug("about to play"); - this.mpris_player.Play(); + debug("transport_event input = %i", (int)command); + if(command == TransportMenuitem.action.PLAY_PAUSE){ + status st = this.mpris_player.GetStatus(); + bool play_state = st.playback == 1; + debug("toggle_playback - initial play state %i", (int)play_state); + bool new_play_state = !play_state; + debug("toggle_playback - new play state %i", (int)new_play_state); + if(new_play_state == true){ + debug("about to play"); + this.mpris_player.Play(); + } + else{ + debug("about to pause"); + this.mpris_player.Pause(); + } } - else{ - debug("about to pause"); - this.mpris_player.Pause(); - } + else if(command == TransportMenuitem.action.PREVIOUS){ + this.mpris_player.previous(); + } + else if(command == TransportMenuitem.action.NEXT){ + this.mpris_player.next(); + } + } + + public bool connected() + { + return (this.mpris_player != null); } private void onStatusChange(dynamic DBus.Object mpris_client, status st) |
