From 19daef127f90a4e457cb09c0c32b196a6b0c8915 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 28 Nov 2015 13:35:08 +0100 Subject: [PATCH] Tested default-value. --- src/formelement.c | 2 ++ src/formelementcheck.c | 2 +- src/formelementradio.c | 7 ++++--- tests/test.c | 5 ++++- tests/test.ui | 9 +++++++-- tests/test.xml | 15 +++++++++++++-- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/formelement.c b/src/formelement.c index 57281d8..6c2dec1 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -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) { diff --git a/src/formelementcheck.c b/src/formelementcheck.c index b345f89..da2ea53 100644 --- a/src/formelementcheck.c +++ b/src/formelementcheck.c @@ -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 diff --git a/src/formelementradio.c b/src/formelementradio.c index eeea2ad..c0e6796 100644 --- a/src/formelementradio.c +++ b/src/formelementradio.c @@ -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: diff --git a/tests/test.c b/tests/test.c index ca979c7..2f3cffc 100644 --- a/tests/test.c +++ b/tests/test.c @@ -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); diff --git a/tests/test.ui b/tests/test.ui index 505bfe3..4befde9 100644 --- a/tests/test.ui +++ b/tests/test.ui @@ -2,6 +2,11 @@ + + 100 + 1 + 10 + False @@ -86,12 +91,12 @@ True True + 6 1 False False - adjustment2 + adjustment1 1 - 1 1 diff --git a/tests/test.xml b/tests/test.xml index c7a8584..bcce5b1 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -2,26 +2,34 @@ + 999 lbl_id - + -- 2.49.0