[gnome-flashback] input-sources: don't use "default" as layout



commit 5509699e1d352d53f5f22ea38843cf2f4b8cb892
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jan 2 12:37:24 2020 +0200

    input-sources: don't use "default" as layout
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770544

 gnome-flashback/libinput-sources/gf-input-source-ibus.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-input-source-ibus.c 
b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
index d605964..b7b6b12 100644
--- a/gnome-flashback/libinput-sources/gf-input-source-ibus.c
+++ b/gnome-flashback/libinput-sources/gf-input-source-ibus.c
@@ -47,6 +47,19 @@ static GParamSpec *ibus_properties[LAST_PROP] = { NULL };
 
 G_DEFINE_TYPE (GfInputSourceIBus, gf_input_source_ibus, GF_TYPE_INPUT_SOURCE)
 
+static const char *
+get_layout (IBusEngineDesc *engine_desc)
+{
+  const char *layout;
+
+  layout = ibus_engine_desc_get_layout (engine_desc);
+
+  if (g_strcmp0 (layout, "default") == 0)
+    return "us";
+
+  return layout;
+}
+
 static gchar *
 get_symbol_from_char_code (gunichar code)
 {
@@ -129,7 +142,7 @@ gf_input_source_ibus_constructed (GObject *object)
 
   self->icon = g_strdup (ibus_engine_desc_get_icon (engine_desc));
 
-  layout = ibus_engine_desc_get_layout (engine_desc);
+  layout = get_layout (engine_desc);
   layout_variant = ibus_engine_desc_get_layout_variant (engine_desc);
 
   if (layout_variant != NULL && *layout_variant != '\0')
@@ -242,7 +255,7 @@ gf_input_source_ibus_get_layout (GfInputSource  *input_source,
   if (engine_desc == NULL)
     return FALSE;
 
-  *layout = ibus_engine_desc_get_layout (engine_desc);
+  *layout = get_layout (engine_desc);
   *variant = ibus_engine_desc_get_layout_variant (engine_desc);
 
   return TRUE;


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