From: Andrea Zagli Date: Sat, 28 Nov 2015 12:34:40 +0000 (+0100) Subject: Aded member function ZakFormElement::xml_parsing. X-Git-Tag: debian/0.0.1-1~32 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=c72e94e4e55fa3ad07ca9ea1fcedf61a984cd1b6;p=zakform%2Flibzakform Aded member function ZakFormElement::xml_parsing. --- diff --git a/src/formelement.c b/src/formelement.c index 855c5df..da9775a 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -51,6 +51,8 @@ static void zak_form_element_get_property (GObject *object, static void zak_form_element_dispose (GObject *gobject); static void zak_form_element_finalize (GObject *gobject); +static void zak_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode); + static GPtrArray *zak_form_element_get_messages (ZakFormElement *element); typedef struct @@ -77,6 +79,7 @@ zak_form_element_class_init (ZakFormElementClass *class) object_class->dispose = zak_form_element_dispose; object_class->finalize = zak_form_element_finalize; + class->xml_parsing = zak_form_element_xml_parsing; class->get_messages = zak_form_element_get_messages; g_object_class_install_property (object_class, PROP_VALUE, @@ -624,6 +627,23 @@ zak_form_element_finalize (GObject *gobject) parent_class->finalize (gobject); } +static void +zak_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode) +{ + xmlNode *cur; + + cur = xmlnode->children; + while (cur) + { + if (xmlStrcmp (cur->name, (const xmlChar *)"default-value") == 0) + { + zak_form_element_set_default_value (element, (const gchar *)xmlNodeGetContent (cur)); + } + + cur = cur->next; + } +} + static GPtrArray *zak_form_element_get_messages (ZakFormElement *element) { diff --git a/src/formelement.h b/src/formelement.h index 4f3dc31..6640edb 100644 --- a/src/formelement.h +++ b/src/formelement.h @@ -22,6 +22,8 @@ #include +#include + #include "formelementfilter.h" #include "formelementvalidator.h" @@ -36,6 +38,8 @@ struct _ZakFormElementClass { GObjectClass parent_class; + void (*xml_parsing) (ZakFormElement *element, xmlNode *xmlnode); + gboolean (*set_value) (ZakFormElement *element, const gchar *value); gchar *(*get_value) (ZakFormElement *element);