From 2d6e42832bddb9c5637957bd5320a410ef75d359 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 13 Jan 2016 16:48:43 -0500 Subject: [PATCH] gui/queue: Add a text field to the gui queue The sidebar is going to look at this when setting queue sizes. Signed-off-by: Anna Schumaker --- gui/queue.c | 5 ++++- include/gui/queue.h | 3 ++- tests/gui/queue.c | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) 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, };