From 380657715428e15c3b07974d98770bcef3ccff18 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sun, 28 Aug 2016 09:48:12 -0400 Subject: [PATCH] gui/playlists: Add artist playlists when they are created We only need to do this after Ocarina init has completed, otherwise artist playlists will be added twice. Fixes #79: Artist playlists not updated when tracks are added Signed-off-by: Anna Schumaker --- gui/playlist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/playlist.c b/gui/playlist.c index aca72eeb..31bf6b23 100644 --- a/gui/playlist.c +++ b/gui/playlist.c @@ -15,6 +15,7 @@ enum playlist_sidebar_columns { static GtkTreeStore *p_store; static gchar *p_name = NULL; +static bool p_init_done = false; static inline enum playlist_type_t __playlist_type(GtkTreeIter *iter) @@ -180,6 +181,8 @@ static void *__playlist_init(struct queue *queue, void *data) if (string_match(playlist->pl_name, "Collection")) flags = GQ_CAN_RANDOM; + if (p_init_done && playlist->pl_type == PL_ARTIST) + gui_playlist_add_artist(artist_find(playlist->pl_name)); return gui_queue_alloc(playlist, queue, playlist->pl_name, flags); } @@ -212,6 +215,7 @@ bool __gui_playlist_init_idle() db_for_each(artist, next, artist_db_get()) gui_playlist_add_artist(ARTIST(artist)); + p_init_done = true; gui_queue_show(gui_queue(playlist_get_queue(PL_SYSTEM, "Collection"))); return true; }