]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added functions ZakFormForm::get_element_value*_by_id.
authorAndrea Zagli <azagli@libero.it>
Tue, 15 Dec 2020 07:27:48 +0000 (08:27 +0100)
committerAndrea Zagli <azagli@libero.it>
Tue, 15 Dec 2020 07:27:48 +0000 (08:27 +0100)
src/form.c
src/form.h

index c6bb5c256a9d2dc6a096c92240009966188e44c3..c3c061e0c785bbfbd392d9489af7445125cd6a82 100644 (file)
@@ -597,6 +597,52 @@ GPtrArray
        return ar;
 }
 
+/**
+ * zak_form_form_get_element_value_by_id:
+ * @zakform:
+ * @id:
+ *
+ * Returns: the #ZakFormElement value.
+ */
+gchar
+*zak_form_form_get_element_value_by_id (ZakFormForm *zakform, const gchar *id)
+{
+       ZakFormElement *element;
+
+       element = zak_form_form_get_element_by_id (zakform, id);
+       if (element != NULL)
+               {
+                       return zak_form_element_get_value (element);
+               }
+       else
+               {
+                       return NULL;
+               }
+}
+
+/**
+ * zak_form_form_get_element_value_gvalue_by_id:
+ * @zakform:
+ * @id:
+ *
+ * Returns: the #ZakFormElement #GValue.
+ */
+GValue
+*zak_form_form_get_element_value_gvalue_by_id (ZakFormForm *zakform, const gchar *id)
+{
+       ZakFormElement *element;
+
+       element = zak_form_form_get_element_by_id (zakform, id);
+       if (element != NULL)
+               {
+                       return zak_form_element_get_value_gvalue (element);
+               }
+       else
+               {
+                       return NULL;
+               }
+}
+
 /**
  * zak_form_form_clear:
  * @zakform: a #ZakFormForm object.
index 21fb097b26677fc40d63a85b8d3e3f2293dbb5e1..1080fc1cf5e8665023ff9179011e4d8f61734585 100644 (file)
@@ -62,6 +62,9 @@ ZakFormValidator *zak_form_form_get_validator_by_id (ZakFormForm *zakform, const
 GPtrArray *zak_form_form_get_validators (ZakFormForm *zakform);
 GPtrArray *zak_form_form_get_validators_by_type (ZakFormForm *zakform, GType type);
 
+gchar *zak_form_form_get_element_value_by_id (ZakFormForm *zakform, const gchar *id);
+GValue *zak_form_form_get_element_value_gvalue_by_id (ZakFormForm *zakform, const gchar *id);
+
 void zak_form_form_clear (ZakFormForm *zakform);
 
 void zak_form_form_set_as_original (ZakFormForm *zakform);