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

index c3c061e0c785bbfbd392d9489af7445125cd6a82..3e019b10ba3cb6ee3b5fa4c571d1b0bd6600a43b 100644 (file)
@@ -643,6 +643,46 @@ GValue
                }
 }
 
+/**
+ * zak_form_form_set_element_value_by_id:
+ * @zakform:
+ * @id:
+ * @value:
+ *
+ * Sets the #ZakFormElement value.
+ */
+gboolean
+zak_form_form_set_element_value_by_id (ZakFormForm *zakform, const gchar *id, const gchar *value)
+{
+       ZakFormElement *element;
+
+       element = zak_form_form_get_element_by_id (zakform, id);
+       if (element != NULL)
+               {
+                       zak_form_element_set_value (element, value);
+               }
+}
+
+/**
+ * zak_form_form_get_element_value_gvalue_by_id:
+ * @zakform:
+ * @id:
+ * @value:
+ *
+ * Sets the #ZakFormElement value.
+ */
+gboolean
+zak_form_form_set_element_value_gvalue_by_id (ZakFormForm *zakform, const gchar *id, GValue *value)
+{
+       ZakFormElement *element;
+
+       element = zak_form_form_get_element_by_id (zakform, id);
+       if (element != NULL)
+               {
+                       zak_form_element_set_value_gvalue (element, value);
+               }
+}
+
 /**
  * zak_form_form_clear:
  * @zakform: a #ZakFormForm object.
index 1080fc1cf5e8665023ff9179011e4d8f61734585..61d76529f4493665e40cc4b93f0aa0095b4a146a 100644 (file)
@@ -65,6 +65,9 @@ GPtrArray *zak_form_form_get_validators_by_type (ZakFormForm *zakform, GType typ
 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);
 
+gboolean zak_form_form_set_element_value_by_id (ZakFormForm *zakform, const gchar *id, const gchar *value);
+gboolean zak_form_form_set_element_value_gvalue_by_id (ZakFormForm *zakform, const gchar *id, GValue *value);
+
 void zak_form_form_clear (ZakFormForm *zakform);
 
 void zak_form_form_set_as_original (ZakFormForm *zakform);