From: Andrea Zagli Date: Mon, 12 Jun 2017 14:27:38 +0000 (+0200) Subject: Use of ZakFormForm::get_module_new in FormValidator construct from xml. X-Git-Tag: v0.1.0~1^2~6^2~7 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=336d725c0a02fd030076d196a49e16f9be834bce;p=zakform%2Flibzakform Use of ZakFormForm::get_module_new in FormValidator construct from xml. --- diff --git a/src/form.c b/src/form.c index 637f007..7ea80b0 100644 --- a/src/form.c +++ b/src/form.c @@ -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); }