]> saetta.ns0.it Git - zakform/gtk/commitdiff
Tested default-value.
authorAndrea Zagli <azagli@libero.it>
Sat, 28 Nov 2015 12:35:08 +0000 (13:35 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 28 Nov 2015 12:35:08 +0000 (13:35 +0100)
src/formelement.c
src/formelementcheck.c
src/formelementradio.c
tests/test.c
tests/test.ui
tests/test.xml

index 57281d8c04e220972672af6e10bfb520d6326f7e..6c2dec144e163f9ab82db2bcdb37f1b43afde692 100644 (file)
@@ -406,6 +406,8 @@ zak_form_gtk_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode
 
        ZakFormGtkFormElementPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE ((ZakFormGtkFormElement *)element);
 
+       ZAK_FORM_ELEMENT_GET_CLASS (element)->xml_parsing (element, xmlnode);
+
        cur = xmlnode->children;
        while (cur != NULL)
                {
index b345f89f1c211767f43ec4520007b1b0903ad11a..da2ea534e97f8a646e799c16fd58e86e704fbdcd 100644 (file)
@@ -195,7 +195,7 @@ zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element,
 
        w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element));
 
-       str_value = g_strstrip (g_strdup (zak_form_gtk_form_element_check_get_value (element)));
+       str_value = g_strstrip (g_strdup (value));
 
        if (strcmp (str_value, "0") == 0
            || strcasecmp (str_value, "f") == 0
index eeea2ad8cecf39025a548e50b976101df9ca5ad5..c0e679665a5102be59ecb5e4f71c2319ed9fcd16 100644 (file)
@@ -77,7 +77,7 @@ zak_form_gtk_form_element_radio_class_init (ZakFormGtkFormElementRadioClass *kla
                                                              "Return value",
                                                              "Return value",
                                                              "",
-                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+                                                             G_PARAM_READWRITE));
 }
 
 static void
@@ -85,6 +85,7 @@ zak_form_gtk_form_element_radio_init (ZakFormGtkFormElementRadio *zak_form_gtk_f
 {
        ZakFormGtkFormElementRadioPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_RADIO_GET_PRIVATE (zak_form_gtk_form_element_radio);
 
+       priv->return_value = g_strdup ("");
 }
 
 /**
@@ -179,7 +180,7 @@ zak_form_gtk_form_element_radio_set_property (GObject *object,
        switch (property_id)
                {
                case PROP_RETURN_VALUE:
-                       zak_form_gtk_form_element_radio_set_value (zak_form_gtk_form_element_radio, g_value_get_string (value));
+                       zak_form_gtk_form_element_radio_set_return_value (zak_form_gtk_form_element_radio, g_value_get_string (value));
                        break;
 
                default:
@@ -200,7 +201,7 @@ zak_form_gtk_form_element_radio_get_property (GObject *object,
        switch (property_id)
                {
                case PROP_RETURN_VALUE:
-                       g_value_set_string (value, zak_form_gtk_form_element_radio_get_value (zak_form_gtk_form_element_radio));
+                       g_value_set_string (value, zak_form_gtk_form_element_radio_get_return_value (zak_form_gtk_form_element_radio));
                        break;
 
                default:
index ca979c79064c5991344e4a666691b7606dc10c2c..2f3cffc6878f5f7b0a8bfa3d56004e9920484a71 100644 (file)
@@ -31,7 +31,9 @@ main (int argc, char *argv[])
        gtk_init (&argc, &argv);
 
        builder = gtk_builder_new ();
-       gtk_builder_add_objects_from_file (builder, GUIDIR "/test.ui", g_strsplit ("w_main", "|", -1), NULL);
+       gtk_builder_add_objects_from_file (builder, GUIDIR "/test.ui",
+                                                                          g_strsplit ("w_main"
+                                                                                                  "|adjustment1", "|", -1), NULL);
 
        w = GTK_WIDGET (gtk_builder_get_object (builder, "w_main"));
 
@@ -41,6 +43,7 @@ main (int argc, char *argv[])
        form = zak_form_gtk_form_new ();
        zak_form_gtk_form_set_gtkbuilder (form, builder);
        zak_form_form_load_from_file (ZAK_FORM_FORM (form), GUIDIR "/test.xml");
+       zak_form_form_clear (ZAK_FORM_FORM (form));
 
        gtk_widget_show_all (w);
 
index 505bfe3efcce4a5060c02388322a29c8970cc7c0..4befde9bfc5c85dc8baf16939280ca3894d9c291 100644 (file)
@@ -2,6 +2,11 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkWindow" id="w_main">
     <property name="can_focus">False</property>
     <child>
               <object class="GtkSpinButton" id="spn_age">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="max_length">6</property>
                 <property name="text" translatable="yes">1</property>
                 <property name="primary_icon_activatable">False</property>
                 <property name="secondary_icon_activatable">False</property>
-                <property name="adjustment">adjustment2</property>
+                <property name="adjustment">adjustment1</property>
                 <property name="climb_rate">1</property>
-                <property name="value">1</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
index c7a8584e1ea6ce6e2ddf3df90b1cc91026bb622a..bcce5b16ec7a50df5699b1df9afd224d044179e2 100644 (file)
@@ -2,26 +2,34 @@
 <zakform>
 
   <element type="zak_form_gtk_form_element_label">
+       <default-value>999</default-value>
        <widget>lbl_id</widget>
        <label>label8</label>
   </element>
 
-  <!--<element type="zak_form_gtk_form_element_entry">
+  <element type="zak_form_gtk_form_element_entry">
+       <default-value>John Doe</default-value>
        <widget>txt_name</widget>
        <label>label1</label>
   </element>
 
   <element type="zak_form_gtk_form_element_spin">
+       <default-value>33</default-value>
        <widget>spn_age</widget>
        <label>label4</label>
   </element>
 
   <element type="zak_form_gtk_form_element_check">
+       <default-value>TRUE</default-value>
        <widget>chk_married</widget>
        <label>label9</label>
   </element>
 
   <element type="zak_form_gtk_form_element_textview">
+       <default-value>dafault value for textview
+with line break
+and                                     some            tabs
+       and ' ' ' ' ' ' ' ' ?? ? ? ? ?? * * * * </default-value>
        <widget>txtv_description</widget>
        <label>label10</label>
   </element>
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <default-value>M</default-value>
        <widget>rbtnNone</widget>
        <label>label3</label>
        <return-value></return-value>
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <default-value>M</default-value>
        <widget>rbtnMale</widget>
        <label>label3</label>
        <return-value>M</return-value>
   </element>
 
   <element type="zak_form_gtk_form_element_radio">
+       <default-value>M</default-value>
        <widget>rbtnFemale</widget>
        <label>label3</label>
        <return-value>F</return-value>
@@ -52,6 +63,6 @@
   <element type="zak_form_gtk_form_element_entry">
        <widget>txt_income</widget>
        <label>label5</label>
-  </element>-->
+  </element>
 
 </zakform>