[gnome-settings-daemon/gnome-3-24] keyboard: Only add the "us" layout if the system config cannot be determined



commit 11face1da83bdbc54d03b4f6d9b62c35897dd83f
Author: Laurent Bigonville <bigon bigon be>
Date:   Fri Jul 7 17:40:17 2017 +0200

    keyboard: Only add the "us" layout if the system config cannot be determined
    
    Currently, the "us" keyboard layout is always added the first time the
    user is login in, this should only be necessary if the system configured
    layout cannot be determined.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784654

 plugins/keyboard/gsd-keyboard-manager.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index ddeeee6..ea67dda 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -441,7 +441,6 @@ get_sources_from_xkb_config (GsdKeyboardManager *manager)
         gint i, n;
         gchar **layouts = NULL;
         gchar **variants = NULL;
-        gboolean have_default_layout = FALSE;
 
         v = g_dbus_proxy_get_cached_property (priv->localed, "X11Layout");
         if (v) {
@@ -451,8 +450,12 @@ get_sources_from_xkb_config (GsdKeyboardManager *manager)
                 g_variant_unref (v);
         }
 
-        if (!layouts)
-                return;
+        init_builder_with_sources (&builder, priv->input_sources_settings);
+
+        if (!layouts) {
+                g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, DEFAULT_LAYOUT);
+                goto out;
+       }
 
         v = g_dbus_proxy_get_cached_property (priv->localed, "X11Variant");
         if (v) {
@@ -467,8 +470,6 @@ get_sources_from_xkb_config (GsdKeyboardManager *manager)
         else
                 n = g_strv_length (layouts);
 
-        init_builder_with_sources (&builder, priv->input_sources_settings);
-
         for (i = 0; i < n && layouts[i][0]; ++i) {
                 gchar *id;
 
@@ -477,16 +478,11 @@ get_sources_from_xkb_config (GsdKeyboardManager *manager)
                 else
                         id = g_strdup (layouts[i]);
 
-                if (g_str_equal (id, DEFAULT_LAYOUT))
-                        have_default_layout = TRUE;
-
                 g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, id);
                 g_free (id);
         }
 
-        if (!have_default_layout)
-                g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, DEFAULT_LAYOUT);
-
+out:
         g_settings_set_value (priv->input_sources_settings, KEY_INPUT_SOURCES, g_variant_builder_end 
(&builder));
 
         g_strfreev (layouts);


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