gui/history: Convert file to C

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-01-20 16:27:14 -05:00
parent 5a9c6a1dd1
commit e290552812
5 changed files with 49 additions and 42 deletions

38
gui/history.c Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright 2014 (c) Anna Schumaker.
*/
#include <gui/queue.h>
#include <gui/sidebar.h>
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,
};

View File

@ -1,41 +0,0 @@
/*
* Copyright 2014 (c) Anna Schumaker.
*/
extern "C" {
#include <gui/queue.h>
#include <gui/sidebar.h>
}
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,
};

View File

@ -7,6 +7,7 @@ extern "C" {
#include <gui/audio.h>
#include <gui/builder.h>
#include <gui/collection.h>
#include <gui/history.h>
#include <gui/playlist.h>
#include <gui/settings.h>
#include <gui/sidebar.h>

10
include/gui/history.h Normal file
View File

@ -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 */

View File

@ -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);