[gnome-music/wip/jfelder/playlist-creation-populate] playlistview: Do not add a playlist if the view is not populated
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/playlist-creation-populate] playlistview: Do not add a playlist if the view is not populated
- Date: Wed, 24 Apr 2019 06:51:30 +0000 (UTC)
commit 17fff104055f06e71be97d24021b4ba1fd24614b
Author: Jean Felder <jfelder src gnome org>
Date: Wed Apr 24 08:35:36 2019 +0200
playlistview: Do not add a playlist if the view is not populated
Since commit 0faaeea7, the views are populated when opened. This means
that a playlist can be created before the PlaylistView has been
populated. In that case, the newly created playlist will be displayed
two times: one because of the playlist creation logic and a second
time because of the populate logic.
Fix the issue by doing nothing in PlaylistView on playlist creation if
the sidebar is not populated. The playlist will be correctly displayed
on populate.
gnomemusic/views/playlistview.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index f77722fc..e43eee4b 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -749,7 +749,13 @@ class PlaylistView(BaseView):
@log
def _on_playlist_created(self, playlists, playlist):
- """Add new playlist to sidebar"""
+ """Adds new playlist to sidebar
+
+ If the sidebar has not been populated yet, it has no effect:
+ the playlist will be displayed once the playlists are loaded.
+ """
+ if not self._init:
+ return
self._add_playlist_to_sidebar(playlist)
@log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]