[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 14:27:57 +0000 (UTC)
commit e015bbd37c105e6fbfabb35891a6a5e39c2d8742
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]