new function which takes menu_paths with mnemonics and removes them so

2003-07-02  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpwidgets-utils.[ch] (gimp_menu_path_strip_uline):
	new function which takes menu_paths with mnemonics and removes
	them so they can be used as identifiers.

	* app/gui/plug-in-menus.c: use the new function. Enables mnemonics
	for plug-in menu entries. Removed plug_in_escape_uline() which
	implemented disabling them.

	* app/widgets/gimptoolbox.c (toolbox_create_tools): use it here
	too, made the function more robust.
This commit is contained in:
Michael Natterer
2003-07-02 09:54:48 +00:00
committed by Michael Natterer
parent d46b87b1e4
commit 9f530a3021
6 changed files with 148 additions and 135 deletions

View File

@ -565,3 +565,35 @@ gimp_rgb_get_gdk_color (const GimpRGB *color,
gdk_color->green = (g << 8) | g;
gdk_color->blue = (b << 8) | b;
}
gchar *
gimp_menu_path_strip_uline (const gchar *menu_path)
{
gchar *escaped;
gchar *p;
if (! menu_path)
return NULL;
p = escaped = g_strdup (menu_path);
while (*menu_path)
{
if (*menu_path == '_')
{
/* "__" means a literal "_" in the menu path */
if (menu_path[1] == '_')
*p++ = *menu_path++;
menu_path++;
}
else
{
*p++ = *menu_path++;
}
}
*p = '\0';
return escaped;
}