gui/queue: Store playlist in the gui queue

I'll need to know the playlist type to set artist information properly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-05-15 11:04:13 -04:00 committed by Anna Schumaker
parent f70b2b940f
commit 871bf88b94
5 changed files with 14 additions and 11 deletions

View File

@ -138,7 +138,7 @@ static void *__playlist_init(struct queue *queue, void *data)
if (string_match(playlist->pl_name, "Collection"))
flags = GQ_CAN_RANDOM;
return gui_queue_alloc(queue, playlist->pl_name, flags);
return gui_queue_alloc(playlist, queue, playlist->pl_name, flags);
}
static void __playlist_added(struct queue *queue, unsigned int row)

View File

@ -99,8 +99,8 @@ void __queue_filter(GtkSearchEntry *entry, gpointer data)
}
}
struct gui_queue *gui_queue_alloc(struct queue *queue, const gchar *text,
unsigned int flags)
struct gui_queue *gui_queue_alloc(struct playlist *playlist, struct queue *queue,
const gchar *text, unsigned int flags)
{
struct gui_queue *gq = g_malloc(sizeof(struct gui_queue));
@ -110,7 +110,8 @@ struct gui_queue *gui_queue_alloc(struct queue *queue, const gchar *text,
gq->gq_model = gui_queue_model_new(queue);
gq->gq_filter = gtk_tree_model_filter_new(
GTK_TREE_MODEL(gq->gq_model), NULL);
gq->gq_queue = queue;
gq->gq_playlist = playlist;
gq->gq_queue = queue;
gq->gq_visible = NULL;
gtk_tree_model_filter_set_visible_func(

View File

@ -11,7 +11,7 @@ static void *__tempq_init(struct queue *queue, void *data)
{
struct gui_queue *gq;
gq = gui_queue_alloc(queue, "Queued Tracks", TEMPQ_FLAGS);
gq = gui_queue_alloc(NULL, queue, "Queued Tracks", TEMPQ_FLAGS);
gui_sidebar_add(gq);
return gq;
}

View File

@ -18,15 +18,17 @@ struct gui_queue {
gchar *gq_text;
gchar *gq_search;
GuiQueueModel *gq_model;
GtkTreeModel *gq_filter;
struct queue *gq_queue;
GHashTable *gq_visible;
GuiQueueModel *gq_model;
GtkTreeModel *gq_filter;
struct playlist *gq_playlist;
struct queue *gq_queue;
GHashTable *gq_visible;
};
/* Called to allocate a new struct gui_queue. */
struct gui_queue *gui_queue_alloc(struct queue *, const gchar *, unsigned int);
struct gui_queue *gui_queue_alloc(struct playlist *, struct queue *,
const gchar *, unsigned int);
/* Called to free a struct gui_queue. */
void gui_queue_free(struct queue *);

View File

@ -18,7 +18,7 @@
static void *test_queue_init(struct queue *queue, void *data)
{
return gui_queue_alloc(queue, "Test Queue",
return gui_queue_alloc(NULL, queue, "Test Queue",
GQ_CAN_RANDOM | GQ_CAN_REPEAT | GQ_CAN_DISABLE);
}