104 lines
4.2 KiB
Diff
104 lines
4.2 KiB
Diff
From 4a9511328fa095de8c3709b380f175755e845175 Mon Sep 17 00:00:00 2001
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
Date: Sat, 19 Aug 2023 15:31:03 -0400
|
|
Subject: [PATCH 09/12] keyboard: Don't add default input sources if input
|
|
sources already set
|
|
|
|
If the keyboard page gets skipped, it adds default input sources derived
|
|
from the users locale.
|
|
|
|
That is all fine and good, but may stomp on existiing site or distro configuration.
|
|
|
|
This commit checks for that kind of thing first, and skips adding the
|
|
default in that case.
|
|
---
|
|
gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
|
index ac15bcc7..f477bd5c 100644
|
|
--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
|
+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c
|
|
@@ -63,70 +63,77 @@ struct _GisKeyboardPagePrivate {
|
|
typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate;
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE);
|
|
|
|
static void
|
|
gis_keyboard_page_finalize (GObject *object)
|
|
{
|
|
GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object);
|
|
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
|
|
|
if (priv->cancellable)
|
|
g_cancellable_cancel (priv->cancellable);
|
|
g_clear_object (&priv->cancellable);
|
|
|
|
g_clear_object (&priv->permission);
|
|
g_clear_object (&priv->localed);
|
|
g_clear_object (&priv->input_settings);
|
|
g_clear_pointer (&priv->default_input_source_ids, g_strfreev);
|
|
g_clear_pointer (&priv->default_input_source_types, g_strfreev);
|
|
g_clear_pointer (&priv->default_input_options, g_strfreev);
|
|
|
|
G_OBJECT_CLASS (gis_keyboard_page_parent_class)->finalize (object);
|
|
}
|
|
|
|
static void
|
|
set_input_settings (GisKeyboardPage *self,
|
|
const char *type,
|
|
const char *id)
|
|
{
|
|
GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self);
|
|
-
|
|
+ g_autoptr(GVariant) default_value = NULL;
|
|
+ g_autoptr(GVariant) value = NULL;
|
|
GVariantBuilder input_source_builder;
|
|
GVariantBuilder input_options_builder;
|
|
size_t i;
|
|
gboolean has_latin_layout = FALSE;
|
|
gboolean is_xkb_source = FALSE;
|
|
|
|
type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser));
|
|
id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser));
|
|
|
|
+ default_value = g_settings_get_default_value (priv->input_settings, KEY_INPUT_SOURCES);
|
|
+ value = g_settings_get_value (priv->input_settings, KEY_INPUT_SOURCES);
|
|
+
|
|
+ if (!g_variant_equal (default_value, value))
|
|
+ return;
|
|
+
|
|
g_variant_builder_init (&input_source_builder, G_VARIANT_TYPE ("a(ss)"));
|
|
g_variant_builder_init (&input_options_builder, G_VARIANT_TYPE ("as"));
|
|
|
|
if (type != NULL && id != NULL) {
|
|
has_latin_layout = !gnome_input_source_is_non_latin (type, id);
|
|
if (g_str_equal (type, "xkb")) {
|
|
g_variant_builder_add (&input_source_builder, "(ss)", type, id);
|
|
|
|
is_xkb_source = TRUE;
|
|
}
|
|
}
|
|
|
|
for (i = 0; priv->default_input_source_ids && priv->default_input_source_ids[i] != NULL; i++) {
|
|
if (g_str_equal (id, priv->default_input_source_ids[i]) && g_str_equal (type, priv->default_input_source_types[i]))
|
|
continue;
|
|
|
|
g_variant_builder_add (&input_source_builder, "(ss)", priv->default_input_source_types[i], priv->default_input_source_ids[i]);
|
|
|
|
if (!gnome_input_source_is_non_latin (priv->default_input_source_types[i], priv->default_input_source_ids[i]))
|
|
has_latin_layout = TRUE;
|
|
}
|
|
|
|
if (type != NULL && id != NULL) {
|
|
if (!is_xkb_source) {
|
|
g_variant_builder_add (&input_source_builder, "(ss)", type, id);
|
|
}
|
|
}
|
|
|
|
if (!has_latin_layout) {
|
|
g_variant_builder_add (&input_source_builder, "(ss)", "xkb", "us");
|
|
--
|
|
2.41.0
|
|
|