From 60cb2f729f64b78bee0c5ad8cfe7528190ae1bc7 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 26 Nov 2015 20:57:30 +0100 Subject: [PATCH] Added member function ZakFormForm::element_added. --- src/form.c | 5 +++++ src/form.h | 2 ++ src/formelement.c | 9 ++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/form.c b/src/form.c index 7fe02ff..71bbfc5 100644 --- a/src/form.c +++ b/src/form.c @@ -377,6 +377,11 @@ zak_form_form_add_element (ZakFormForm *zakform, ZakFormElement *element) g_ptr_array_add (priv->ar_elements, g_object_ref (element)); ret = TRUE; + if (ZAK_FORM_FORM_GET_CLASS (zakform)->element_added != NULL) + { + ZAK_FORM_FORM_GET_CLASS (zakform)->element_added (zakform, element); + } + return ret; } diff --git a/src/form.h b/src/form.h index 0bb4bdc..e1b3ef7 100644 --- a/src/form.h +++ b/src/form.h @@ -38,6 +38,8 @@ struct _ZakFormFormClass GObjectClass parent_class; GPtrArray *(*get_elements) (ZakFormForm *zakform); + + void (*element_added) (ZakFormForm *zakform, ZakFormElement *element); }; diff --git a/src/formelement.c b/src/formelement.c index acf4709..855c5df 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -84,7 +84,7 @@ zak_form_element_class_init (ZakFormElementClass *class) "Value", "Value", "", - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_DEFAULT_VALUE, g_param_spec_string ("default-value", @@ -105,14 +105,14 @@ zak_form_element_class_init (ZakFormElementClass *class) "Visible", "Visible", TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_EDITABLE, g_param_spec_boolean ("editable", "Editable", "Editable", TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE)); } static void @@ -120,6 +120,9 @@ zak_form_element_init (ZakFormElement *zak_form_element) { ZakFormElementPrivate *priv = zak_form_element_get_instance_private (zak_form_element); + priv->value = g_strdup (""); + priv->visible = TRUE; + priv->editable = TRUE; priv->pa_filters = NULL; priv->pa_validators = NULL; priv->pa_messages = NULL; -- 2.49.0