From 947c12c8ad1d6cf02d32d0c3554373ae15bc1640 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 9 Aug 2017 15:42:37 +0200 Subject: [PATCH] Added function ZakForm::remove_element (refs #1104). --- src/form.c | 17 +++++++++++++++++ src/form.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/form.c b/src/form.c index a4135fe..bc3000b 100644 --- a/src/form.c +++ b/src/form.c @@ -305,6 +305,23 @@ zak_form_form_add_element (ZakFormForm *zakform, ZakFormElement *element) return ret; } +/** + * zak_form_form_remove_element: + * @zakform: + * @element: + * + * Returns: #TRUE if @element is added; FALSE otherwise. + */ +gboolean +zak_form_form_remove_element (ZakFormForm *zakform, ZakFormElement *element) +{ + ZakFormFormPrivate *priv; + + priv = zak_form_form_get_instance_private (zakform); + + return g_ptr_array_remove (priv->ar_elements, (gpointer)element); +} + /** * zak_form_form_remove_element_by_id: * @zakform: diff --git a/src/form.h b/src/form.h index 2ccc2ca..f860fa7 100644 --- a/src/form.h +++ b/src/form.h @@ -49,6 +49,7 @@ gboolean zak_form_form_load_from_xml (ZakFormForm *zakform, xmlDoc *xmldoc); gboolean zak_form_form_load_from_file (ZakFormForm *zakform, const gchar *filename); gboolean zak_form_form_add_element (ZakFormForm *zakform, ZakFormElement *element); +gboolean zak_form_form_remove_element (ZakFormForm *zakform, ZakFormElement *element); gboolean zak_form_form_remove_element_by_id (ZakFormForm *zakform, const gchar *id); ZakFormElement *zak_form_form_get_element_by_id (ZakFormForm *zakform, const gchar *id); GPtrArray *zak_form_form_get_elements (ZakFormForm *zakform); -- 2.49.0