]> saetta.ns0.it Git - zakform/tests/commitdiff
Tested load.
authorAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 15:09:58 +0000 (16:09 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 15:09:58 +0000 (16:09 +0100)
configure.ac
data/zakformtests/Makefile.am
data/zakformtests/db/Makefile.am [new file with mode: 0644]
data/zakformtests/db/main.db [new file with mode: 0644]
data/zakformtests/gui/main.ui
data/zakformtests/xml/main.xml
src/Makefile.am
src/main.c

index 794b7c38acf8b2622b75feade5b5e360eee9d962..88f65b1f99b706ab5524d9b4cd9b20ceeabaa5d6 100644 (file)
@@ -70,6 +70,7 @@ AC_CONFIG_FILES([
        src/Makefile
        data/Makefile
        data/zakformtests/Makefile
+       data/zakformtests/db/Makefile
        data/zakformtests/gui/Makefile
        data/zakformtests/xml/Makefile
 ])
index 24edb2fdaf8cae648c992d130e11e9c75cd7666c..c87de490e1de0912c9262bc4d6676da6e103271e 100644 (file)
@@ -1 +1 @@
-SUBDIRS = gui xml
+SUBDIRS = db gui xml
diff --git a/data/zakformtests/db/Makefile.am b/data/zakformtests/db/Makefile.am
new file mode 100644 (file)
index 0000000..5995dc6
--- /dev/null
@@ -0,0 +1 @@
+noinst_DATA = main.db
diff --git a/data/zakformtests/db/main.db b/data/zakformtests/db/main.db
new file mode 100644 (file)
index 0000000..8925b31
Binary files /dev/null and b/data/zakformtests/db/main.db differ
index 4befde9bfc5c85dc8baf16939280ca3894d9c291..db8a37abdc2592c52287c100ec60bc3359f3e795 100644 (file)
@@ -35,7 +35,7 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
             <child>
@@ -47,7 +47,7 @@
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
             <child>
@@ -59,7 +59,7 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
+                <property name="top_attach">2</property>
               </packing>
             </child>
             <child>
@@ -72,7 +72,7 @@
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
+                <property name="top_attach">2</property>
               </packing>
             </child>
             <child>
@@ -84,7 +84,7 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
+                <property name="top_attach">3</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
+                <property name="top_attach">3</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
+                <property name="top_attach">4</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
+                <property name="top_attach">4</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">4</property>
+                <property name="top_attach">5</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">4</property>
+                <property name="top_attach">5</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">5</property>
+                <property name="top_attach">6</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">5</property>
+                <property name="top_attach">6</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">6</property>
+                <property name="top_attach">7</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">6</property>
+                <property name="top_attach">7</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">7</property>
+                <property name="top_attach">8</property>
               </packing>
             </child>
             <child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">7</property>
+                <property name="top_attach">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">ID to load</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
           </object>
           </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkButtonBox" id="buttonbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">5</property>
+            <property name="layout_style">start</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label" translatable="yes">Select</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTextView" id="textview1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
         </child>
       </object>
     </child>
index bcce5b16ec7a50df5699b1df9afd224d044179e2..bb6f5051d8cce296fd53b7817fd1f56eb0d1ad21 100644 (file)
@@ -1,31 +1,51 @@
 <?xml version="1.0"?>
 <zakform>
 
+  <element type="zak_form_gtk_form_element_entry">
+       <name>id</name>
+       <type>integer</type>
+       <is-key>TRUE</is-key>
+       <to-load>FALSE</to-load>
+       <to-save>FALSE</to-save>
+       <widget>entry1</widget>
+       <label>label2</label>
+  </element>
+
   <element type="zak_form_gtk_form_element_label">
+       <name>id</name>
+       <type>integer</type>
        <default-value>999</default-value>
        <widget>lbl_id</widget>
        <label>label8</label>
   </element>
 
   <element type="zak_form_gtk_form_element_entry">
+       <name>name</name>
+       <type>string</type>
        <default-value>John Doe</default-value>
        <widget>txt_name</widget>
        <label>label1</label>
   </element>
 
   <element type="zak_form_gtk_form_element_spin">
+       <name>age</name>
+       <type>integer</type>
        <default-value>33</default-value>
        <widget>spn_age</widget>
        <label>label4</label>
   </element>
 
   <element type="zak_form_gtk_form_element_check">
+       <name>married</name>
+       <type>boolean</type>
        <default-value>TRUE</default-value>
        <widget>chk_married</widget>
        <label>label9</label>
   </element>
 
   <element type="zak_form_gtk_form_element_textview">
+       <name>description</name>
+       <type>string</type>
        <default-value>dafault value for textview
 with line break
 and                                     some            tabs
@@ -35,11 +55,15 @@ and                                  some            tabs
   </element>
 
   <element type="zak_form_gtk_form_element_entry">
+       <name>birthday</name>
+       <type>datetime</type>
        <widget>txt_birthday</widget>
        <label>label11</label>
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <name>sex</name>
+       <type>string</type>
        <default-value>M</default-value>
        <widget>rbtnNone</widget>
        <label>label3</label>
@@ -47,6 +71,8 @@ and                                    some            tabs
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <name>sex</name>
+       <type>string</type>
        <default-value>M</default-value>
        <widget>rbtnMale</widget>
        <label>label3</label>
@@ -54,6 +80,8 @@ and                                    some            tabs
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <name>sex</name>
+       <type>string</type>
        <default-value>M</default-value>
        <widget>rbtnFemale</widget>
        <label>label3</label>
@@ -61,6 +89,8 @@ and                                    some            tabs
   </element>
 
   <element type="zak_form_gtk_form_element_entry">
+       <name>income</name>
+       <type>float</type>
        <widget>txt_income</widget>
        <label>label5</label>
   </element>
index de5e8c85535bf791cb74449aaea69858e586bcb2..1ca58cc317f99a68e7ac0c2b7c3916219a150825 100644 (file)
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = $(WARN_CFLAGS) \
               $(DISABLE_DEPRECATED_CFLAGS) \
               $(ZAKFORMTESTS_CFLAGS) \
+              -DDBDIR="\"$(datadir)/$(PACKAGE)/db\"" \
               -DGUIDIR="\"$(datadir)/$(PACKAGE)/gui\"" \
               -DXMLDIR="\"$(datadir)/$(PACKAGE)/xml\""
 
index 0e460c89c4863a2cba3315d8422938403315b823..a0900b18d10f441f9274e1e1db5b32a6fbfdbff3 100644 (file)
 #include <libzakformgtk/libzakformgtk.h>
 #include <libzakformgdaex/libzakformgdaex.h>
 
+ZakFormGtkForm *form;
+ZakFormGdaexProvider *provider;
+
+void
+select_clicked (GtkButton *button,
+                               gpointer   user_data)
+{
+       zak_form_form_load (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+}
+
 int
 main (int argc, char *argv[])
 {
        GtkBuilder *builder;
        GtkWidget *w;
 
-       ZakFormGtkForm *form;
+       GdaEx *gdaex;
 
        gtk_init (&argc, &argv);
 
@@ -44,11 +54,17 @@ main (int argc, char *argv[])
        g_signal_connect (w, "delete-event",
                                          gtk_main_quit, NULL);
 
+       g_signal_connect (gtk_builder_get_object (builder, "button1"), "clicked",
+                                         G_CALLBACK (select_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));
 
+       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 ();