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 <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-06-04 09:34:49 -04:00
parent c803699215
commit 72a51fb78f
3 changed files with 15 additions and 3 deletions

View File

@ -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<Gtk::Notebook>("o_notebook");
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
}
void post_init_queue_tabs()
{
std::list<TempQueue>::iterator it;
unsigned int i = 0;
for (it = deck :: get_queues().begin(); it != deck :: get_queues().end(); it++)
on_pq_created(&(*it), i++);
}

View File

@ -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<Gtk::Notebook>("o_notebook")->set_current_page(tab);
post_init_queue_tabs();
}
void cleanup_tabs()

View File

@ -76,7 +76,8 @@ static Glib::RefPtr<T> get_object(const std::string &name)
return Glib::RefPtr<T>::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();