-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
20 lines (18 loc) · 874 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <gtk/gtk.h>
static void on_activate (GtkApplication *app) {
// Create a new window
GtkWidget *window = gtk_application_window_new (app);
// Create a new button
GtkWidget *button = gtk_button_new_with_label ("Hello, World!");
// When the button is clicked, close the window passed as an argument
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_close), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main(int argc, char **argv) {
// Create a new application
GtkApplication *app = gtk_application_new ("com.example.GtkApplication",
G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
return g_application_run (G_APPLICATION (app), argc, argv);
}