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 <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-28 09:06:33 -04:00
parent f855eaea58
commit 3d31349cca
2 changed files with 7 additions and 0 deletions

View File

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

View File

@ -2,6 +2,7 @@
* Copyright 2016 (c) Anna Schumaker.
*/
#include <core/filter.h>
#include <core/playlist.h>
#include <core/string.h>
#include <gui/builder.h>
#include <gui/model.h>
@ -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)