From 34418c4e8eeae411fa2f38f41d48ae5f53c88445 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 16 Feb 2008 03:43:38 +0000 Subject: [PATCH] Warn on duplicate action group names. (#501746, Christian Persch) 2008-02-15 Matthias Clasen * gtk/gtkuimanager.c (gtk_ui_manager_insert_action_group): Warn on duplicate action group names. (#501746, Christian Persch) svn path=/trunk/; revision=19592 --- ChangeLog | 6 ++++++ gtk/gtkuimanager.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index c7e5d12fd0..eaeb429ea9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-15 Matthias Clasen + + * gtk/gtkuimanager.c (gtk_ui_manager_insert_action_group): + Warn on duplicate action group names. (#501746, Christian + Persch) + 2008-02-15 Matthias Clasen * gtk/Makefile.am: diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c index fa95be1151..1db9e9bfe7 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -696,11 +696,32 @@ gtk_ui_manager_insert_action_group (GtkUIManager *self, GtkActionGroup *action_group, gint pos) { +#ifdef G_ENABLE_DEBUG + GList *l; + const char *group_name; +#endif + g_return_if_fail (GTK_IS_UI_MANAGER (self)); g_return_if_fail (GTK_IS_ACTION_GROUP (action_group)); g_return_if_fail (g_list_find (self->private_data->action_groups, action_group) == NULL); +#ifdef G_ENABLE_DEBUG + group_name = gtk_action_group_get_name (action_group); + + for (l = self->private_data->action_groups; l; l = l->next) + { + GtkActionGroup *group = l->data; + + if (strcmp (gtk_action_group_get_name (group), group_name) == 0) + { + g_warning ("Inserting action group '%s' into UI manager which " + "already has a group with this name\n", group_name); + break; + } + } +#endif /* G_ENABLE_DEBUG */ + g_object_ref (action_group); self->private_data->action_groups = g_list_insert (self->private_data->action_groups, action_group, pos);