gui: Add initial extra notebook tab
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
f80203c5fe
commit
2724b90281
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 (c) Anna Schumaker.
|
||||||
|
*/
|
||||||
|
#include <deck.h>
|
||||||
|
#include <ocarina.h>
|
||||||
|
#include <playqueue.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tab class definition
|
||||||
|
*/
|
||||||
|
class OcarinaTab {
|
||||||
|
private:
|
||||||
|
Playqueue *queue;
|
||||||
|
Gtk::Label tab_label;
|
||||||
|
Gtk::VBox tab_box;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OcarinaTab(const std::string &, Playqueue *);
|
||||||
|
~OcarinaTab();
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::map<Playqueue *, OcarinaTab *> tab_map;
|
||||||
|
|
||||||
|
|
||||||
|
OcarinaTab::OcarinaTab(const std::string &text, Playqueue *pq)
|
||||||
|
: queue(pq), tab_label(text)
|
||||||
|
{
|
||||||
|
Gtk::Notebook *notebook;
|
||||||
|
tab_label.set_visible();
|
||||||
|
tab_box.set_visible();
|
||||||
|
get_builder()->get_widget("o_notebook", notebook);
|
||||||
|
notebook->prepend_page(tab_box, tab_label);
|
||||||
|
|
||||||
|
tab_map[pq] = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
OcarinaTab::~OcarinaTab()
|
||||||
|
{
|
||||||
|
tab_map.erase(queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do stuff with tabs
|
||||||
|
*/
|
||||||
|
void setup_library_tab()
|
||||||
|
{
|
||||||
|
/*OcarinaTab *ot =*/ new OcarinaTab("Library", deck::get_library_pq());
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanup_tabs()
|
||||||
|
{
|
||||||
|
std::map<Playqueue *, OcarinaTab *>::iterator it;
|
||||||
|
for (it = tab_map.begin(); it != tab_map.end(); it++)
|
||||||
|
delete it->second;
|
||||||
|
}
|
|
@ -203,6 +203,7 @@ Gtk::Window *connect_wires()
|
||||||
builder->add_from_file("gui/ocarina6.glade");
|
builder->add_from_file("gui/ocarina6.glade");
|
||||||
builder->get_widget("o_window", window);
|
builder->get_widget("o_window", window);
|
||||||
|
|
||||||
|
|
||||||
/* Collection manager */
|
/* Collection manager */
|
||||||
cb->on_library_add = on_library_add;
|
cb->on_library_add = on_library_add;
|
||||||
cb->on_library_update = on_library_update;
|
cb->on_library_update = on_library_update;
|
||||||
|
@ -219,5 +220,9 @@ Gtk::Window *connect_wires()
|
||||||
connect_button("o_collection_update", on_collection_update);
|
connect_button("o_collection_update", on_collection_update);
|
||||||
connect_button("o_collection_import", on_collection_import);
|
connect_button("o_collection_import", on_collection_import);
|
||||||
|
|
||||||
|
|
||||||
|
/* Set up other tabs */
|
||||||
|
setup_library_tab();
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
|
|
||||||
|
/* tabs.cpp */
|
||||||
|
void setup_library_tab();
|
||||||
|
void cleanup_tabs();
|
||||||
|
|
||||||
/* wires.cpp */
|
/* wires.cpp */
|
||||||
Gtk::Window *connect_wires();
|
Gtk::Window *connect_wires();
|
||||||
Gtk::Button *get_button(const std::string &);
|
Gtk::Button *get_button(const std::string &);
|
||||||
|
|
|
@ -121,5 +121,6 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
schedule_test(test_0);
|
schedule_test(test_0);
|
||||||
Gtk::Main::run(*window);
|
Gtk::Main::run(*window);
|
||||||
|
cleanup_tabs();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue