]> saetta.ns0.it Git - zakform/tests/commitdiff
Renamed main to gtk_gdaex.
authorAndrea Zagli <azagli@libero.it>
Sun, 13 Dec 2015 09:11:06 +0000 (10:11 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 13 Dec 2015 09:11:06 +0000 (10:11 +0100)
.gitignore
configure.ac
src/Makefile.am
src/gtk_gdaex.c [new file with mode: 0644]
src/main.c [deleted file]

index 93c67f2dfb8c2acdf8a976c046dc9f6d0554c66b..e503f7cba4fbadc9fa66d47a4e27866895174054 100644 (file)
@@ -50,4 +50,4 @@ intltool-*
 Rules-quot
 *.exe
 *.csv
-main
+gtk_gdaex
index 88f65b1f99b706ab5524d9b4cd9b20ceeabaa5d6..82331439175b433f6165db85d8ff4fab9adeddb6 100644 (file)
@@ -3,7 +3,7 @@
 
 AC_PREREQ(2.65)
 AC_INIT([zakformtests], [0.0.1], [azagli@libero.it])
-AC_CONFIG_SRCDIR([src/main.c])
+AC_CONFIG_SRCDIR([src/gtk_gdaex.c])
 AC_CONFIG_HEADER([config.h])
 
 AM_INIT_AUTOMAKE(-Wall)
index 1ca58cc317f99a68e7ac0c2b7c3916219a150825..0e17ba8a6146950946aa8a502a9458d1329a6726 100644 (file)
@@ -8,4 +8,4 @@ AM_CPPFLAGS = $(WARN_CFLAGS) \
 LIBS = $(ZAKFORMTESTS_LIBS)
 
 noinst_PROGRAMS = \
-                  main
+                  gtk_gdaex
diff --git a/src/gtk_gdaex.c b/src/gtk_gdaex.c
new file mode 100644 (file)
index 0000000..3a3fde1
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+       #include <config.h>
+#endif
+
+#include <libzakform/libzakform.h>
+#include <libzakformgtk/libzakformgtk.h>
+#include <libzakformgdaex/libzakformgdaex.h>
+
+GtkWidget *w;
+
+ZakFormGtkForm *form;
+ZakFormGdaexProvider *provider;
+
+void
+load_clicked (GtkButton *button,
+                         gpointer   user_data)
+{
+       zak_form_form_load (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+}
+
+void
+insert_clicked (GtkButton *button,
+                               gpointer   user_data)
+{
+       zak_form_form_insert (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+}
+
+void
+update_clicked (GtkButton *button,
+                               gpointer   user_data)
+{
+       zak_form_form_update (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+}
+
+void
+is_valid_clicked (GtkButton *button,
+                                 gpointer   user_data)
+{
+       zak_form_gtk_form_is_valid (form, w);
+}
+
+void
+is_changed_clicked (GtkButton *button,
+                                       gpointer   user_data)
+{
+       if (zak_form_form_is_changed (ZAK_FORM_FORM (form)))
+               {
+                       GtkWidget *dialog;
+
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (w),
+                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                                                        GTK_MESSAGE_WARNING,
+                                                                                        GTK_BUTTONS_OK,
+                                                                                        "Form is changed.");
+                       gtk_dialog_run (GTK_DIALOG (dialog));
+                       gtk_widget_destroy (dialog);
+               }
+}
+
+int
+main (int argc, char *argv[])
+{
+       GtkBuilder *builder;
+
+       GdaEx *gdaex;
+
+       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);
+
+       g_signal_connect (gtk_builder_get_object (builder, "button1"), "clicked",
+                                         G_CALLBACK (load_clicked), NULL);
+       g_signal_connect (gtk_builder_get_object (builder, "button2"), "clicked",
+                                         G_CALLBACK (insert_clicked), NULL);
+       g_signal_connect (gtk_builder_get_object (builder, "button3"), "clicked",
+                                         G_CALLBACK (update_clicked), NULL);
+       g_signal_connect (gtk_builder_get_object (builder, "button4"), "clicked",
+                                         G_CALLBACK (is_valid_clicked), NULL);
+       g_signal_connect (gtk_builder_get_object (builder, "button5"), "clicked",
+                                         G_CALLBACK (is_changed_clicked), 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));
+       zak_form_form_set_as_original (ZAK_FORM_FORM (form));
+
+       gdaex = gdaex_new_from_string ("SQLite://DB_DIR=" DBDIR ";DB_NAME=main.db;");
+       provider = zak_form_gdaex_provider_new (gdaex, "clients");
+
+       gtk_widget_show_all (w);
+
+       gtk_main ();
+
+       return 0;
+}
diff --git a/src/main.c b/src/main.c
deleted file mode 100644 (file)
index 3a3fde1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-       #include <config.h>
-#endif
-
-#include <libzakform/libzakform.h>
-#include <libzakformgtk/libzakformgtk.h>
-#include <libzakformgdaex/libzakformgdaex.h>
-
-GtkWidget *w;
-
-ZakFormGtkForm *form;
-ZakFormGdaexProvider *provider;
-
-void
-load_clicked (GtkButton *button,
-                         gpointer   user_data)
-{
-       zak_form_form_load (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
-}
-
-void
-insert_clicked (GtkButton *button,
-                               gpointer   user_data)
-{
-       zak_form_form_insert (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
-}
-
-void
-update_clicked (GtkButton *button,
-                               gpointer   user_data)
-{
-       zak_form_form_update (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
-}
-
-void
-is_valid_clicked (GtkButton *button,
-                                 gpointer   user_data)
-{
-       zak_form_gtk_form_is_valid (form, w);
-}
-
-void
-is_changed_clicked (GtkButton *button,
-                                       gpointer   user_data)
-{
-       if (zak_form_form_is_changed (ZAK_FORM_FORM (form)))
-               {
-                       GtkWidget *dialog;
-
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Form is changed.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
-               }
-}
-
-int
-main (int argc, char *argv[])
-{
-       GtkBuilder *builder;
-
-       GdaEx *gdaex;
-
-       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);
-
-       g_signal_connect (gtk_builder_get_object (builder, "button1"), "clicked",
-                                         G_CALLBACK (load_clicked), NULL);
-       g_signal_connect (gtk_builder_get_object (builder, "button2"), "clicked",
-                                         G_CALLBACK (insert_clicked), NULL);
-       g_signal_connect (gtk_builder_get_object (builder, "button3"), "clicked",
-                                         G_CALLBACK (update_clicked), NULL);
-       g_signal_connect (gtk_builder_get_object (builder, "button4"), "clicked",
-                                         G_CALLBACK (is_valid_clicked), NULL);
-       g_signal_connect (gtk_builder_get_object (builder, "button5"), "clicked",
-                                         G_CALLBACK (is_changed_clicked), 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));
-       zak_form_form_set_as_original (ZAK_FORM_FORM (form));
-
-       gdaex = gdaex_new_from_string ("SQLite://DB_DIR=" DBDIR ";DB_NAME=main.db;");
-       provider = zak_form_gdaex_provider_new (gdaex, "clients");
-
-       gtk_widget_show_all (w);
-
-       gtk_main ();
-
-       return 0;
-}