diff --git a/gui/queue.c b/gui/queue.c index 8d776fda..73f086c6 100644 --- a/gui/queue.c +++ b/gui/queue.c @@ -3,11 +3,12 @@ */ #include -void *gui_queue_alloc(struct queue *queue) +struct gui_queue *gui_queue_alloc(struct queue *queue, const gchar *text) { struct gui_queue *gq = g_malloc(sizeof(struct gui_queue)); gq->gq_queue = queue; + gq->gq_text = g_strdup(text); return gq; } @@ -16,5 +17,7 @@ void gui_queue_free(struct queue *queue) struct gui_queue *gq = gui_queue(queue); queue->q_private = NULL; + + g_free(gq->gq_text); g_free(gq); } diff --git a/include/gui/queue.h b/include/gui/queue.h index 2e858f84..a720a52d 100644 --- a/include/gui/queue.h +++ b/include/gui/queue.h @@ -8,11 +8,12 @@ struct gui_queue { struct queue *gq_queue; + gchar *gq_text; }; /* Called to allocate a new struct gui_queue. */ -void *gui_queue_alloc(struct queue *); +struct gui_queue *gui_queue_alloc(struct queue *, const gchar *); /* Called to free a struct gui_queue. */ void gui_queue_free(struct queue *); diff --git a/tests/gui/queue.c b/tests/gui/queue.c index 2cdce96d..6b6c3e1f 100644 --- a/tests/gui/queue.c +++ b/tests/gui/queue.c @@ -4,10 +4,15 @@ #include #include +static void *test_queue_init(struct queue *queue) +{ + return gui_queue_alloc(queue, "Test Queue"); +} + void __test_queue_clear(struct queue *queue, unsigned int n) {} static const struct queue_ops test_ops = { - .qop_init = gui_queue_alloc, + .qop_init = test_queue_init, .qop_deinit = gui_queue_free, .qop_cleared = __test_queue_clear, };