From 7555ea6755750dd64a6c4652b852a0bdc0d0bfeb Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Jul 2010 18:55:05 +0100 Subject: whole new widget to house the customised title item --- src/mpris-controller.vala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mpris-controller.vala') diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index beaf02c..b1e66f3 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -76,6 +76,11 @@ public class MprisController : GLib.Object this.mpris_player.Pause(); } } + + public bool connected() + { + return (this.mpris_player != null); + } private void onStatusChange(dynamic DBus.Object mpris_client, status st) { -- cgit v1.2.3 From e4f900efd1e48814a70e4351cc3d878312daef37 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Jul 2010 16:12:59 +0100 Subject: event handling now plugged in crudely --- src/mpris-controller.vala | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/mpris-controller.vala') 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() -- cgit v1.2.3 From 0f2a6b2736713951fb4b88848e79849a8f1dc72a Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Jul 2010 17:47:28 +0100 Subject: constants replaced and enums and title image now fetched from the mono theme --- src/mpris-controller.vala | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/mpris-controller.vala') diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 61c96e7..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,9 +65,10 @@ public class MprisController : GLib.Object * TRUE => Playing * FALSE => Paused **/ - public void transport_event(int command) + public void transport_event(TransportMenuitem.action command) { - if(command == 2){ + 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); @@ -82,10 +83,10 @@ public class MprisController : GLib.Object this.mpris_player.Pause(); } } - else if(command == 1){ + else if(command == TransportMenuitem.action.PREVIOUS){ this.mpris_player.previous(); } - else if(command == 3){ + else if(command == TransportMenuitem.action.NEXT){ this.mpris_player.next(); } } -- cgit v1.2.3