diff --git a/gui/collection.cpp b/gui/collection.cpp index 5e302e60..9679c41e 100644 --- a/gui/collection.cpp +++ b/gui/collection.cpp @@ -12,7 +12,6 @@ class CollectionTab : public Tab { private: Glib::RefPtr builder; - Gtk::VBox collection_vbox; CollectionLabel *collection_label; QueueToolbar *collection_toolbar; @@ -33,22 +32,17 @@ public: collection_toolbar->init(tab_pq, collection_label, collection_window, T_RANDOM); collection_window->init(tab_pq); - collection_vbox.set_margin_left(1); - collection_vbox.set_margin_right(1); - collection_vbox.set_homogeneous(false); - collection_vbox.pack_start(*collection_toolbar, false, true, 2); - collection_vbox.pack_start(*collection_window, true, true); - collection_vbox.show(); + tab_vbox.pack_start(*collection_toolbar, false, true, 2); + tab_vbox.pack_start(*collection_window, true, true); tab_model = collection_window->q_model; tab_filter = collection_window->q_filter; tab_search = collection_toolbar->q_search; tab_size = collection_label->collection_size; tab_treeview = collection_window->q_treeview; - tab_widget = &collection_vbox; tab_finish_init(); - gui :: get_widget("o_notebook")->insert_page(collection_vbox, *collection_label, 0); + gui :: get_widget("o_notebook")->insert_page(tab_vbox, *collection_label, 0); } ~CollectionTab() diff --git a/gui/history.cpp b/gui/history.cpp index 7a6734e9..5676ad55 100644 --- a/gui/history.cpp +++ b/gui/history.cpp @@ -11,7 +11,6 @@ class HistoryTab : public Tab { private: Glib::RefPtr builder; - Gtk::VBox history_vbox; HistoryLabel *history_label; QueueToolbar *history_toolbar; @@ -32,22 +31,17 @@ public: history_toolbar->init(tab_pq, history_label, history_window, 0); history_window->init(tab_pq); - history_vbox.set_margin_left(1); - history_vbox.set_margin_right(1); - history_vbox.set_homogeneous(false); - history_vbox.pack_start(*history_toolbar, false, true, 2); - history_vbox.pack_start(*history_window, true, true); - history_vbox.show(); + tab_vbox.pack_start(*history_toolbar, false, true, 2); + tab_vbox.pack_start(*history_window, true, true); tab_model = history_window->q_model; tab_filter = history_window->q_filter; tab_search = history_toolbar->q_search; tab_size = history_label->history_size; tab_treeview = history_window->q_treeview; - tab_widget = &history_vbox; tab_finish_init(); - gui :: get_widget("o_notebook")->insert_page(history_vbox, *history_label, 0); + gui :: get_widget("o_notebook")->insert_page(tab_vbox, *history_label, 0); } ~HistoryTab() diff --git a/gui/playlist.cpp b/gui/playlist.cpp index 86751488..1b6c535c 100644 --- a/gui/playlist.cpp +++ b/gui/playlist.cpp @@ -72,7 +72,6 @@ public: static class PlaylistTab : public Tab { private: Glib::RefPtr builder; - Gtk::VBox playlist_vbox; Gtk::HBox playlist_hbox; PlaylistLabel *playlist_label; @@ -101,21 +100,16 @@ public: playlist_hbox.pack_start(*playlist_tracks, true, true); playlist_hbox.show(); - playlist_vbox.set_margin_left(1); - playlist_vbox.set_margin_right(1); - playlist_vbox.set_homogeneous(false); - playlist_vbox.pack_start(*playlist_toolbar, false, true, 2); - playlist_vbox.pack_start(playlist_hbox, true, true); - playlist_vbox.show(); + tab_vbox.pack_start(*playlist_toolbar, false, true, 2); + tab_vbox.pack_start(playlist_hbox, true, true); tab_model = playlist_tracks->q_model; tab_filter = playlist_tracks->q_filter; tab_search = playlist_toolbar->q_search; tab_treeview = playlist_tracks->q_treeview; - tab_widget = &playlist_vbox; tab_finish_init(); - gui :: get_widget("o_notebook")->insert_page(playlist_vbox, *playlist_label, 0); + gui :: get_widget("o_notebook")->insert_page(tab_vbox, *playlist_label, 0); } ~PlaylistTab() diff --git a/gui/queue.cpp b/gui/queue.cpp index fab9e17c..55cc1e51 100644 --- a/gui/queue.cpp +++ b/gui/queue.cpp @@ -42,11 +42,6 @@ private: */ TempLabel *q_label; - /** - * Queue page widgets - */ - Gtk::VBox q_vbox; - /** * Toolbar widgets */ @@ -118,12 +113,8 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num) * Fill in the page! */ - q_vbox.set_margin_left(1); - q_vbox.set_margin_right(1); - q_vbox.set_homogeneous(false); - q_vbox.pack_start(*q_toolbar, false, true, 2); - q_vbox.pack_start(*q_window, true, true); - q_vbox.show(); + tab_vbox.pack_start(*q_toolbar, false, true, 2); + tab_vbox.pack_start(*q_window, true, true); /* @@ -135,20 +126,19 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num) tab_search = q_toolbar->q_search; tab_size = q_label->temp_size; tab_treeview = q_window->q_treeview; - tab_widget = &q_vbox; tab_finish_init(); - queue_mapping[tab_widget] = this; + queue_mapping[&tab_vbox] = this; - gui :: get_widget("o_notebook")->insert_page(q_vbox, *q_label, num); - gui :: get_widget("o_notebook")->set_tab_reorderable(q_vbox); + gui :: get_widget("o_notebook")->insert_page(tab_vbox, *q_label, num); + gui :: get_widget("o_notebook")->set_tab_reorderable(tab_vbox); } QueueTab :: ~QueueTab() { - queue_mapping.erase(tab_widget); + queue_mapping.erase(&tab_vbox); tab_unmap(); - gui :: get_widget("o_notebook")->remove_page(q_vbox); + gui :: get_widget("o_notebook")->remove_page(tab_vbox); renumber_queues(); } diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 1b8198bd..115153d0 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -31,6 +31,11 @@ Tab :: Tab(Queue *pq) { pq->set_notifier(this); queue_mapping[tab_pq] = this; + + tab_vbox.set_margin_start(1); + tab_vbox.set_margin_end(1); + tab_vbox.set_homogeneous(false); + tab_vbox.show(); } Tab :: ~Tab() {} @@ -89,13 +94,13 @@ void Tab :: on_track_updated(unsigned int row) int Tab :: tab_page_num() { Gtk::Notebook *notebook = gui :: get_widget("o_notebook"); - return notebook->page_num(*tab_widget); + return notebook->page_num(tab_vbox); } bool Tab :: tab_is_cur() { Gtk::Notebook *notebook = gui :: get_widget("o_notebook"); - return notebook->page_num(*tab_widget) == notebook->get_current_page(); + return notebook->page_num(tab_vbox) == notebook->get_current_page(); } void Tab :: tab_runtime_changed() diff --git a/include/gui/tabs.h b/include/gui/tabs.h index 7426ea7b..40c4c09f 100644 --- a/include/gui/tabs.h +++ b/include/gui/tabs.h @@ -15,6 +15,7 @@ private: protected: Queue *tab_pq; + Gtk::VBox tab_vbox; /** * Widgets that MUST be set by a child class @@ -24,7 +25,6 @@ protected: Gtk::SearchEntry *tab_search; Gtk::TreeView *tab_treeview; - Gtk::Widget *tab_widget; /** * Optional widgets that MAY be set