From e80a4a91ab8cd4721f5007c9d9eb8cfbe997155e Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Fri, 22 Jun 2012 14:56:18 +0000 Subject: Premier essai d'interface graphique avec Glade 2 git-svn-id: file:///var/svn/2012-violon-leds/trunk@25 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test7/test7.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/test7/test7.c (limited to 'tests/test7/test7.c') diff --git a/tests/test7/test7.c b/tests/test7/test7.c new file mode 100644 index 0000000..7a3ca63 --- /dev/null +++ b/tests/test7/test7.c @@ -0,0 +1,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 +#include + +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; +} + -- cgit v1.2.3