From e2905528120ec0f2023d8c7b92cf63f1aa2a3b8b Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 20 Jan 2016 16:27:14 -0500 Subject: [PATCH] gui/history: Convert file to C Signed-off-by: Anna Schumaker --- gui/history.c | 38 ++++++++++++++++++++++++++++++++++++++ gui/history.cpp | 41 ----------------------------------------- gui/ocarina.cpp | 1 + include/gui/history.h | 10 ++++++++++ include/gui/ocarina.h | 1 - 5 files changed, 49 insertions(+), 42 deletions(-) create mode 100644 gui/history.c delete mode 100644 gui/history.cpp create mode 100644 include/gui/history.h diff --git a/gui/history.c b/gui/history.c new file mode 100644 index 00000000..73d39576 --- /dev/null +++ b/gui/history.c @@ -0,0 +1,38 @@ +/* + * Copyright 2014 (c) Anna Schumaker. + */ +#include +#include + + +static void *__history_init(struct queue *queue) +{ + return gui_queue_alloc(queue, "History", 0); +} + +static void __history_added(struct queue *queue, unsigned int pos) +{ + gui_queue_added(queue, pos); + gui_sidebar_set_size(gui_queue(queue)); +} + +static bool __history_erase(struct queue *queue, struct track *track) +{ + return false; +} + +static void __history_removed(struct queue *queue, unsigned int pos) +{ + gui_queue_removed(queue, pos); + gui_sidebar_set_size(gui_queue(queue)); +} + +struct queue_ops history_ops = { + .qop_init = __history_init, + .qop_deinit = gui_queue_free, + .qop_added = __history_added, + .qop_erase = __history_erase, + .qop_removed = __history_removed, + .qop_cleared = gui_queue_cleared, + .qop_updated = gui_queue_updated, +}; diff --git a/gui/history.cpp b/gui/history.cpp deleted file mode 100644 index fb379e69..00000000 --- a/gui/history.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2014 (c) Anna Schumaker. - */ -extern "C" { -#include -#include -} - - -static void *history_init(struct queue *queue) -{ - return gui_queue_alloc(queue, "History", 0); -} - -static void history_added(struct queue *queue, unsigned int pos) -{ - gui_queue_added(queue, pos); - gui_sidebar_set_size(gui_queue(queue)); -} - -static bool history_erase(struct queue *queue, struct track *track) -{ - return false; -} - -static void history_removed(struct queue *queue, unsigned int pos) -{ - gui_queue_removed(queue, pos); - gui_sidebar_set_size(gui_queue(queue)); -} - -struct queue_ops history_ops = { - history_init, - gui_queue_free, - history_added, - history_erase, - history_removed, - gui_queue_cleared, - NULL, - gui_queue_updated, -}; diff --git a/gui/ocarina.cpp b/gui/ocarina.cpp index 1e232ce9..d0a7684b 100644 --- a/gui/ocarina.cpp +++ b/gui/ocarina.cpp @@ -7,6 +7,7 @@ extern "C" { #include #include #include +#include #include #include #include diff --git a/include/gui/history.h b/include/gui/history.h new file mode 100644 index 00000000..d9d0766a --- /dev/null +++ b/include/gui/history.h @@ -0,0 +1,10 @@ +/* + * Copyright 2016 (c) Anna Schumaker. + */ +#ifndef OCARINA_GUI_HISTORY_H +#define OCARINA_GUI_HISTORY_H + +/* History operations passed to core_init() */ +extern struct queue_ops history_ops; + +#endif /* OCARINA_GUI_HISTORY_H */ diff --git a/include/gui/ocarina.h b/include/gui/ocarina.h index 2315c533..23378ad7 100644 --- a/include/gui/ocarina.h +++ b/include/gui/ocarina.h @@ -15,7 +15,6 @@ namespace gui } extern struct queue_ops collection_ops; -extern struct queue_ops history_ops; extern struct queue_ops tempq_ops; void on_pq_created(queue *, unsigned int);