[gnome-builder] prefs: allow duplicate page defines



commit 2ff44c6db2a3e7bc1a0c714ebbd37bb02374921f
Author: Christian Hergert <chergert redhat com>
Date:   Sat Nov 7 23:16:41 2015 -0800

    prefs: allow duplicate page defines

 libide/preferences/ide-preferences-page.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/libide/preferences/ide-preferences-page.c b/libide/preferences/ide-preferences-page.c
index 7a680a1..a13daa1 100644
--- a/libide/preferences/ide-preferences-page.c
+++ b/libide/preferences/ide-preferences-page.c
@@ -132,12 +132,19 @@ ide_preferences_page_add_group (IdePreferencesPage  *self,
   g_return_if_fail (IDE_IS_PREFERENCES_PAGE (self));
   g_return_if_fail (IDE_IS_PREFERENCES_GROUP (group));
 
+  g_object_get (group, "name", &name, NULL);
+
+  if (g_hash_table_contains (self->groups_by_name, name))
+    {
+      g_free (name);
+      return;
+    }
+
+  g_hash_table_insert (self->groups_by_name, name, group);
+
   gtk_container_add_with_properties (GTK_CONTAINER (self->box), GTK_WIDGET (group),
                                      "position", position,
                                      NULL);
-
-  g_object_get (group, "name", &name, NULL);
-  g_hash_table_insert (self->groups_by_name, name, group);
 }
 
 IdePreferencesGroup *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]