Warn on duplicate action group names. (#501746, Christian Persch)

2008-02-15  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkuimanager.c (gtk_ui_manager_insert_action_group):
        Warn on duplicate action group names.  (#501746, Christian
        Persch)



svn path=/trunk/; revision=19592
This commit is contained in:
Matthias Clasen 2008-02-16 03:43:38 +00:00 committed by Matthias Clasen
parent ca36ffc2af
commit 34418c4e8e
2 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-02-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkuimanager.c (gtk_ui_manager_insert_action_group):
Warn on duplicate action group names. (#501746, Christian
Persch)
2008-02-15 Matthias Clasen <mclasen@redhat.com> 2008-02-15 Matthias Clasen <mclasen@redhat.com>
* gtk/Makefile.am: * gtk/Makefile.am:

View File

@ -696,11 +696,32 @@ gtk_ui_manager_insert_action_group (GtkUIManager *self,
GtkActionGroup *action_group, GtkActionGroup *action_group,
gint pos) 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_UI_MANAGER (self));
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group)); g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
g_return_if_fail (g_list_find (self->private_data->action_groups, g_return_if_fail (g_list_find (self->private_data->action_groups,
action_group) == NULL); 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); g_object_ref (action_group);
self->private_data->action_groups = self->private_data->action_groups =
g_list_insert (self->private_data->action_groups, action_group, pos); g_list_insert (self->private_data->action_groups, action_group, pos);