]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Implemented functions ZakFormElementArray::is_valid.
authorAndrea Zagli <azagli@libero.it>
Sat, 17 Jun 2017 07:41:13 +0000 (09:41 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 17 Jun 2017 07:41:18 +0000 (09:41 +0200)
src/formelementarray.c

index 0632e72b4aaf3a703dbe0a8c450cdd0315c913b4..985f7fe104b6b5a259af63aa35d9726269e387a8 100644 (file)
@@ -50,6 +50,7 @@ static gboolean zak_form_element_array_get_visible (ZakFormElement *element);
 static void zak_form_element_array_set_editable (ZakFormElement *element, gboolean editable);
 static gboolean zak_form_element_array_get_editable (ZakFormElement *element);
 static void zak_form_element_array_clear (ZakFormElement *element);
+static gboolean zak_form_element_array_is_valid (ZakFormElement *element);
 
 #define ZAK_FORM_ELEMENT_ARRAY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_TYPE_ELEMENT_ARRAY, ZakFormElementArrayPrivate))
 
@@ -81,6 +82,7 @@ zak_form_element_array_class_init (ZakFormElementArrayClass *klass)
        elem_class->set_editable = zak_form_element_array_set_editable;
        elem_class->get_editable = zak_form_element_array_get_editable;
        elem_class->clear = zak_form_element_array_clear;
+       elem_class->is_valid = zak_form_element_array_is_valid;
 
        g_type_class_add_private (object_class, sizeof (ZakFormElementArrayPrivate));
 
@@ -509,3 +511,25 @@ zak_form_element_array_clear (ZakFormElement *element)
                        zak_form_element_clear (form_element);
                }
 }
+
+static gboolean
+zak_form_element_array_is_valid (ZakFormElement *element)
+{
+       guint i;
+
+       gboolean ret;
+
+       ZakFormElementArrayPrivate *priv = ZAK_FORM_ELEMENT_ARRAY_GET_PRIVATE (element);
+
+       ret = TRUE;
+
+       for (i = 0; i < priv->ar_elements->len; i++)
+               {
+                       ZakFormElement *form_element = (ZakFormElement *)g_ptr_array_index (priv->ar_elements, i);
+
+                       if (!zak_form_element_is_valid (form_element))
+                               {
+                                       ret = FALSE;
+                               }
+               }
+}