diff --git a/gui/queue.c b/gui/queue.c index 21537115..9c223e9f 100644 --- a/gui/queue.c +++ b/gui/queue.c @@ -2,6 +2,7 @@ * Copyright 2016 (c) Anna Schumaker. */ #include +#include #include static struct gui_queue *gq_queue = NULL; @@ -106,3 +107,23 @@ void gui_queue_show(struct gui_queue *queue) gtk_widget_set_sensitive(GTK_WIDGET(search), queue != NULL); gtk_entry_set_text(search, ""); } + +void gui_queue_added(struct queue *queue, unsigned int row) +{ + gui_queue_model_add(gui_queue(queue)->gq_model, row); +} + +void gui_queue_removed(struct queue *queue, unsigned int row) +{ + gui_queue_model_remove(gui_queue(queue)->gq_model, row); +} + +void gui_queue_cleared(struct queue *queue, unsigned int n) +{ + gui_queue_model_clear(gui_queue(queue)->gq_model, n); +} + +void gui_queue_updated(struct queue *queue, unsigned int row) +{ + gui_queue_model_update(gui_queue(queue)->gq_model, row); +} diff --git a/include/gui/model.h b/include/gui/model.h index 9153f8e4..a297cfc9 100644 --- a/include/gui/model.h +++ b/include/gui/model.h @@ -3,6 +3,7 @@ */ #ifndef OCARINA_GUI_MODEL_H #define OCARINA_GUI_MODEL_H +#include #include #define GUI_QUEUE_MODEL_TYPE (gui_queue_model_get_type()) diff --git a/include/gui/queue.h b/include/gui/queue.h index f996ea3f..9c40ee53 100644 --- a/include/gui/queue.h +++ b/include/gui/queue.h @@ -61,4 +61,16 @@ static inline bool gui_queue_can_disable(struct gui_queue *gq) /* Called to set the correct state of the random and repeat buttons. */ void gui_queue_show(struct gui_queue *); +/* Called when a track is added to the queue. */ +void gui_queue_added(struct queue *, unsigned int); + +/* Called when a track is removed from the queue. */ +void gui_queue_removed(struct queue *, unsigned int); + +/* Called when a queue is cleared. */ +void gui_queue_cleared(struct queue *, unsigned int); + +/* Called when a track is updated. */ +void gui_queue_updated(struct queue *, unsigned int); + #endif /* OCARINA_GUI_QUEUE_H */ diff --git a/tests/gui/queue.c b/tests/gui/queue.c index b18c9839..0045dcf2 100644 --- a/tests/gui/queue.c +++ b/tests/gui/queue.c @@ -17,12 +17,16 @@ static void *test_queue_init(struct queue *queue) GQ_CAN_RANDOM | GQ_CAN_REPEAT | GQ_CAN_DISABLE); } -void __test_queue_clear(struct queue *queue, unsigned int n) {} +static void test_queue_save(struct queue *queue, unsigned int row) {} static const struct queue_ops test_ops = { .qop_init = test_queue_init, .qop_deinit = gui_queue_free, - .qop_cleared = __test_queue_clear, + .qop_cleared = gui_queue_cleared, + .qop_added = gui_queue_added, + .qop_removed = gui_queue_removed, + .qop_save = test_queue_save, + .qop_updated = gui_queue_updated, }; static void test_queue()