[gnome-music/wip/jfelder/mpris-limit-get-songs: 2/12] mpris: Merge player_playlist functions



commit ee524fdf57e51ab3b8bc088242beeb5fb7371cc6
Author: Jean Felder <jfelder src gnome org>
Date:   Tue Oct 23 19:37:36 2018 +0200

    mpris: Merge player_playlist functions
    
    _on_player_playlist_modified is only called by
    _on_player_playlist_changed.

 gnomemusic/mpris.py | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 5a96f347..4171f524 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -477,25 +477,19 @@ class MediaPlayer2Service(Server):
 
     @log
     def _on_player_playlist_changed(self, klass):
-        self._on_player_playlist_modified()
-
-        self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE,
-                               {
-                                'ActivePlaylist': GLib.Variant('(b(oss))', self._get_active_playlist()),
-                               },
-                               [])
-
-    @log
-    def _on_player_playlist_modified(self, path=None, _iter=None, data=None):
         if self.player.props.current_song:
             track_list = self._get_track_list()
             self.TrackListReplaced(
                 track_list, self._get_media_id(self.player.props.current_song))
-            self.PropertiesChanged(MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
-                                   {
-                                       'Tracks': GLib.Variant('ao', track_list),
-                                   },
-                                   [])
+            self.PropertiesChanged(
+                MediaPlayer2Service.MEDIA_PLAYER2_TRACKLIST_IFACE,
+                {'Tracks': GLib.Variant('ao', track_list), }, [])
+
+        active_playlist = self._get_active_playlist()
+        self.PropertiesChanged(
+            MediaPlayer2Service.MEDIA_PLAYER2_PLAYLISTS_IFACE,
+            {'ActivePlaylist': GLib.Variant('(b(oss))', active_playlist), },
+            [])
 
     @log
     def _reload_playlists(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]