[gnome-builder/wip/tingping/meson-template: 2/2] egg-radio-box: Don't allow duplicate entries
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/tingping/meson-template: 2/2] egg-radio-box: Don't allow duplicate entries
- Date: Mon, 31 Oct 2016 03:09:44 +0000 (UTC)
commit 51ad976d83c070435f4a23d45cf9bb46672db000
Author: Patrick Griffis <tingping tingping se>
Date: Sun Oct 30 23:02:48 2016 -0400
egg-radio-box: Don't allow duplicate entries
contrib/egg/egg-radio-box.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/contrib/egg/egg-radio-box.c b/contrib/egg/egg-radio-box.c
index 90fe7ae..d567480 100644
--- a/contrib/egg/egg-radio-box.c
+++ b/contrib/egg/egg-radio-box.c
@@ -270,6 +270,13 @@ egg_radio_box_add_item (EggRadioBox *self,
precount = priv->items->len;
+ for (guint i = 0; i < precount; ++i)
+ {
+ /* Avoid duplicate items */
+ if (!g_strcmp0 (g_array_index (priv->items, EggRadioBoxItem, i).id, id))
+ return;
+ }
+
item.id = g_strdup (id);
item.text = g_strdup (text);
item.button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]