Added private function ZakForm::get_module_new.
authorAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 13:16:50 +0000 (15:16 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 12 Jun 2017 13:16:50 +0000 (15:16 +0200)
src/form.c

index 226ca90a0bc86e7c206595ed88638f529351a152..bdf210409e2074c96c88f4501c2bfb04f16ec37e 100644 (file)
@@ -279,37 +279,52 @@ zak_form_form_element_xml_parsing (ZakFormForm *zakform, ZakFormElement *element
 }
 
 /**
- * zak_form_get_form_validator:
+ * _zak_form_get_module_new:
  * @zakform:
  * @namespace:
  *
- * Returns:
+ * Returns: the constructor (_new) function for the module.
  */
-ZakFormElementValidatorConstructorFunc
-zak_form_get_form_element_validator (ZakFormForm *zakform, const gchar *namespace)
+static gpointer
+_zak_form_get_module_new (ZakFormForm *zakform, const gchar *namespace)
 {
-       ZakFormFormPrivate *priv;
+       gpointer ret;
 
-       ZakFormElementValidatorConstructorFunc validator_constructor;
+       ZakFormFormPrivate *priv;
 
        guint i;
 
-       g_return_val_if_fail (ZAK_FORM_IS_FORM (zakform), NULL);
-
        priv = zak_form_form_get_instance_private (zakform);
 
-       validator_constructor = NULL;
-
        for (i = 0; i < priv->ar_modules->len; i++)
                {
                        if (g_module_symbol ((GModule *)g_ptr_array_index (priv->ar_modules, i),
                                             g_strconcat (namespace, "_new", NULL),
-                                            (gpointer *)&validator_constructor))
+                                            (gpointer *)&ret))
                                {
                                        break;
                                }
                }
 
+       return ret;
+}
+
+/**
+ * zak_form_get_form_element_validator:
+ * @zakform:
+ * @namespace:
+ *
+ * Returns:
+ */
+ZakFormElementValidatorConstructorFunc
+zak_form_get_form_element_validator (ZakFormForm *zakform, const gchar *namespace)
+{
+       ZakFormElementValidatorConstructorFunc validator_constructor;
+
+       g_return_val_if_fail (ZAK_FORM_IS_FORM (zakform), NULL);
+
+       validator_constructor = (ZakFormElementValidatorConstructorFunc)_zak_form_get_module_new (zakform, namespace);
+
        return validator_constructor;
 }