We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7647185 commit 19a1b4aCopy full SHA for 19a1b4a
meson-tutorial-gtk/gtkmain.c
@@ -1,11 +1,22 @@
1
#include <gtk/gtk.h>
2
3
+void button_event(GtkWidget *widget, gpointer *data) {
4
+ g_print("Button clicked\n");
5
+ gtk_button_set_label(GTK_BUTTON(widget), "It worked!");
6
+}
7
+
8
int main(int argc, char **argv) {
9
GtkWidget *win;
10
gtk_init(&argc, &argv);
11
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
12
gtk_window_set_title(GTK_WINDOW(win), "Hello there");
13
g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
14
15
+ GtkWidget *button = gtk_button_new_with_mnemonic("_Click me!");
16
+ gtk_widget_show(button);
17
+ g_signal_connect(button, "pressed", G_CALLBACK(button_event), NULL);
18
+ gtk_container_add(GTK_CONTAINER(win), button);
19
20
gtk_widget_show(win);
21
gtk_main();
22
}
0 commit comments