[gnome-settings-daemon] keyboard: Don't touch the XKB layout with an empty input sources list
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] keyboard: Don't touch the XKB layout with an empty input sources list
- Date: Thu, 13 Sep 2012 12:37:55 +0000 (UTC)
commit e6b023d6cea08d568a664ee7a166e1f3fc4dd792
Author: Rui Matos <tiagomatos gmail com>
Date: Thu Sep 13 01:01:16 2012 +0200
keyboard: Don't touch the XKB layout with an empty input sources list
In case the user hasn't configured any input source it's less
surprising to default to the current X server's XKB layout and
variant.
https://bugzilla.gnome.org/show_bug.cgi?id=683878
plugins/keyboard/gsd-keyboard-manager.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index 5462805..6162bc5 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -647,6 +647,9 @@ replace_layout_and_variant (GsdKeyboardManager *manager,
const gchar *locale;
gchar *language;
+ if (!layout)
+ return;
+
locale = setlocale (LC_MESSAGES, NULL);
/* If LANG is empty, default to en_US */
if (!locale)
@@ -803,6 +806,7 @@ apply_input_sources_settings (GSettings *settings,
GsdKeyboardManagerPrivate *priv = manager->priv;
GVariant *sources;
guint current;
+ guint n_sources;
const gchar *type = NULL;
const gchar *id = NULL;
const gchar *layout = NULL;
@@ -810,16 +814,15 @@ apply_input_sources_settings (GSettings *settings,
sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES);
current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE);
+ n_sources = g_variant_n_children (sources);
- if (g_variant_n_children (sources) < 1) {
- g_warning ("No input source configured, resetting");
- g_settings_reset (priv->input_sources_settings, KEY_INPUT_SOURCES);
+ if (n_sources < 1)
goto exit;
- }
- if (current >= g_variant_n_children (sources)) {
+
+ if (current >= n_sources) {
g_settings_set_uint (priv->input_sources_settings,
KEY_CURRENT_INPUT_SOURCE,
- g_variant_n_children (sources) - 1);
+ n_sources - 1);
goto exit;
}
@@ -863,16 +866,13 @@ apply_input_sources_settings (GSettings *settings,
set_ibus_engine (manager, id);
#else
g_warning ("IBus input source type specified but IBus support was not compiled");
- goto exit;
#endif
} else {
g_warning ("Unknown input source type '%s'", type);
- goto exit;
}
- apply_xkb_layout (manager, layout, variant);
-
exit:
+ apply_xkb_layout (manager, layout, variant);
g_variant_unref (sources);
/* Prevent individual "changed" signal invocations since we
don't need them. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]