From d8f6cc3655825e0ccec57f332836d8baa2be3800 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 3 Dec 2015 08:41:51 +0100 Subject: [PATCH] Loaded gui and xml. --- src/Makefile.am | 3 ++- src/main.c | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) 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; } -- 2.49.0