[gnome-music/wip/jfelder/player-remove-prev-next-invalidated: 3/7] mpris: Use repeat-mode changes to emit CanGo{previous/next}
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/player-remove-prev-next-invalidated: 3/7] mpris: Use repeat-mode changes to emit CanGo{previous/next}
- Date: Wed, 24 Apr 2019 11:58:28 +0000 (UTC)
commit 4b9e9fe6e3f6db1a3eca06f343cbfc1c6ba01cb9
Author: Jean Felder <jfelder src gnome org>
Date: Wed Apr 24 00:18:04 2019 +0200
mpris: Use repeat-mode changes to emit CanGo{previous/next}
See the previous commit message for the whole explanation. In summary,
"prev-next-invalidated" and "repeat-mode" changes are redundant.
gnomemusic/mpris.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index d582208a..38b16dce 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -225,7 +225,6 @@ class MediaPlayer2Service(Server):
self.player.connect('notify::state', self._on_player_state_changed)
self.player.connect('notify::repeat-mode', self._on_repeat_mode_changed)
self.player.connect('volume-changed', self._on_volume_changed)
- self.player.connect('prev-next-invalidated', self._on_prev_next_invalidated)
self.player.connect('seek-finished', self._on_seek_finished)
self.player.connect(
'playlist-changed', self._on_player_playlist_changed)
@@ -477,8 +476,12 @@ class MediaPlayer2Service(Server):
@log
def _on_repeat_mode_changed(self, player, param):
self._update_songs_list()
+ has_next = self.player.props.has_next
+ has_previous = self.player.props.has_previous
self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
{
+ 'CanGoNext': GLib.Variant('b', has_next),
+ 'CanGoPrevious': GLib.Variant('b', has_previous),
'LoopStatus': GLib.Variant('s', self._get_loop_status()),
'Shuffle': GLib.Variant('b', self.player.props.repeat_mode ==
RepeatMode.SHUFFLE),
},
@@ -492,15 +495,6 @@ class MediaPlayer2Service(Server):
},
[])
- @log
- def _on_prev_next_invalidated(self, player, data=None):
- self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYER_IFACE,
- {
- 'CanGoNext': GLib.Variant('b', self.player.props.has_next),
- 'CanGoPrevious': GLib.Variant('b', self.player.props.has_previous),
- },
- [])
-
@log
def _on_seek_finished(self, player, position_second):
self.Seeked(int(position_second * 1e6))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]