[gnome-music] playlistview: Correctly populate the sidebar



commit 2efea25a7d89048e4be9662fd791bf14aaf69248
Author: Jean Felder <jean felder gmail com>
Date:   Thu Jan 25 17:16:19 2018 +0100

    playlistview: Correctly populate the sidebar
    
    _offset keeps track of the playlists already loaded during runtime.
    It is incremented each time a playlist is loaded.
    
    Closes: #127

 gnomemusic/views/playlistview.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 2c91d0d..2d2e12e 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -318,6 +318,7 @@ class PlaylistView(BaseView):
         row.add(label)
         row.show_all()
         self._sidebar.insert(row, index)
+        self._offset += 1
 
         if len(self._sidebar) == 1:
             self._sidebar.select_row(row)
@@ -519,7 +520,6 @@ class PlaylistView(BaseView):
             self.emit('playlist-songs-loaded')
             return
 
-        self._offset += 1
         title = utils.get_media_title(song)
         song.set_title(title)
         artist = utils.get_artist_name(song)
@@ -690,7 +690,7 @@ class PlaylistView(BaseView):
 
     @log
     def populate(self):
-        """Clear sidebar, then populate it"""
-        for row in self._sidebar:
-            self._sidebar.remove(row)
+        """Populate sidebar.
+        Do not reload playlists already displayed.
+        """
         grilo.populate_playlists(self._offset, self._add_playlist_item)


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