]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added function ZakFormForm::is_valid.
authorAndrea Zagli <azagli@libero.it>
Sat, 31 Oct 2015 10:08:46 +0000 (11:08 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 31 Oct 2015 10:08:46 +0000 (11:08 +0100)
src/form.c
src/form.h

index 4faf75f9fdc321a5ed51816a1591babe0609e189..e4c495265599fb3f5a40eba198e671a52201f253 100644 (file)
@@ -60,7 +60,7 @@ zak_form_form_init (ZakFormForm *zak_form_form)
 {
        ZakFormFormPrivate *priv = zak_form_form_get_instance_private (zak_form_form);
 
-       priv->ar_elems = NULL;
+       priv->ar_elements = NULL;
 }
 
 /**
@@ -85,6 +85,38 @@ zak_form_form_add_element (ZakFormForm *zakform, ZakFormElement *element)
        return ret;
 }
 
+/**
+ * zak_form_form_is_valid:
+ * @zakform:
+ *
+ * Returns:
+ */
+gboolean
+zak_form_form_is_valid (ZakFormForm *zakform)
+{
+       guint i;
+
+       gboolean ret;
+
+       ZakFormFormPrivate *priv;
+
+       priv = zak_form_form_get_instance_private (zakform);
+
+       ret = TRUE;
+
+       for (i = 0; i < priv->ar_elements->len; i++)
+               {
+                       ZakFormElement *element = (ZakFormElement *)g_ptr_array_index (priv->ar_elements, i);
+                       if (!zak_form_element_is_valid (element))
+                               {
+                                       ret = FALSE;
+                               }
+               }
+
+       return ret;
+}
+
+
 /* PRIVATE */
 static void
 zak_form_form_set_property (GObject *object,
index 6ab6c160472bb08c0d111726896c9acaced10824..921fd84dd7cc545ca985741e54593e614bc9e8ee 100644 (file)
@@ -39,6 +39,8 @@ struct _ZakFormFormClass
 
 gboolean zak_form_form_add_element (ZakFormForm *zakform, ZakFormElement *element);
 
+gboolean zak_form_form_is_valid (ZakFormForm *zakform);
+
 
 G_END_DECLS