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 <Anna@OcarinaProject.net>
This commit is contained in:
parent
f85ad3a9c3
commit
2d6e42832b
|
@ -3,11 +3,12 @@
|
|||
*/
|
||||
#include <gui/queue.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -4,10 +4,15 @@
|
|||
#include <gui/queue.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
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,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue