gui: Create a register_tab_type() function

Rather than returning tab types from init functions.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-02-20 19:49:33 -05:00 committed by Anna Schumaker
parent f68f03c057
commit e3612b6e38
5 changed files with 18 additions and 13 deletions

View File

@ -90,7 +90,7 @@ static struct FilterDesc filter_desc;
* Basic tab setup
*/
struct TabType *init_collection_tab()
void init_collection_tab()
{
model = Glib::RefPtr<PlayqueueModel>(new PlayqueueModel(library_pq()));
@ -102,5 +102,5 @@ struct TabType *init_collection_tab()
get_random_button()->signal_toggled().connect(sigc::ptr_fun(on_random_toggled));
return &collection_funcs;
register_tab_type(&collection_funcs);
}

View File

@ -81,7 +81,7 @@ static struct FilterDesc filter_desc;
* Basic tab setup
*/
struct TabType *init_history_tab()
void init_history_tab()
{
model = Glib::RefPtr<PlayqueueModel>(new PlayqueueModel(history_pq()));
@ -91,5 +91,5 @@ struct TabType *init_history_tab()
get_widget<Gtk::TreeView>("o_history_treeview")->set_model(filter_desc.filter);
return &history_funcs;
register_tab_type(&history_funcs);
}

View File

@ -100,7 +100,7 @@ static struct TabType playlist_funcs = {
* Basic tab setup
*/
struct TabType *init_playlist_tab()
void init_playlist_tab()
{
Gtk::TreeView *playlist = get_playlist_treeview();
@ -111,5 +111,5 @@ struct TabType *init_playlist_tab()
playlist->signal_button_press_event().connect(sigc::ptr_fun(on_playlist_clicked));
playlist->set_cursor(Gtk::TreePath("0"));
return &playlist_funcs;
register_tab_type(&playlist_funcs);
}

View File

@ -829,15 +829,20 @@ void init_tabs()
init_menu_item("o_pq_8", 8);
init_menu_item("o_pq_9", 9);*/
tab_types.push_back(init_collection_tab());
tab_types.push_back(init_history_tab());
tab_types.push_back(init_playlist_tab());
init_collection_tab();
init_history_tab();
init_playlist_tab();
notebook->signal_switch_page().connect(sigc::ptr_fun(on_switch_page));
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
notebook->set_current_page(0);
}
void register_tab_type(struct TabType *tab)
{
tab_types.push_back(tab);
}
void init_tabs2()
{
std::map<Playqueue *, OcarinaPage *>::iterator it;

View File

@ -41,17 +41,17 @@ static inline std::string itoa(unsigned int i)
/* collection.cpp */
struct TabType *init_collection_tab();
void init_collection_tab();
/* history.cpp */
struct TabType *init_history_tab();
void init_history_tab();
/* playlist.cpp */
struct TabType *init_playlist_tab();
void init_playlist_tab();
/* tabs.cpp */
void init_filter(struct FilterDesc *);
void register_tab_type(struct TabType *);