gui: Remove C++ collection tab code

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-01-21 10:10:56 -05:00
parent e290552812
commit 27a4cc23ed
7 changed files with 7 additions and 66 deletions

View File

@ -209,6 +209,7 @@ void gui_collection_init()
gtk_tree_view_get_selection(treeview),
gui_sidebar_on_select, NULL, NULL);
gui_sidebar_set_size(gui_queue(collection_get_queue()));
gui_collection_idle_enable();
}

View File

@ -6,39 +6,12 @@ extern "C" {
#include <core/playlist.h>
#include <gui/builder.h>
#include <gui/queue.h>
#include <gui/sidebar.h>
}
#include <gui/tabs.h>
#include <gui/queue/label.h>
class CollectionTab : public Tab {
private:
CollectionLabel *collection_label;
public:
CollectionTab() : Tab(collection_get_queue())
{
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
tab_builder->get_widget_derived("CollectionLabel", collection_label);
collection_label->init(tab_pq);
tab_label = collection_label;
tab_vbox.pack_start(*tab_window, true, true);
Glib::wrap(GTK_NOTEBOOK(gui_builder_widget("o_notebook")),
false)->insert_page(tab_vbox, *collection_label, 0);
}
~CollectionTab()
{
tab_unmap();
}
};
static CollectionTab *collection_tab;
static void *collection_init(struct queue *queue)
{
return gui_queue_alloc(queue, "Collection", GQ_CAN_RANDOM);
@ -46,9 +19,8 @@ static void *collection_init(struct queue *queue)
static void collection_added(struct queue *queue, unsigned int pos)
{
if (collection_tab)
collection_tab->on_track_added(pos);
gui_queue_added(queue, pos);
gui_sidebar_set_size(gui_queue(queue));
}
static bool collection_erase(struct queue *queue, struct track *track)
@ -58,9 +30,8 @@ static bool collection_erase(struct queue *queue, struct track *track)
static void collection_removed(struct queue *queue, unsigned int pos)
{
if (collection_tab)
collection_tab->on_track_removed(pos);
gui_queue_removed(queue, pos);
gui_sidebar_set_size(gui_queue(queue));
}
struct queue_ops collection_ops = {
@ -73,8 +44,3 @@ struct queue_ops collection_ops = {
collection_save,
gui_queue_updated,
};
void init_collection_tab()
{
collection_tab = new CollectionTab;
}

View File

@ -27,23 +27,6 @@ void QueueLabel :: init(queue *queue)
CollectionLabel :: CollectionLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: QueueLabel(cobject, builder)
{
_builder->get_widget("collection_size", collection_size);
}
void CollectionLabel :: set_size()
{
gchar *size = g_strdup_printf("%u", queue_size(_queue));
collection_size->set_text(size);
gui_sidebar_set_size(gui_queue(_queue));
g_free(size);
}
TempLabel :: TempLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: QueueLabel(cobject, builder)

View File

@ -198,6 +198,9 @@ void gui_sidebar_set_size(struct gui_queue *queue)
{
GtkTreeIter iter;
if (!GTK_IS_TREE_MODEL(sb_store))
return;
if (__sidebar_find_queue(queue, &iter))
__sidebar_set_size(&iter, queue->gq_text,
queue_size(queue->gq_queue));

View File

@ -178,7 +178,6 @@ void init_tabs()
Gtk::Window *window = Glib :: wrap(GTK_WINDOW(gui_builder_widget("o_window")), false);
/* Initialize other tabs */
init_collection_tab();
init_queue_tabs();
/* Setup keyboard shortcuts */

View File

@ -23,16 +23,6 @@ public:
class CollectionLabel : public QueueLabel {
public:
Gtk::Label *collection_size;
CollectionLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
void set_size();
};
class TempLabel : public QueueLabel {
public:
Gtk::Label *temp_number;

View File

@ -62,7 +62,6 @@ void post_init_tabs();
void cleanup_tabs();
void init_collection_tab();
void init_queue_tabs();
#endif /* OCARINA_TABS_H */