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:
parent
4b7762c589
commit
0f5303503c
|
@ -11,3 +11,8 @@ GtkWidget *make_button(const gchar *stockid, GtkIconSize size)
|
||||||
gtk_widget_show_all(button);
|
gtk_widget_show_all(button);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkWidget *make_play_button(GtkIconSize size)
|
||||||
|
{
|
||||||
|
return make_button(GTK_STOCK_MEDIA_PLAY, size);
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include <ocarina/button.h>
|
#include <ocarina/button.h>
|
||||||
#include <ocarina/window.h>
|
#include <ocarina/window.h>
|
||||||
#include <libsaria/libsaria.h>
|
#include <libsaria/libsaria.h>
|
||||||
|
@ -9,10 +6,9 @@ using namespace std;
|
||||||
void ocarina_init(int argc, char **argv)
|
void ocarina_init(int argc, char **argv)
|
||||||
{
|
{
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
const gchar *play = GTK_STOCK_MEDIA_PLAY;
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
window_init();
|
window_init();
|
||||||
button = make_button(play, GTK_ICON_SIZE_MENU);
|
button = make_play_button(GTK_ICON_SIZE_MENU);
|
||||||
window_add(button);
|
window_add(button);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,6 @@ using namespace std;
|
||||||
#include <ocarina/gtk.h>
|
#include <ocarina/gtk.h>
|
||||||
|
|
||||||
GtkWidget *make_button(const gchar *, GtkIconSize);
|
GtkWidget *make_button(const gchar *, GtkIconSize);
|
||||||
|
GtkWidget *make_play_button(GtkIconSize);
|
||||||
|
|
||||||
#endif /* OCARINA_BUTTON_H */
|
#endif /* OCARINA_BUTTON_H */
|
||||||
|
|
Loading…
Reference in New Issue