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 <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-28 09:48:12 -04:00
parent a430c5b117
commit 3806577154
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}