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



commit 4a92b669c558a3fc97426b60c55c152527f04e2f
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, 8 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 1bff3a20..6b527e7d 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -376,7 +376,14 @@ class MPRIS(DBusInterface):
                 or previous_path_list[-1] != self._path_list[-1]):
             current_song_path = self._get_song_dbus_path(
                 self.player.props.current_song)
-            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', current_song_path)))
+
             self.PropertiesChanged(
                 MPRIS.MEDIA_PLAYER2_TRACKLIST_IFACE,
                 {'Tracks': GLib.Variant('ao', self._path_list), }, [])
@@ -677,14 +684,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]