-
Notifications
You must be signed in to change notification settings - Fork 1
/
gtk_test.c
31 lines (23 loc) · 971 Bytes
/
gtk_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <gtk/gtk.h>
static void print_hello(GtkWidget *widget, gpointer data) { g_print("Hello World\n"); }
static void activate(GtkApplication *app, gpointer user_data) {
GtkWidget *window;
GtkWidget *label = gtk_label_new (NULL);
window = gtk_application_window_new(app);
gtk_window_set_title(GTK_WINDOW(window), "Users");
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
gtk_label_set_markup (GTK_LABEL (label), "Hello World");
gtk_label_set_xalign(GTK_LABEL (label), 0.5f);
gtk_label_set_yalign(GTK_LABEL (label), 0.5f);
gtk_window_set_child(GTK_WINDOW(window), label);
gtk_window_present(GTK_WINDOW(window));
}
int main(int argc, char **argv) {
GtkApplication *app;
int status;
app = gtk_application_new("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);
return status;
}