diff --git a/gui/tabs.cpp b/gui/tabs.cpp index ca209a75..f796c1f6 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -6,8 +6,11 @@ #include #include +#include #include +class OcarinaTab; +static std::map tab_map; /* * Tab class definition @@ -15,25 +18,41 @@ class OcarinaTab { private: Playqueue *queue; - Gtk::Label tab_label; + + /* Tab widgets */ Gtk::VBox tab_box; + Gtk::Label tab_name; + Gtk::Label tab_size; + + Gtk::VBox tab_page; + + void set_tab_size(); public: OcarinaTab(const std::string &, Playqueue *); ~OcarinaTab(); }; -static std::map tab_map; - OcarinaTab::OcarinaTab(const std::string &text, Playqueue *pq) - : queue(pq), tab_label(text) + : queue(pq), + tab_name("" + text + "", 1, 0.5), + tab_size("0", 1, 0.5) { 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); + + /* Make tab label */ + tab_name.set_use_markup(); + tab_box.pack_start(tab_name); + tab_box.pack_start(tab_size); + tab_box.show_all(); + set_tab_size(); + + + + tab_page.set_visible(); + notebook->prepend_page(tab_page, tab_box); tab_map[pq] = this; }; @@ -43,14 +62,21 @@ OcarinaTab::~OcarinaTab() tab_map.erase(queue); } +void OcarinaTab::set_tab_size() +{ + std::stringstream ss; + ss << queue->size(); + tab_size.set_text(ss.str()); +} + /* * Do stuff with tabs */ -void setup_library_tab() +void init_tabs() { - /*OcarinaTab *ot =*/ new OcarinaTab("Library", deck::get_library_pq()); + new OcarinaTab("Library", deck::get_library_pq()); } void cleanup_tabs() diff --git a/gui/wires.cpp b/gui/wires.cpp index e684a205..8f42b6c1 100644 --- a/gui/wires.cpp +++ b/gui/wires.cpp @@ -222,7 +222,7 @@ Gtk::Window *connect_wires() /* Set up other tabs */ - setup_library_tab(); + init_tabs(); return window; } diff --git a/include/ocarina.h b/include/ocarina.h index 50e59bca..9cfd5429 100644 --- a/include/ocarina.h +++ b/include/ocarina.h @@ -7,7 +7,7 @@ #include /* tabs.cpp */ -void setup_library_tab(); +void init_tabs(); void cleanup_tabs(); /* wires.cpp */