[gnome-music/wip/jfelder/3-34-smart-playlist-loaded] smartplaylist: Add missing playlist-loaded emission



commit f439d40a16f7f8530beb0646d47d59f073a673fe
Author: Jean Felder <jfelder src gnome org>
Date:   Tue Jan 21 21:45:03 2020 +0100

    smartplaylist: Add missing playlist-loaded emission
    
    There are two ways to start playing a playlist:
    - from PlaylistsView, by clicking on a song
    - from a MPRIS client which handles the MediaPlayer2.Playlists
    interface
    
    In the second case, the playlist model has not been loaded yet if it
    has not been displayed in the PlaylistsView (models are loaded on
    demand). In that case, it is necessary to register to the
    "playlist-loaded" signal to the set player model once the playlist
    model is loaded. It works correctly for user playlists but not for
    smart playlists. Indeed, the latter do not emit the "playlist-loaded"
    signal.
    
    Fix this issue by emitting the "playlist-loaded" signal once a smart
    playlist model is loaded.

 gnomemusic/grilowrappers/grltrackerplaylists.py | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index acd626a9..57ed1c42 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -698,11 +698,13 @@ class SmartPlaylist(Playlist):
                 if error:
                     print("ERROR", error)
                     self._window.notifications_popup.pop_loading()
+                    self.emit("playlist-loaded")
                     return
 
                 if not media:
                     self.props.count = self._model.get_n_items()
                     self._window.notifications_popup.pop_loading()
+                    self.emit("playlist-loaded")
                     return
 
                 coresong = CoreSong(media, self._coreselection, self._grilo)


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