]> saetta.ns0.it Git - zakform/tests/commitdiff
Loaded gui and xml.
authorAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 07:41:51 +0000 (08:41 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 07:41:51 +0000 (08:41 +0100)
src/Makefile.am
src/main.c

index 92055727d3471dbe874a3e5803f2be01a6d1cd43..de5e8c85535bf791cb74449aaea69858e586bcb2 100644 (file)
@@ -1,7 +1,8 @@
 AM_CPPFLAGS = $(WARN_CFLAGS) \
               $(DISABLE_DEPRECATED_CFLAGS) \
               $(ZAKFORMTESTS_CFLAGS) \
-              -DGUIDIR="\"($datadir)\""
+              -DGUIDIR="\"$(datadir)/$(PACKAGE)/gui\"" \
+              -DXMLDIR="\"$(datadir)/$(PACKAGE)/xml\""
 
 LIBS = $(ZAKFORMTESTS_LIBS)
 
index 384d7d2859cf255b83a6de71af1b689cf68f40c8..0e460c89c4863a2cba3315d8422938403315b823 100644 (file)
@@ -20,8 +20,6 @@
        #include <config.h>
 #endif
 
-
-
 #include <libzakform/libzakform.h>
 #include <libzakformgtk/libzakformgtk.h>
 #include <libzakformgdaex/libzakformgdaex.h>
 int
 main (int argc, char *argv[])
 {
+       GtkBuilder *builder;
+       GtkWidget *w;
+
+       ZakFormGtkForm *form;
+
+       gtk_init (&argc, &argv);
+
+       builder = gtk_builder_new ();
+       gtk_builder_add_objects_from_file (builder, GUIDIR "/main.ui",
+                                                                          g_strsplit ("w_main"
+                                                                                                  "|adjustment1", "|", -1), NULL);
+
+       w = GTK_WIDGET (gtk_builder_get_object (builder, "w_main"));
+
+       g_signal_connect (w, "delete-event",
+                                         gtk_main_quit, NULL);
+
+       form = zak_form_gtk_form_new ();
+       zak_form_gtk_form_set_gtkbuilder (form, builder);
+       zak_form_form_load_from_file (ZAK_FORM_FORM (form), XMLDIR "/main.xml");
+       zak_form_form_clear (ZAK_FORM_FORM (form));
+
+       gtk_widget_show_all (w);
+
+       gtk_main ();
 
        return 0;
 }