[gnome-control-center/196-remove-cjk-xkb-based-input-sources-from-the-list] region: Do not show XKB input sources for CJK languages



commit 2e545c8449661b7166cd6ace90e10a3c2139550e
Author: Changwoo Ryu <cwryu debian org>
Date:   Sun Aug 4 16:26:19 2019 +0900

    region: Do not show XKB input sources for CJK languages
    
    Only ibus based input sources should be used for CJK languages.
    
    XKB layouts for CJK languages have their own language or country specific
    features but they can't be used alone for text input of the languages. So
    selecting one of the XKB layouts as an input source does not make sense.
    Showing these lnput sources in the input source selection UI could confuse
    users and lead them to broken input settings.
    
    https://gitlab.gnome.org/GNOME/gnome-control-center/issues/196

 panels/region/cc-input-chooser.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/panels/region/cc-input-chooser.c b/panels/region/cc-input-chooser.c
index 74c8e0ca4..6562292e3 100644
--- a/panels/region/cc-input-chooser.c
+++ b/panels/region/cc-input-chooser.c
@@ -917,6 +917,17 @@ get_locale_infos (CcInputChooser *self)
       g_hash_table_replace (self->locales, g_strdup (simple_locale), info);
       add_locale_to_table (self->locales_by_language, lang_code, info);
 
+      /* We don't own these ids */
+      info->layout_rows_by_id = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                       NULL, g_object_unref);
+      info->engine_rows_by_id = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                       NULL, g_object_unref);
+
+      /* Skip XKB input sources for CJK languages. */
+      if (strcmp(lang_code, "ja") == 0 || strcmp(lang_code, "ko") == 0 ||
+         strcmp(lang_code, "zh") == 0)
+       continue;
+
       if (gnome_get_input_source_from_locale (simple_locale, &type, &id) &&
           g_str_equal (type, INPUT_SOURCE_TYPE_XKB))
         {
@@ -924,12 +935,6 @@ get_locale_infos (CcInputChooser *self)
           g_hash_table_add (layouts_with_locale, (gpointer) id);
         }
 
-      /* We don't own these ids */
-      info->layout_rows_by_id = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                       NULL, g_object_unref);
-      info->engine_rows_by_id = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                       NULL, g_object_unref);
-
       language_layouts = gnome_xkb_info_get_layouts_for_language (self->xkb_info, lang_code);
       add_rows_to_table (self, info, language_layouts, INPUT_SOURCE_TYPE_XKB, id);
       add_ids_to_set (layouts_with_locale, language_layouts);


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