2014-02-17 15:47:19 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
2015-12-12 09:04:25 -05:00
|
|
|
extern "C" {
|
|
|
|
#include <core/history.h>
|
2015-12-24 09:35:36 -05:00
|
|
|
#include <gui/builder.h>
|
2016-01-13 09:37:05 -05:00
|
|
|
#include <gui/queue.h>
|
2015-12-12 09:04:25 -05:00
|
|
|
}
|
2014-06-04 13:59:15 -04:00
|
|
|
#include <gui/tabs.h>
|
2015-04-12 10:17:40 -04:00
|
|
|
#include <gui/queue/label.h>
|
2014-02-17 15:47:19 -05:00
|
|
|
|
2014-02-17 17:40:18 -05:00
|
|
|
|
2014-02-21 22:06:42 -05:00
|
|
|
class HistoryTab : public Tab {
|
2015-04-12 10:17:40 -04:00
|
|
|
private:
|
|
|
|
HistoryLabel *history_label;
|
|
|
|
|
2014-02-21 22:06:42 -05:00
|
|
|
public:
|
2015-12-12 09:04:25 -05:00
|
|
|
HistoryTab() : Tab(history_get_queue())
|
2015-04-12 10:08:10 -04:00
|
|
|
{
|
2015-04-19 09:24:25 -04:00
|
|
|
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
|
|
|
tab_builder->get_widget_derived("HistoryLabel", history_label);
|
2015-04-12 10:08:10 -04:00
|
|
|
|
2015-04-19 12:13:32 -04:00
|
|
|
history_label->init(tab_pq);
|
|
|
|
tab_label = history_label;
|
2015-04-12 10:17:40 -04:00
|
|
|
|
2015-04-19 12:13:32 -04:00
|
|
|
tab_vbox.pack_start(*tab_window, true, true);
|
2015-04-12 10:17:40 -04:00
|
|
|
|
2015-12-24 09:35:36 -05:00
|
|
|
Glib :: wrap(GTK_NOTEBOOK(gui_builder_widget("o_notebook")),
|
|
|
|
false)->insert_page(tab_vbox, *history_label, 0);
|
2015-04-12 10:08:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
~HistoryTab()
|
|
|
|
{
|
|
|
|
tab_unmap();
|
|
|
|
}
|
2014-02-21 22:06:42 -05:00
|
|
|
};
|
2014-02-17 15:47:19 -05:00
|
|
|
|
|
|
|
|
2014-02-21 22:06:42 -05:00
|
|
|
static HistoryTab *history_tab;
|
2014-02-17 15:47:19 -05:00
|
|
|
|
2016-01-12 08:02:28 -05:00
|
|
|
static void *history_init(struct queue *queue)
|
|
|
|
{
|
2016-01-14 08:00:04 -05:00
|
|
|
return gui_queue_alloc(queue, "History", 0);
|
2016-01-13 08:18:03 -05:00
|
|
|
}
|
|
|
|
|
2015-11-29 19:45:39 -05:00
|
|
|
static void history_added(struct queue *queue, unsigned int pos)
|
|
|
|
{
|
|
|
|
if (history_tab)
|
|
|
|
history_tab->on_track_added(pos);
|
2016-01-18 09:11:30 -05:00
|
|
|
gui_queue_added(queue, pos);
|
2015-11-29 19:45:39 -05:00
|
|
|
}
|
|
|
|
|
2015-11-29 20:01:12 -05:00
|
|
|
static void history_removed(struct queue *queue, unsigned int pos)
|
|
|
|
{
|
|
|
|
history_tab->on_track_removed(pos);
|
2016-01-18 09:11:30 -05:00
|
|
|
gui_queue_removed(queue, pos);
|
2015-11-29 20:01:12 -05:00
|
|
|
}
|
|
|
|
|
2016-01-29 10:12:09 -05:00
|
|
|
static void history_cleared(struct queue *queue, unsigned int n)
|
|
|
|
{
|
|
|
|
history_tab->on_tracks_cleared(n);
|
2016-01-18 09:11:30 -05:00
|
|
|
gui_queue_cleared(queue, n);
|
2016-01-29 10:12:09 -05:00
|
|
|
}
|
|
|
|
|
2015-11-29 20:10:15 -05:00
|
|
|
static void history_updated(struct queue *queue, unsigned int pos)
|
|
|
|
{
|
|
|
|
history_tab->on_track_updated(pos);
|
2016-01-18 09:11:30 -05:00
|
|
|
gui_queue_updated(queue, pos);
|
2015-11-29 20:10:15 -05:00
|
|
|
}
|
|
|
|
|
2015-11-29 19:45:39 -05:00
|
|
|
struct queue_ops history_ops = {
|
2016-01-12 08:02:28 -05:00
|
|
|
history_init,
|
2016-01-13 09:37:05 -05:00
|
|
|
gui_queue_free,
|
2015-11-29 19:45:39 -05:00
|
|
|
history_added,
|
2015-11-29 20:01:12 -05:00
|
|
|
history_removed,
|
2016-01-29 10:12:09 -05:00
|
|
|
history_cleared,
|
2015-11-29 19:45:39 -05:00
|
|
|
NULL,
|
2015-11-29 20:10:15 -05:00
|
|
|
history_updated,
|
2015-11-29 19:45:39 -05:00
|
|
|
};
|
|
|
|
|
2014-02-20 19:49:33 -05:00
|
|
|
void init_history_tab()
|
2014-02-17 15:47:19 -05:00
|
|
|
{
|
2014-02-21 22:06:42 -05:00
|
|
|
history_tab = new HistoryTab;
|
2014-02-17 15:47:19 -05:00
|
|
|
}
|