blob: 7a3ca63fd8db447d7b4129265fb204a160bac304 (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
First run tutorial.glade through gtk-builder-convert with this command:
gtk-builder-convert tutorial.glade tutorial.xml
Then save this file as main.c and compile it using this command
(those are backticks, not single quotes):
gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
Then execute it using:
./tutorial
*/
#include <gtk/gtk.h>
#include <stdio.h>
void on_win_main_destroy (GtkObject *object, gpointer user_data) {
gtk_main_quit();
}
void on_action1_activate(GtkObject *object, gpointer user_data) {
printf("action1\n");
}
int main (int argc, char *argv[]) {
GtkBuilder *builder;
GtkWidget *window;
// int res;
gtk_init (&argc, &argv);
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "win_main.glade", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "win_main"));
printf("window==%p\n", window);
gtk_builder_connect_signals (builder, NULL);
g_object_unref (G_OBJECT (builder));
gtk_widget_show (window);
gtk_main ();
return 0;
}
|