From: Andrea Zagli Date: Sat, 17 Jun 2017 07:35:37 +0000 (+0200) Subject: Implemented functions ZakFormElementArray::[gs]et_visible. X-Git-Tag: v0.1.0~1^2~10 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=a7ecee0f2d27260788877072f81ce41a82857b19;p=zakform%2Flibzakform Implemented functions ZakFormElementArray::[gs]et_visible. --- diff --git a/src/formelementarray.c b/src/formelementarray.c index 0ef6830..dab22e3 100644 --- a/src/formelementarray.c +++ b/src/formelementarray.c @@ -42,9 +42,11 @@ static void zak_form_element_array_get_property (GObject *object, static void zak_form_element_array_dispose (GObject *gobject); static void zak_form_element_array_finalize (GObject *gobject); -static GValue *zak_form_element_array_get_value (ZakFormElementArray *element); static gboolean zak_form_element_array_set_value (ZakFormElementArray *element, GValue *value); +static GValue *zak_form_element_array_get_value (ZakFormElementArray *element); static void zak_form_element_array_set_as_original_value (ZakFormElement *element); +static void zak_form_element_array_set_visible (ZakFormElement *element, gboolean visible); +static gboolean zak_form_element_array_get_visible (ZakFormElement *element); static void zak_form_element_array_clear (ZakFormElement *element); #define ZAK_FORM_ELEMENT_ARRAY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_TYPE_ELEMENT_ARRAY, ZakFormElementArrayPrivate)) @@ -68,13 +70,14 @@ zak_form_element_array_class_init (ZakFormElementArrayClass *klass) object_class->dispose = zak_form_element_array_dispose; object_class->finalize = zak_form_element_array_finalize; - elem_class->get_value = zak_form_element_array_get_value; + elem_class->xml_parsing = zak_form_element_array_xml_parsing; elem_class->set_value = zak_form_element_array_set_value; + elem_class->get_value = zak_form_element_array_get_value; elem_class->set_as_original_value = zak_form_element_array_set_as_original_value; + elem_class->set_visible = zak_form_element_array_set_visible; + elem_class->get_visible = zak_form_element_array_get_visible; elem_class->clear = zak_form_element_array_clear; - elem_class->xml_parsing = zak_form_element_array_xml_parsing; - g_type_class_add_private (object_class, sizeof (ZakFormElementArrayPrivate)); /** @@ -438,6 +441,31 @@ zak_form_element_array_set_as_original_value (ZakFormElement *element) } } +static void +zak_form_element_array_set_visible (ZakFormElement *element, gboolean visible) +{ + guint i; + + ZakFormElementArrayPrivate *priv = ZAK_FORM_ELEMENT_ARRAY_GET_PRIVATE (element); + + for (i = 0; i < priv->ar_elements->len; i++) + { + ZakFormElement *form_element = (ZakFormElement *)g_ptr_array_index (priv->ar_elements, i); + + zak_form_element_set_visible (form_element, visible); + } +} + +static gboolean +zak_form_element_array_get_visible (ZakFormElement *element) +{ + ZakFormElementArrayPrivate *priv = ZAK_FORM_ELEMENT_ARRAY_GET_PRIVATE (element); + + ZakFormElement *form_element = (ZakFormElement *)g_ptr_array_index (priv->ar_elements, 0); + + zak_form_element_get_visible (form_element); +} + static void zak_form_element_array_clear (ZakFormElement *element) {