[gnome-control-center] keyboard: Add more key aliases



commit f981eb58acfab088639cb32d0ed92ce75690abc3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed May 3 15:55:30 2017 -0300

    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

 panels/keyboard/cc-keyboard-panel.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-panel.c b/panels/keyboard/cc-keyboard-panel.c
index 4487bea..ad0f0e7 100644
--- a/panels/keyboard/cc-keyboard-panel.c
+++ b/panels/keyboard/cc-keyboard-panel.c
@@ -348,8 +348,11 @@ strv_contains_prefix_or_match (gchar       **strv,
     const gchar *synonym;
   } key_aliases[] =
     {
-      { "ctrl",  "Ctrl",  "ctrl" },
-      { "win",   "Super", "super" },
+      { "ctrl",   "Ctrl",  "ctrl" },
+      { "win",    "Super", "super" },
+      { "option",  NULL,   "alt" },
+      { "command", NULL,   "super" },
+      { "apple",   NULL,   "super" },
     };
 
   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++)
     {
       g_autofree gchar *alias = NULL;
-      const gchar *translated_label, *synonym;
+      const gchar *synonym;
 
       if (!g_str_has_prefix (key_aliases[i].key, prefix))
         continue;
 
-      /* Get GTK+'s translation */
-      translated_label = g_dpgettext2 ("gtk30", "keyboard label", key_aliases[i].untranslated);
+      if (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;
 
       /* If a translation or synonym of the key is in the accelerator, and we typed


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]