[gnome-music/wip/jfelder/mpris-limit-songs: 3/6] player: Define has_songs property
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-limit-songs: 3/6] player: Define has_songs property
- Date: Tue, 18 Sep 2018 16:30:44 +0000 (UTC)
commit 4d9b93ec83970c887a19775ae4c2d76c591a223b
Author: Jean Felder <jfelder src gnome org>
Date: Thu Sep 13 23:54:21 2018 +0200
player: Define has_songs property
This simplifies mpris Play method.
gnomemusic/mpris.py | 2 +-
gnomemusic/player.py | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index dce483de..b103c50c 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -538,7 +538,7 @@ class MediaPlayer2Service(Server):
self.player.stop()
def Play(self):
- if self.player.get_songs():
+ if self.player.props.has_songs:
self.player.play()
elif self.first_song_handler == 0:
window = self.app.get_active_window()
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index c26cb20f..644a6ee2 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -852,6 +852,12 @@ class Player(GObject.GObject):
self._player.volume = rate
self.emit('volume-changed')
+ @GObject.Property(
+ type=bool, default=False, flags=GObject.ParamFlags.READABLE)
+ def has_songs(self):
+ """Check if the playlist has songs"""
+ return self._playlist.props.current_song is not None
+
@log
def get_songs(self):
return self._playlist.get_songs()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]