[gnome-music/wip/jfelder/mpris-cleanup: 18/29] mpris: Do not expose a TrackListReplaced method



commit d366fd09bc2ff602d579c5ee436a5c6aa2be4c91
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Apr 4 15:47:07 2019 +0200

    mpris: Do not expose a TrackListReplaced method
    
    TrackListReplaced is used to send a signal from MediaPlayer2.TrackList
    interface when the playlist (tracklist in MPRIS terminology) is
    changed. It is only used by the _update_songs_list method. So it does
    not need to be in its own function.

 gnomemusic/mpris.py | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 26ff3281..68866eb3 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -383,8 +383,13 @@ class MPRIS(DBusInterface):
         if (not previous_path_list
                 or previous_path_list[0] != self._path_list[0]
                 or previous_path_list[-1] != self._path_list[-1]):
-            current_song_path = self._get_song_dbus_path()
-            self.TrackListReplaced(self._path_list, current_song_path)
+            self.con.emit_signal(
+                None, '/org/mpris/MediaPlayer2',
+                MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE, 'TrackListReplaced',
+                GLib.Variant.new_tuple(
+                    GLib.Variant('ao', self._path_list),
+                    GLib.Variant('o', self._get_song_dbus_path())))
+
             self.PropertiesChanged(
                 MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
                 {'Tracks': GLib.Variant('ao', self._path_list), }, [])
@@ -683,14 +688,6 @@ class MPRIS(DBusInterface):
         goto_index = self._path_list.index(path)
         self.player.play(goto_index - current_song_index)
 
-    def TrackListReplaced(self, tracks, current_song):
-        self.con.emit_signal(None,
-                             '/org/mpris/MediaPlayer2',
-                             MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
-                             'TrackListReplaced',
-                             GLib.Variant.new_tuple(GLib.Variant('ao', tracks),
-                                                    GLib.Variant('o', current_song)))
-
     def ActivatePlaylist(self, playlist_path):
         playlist_id = self._get_playlist_from_dbus_path(playlist_path).get_id()
         self.app._window.views[View.PLAYLIST].activate_playlist(playlist_id)


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