33 lines
801 B
C++
33 lines
801 B
C++
|
|
#include <ocarina/button.h>
|
|
#include <ocarina/chooser.h>
|
|
|
|
#include <libsaria/libsaria.h>
|
|
|
|
GtkWidget *make_button(const gchar *stockid, GtkIconSize size,
|
|
void (* func)(GtkWidget *, GdkEvent *, gpointer),
|
|
bool show)
|
|
{
|
|
GtkWidget *button = gtk_button_new();
|
|
GtkWidget *image = gtk_image_new_from_stock(stockid, size);
|
|
gtk_widget_show(image);
|
|
GTK_CONNECT(button, "clicked", func, NULL);
|
|
|
|
container_add(button, image);
|
|
if (show == true)
|
|
gtk_widget_show_all(button);
|
|
return button;
|
|
}
|
|
|
|
static void on_click_open_file(GtkWidget *b, GdkEvent *e, gpointer d)
|
|
{
|
|
string file = ocarina_choose_file();
|
|
print("Playing file: " + file);
|
|
libsaria_get()->load(file);
|
|
}
|
|
|
|
GtkWidget *make_open_button(GtkIconSize size)
|
|
{
|
|
return make_button(GTK_STOCK_OPEN, size, on_click_open_file, true);
|
|
}
|