From 72a51fb78fa165c0e69d391759205144d099c685 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 4 Jun 2014 09:34:49 -0400 Subject: [PATCH] gui: Properly create queue tabs Changes to the deck removed the on_pq_created() callback that we looked for to create new tabs. This patch creates tabs correctly. Signed-off-by: Anna Schumaker --- gui/queue.cpp | 13 +++++++++++-- gui/tabs.cpp | 2 ++ include/ocarina.h | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gui/queue.cpp b/gui/queue.cpp index f0d8cf38..b1ffe75b 100644 --- a/gui/queue.cpp +++ b/gui/queue.cpp @@ -319,11 +319,11 @@ static void renumber_queues() it->second->on_tab_reordered(); } -/*static void on_pq_created(Queue *pq, unsigned int num) +void on_pq_created(Queue *pq, unsigned int num) { QueueTab *tab = new QueueTab(pq, num); tab->on_post_init(); -}*/ +} static void on_pq_removed(Queue *pq) { @@ -359,3 +359,12 @@ void init_queue_tabs() Gtk::Notebook *notebook = get_widget("o_notebook"); notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered)); } + +void post_init_queue_tabs() +{ + std::list::iterator it; + unsigned int i = 0; + + for (it = deck :: get_queues().begin(); it != deck :: get_queues().end(); it++) + on_pq_created(&(*it), i++); +} diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 9ebafd5a..587acb5b 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -170,6 +170,7 @@ bool Tab :: tab_queue_selected(bool random) return true; Queue *pq = deck :: create(random); + on_pq_created(pq, deck :: get_queues().size() - 1); tab_queue_add(pq); return true; } @@ -526,6 +527,7 @@ void post_init_tabs() // break; //} get_widget("o_notebook")->set_current_page(tab); + post_init_queue_tabs(); } void cleanup_tabs() diff --git a/include/ocarina.h b/include/ocarina.h index deae5f52..aafd3e15 100644 --- a/include/ocarina.h +++ b/include/ocarina.h @@ -76,7 +76,8 @@ static Glib::RefPtr get_object(const std::string &name) return Glib::RefPtr::cast_static(get_builder()->get_object(name)); } - +void on_pq_created(Queue *, unsigned int); +void post_init_queue_tabs(); #ifdef CONFIG_TEST void do_collection_delete();