mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-23 04:51:44 +00:00
check that the action name is unique before adding it to a
2008-12-03 Sven Neumann <sven@gimp.org> * app/widgets/gimpactiongroup.c: check that the action name is unique before adding it to a GimpActionGroup. svn path=/trunk/; revision=27751
This commit is contained in:
parent
86bab55c2f
commit
6c82108236
|
@ -1,3 +1,8 @@
|
|||
2008-12-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpactiongroup.c: check that the action name is
|
||||
unique before adding it to a GimpActionGroup.
|
||||
|
||||
2008-12-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpitem.c (gimp_item_get_offset_node): use
|
||||
|
|
|
@ -111,8 +111,7 @@ gimp_action_group_class_init (GimpActionGroupClass *klass)
|
|||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
klass->groups = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, NULL);
|
||||
klass->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -262,6 +261,23 @@ gimp_action_group_get_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_action_group_check_unique_action (GimpActionGroup *group,
|
||||
const gchar *action_name)
|
||||
{
|
||||
if (G_UNLIKELY (gtk_action_group_get_action (GTK_ACTION_GROUP (group),
|
||||
action_name)))
|
||||
{
|
||||
g_warning ("Refusing to add non-unique action '%s' to action group '%s'",
|
||||
action_name,
|
||||
gtk_action_group_get_name (GTK_ACTION_GROUP (group)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_action_group_new:
|
||||
* @gimp: the @Gimp instance this action group belongs to
|
||||
|
@ -349,6 +365,9 @@ gimp_action_group_add_actions (GimpActionGroup *group,
|
|||
gchar *label;
|
||||
const gchar *tooltip;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) g_strip_context (entries[i].label,
|
||||
gettext (entries[i].label));
|
||||
tooltip = gettext (entries[i].tooltip);
|
||||
|
@ -395,6 +414,9 @@ gimp_action_group_add_toggle_actions (GimpActionGroup *group,
|
|||
gchar *label;
|
||||
const gchar *tooltip;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) g_strip_context (entries[i].label,
|
||||
gettext (entries[i].label));
|
||||
tooltip = gettext (entries[i].tooltip);
|
||||
|
@ -447,6 +469,9 @@ gimp_action_group_add_radio_actions (GimpActionGroup *group,
|
|||
gchar *label;
|
||||
const gchar *tooltip;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) g_strip_context (entries[i].label,
|
||||
gettext (entries[i].label));
|
||||
tooltip = gettext (entries[i].tooltip);
|
||||
|
@ -506,6 +531,9 @@ gimp_action_group_add_enum_actions (GimpActionGroup *group,
|
|||
gchar *label;
|
||||
const gchar *tooltip;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) g_strip_context (entries[i].label,
|
||||
gettext (entries[i].label));
|
||||
tooltip = gettext (entries[i].tooltip);
|
||||
|
@ -555,6 +583,9 @@ gimp_action_group_add_string_actions (GimpActionGroup *group,
|
|||
gchar *label;
|
||||
const gchar *tooltip;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) g_strip_context (entries[i].label,
|
||||
gettext (entries[i].label));
|
||||
tooltip = gettext (entries[i].tooltip);
|
||||
|
@ -602,6 +633,9 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
|
|||
GimpPlugInAction *action;
|
||||
gchar *label;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
label = (gchar *) entries[i].label;
|
||||
|
||||
if (! group->mnemonics)
|
||||
|
|
Loading…
Reference in a new issue