aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index f226049..93a1fd9 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -30,15 +30,22 @@
#include <stdlib.h>
#include "types.h"
+#include "audio.h"
static gint mainwindow_closed(GtkWidget *widget, MainWindow *mw) {
gtk_exit(0);
return 0;
}
+static gint mainwindow_clicked(GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ audio_trigger_moo();
+ return 0;
+}
+
MainWindow *mainwindow_open(void) {
MainWindow *mw;
+ GtkWidget *eb;
mw = malloc(sizeof(*mw));
if ( mw == NULL ) return NULL;
@@ -47,9 +54,13 @@ MainWindow *mainwindow_open(void) {
gtk_window_set_default_size(GTK_WINDOW(mw->window), 240, 320);
gtk_window_set_title(GTK_WINDOW(mw->window), "OpenMooCow");
+ eb = gtk_event_box_new();
mw->cow = gtk_image_new_from_file(PIXMAPDIR"/cow.png");
- gtk_container_add(GTK_CONTAINER(mw->window), mw->cow);
+ gtk_container_add(GTK_CONTAINER(eb), mw->cow);
+ gtk_container_add(GTK_CONTAINER(mw->window), eb);
+ gtk_widget_add_events(GTK_WIDGET(eb), GDK_BUTTON_PRESS_MASK);
+ g_signal_connect(G_OBJECT(eb), "button_press_event", G_CALLBACK(mainwindow_clicked), mw);
g_signal_connect(G_OBJECT(mw->window), "destroy", G_CALLBACK(mainwindow_closed), mw);
gtk_widget_show_all(mw->window);