ocarina: Remove custom icon size from button constructor
All buttons are the same size, so there is no point in requesting the size for each button.
This commit is contained in:
parent
39a8f861c7
commit
a097e751b2
|
@ -5,12 +5,13 @@
|
|||
#include <libsaria/print.h>
|
||||
#include <libsaria/controls.h>
|
||||
|
||||
GtkWidget *make_button(const gchar *stockid, GtkIconSize size,
|
||||
GtkWidget *make_button(const gchar *stockid,
|
||||
void (* func)(GtkWidget *, GdkEvent *, gpointer),
|
||||
bool show)
|
||||
{
|
||||
GtkWidget *button = gtk_button_new();
|
||||
GtkWidget *image = gtk_image_new_from_stock(stockid, size);
|
||||
GtkWidget *image = gtk_image_new_from_stock(stockid,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show(image);
|
||||
GTK_CONNECT(button, "clicked", func, NULL);
|
||||
|
||||
|
@ -27,7 +28,7 @@ static void on_click_open_file(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_load(file);
|
||||
}
|
||||
|
||||
GtkWidget *make_open_button(GtkIconSize size)
|
||||
GtkWidget *make_open_button()
|
||||
{
|
||||
return make_button(GTK_STOCK_OPEN, size, on_click_open_file, true);
|
||||
return make_button(GTK_STOCK_OPEN, on_click_open_file, true);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,9 @@ static void on_click_play(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_play();
|
||||
}
|
||||
|
||||
GtkWidget *make_play_button(GtkIconSize size)
|
||||
GtkWidget *make_play_button()
|
||||
{
|
||||
GtkWidget *b = make_button(GTK_STOCK_MEDIA_PLAY,
|
||||
size,
|
||||
on_click_play,
|
||||
true);
|
||||
play_buttons.push_back(b);
|
||||
|
@ -55,10 +54,9 @@ static void on_click_pause(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_pause();
|
||||
}
|
||||
|
||||
GtkWidget *make_pause_button(GtkIconSize size)
|
||||
GtkWidget *make_pause_button()
|
||||
{
|
||||
GtkWidget *b = make_button(GTK_STOCK_MEDIA_PAUSE,
|
||||
size,
|
||||
on_click_pause,
|
||||
false);
|
||||
pause_buttons.push_back(b);
|
||||
|
@ -70,10 +68,9 @@ static void on_click_stop(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_stop();
|
||||
}
|
||||
|
||||
GtkWidget *make_stop_button(GtkIconSize size)
|
||||
GtkWidget *make_stop_button()
|
||||
{
|
||||
return make_button(GTK_STOCK_MEDIA_STOP,
|
||||
size,
|
||||
on_click_stop,
|
||||
true);
|
||||
}
|
||||
|
@ -83,10 +80,9 @@ static void on_click_rewind(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_seek(-5);
|
||||
}
|
||||
|
||||
GtkWidget *make_rewind_button(GtkIconSize size)
|
||||
GtkWidget *make_rewind_button()
|
||||
{
|
||||
return make_button(GTK_STOCK_MEDIA_REWIND,
|
||||
size,
|
||||
on_click_rewind,
|
||||
true);
|
||||
}
|
||||
|
@ -96,10 +92,9 @@ static void on_click_forward(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
libsaria_seek(5);
|
||||
}
|
||||
|
||||
GtkWidget *make_forward_button(GtkIconSize size)
|
||||
GtkWidget *make_forward_button()
|
||||
{
|
||||
return make_button(GTK_STOCK_MEDIA_FORWARD,
|
||||
size,
|
||||
on_click_forward,
|
||||
true);
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@ void ocarina_init(int argc, char **argv)
|
|||
window_icon("images/ocarina.png");
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
open = make_open_button(GTK_ICON_SIZE_MENU);
|
||||
rewind = make_rewind_button(GTK_ICON_SIZE_MENU);
|
||||
forward = make_forward_button(GTK_ICON_SIZE_MENU);
|
||||
play = make_play_button(GTK_ICON_SIZE_MENU);
|
||||
pause = make_pause_button(GTK_ICON_SIZE_MENU);
|
||||
stop = make_stop_button(GTK_ICON_SIZE_MENU);
|
||||
open = make_open_button();
|
||||
rewind = make_rewind_button();
|
||||
forward = make_forward_button();
|
||||
play = make_play_button();
|
||||
pause = make_pause_button();
|
||||
stop = make_stop_button();
|
||||
volume = make_volume_button();
|
||||
|
||||
box_pack_start(hbox, open, FALSE, FALSE, 0);
|
||||
|
|
|
@ -7,17 +7,16 @@ using namespace std;
|
|||
#include <ocarina/gtk.h>
|
||||
|
||||
GtkWidget *make_button(const gchar *stockid,
|
||||
GtkIconSize size,
|
||||
void (* func)(GtkWidget *, GdkEvent *, gpointer),
|
||||
bool show);
|
||||
|
||||
GtkWidget *make_play_button(GtkIconSize);
|
||||
GtkWidget *make_pause_button(GtkIconSize);
|
||||
GtkWidget *make_stop_button(GtkIconSize);
|
||||
GtkWidget *make_rewind_button(GtkIconSize);
|
||||
GtkWidget *make_forward_button(GtkIconSize);
|
||||
GtkWidget *make_play_button();
|
||||
GtkWidget *make_pause_button();
|
||||
GtkWidget *make_stop_button();
|
||||
GtkWidget *make_rewind_button();
|
||||
GtkWidget *make_forward_button();
|
||||
|
||||
GtkWidget *make_open_button(GtkIconSize);
|
||||
GtkWidget *make_open_button();
|
||||
GtkWidget *make_volume_button();
|
||||
|
||||
enum button_list_t {
|
||||
|
|
Loading…
Reference in New Issue