gui/queue: Create a GuiQueueModel as part of the gui_queue

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-01-18 08:54:24 -05:00
parent 4fd370ceb6
commit 70803cc199
3 changed files with 10 additions and 3 deletions

View File

@ -55,6 +55,7 @@ struct gui_queue *gui_queue_alloc(struct queue *queue, const gchar *text,
gq->gq_flags = flags;
gq->gq_text = g_strdup(text);
gq->gq_model = gui_queue_model_new(queue);
gq->gq_queue = queue;
return gq;
@ -66,6 +67,7 @@ void gui_queue_free(struct queue *queue)
queue->q_private = NULL;
g_object_unref(gq->gq_model);
g_free(gq->gq_text);
g_free(gq);
}

View File

@ -5,6 +5,7 @@
#define OCARINA_GUI_QUEUE_H
#include <core/queue.h>
#include <gui/model.h>
enum gui_queue_flags {
GQ_CAN_RANDOM = (1 << 0), /* Random button can be clicked. */
@ -13,10 +14,11 @@ enum gui_queue_flags {
};
struct gui_queue {
unsigned int gq_flags;
gchar *gq_text;
unsigned int gq_flags;
gchar *gq_text;
struct queue *gq_queue;
GuiQueueModel *gq_model;
struct queue *gq_queue;
};

View File

@ -47,6 +47,9 @@ static void test_queue()
/* Test initialization */
queue_init(&q, 0, &test_ops);
gq = gui_queue(&q);
test_equal((void *)gq->gq_queue, (void *)&q);
test_not_equal((void *)gq->gq_model, NULL);
test_equal(gui_queue_can_random(gq), (bool)true);
test_equal(gui_queue_can_repeat(gq), (bool)true);
test_equal(gui_queue_can_disable(gq), (bool)true);