]> Pileus Git - ~andy/gtk/blob - examples/builder.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / examples / builder.c
1 #include <gtk/gtk.h>
2
3 static void
4 print_hello (GtkWidget *widget,
5              gpointer   data)
6 {
7   g_print ("Hello World\n");
8 }
9
10 int
11 main (int   argc,
12       char *argv[])
13 {
14   GtkBuilder *builder;
15   GObject *window;
16   GObject *button;
17
18   gtk_init (&argc, &argv);
19
20   /* Construct a GtkBuilder instance and load our UI description */
21   builder = gtk_builder_new ();
22   gtk_builder_add_from_file (builder, "builder.ui", NULL);
23
24   /* Connect signal handlers to the constructed widgets. */
25   window = gtk_builder_get_object (builder, "window");
26   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
27
28   button = gtk_builder_get_object (builder, "button1");
29   g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
30
31   button = gtk_builder_get_object (builder, "button2");
32   g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
33
34   button = gtk_builder_get_object (builder, "quit");
35   g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
36
37   gtk_main ();
38
39   return 0;
40 }