Commit 76d31078 authored by Daniel Pauls's avatar Daniel Pauls Committed by Ernestas Kulik

files-view: Fix unintended mnemonics in context menu

If a template has an underscore in its name, it will be interpreted as a
mnemonic shortcut, which is not desired for these. Escaping underscores
makes the labels appear as they are.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=783249

Fixes #995
parent 61a26927
Pipeline #81397 failed with stages
in 51 minutes and 36 seconds
......@@ -5562,6 +5562,7 @@ add_template_to_templates_menus (NautilusFilesView *view,
char *action_name, *detailed_action_name;
CreateTemplateParameters *parameters;
GAction *action;
g_autofree char *label = NULL;
GMenuItem *menu_item;
priv = nautilus_files_view_get_instance_private (view);
......@@ -5583,7 +5584,8 @@ add_template_to_templates_menus (NautilusFilesView *view,
g_action_map_add_action (G_ACTION_MAP (priv->view_action_group), action);
detailed_action_name = g_strconcat ("view.", action_name, NULL);
menu_item = g_menu_item_new (name, detailed_action_name);
label = eel_str_double_underscores (name);
menu_item = g_menu_item_new (label, detailed_action_name);
mimetype_icon = get_menu_icon_for_file (file, GTK_WIDGET (view));
if (mimetype_icon != NULL)
......@@ -5704,7 +5706,12 @@ update_directory_in_templates_menu (NautilusFilesView *view,
if (children_menu != NULL)
{
menu_item = g_menu_item_new_submenu (nautilus_file_get_display_name (file),
g_autofree char *display_name = NULL;
g_autofree char *label = NULL;
display_name = nautilus_file_get_display_name (file);
label = eel_str_double_underscores (display_name);
menu_item = g_menu_item_new_submenu (label,
G_MENU_MODEL (children_menu));
g_menu_append_item (menu, menu_item);
any_templates = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment