keyboard: Add more key aliases

To improve even more the search feature, add the
following new key aliases:

Option  → Alt
Command → Super
Apple   → Super

https://bugzilla.gnome.org/show_bug.cgi?id=772565
This commit is contained in:
Georges Basile Stavracas Neto 2017-05-03 15:55:30 -03:00 committed by Bastien Nocera
parent 1cb787e8b8
commit f981eb58ac

View file

@ -348,8 +348,11 @@ strv_contains_prefix_or_match (gchar **strv,
const gchar *synonym; const gchar *synonym;
} key_aliases[] = } key_aliases[] =
{ {
{ "ctrl", "Ctrl", "ctrl" }, { "ctrl", "Ctrl", "ctrl" },
{ "win", "Super", "super" }, { "win", "Super", "super" },
{ "option", NULL, "alt" },
{ "command", NULL, "super" },
{ "apple", NULL, "super" },
}; };
for (i = 0; strv[i]; i++) for (i = 0; strv[i]; i++)
@ -361,15 +364,20 @@ strv_contains_prefix_or_match (gchar **strv,
for (i = 0; i < G_N_ELEMENTS (key_aliases); i++) for (i = 0; i < G_N_ELEMENTS (key_aliases); i++)
{ {
g_autofree gchar *alias = NULL; g_autofree gchar *alias = NULL;
const gchar *translated_label, *synonym; const gchar *synonym;
if (!g_str_has_prefix (key_aliases[i].key, prefix)) if (!g_str_has_prefix (key_aliases[i].key, prefix))
continue; continue;
/* Get GTK+'s translation */ if (key_aliases[i].untranslated)
translated_label = g_dpgettext2 ("gtk30", "keyboard label", key_aliases[i].untranslated); {
const gchar *translated_label;
/* Steal GTK+'s translation */
translated_label = g_dpgettext2 ("gtk30", "keyboard label", key_aliases[i].untranslated);
alias = g_utf8_strdown (translated_label, -1);
}
alias = g_utf8_strdown (translated_label, -1);
synonym = key_aliases[i].synonym; synonym = key_aliases[i].synonym;
/* If a translation or synonym of the key is in the accelerator, and we typed /* If a translation or synonym of the key is in the accelerator, and we typed