From: Andrea Zagli Date: Sun, 22 Nov 2015 15:34:21 +0000 (+0100) Subject: Added functions ZakFormElement::set_as_original_value and ::is_changed. X-Git-Tag: debian/0.0.1-1~36 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=f80f374e4b63fc6e608676a5c8f7f90bcb276b7a;p=zakform%2Flibzakform Added functions ZakFormElement::set_as_original_value and ::is_changed. --- diff --git a/src/formelement.c b/src/formelement.c index b2db2b0..10f702d 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -286,6 +286,28 @@ gchar return g_strdup (priv->original_value); } +/** + * zak_form_element_set_as_original_value: + * @element + * + */ +void +zak_form_element_set_as_original_value (ZakFormElement *element) +{ + zak_form_element_set_original_value (element, zak_form_element_get_value (element)); +} + +/** + * zak_form_element_is_changed: + * @element: + * + */ +gboolean +zak_form_element_is_changed (ZakFormElement *element) +{ + return (g_strcmp0 (zak_form_element_get_original_value (element), zak_form_element_get_value (element)) == 0); +} + /** * zak_form_element_set_visible: * @element: diff --git a/src/formelement.h b/src/formelement.h index a3855d6..5c0e5af 100644 --- a/src/formelement.h +++ b/src/formelement.h @@ -48,6 +48,8 @@ gchar *zak_form_element_get_default_value (ZakFormElement *element); void zak_form_element_set_original_value (ZakFormElement *element, const gchar *value); gchar *zak_form_element_get_original_value (ZakFormElement *element); +void zak_form_element_set_as_original_value (ZakFormElement *element); +gboolean zak_form_element_is_changed (ZakFormElement *element); void zak_form_element_set_visible (ZakFormElement *element, gboolean visible); gboolean zak_form_element_get_visible (ZakFormElement *element);