From: Andrea Zagli Date: Mon, 12 Jun 2017 15:25:43 +0000 (+0200) Subject: Make public function ZakFormElement::xml_parsing. X-Git-Tag: v0.1.0~1^2~6^2~6 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=3d4e3d1f18090489396212205fdfa04780fcf159;p=zakform%2Flibzakform Make public function ZakFormElement::xml_parsing. --- diff --git a/src/form.c b/src/form.c index 7ea80b0..b582583 100644 --- a/src/form.c +++ b/src/form.c @@ -34,7 +34,6 @@ #endif typedef ZakFormElement *(* FormElementConstructorFunc) (void); -typedef gboolean (* FormElementXmlParsingFunc) (ZakFormElement *, xmlNodePtr); typedef GObject *(* FormElementExtensionConstructorFunc) (void); typedef gboolean (* FormElementExtensionXmlParsingFunc) (GObject *, xmlNodePtr); typedef ZakFormValidator *(* FormValidatorConstructorFunc) (void); @@ -149,7 +148,7 @@ zak_form_form_init (ZakFormForm *zak_form_form) zak_form_form_load_modules (zak_form_form); } -static void +void zak_form_form_element_xml_parsing (ZakFormForm *zakform, ZakFormElement *element, xmlNode *xnode) { ZakFormFormPrivate *priv; @@ -359,8 +358,6 @@ zak_form_form_load_from_xml (ZakFormForm *zakform, xmlDoc *xmldoc) gint y; FormElementConstructorFunc element_constructor; - FormElementXmlParsingFunc element_xml_parsing; - FormValidatorConstructorFunc validator_constructor; xmlXPathContextPtr xpcontext; @@ -406,16 +403,7 @@ zak_form_form_load_from_xml (ZakFormForm *zakform, xmlDoc *xmldoc) cur_clean = xmlCopyNode (cur, 1); zak_form_form_element_xml_parsing (zakform, element, cur_clean); - - if (g_module_symbol ((GModule *)g_ptr_array_index (priv->ar_modules, i), - g_strconcat (type, "_xml_parsing", NULL), - (gpointer *)&element_xml_parsing)) - { - if (element_xml_parsing != NULL) - { - element_xml_parsing (element, cur_clean); - } - } + zak_form_element_xml_parsing (element, cur_clean); xmlUnlinkNode (cur_clean); xmlFreeNode (cur_clean); @@ -445,7 +433,7 @@ zak_form_form_load_from_xml (ZakFormForm *zakform, xmlDoc *xmldoc) { type = (gchar *)xmlGetProp (xnodeset->nodeTab[y], (const xmlChar *)"type"); - validator_constructor = _zak_form_form_get_module_new (zakform, type); + validator_constructor = (FormValidatorConstructorFunc)_zak_form_form_get_module_new (zakform, type); if (validator_constructor != NULL) { validator = validator_constructor (); diff --git a/src/formelement.c b/src/formelement.c index 7d5f204..75691c8 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -63,8 +63,6 @@ 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); - typedef struct { gchar *name; @@ -98,8 +96,6 @@ 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; - g_object_class_install_property (object_class, PROP_NAME, g_param_spec_string ("name", "Name", @@ -1571,7 +1567,7 @@ zak_form_element_finalize (GObject *gobject) parent_class->finalize (gobject); } -static void +void zak_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode) { xmlNode *cur; @@ -1664,4 +1660,9 @@ zak_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode) xmlFreeNode (xnode_tmp); } } + + if (ZAK_FORM_ELEMENT_GET_CLASS (element)->xml_parsing != NULL) + { + ZAK_FORM_ELEMENT_GET_CLASS (element)->xml_parsing (element, xmlnode); + } } diff --git a/src/formelement.h b/src/formelement.h index c3fd519..2eb03e8 100644 --- a/src/formelement.h +++ b/src/formelement.h @@ -53,6 +53,8 @@ struct _ZakFormElementClass guint after_validating_signal_id; }; +void zak_form_element_xml_parsing (ZakFormElement *element, xmlNode *xmlnode); + void zak_form_element_set_name (ZakFormElement *element, const gchar *name); gchar *zak_form_element_get_name (ZakFormElement *element);