gui: Collection tab cleanups

This is a statically defined class, so we don't need to separate the
class and function code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-04-12 10:03:54 -04:00
parent d746db6624
commit 2f1d0a3bb8
1 changed files with 33 additions and 42 deletions

View File

@ -8,51 +8,42 @@
class CollectionTab : public Tab {
public:
CollectionTab();
~CollectionTab();
void on_post_init();
bool on_key_press_event(const std::string &);
CollectionTab() : Tab(library::get_queue())
{
tab_random = gui :: get_widget<Gtk::ToggleButton>("o_collection_random");
tab_search = gui :: get_widget<Gtk::SearchEntry>("o_collection_entry");
tab_size = gui :: get_widget<Gtk::Label>("o_collection_size");
tab_treeview = gui :: get_widget<Gtk::TreeView>("o_collection_pq_treeview");
tab_widget = gui :: get_widget<Gtk::Widget>("o_collection_page");
tab_finish_init();
}
~CollectionTab()
{
tab_unmap();
}
void on_post_init()
{
tab_init_random();
}
bool on_key_press_event(const std::string &key)
{
std::vector<unsigned int> ids;
if (key != "Delete")
return Tab :: on_key_press_event(key);
tab_selected_ids(ids);
for (unsigned int i = 0; i < ids.size(); i++)
playlist :: add(tags :: get_track(ids[i]), "Banned");
return true;
}
};
CollectionTab :: CollectionTab()
: Tab(library::get_queue())
{
tab_random = gui :: get_widget<Gtk::ToggleButton>("o_collection_random");
tab_search = gui :: get_widget<Gtk::SearchEntry>("o_collection_entry");
tab_size = gui :: get_widget<Gtk::Label>("o_collection_size");
tab_treeview = gui :: get_widget<Gtk::TreeView>("o_collection_pq_treeview");
tab_widget = gui :: get_widget<Gtk::Widget>("o_collection_page");
tab_finish_init();
}
CollectionTab :: ~CollectionTab()
{
tab_unmap();
}
void CollectionTab :: on_post_init()
{
tab_init_random();
}
bool CollectionTab :: on_key_press_event(const std::string &key)
{
std::vector<unsigned int> ids;
if (key != "Delete")
return Tab :: on_key_press_event(key);
tab_selected_ids(ids);
for (unsigned int i = 0; i < ids.size(); i++)
playlist :: add(tags :: get_track(ids[i]), "Banned");
return true;
}
static CollectionTab *collection_tab;
void init_collection_tab()