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



commit d981e55e85a86ecb684e3e00b5b53ed222270385
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 | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 833fb723..a227ac0d 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -395,8 +395,12 @@ 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())))
 
     @log
     def _get_playlist_dbus_path(self, playlist):
@@ -660,14 +664,6 @@ class MPRIS(DBusInterface):
         song_offset = goto_index - current_song_index
         self.player.play(song_offset=song_offset)
 
-    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._playlists.activate_playlist(playlist_id)


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