From 3d31349ccaeeb7fe01108e293213823c68f0249a Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sun, 28 Aug 2016 09:06:33 -0400 Subject: [PATCH] gui/playlist: Random state isn't saved when random button is clicked We were calling the queue function directly, rather than passing through the playlist layer. This means random state isn't saved when the button is clicked and Ocarina is closed. Fixes #78: Call playlist_set_random() when clicking random button Signed-off-by: Anna Schumaker --- gui/playlist.c | 1 + gui/queue.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/gui/playlist.c b/gui/playlist.c index 75b75635..aca72eeb 100644 --- a/gui/playlist.c +++ b/gui/playlist.c @@ -212,6 +212,7 @@ bool __gui_playlist_init_idle() db_for_each(artist, next, artist_db_get()) gui_playlist_add_artist(ARTIST(artist)); + gui_queue_show(gui_queue(playlist_get_queue(PL_SYSTEM, "Collection"))); return true; } diff --git a/gui/queue.c b/gui/queue.c index 57f144d1..61b85966 100644 --- a/gui/queue.c +++ b/gui/queue.c @@ -2,6 +2,7 @@ * Copyright 2016 (c) Anna Schumaker. */ #include +#include #include #include #include @@ -45,6 +46,11 @@ void __queue_random(GtkToggleButton *button, gpointer data) __queue_toggle_flag(gtk_toggle_button_get_active(button), gtk_button_get_image(GTK_BUTTON(button)), Q_RANDOM); + if (gq_queue->gq_playlist) { + playlist_set_random(gq_queue->gq_playlist->pl_type, + gq_queue->gq_playlist->pl_name, + gtk_toggle_button_get_active(button)); + } } void __queue_repeat(GtkToggleButton *button, gpointer data)