Improve play button creation

I made a function to create a play button.  I suspect that
pre-configured buttons will be easier to use than having to build them
up every time.
This commit is contained in:
Bryan Schumaker 2011-08-20 11:08:42 -04:00
parent 4b7762c589
commit 0f5303503c
3 changed files with 7 additions and 5 deletions

View File

@ -11,3 +11,8 @@ GtkWidget *make_button(const gchar *stockid, GtkIconSize size)
gtk_widget_show_all(button);
return button;
}
GtkWidget *make_play_button(GtkIconSize size)
{
return make_button(GTK_STOCK_MEDIA_PLAY, size);
}

View File

@ -1,7 +1,4 @@
#include <iostream>
using namespace std;
#include <ocarina/button.h>
#include <ocarina/window.h>
#include <libsaria/libsaria.h>
@ -9,10 +6,9 @@ using namespace std;
void ocarina_init(int argc, char **argv)
{
GtkWidget *button;
const gchar *play = GTK_STOCK_MEDIA_PLAY;
gtk_init(&argc, &argv);
window_init();
button = make_button(play, GTK_ICON_SIZE_MENU);
button = make_play_button(GTK_ICON_SIZE_MENU);
window_add(button);
gtk_main();
}

View File

@ -7,5 +7,6 @@ using namespace std;
#include <ocarina/gtk.h>
GtkWidget *make_button(const gchar *, GtkIconSize);
GtkWidget *make_play_button(GtkIconSize);
#endif /* OCARINA_BUTTON_H */