]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added function ZakForm::remove_element_by_idx (closes #1104).
authorAndrea Zagli <azagli@libero.it>
Wed, 9 Aug 2017 13:47:52 +0000 (15:47 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 9 Aug 2017 13:47:52 +0000 (15:47 +0200)
src/form.c
src/form.h

index 2ca08098dca5762fbd955a4dcdfdb0ae7ef4c2bd..7358f1cb8681bd6fb47cc16b8aa89526977d3a8f 100644 (file)
@@ -357,6 +357,23 @@ zak_form_form_remove_element_by_id (ZakFormForm *zakform, const gchar *id)
        return ret;
 }
 
+/**
+ * zak_form_form_remove_element_by_idx:
+ * @zakform:
+ * @idx:
+ *
+ * Returns: #TRUE if @element is removed; FALSE otherwise.
+ */
+gboolean
+zak_form_form_remove_element_by_idx (ZakFormForm *zakform, guint idx)
+{
+       ZakFormFormPrivate *priv;
+
+       priv = zak_form_form_get_instance_private (zakform);
+
+       return (g_ptr_array_remove_index (priv->ar_elements, idx) != NULL);
+}
+
 /**
  * zak_form_form_get_element_by_id:
  * @zakform:
index e141b5f4a239ae0c82ca94676f206e76975cc6d5..9a6e90d6b162c0d1b2b7fe817d44eadeedd6c371 100644 (file)
@@ -51,6 +51,7 @@ gboolean zak_form_form_load_from_file (ZakFormForm *zakform, const gchar *filena
 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);
+gboolean zak_form_form_remove_element_by_idx (ZakFormForm *zakform, guint idx);
 ZakFormElement *zak_form_form_get_element_by_id (ZakFormForm *zakform, const gchar *id);
 guint zak_form_form_get_element_idx_by_id (ZakFormForm *zakform, const gchar *id);
 GPtrArray *zak_form_form_get_elements (ZakFormForm *zakform);