From: Andrea Zagli Date: Thu, 3 Dec 2015 07:41:51 +0000 (+0100) Subject: Loaded gui and xml. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=d8f6cc3655825e0ccec57f332836d8baa2be3800;p=zakform%2Ftests Loaded gui and xml. --- diff --git a/src/Makefile.am b/src/Makefile.am index 9205572..de5e8c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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) diff --git a/src/main.c b/src/main.c index 384d7d2..0e460c8 100644 --- a/src/main.c +++ b/src/main.c @@ -20,8 +20,6 @@ #include #endif - - #include #include #include @@ -29,6 +27,31 @@ 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; }