From a3b4aa7d5959ed275dd501ae2264e81b00b184b3 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Tue, 15 Sep 2015 14:16:10 +0200 Subject: Added changed to reflect the state of the player control buttons --- src/media-player-mpris.vala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/media-player-mpris.vala') diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala index 741d887..8bc2884 100644 --- a/src/media-player-mpris.vala +++ b/src/media-player-mpris.vala @@ -79,6 +79,24 @@ public class MediaPlayerMpris: MediaPlayer { } } + public override bool can_do_play { + get { + return this.proxy.CanPlay; + } + } + + public override bool can_do_prev { + get { + return this.proxy.CanGoPrevious; + } + } + + public override bool can_do_next { + get { + return this.proxy.CanGoNext; + } + } + /** * Attach this object to a process of the associated media player. The player must own @dbus_name and * implement the org.mpris.MediaPlayer2.Player interface. @@ -272,6 +290,9 @@ public class MediaPlayerMpris: MediaPlayer { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; } + if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrev", "b", null)) { + this.playbackstatus_changed (); + } var metadata = changed_properties.lookup_value ("Metadata", new VariantType ("a{sv}")); if (metadata != null) -- cgit v1.2.3 From 95e94f9fe48164a1f74407130584744513bf83b7 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Mon, 28 Sep 2015 14:53:42 +0200 Subject: Fixed property name when checking if CanGoPrevious changed --- src/media-player-mpris.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/media-player-mpris.vala') diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala index 8bc2884..b9961f5 100644 --- a/src/media-player-mpris.vala +++ b/src/media-player-mpris.vala @@ -290,7 +290,7 @@ public class MediaPlayerMpris: MediaPlayer { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; } - if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrev", "b", null)) { + if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrevious", "b", null)) { this.playbackstatus_changed (); } -- cgit v1.2.3 From daa4d9fd99c03fbaa5f9ae17dbd32095cd6d3d95 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Wed, 14 Oct 2015 16:57:41 +0200 Subject: Updating MPRIS control in the menu not only when next and previous are updated --- src/media-player-mpris.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/media-player-mpris.vala') diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala index b9961f5..408cdda 100644 --- a/src/media-player-mpris.vala +++ b/src/media-player-mpris.vala @@ -290,7 +290,8 @@ public class MediaPlayerMpris: MediaPlayer { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; } - if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrevious", "b", null)) { + if (changed_properties.lookup ("CanGoNext", "b", null) || changed_properties.lookup ("CanGoPrevious", "b", null) || + changed_properties.lookup ("CanPlay", "b", null) || changed_properties.lookup ("CanPause", "b", null)) { this.playbackstatus_changed (); } -- cgit v1.2.3