diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-07-08 16:12:59 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-07-08 16:12:59 +0100 |
commit | e4f900efd1e48814a70e4351cc3d878312daef37 (patch) | |
tree | cbedf03dba7641079e1f7aa68b4c325a6d5044b3 /src/mpris-controller.vala | |
parent | 41747b032d2032c97fd7f1766157e2d846626880 (diff) | |
download | ayatana-indicator-sound-e4f900efd1e48814a70e4351cc3d878312daef37.tar.gz ayatana-indicator-sound-e4f900efd1e48814a70e4351cc3d878312daef37.tar.bz2 ayatana-indicator-sound-e4f900efd1e48814a70e4351cc3d878312daef37.zip |
event handling now plugged in crudely
Diffstat (limited to 'src/mpris-controller.vala')
-rw-r--r-- | src/mpris-controller.vala | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index b1e66f3..61c96e7 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -65,16 +65,29 @@ public class MprisController : GLib.Object * TRUE => Playing * FALSE => Paused **/ - public void toggle_playback(bool state) + public void transport_event(int command) { - if(state == true){ - debug("about to play"); - this.mpris_player.Play(); + if(command == 2){ + 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 if(command == 1){ + this.mpris_player.previous(); + } + else if(command == 3){ + this.mpris_player.next(); } - else{ - debug("about to pause"); - this.mpris_player.Pause(); - } } public bool connected() |