]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Make public function ZakFormElement::xml_parsing.
authorAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 15:25:43 +0000 (17:25 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 15:25:43 +0000 (17:25 +0200)
src/form.c
src/formelement.c
src/formelement.h

index 7ea80b07120f93faed366e0c60c15ecf3eb8c397..b5825837d24b10dcc36419b479d8ae2fdd0da234 100644 (file)
@@ -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 ();
index 7d5f204f2ca44e24c09d3b008e8c0ce3a3cbb589..75691c81cd8f1efc67d37202a103afa1e7c7ce13 100644 (file)
@@ -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);
+               }
 }
index c3fd51944e433be1e1d0ac14557872ba15efe506..2eb03e8a5aba107a99a8fd7458850eb228bfaa6e 100644 (file)
@@ -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);