ocarina: Use new play and pause functions
Eventually the global functions are going away, so I convert to using the functions as part of the Libsaria instance.
This commit is contained in:
parent
ec2c848a90
commit
c716f62aaa
|
@ -3,10 +3,10 @@
|
|||
#include <libsaria/audio.h>
|
||||
#include <libsaria/libsaria.h>
|
||||
|
||||
#define reg_on_click(func) \
|
||||
#define ls_on_click(func) \
|
||||
static void on_click_##func(GtkWidget *button, GdkEvent *event, gpointer data)\
|
||||
{ \
|
||||
func(); \
|
||||
libsaria_get()->func(); \
|
||||
}
|
||||
|
||||
#define on_click(func) \
|
||||
|
@ -23,18 +23,18 @@ GtkWidget *make_button(const gchar *stockid, GtkIconSize size)
|
|||
return button;
|
||||
}
|
||||
|
||||
reg_on_click(gst_play);
|
||||
ls_on_click(play);
|
||||
GtkWidget *make_play_button(GtkIconSize size)
|
||||
{
|
||||
GtkWidget *button = make_button(GTK_STOCK_MEDIA_PLAY, size);
|
||||
GTK_CONNECT(button, "clicked", on_click(gst_play), NULL);
|
||||
GTK_CONNECT(button, "clicked", on_click(play), NULL);
|
||||
return button;
|
||||
}
|
||||
|
||||
reg_on_click(gst_pause);
|
||||
ls_on_click(pause);
|
||||
GtkWidget *make_pause_button(GtkIconSize size)
|
||||
{
|
||||
GtkWidget *button = make_button(GTK_STOCK_MEDIA_PAUSE, size);
|
||||
GTK_CONNECT(button, "clicked", on_click(gst_pause), NULL);
|
||||
GTK_CONNECT(button, "clicked", on_click(pause), NULL);
|
||||
return button;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ void ocarina_init(int argc, char **argv)
|
|||
GtkWidget *pause;
|
||||
GtkWidget *hbox;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
window_init();
|
||||
window_title("Ocarina " + vers_str());
|
||||
window_icon("images/ocarina.png");
|
||||
|
@ -36,6 +35,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
print("Ocarina 5.0");
|
||||
libsaria_init(argc, argv);
|
||||
gtk_init(&argc, &argv);
|
||||
ocarina_init(argc, argv);
|
||||
libsaria_quit();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue