summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-04-21 20:41:22 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-04-21 21:51:27 -0400
commit85ccb93b9f618828bbdf511a31912f0c69b6bb72 (patch)
tree92caaf6cdcec8d5354101384ebda71cec0ec516c
parent24bac2460298e2b5698e857b10f5779f69232ad6 (diff)
downloadgtk+-85ccb93b9f618828bbdf511a31912f0c69b6bb72.tar.gz
GtkStack: warn if child names are not unique
-rw-r--r--gtk/gtkstack.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index c6b5953455..6ca1fbb675 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -568,6 +568,9 @@ gtk_stack_set_child_property (GtkContainer *container,
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = stack->priv;
GtkStackChildInfo *info;
+ GtkStackChildInfo *info2;
+ gchar *name;
+ GList *l;
info = find_child_info_for_widget (stack, child);
if (info == NULL)
@@ -579,8 +582,19 @@ gtk_stack_set_child_property (GtkContainer *container,
switch (property_id)
{
case CHILD_PROP_NAME:
+ name = g_value_dup_string (value);
+ for (l = priv->children; l != NULL; l = l->next)
+ {
+ info2 = l->data;
+ if (g_strcmp0 (info2->name, name) == 0)
+ {
+ g_warning ("Duplicate child name in GtkStack: %s\n", name);
+ break;
+ }
+ }
+
g_free (info->name);
- info->name = g_value_dup_string (value);
+ info->name = name;
gtk_container_child_notify (container, child, "name");