[gnome-music/wip/jfelder/mpris-cleanup: 3/19] mpris: Send a notification when a playlist is renamed
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 3/19] mpris: Send a notification when a playlist is renamed
- Date: Wed, 29 May 2019 13:12:30 +0000 (UTC)
commit 690a04a3f41170ba0df8754b35160633f310c926
Author: Jean Felder <jfelder src gnome org>
Date: Thu Apr 4 12:05:20 2019 +0200
mpris: Send a notification when a playlist is renamed
Send a PlaylistChanged signal from the MediaPlayer2.Playlists interface.
gnomemusic/mpris.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 297fe31a..c86984f1 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -267,6 +267,7 @@ class MPRIS(DBusInterface):
'playlist-created', self._on_playlists_count_changed)
self._playlists.connect(
'playlist-deleted', self._on_playlists_count_changed)
+ self._playlists.connect('playlist-renamed', self._on_playlist_renamed)
grilo.connect('ready', self._on_grilo_ready)
self._stored_playlists = []
self._player_previous_type = None
@@ -536,6 +537,15 @@ class MPRIS(DBusInterface):
def _on_playlists_count_changed(self, playlists, item):
self._reload_playlists()
+ @log
+ def _on_playlist_renamed(self, playlists, renamed_playlist):
+ mpris_playlist = self._get_mpris_playlist_from_playlist(
+ renamed_playlist)
+ self.con.emit_signal(
+ None, '/org/mpris/MediaPlayer2',
+ MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE, 'PlaylistChanged',
+ GLib.Variant.new_tuple(GLib.Variant('(oss)', mpris_playlist)))
+
@log
def _on_grilo_ready(self, grilo):
self._reload_playlists()
@@ -688,13 +698,6 @@ class MPRIS(DBusInterface):
first_index = None
return mpris_playlists[index + max_count - 1:first_index:-1]
- def PlaylistChanged(self, playlist):
- self.con.emit_signal(None,
- '/org/mpris/MediaPlayer2',
- MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE,
- 'PlaylistChanged',
- GLib.Variant.new_tuple(GLib.Variant('(oss)', playlist)))
-
def Get(self, interface_name, property_name):
return self.GetAll(interface_name)[property_name]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]