]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Use of ZakFormForm::get_module_new in FormValidator construct from xml.
authorAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 14:27:38 +0000 (16:27 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 14:27:38 +0000 (16:27 +0200)
src/form.c

index 637f007fa116f7bdcff87479a9e00e1cca2a6e60..7ea80b07120f93faed366e0c60c15ecf3eb8c397 100644 (file)
@@ -268,7 +268,7 @@ zak_form_form_element_xml_parsing (ZakFormForm *zakform, ZakFormElement *element
 }
 
 /**
- * _zak_form_get_module_new:
+ * _zak_form_form_get_module_new:
  * @zakform:
  * @namespace:
  *
@@ -445,25 +445,15 @@ zak_form_form_load_from_xml (ZakFormForm *zakform, xmlDoc *xmldoc)
                                                                {
                                                                        type = (gchar *)xmlGetProp (xnodeset->nodeTab[y], (const xmlChar *)"type");
 
-                                                                       /* for each module */
-                                                                       for (i = 0; i < priv->ar_modules->len; i++)
+                                                                       validator_constructor = _zak_form_form_get_module_new (zakform, type);
+                                                                       if (validator_constructor != NULL)
                                                                                {
-                                                                                       if (g_module_symbol ((GModule *)g_ptr_array_index (priv->ar_modules, i),
-                                                                                                            g_strconcat (type, "_new", NULL),
-                                                                                                            (gpointer *)&validator_constructor))
-                                                                                               {
-                                                                                                       if (validator_constructor != NULL)
-                                                                                                               {
-                                                                                                                       validator = validator_constructor ();
-                                                                                                                       zak_form_form_add_validator (zakform, validator);
-
-                                                                                                                       zak_form_validator_xml_parsing (validator, xnodeset->nodeTab[y], zakform);
+                                                                                       validator = validator_constructor ();
+                                                                                       zak_form_form_add_validator (zakform, validator);
 
-                                                                                                                       break;
-                                                                                                               }
-                                                                                               }
+                                                                                       zak_form_validator_xml_parsing (validator, xnodeset->nodeTab[y], zakform);
                                                                                }
-                                                                       if (i >= priv->ar_modules->len)
+                                                                       else
                                                                                {
                                                                                        g_warning ("Validator «%s» not found.", type);
                                                                                }