ocarina: Remove show_play_buttons() and hide_play_buttons()
I replaced these functions with a generic show_button_list() and hide_button_list() functions.
This commit is contained in:
parent
8234e4072b
commit
bd907ecfe0
|
@ -7,35 +7,33 @@ using namespace std;
|
|||
|
||||
static list<GtkWidget *> play_buttons;
|
||||
|
||||
static void show_list(list<GtkWidget *> &buttons)
|
||||
static list<GtkWidget *> *get_buttons(button_list_t bttn_list)
|
||||
{
|
||||
return &play_buttons;
|
||||
}
|
||||
|
||||
void show_button_list(button_list_t bttn_list)
|
||||
{
|
||||
list<GtkWidget *>::iterator it;
|
||||
for(it = buttons.begin(); it != buttons.end(); it++)
|
||||
list<GtkWidget *> *buttons = get_buttons(bttn_list);
|
||||
for (it = buttons->begin(); it != buttons->end(); it++)
|
||||
gtk_widget_show(*it);
|
||||
}
|
||||
|
||||
static void hide_list(list<GtkWidget *> &buttons)
|
||||
void hide_button_list(button_list_t bttn_list)
|
||||
{
|
||||
list<GtkWidget *>::iterator it;
|
||||
for(it = buttons.begin(); it != buttons.end(); it++)
|
||||
list<GtkWidget *> *buttons = get_buttons(bttn_list);
|
||||
for (it = buttons->begin(); it != buttons->end(); it++)
|
||||
gtk_widget_hide(*it);
|
||||
}
|
||||
|
||||
|
||||
static void on_click_play(GtkWidget *b, GdkEvent *e, gpointer d)
|
||||
{
|
||||
libsaria_get()->play();
|
||||
}
|
||||
|
||||
void show_play_buttons()
|
||||
{
|
||||
show_list(play_buttons);
|
||||
}
|
||||
|
||||
void hide_play_buttons()
|
||||
{
|
||||
hide_list(play_buttons);
|
||||
}
|
||||
|
||||
GtkWidget *make_play_button(GtkIconSize size)
|
||||
{
|
||||
GtkWidget *b = make_button(GTK_STOCK_MEDIA_PLAY,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
void cb_play()
|
||||
{
|
||||
print("Ocarina PLAY callback!");
|
||||
hide_play_buttons();
|
||||
hide_button_list(PLAY_BUTTON_LIST);
|
||||
show_pause_buttons();
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ void cb_pause()
|
|||
{
|
||||
print("Ocarina PAUSE callback!");
|
||||
hide_pause_buttons();
|
||||
show_play_buttons();
|
||||
show_button_list(PLAY_BUTTON_LIST);
|
||||
}
|
||||
|
||||
static void add_callback(callback_t type, void (* func)())
|
||||
|
|
|
@ -16,8 +16,14 @@ GtkWidget *make_pause_button(GtkIconSize);
|
|||
GtkWidget *make_stop_button(GtkIconSize);
|
||||
GtkWidget *make_open_button(GtkIconSize);
|
||||
|
||||
void show_play_buttons();
|
||||
void hide_play_buttons();
|
||||
enum button_list_t {
|
||||
PLAY_BUTTON_LIST,
|
||||
PAUSE_BUTTON_LIST,
|
||||
};
|
||||
|
||||
void show_button_list(button_list_t);
|
||||
void hide_button_list(button_list_t);
|
||||
|
||||
void show_pause_buttons();
|
||||
void hide_pause_buttons();
|
||||
|
||||
|
|
Loading…
Reference in New Issue