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



commit 6935307c71c881f41d3e11816194a50b496bcf4a
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 25acde5e..99ea61f2 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -719,11 +719,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]