From: Andrea Zagli <azagli@libero.it> Date: Sat, 31 Oct 2015 10:08:46 +0000 (+0100) Subject: Added function ZakFormForm::is_valid. X-Git-Tag: debian/0.0.1-1~51 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=88534d979182a974e9cbfc936d04227939eade52;p=zakform%2Flibzakform Added function ZakFormForm::is_valid. --- diff --git a/src/form.c b/src/form.c index 4faf75f..e4c4952 100644 --- a/src/form.c +++ b/src/form.c @@ -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, diff --git a/src/form.h b/src/form.h index 6ab6c16..921fd84 100644 --- a/src/form.h +++ b/src/form.h @@ -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