3 static void print_hello(GtkWidget
*widget
__attribute__((unused
)),
4 gpointer data
__attribute__((unused
))) {
5 g_print("Hello World\n");
8 static void activate(GtkApplication
*app
,
9 gpointer user_data
__attribute__((unused
))) {
12 GtkWidget
*button_box
;
14 window
= gtk_application_window_new(app
);
15 gtk_window_set_title(GTK_WINDOW(window
), "Window");
16 gtk_window_set_default_size(GTK_WINDOW(window
), 200, 200);
18 button_box
= gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL
);
19 gtk_container_add(GTK_CONTAINER(window
), button_box
);
21 button
= gtk_button_new_with_label("Hello World");
22 g_signal_connect(button
, "clicked", G_CALLBACK(print_hello
), NULL
);
23 g_signal_connect_swapped(button
, "clicked", G_CALLBACK(gtk_widget_destroy
),
25 gtk_container_add(GTK_CONTAINER(button_box
), button
);
27 gtk_widget_show_all(window
);
30 int main(int argc
, char **argv
) {
34 app
= gtk_application_new("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS
);
35 g_signal_connect(app
, "activate", G_CALLBACK(activate
), NULL
);
36 status
= g_application_run(G_APPLICATION(app
), argc
, argv
);