]> saetta.ns0.it Git - zakform/tests/commitdiff
Tested insert and update.
authorAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 16:00:18 +0000 (17:00 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 3 Dec 2015 16:00:18 +0000 (17:00 +0100)
data/zakformtests/db/main.db
data/zakformtests/gui/main.ui
data/zakformtests/xml/main.xml
src/main.c

index 8925b312b7a99c40de694f9a33836b50dffd8d53..8851f6ba040362a97a4143e7d169b0a47201a679 100644 (file)
Binary files a/data/zakformtests/db/main.db and b/data/zakformtests/db/main.db differ
index db8a37abdc2592c52287c100ec60bc3359f3e795..d1a60924cd6121a9270ae8bbf36a8a2e8eaff905 100644 (file)
           <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>
+            <property name="layout_style">center</property>
             <child>
               <object class="GtkButton" id="button1">
-                <property name="label" translatable="yes">Select</property>
+                <property name="label" translatable="yes">Load</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="position">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label" translatable="yes">Insert</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">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button3">
+                <property name="label" translatable="yes">Update</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">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
index bb6f5051d8cce296fd53b7817fd1f56eb0d1ad21..336425fd9ff9e1737075f50a040c4ff7db558eba 100644 (file)
@@ -6,7 +6,6 @@
        <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>
@@ -14,6 +13,7 @@
   <element type="zak_form_gtk_form_element_label">
        <name>id</name>
        <type>integer</type>
+       <to-save>FALSE</to-save>
        <default-value>999</default-value>
        <widget>lbl_id</widget>
        <label>label8</label>
@@ -57,6 +57,7 @@ and                                    some            tabs
   <element type="zak_form_gtk_form_element_entry">
        <name>birthday</name>
        <type>datetime</type>
+       <to-save>FALSE</to-save>
        <widget>txt_birthday</widget>
        <label>label11</label>
   </element>
index a0900b18d10f441f9274e1e1db5b32a6fbfdbff3..7d1aaf051e7ae8401a7fe822564f3f2ba3464075 100644 (file)
@@ -28,12 +28,26 @@ ZakFormGtkForm *form;
 ZakFormGdaexProvider *provider;
 
 void
-select_clicked (GtkButton *button,
-                               gpointer   user_data)
+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));
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -55,7 +69,11 @@ main (int argc, char *argv[])
                                          gtk_main_quit, NULL);
 
        g_signal_connect (gtk_builder_get_object (builder, "button1"), "clicked",
-                                         G_CALLBACK (select_clicked), NULL);
+                                         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);
 
        form = zak_form_gtk_form_new ();
        zak_form_gtk_form_set_gtkbuilder (form, builder);