aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-06-23 09:59:14 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-09-01 12:24:46 +0200
commit5134db80dc74456224e9fd0bc7fbe743580696ba (patch)
treec2c34ab1de7beb7a956120085d7aad59c8f4b864 /src
parenta8a2962376b5c106af481c17035a89a14bdfc3c8 (diff)
downloadayatana-indicator-keyboard-5134db80dc74456224e9fd0bc7fbe743580696ba.tar.gz
ayatana-indicator-keyboard-5134db80dc74456224e9fd0bc7fbe743580696ba.tar.bz2
ayatana-indicator-keyboard-5134db80dc74456224e9fd0bc7fbe743580696ba.zip
src/keyboard-lomiri.c: For OSK layouts, update 'enabled-languages' gsettings and move the newly selected 'active-language' to the top.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard-lomiri.c51
1 files changed, 46 insertions, 5 deletions
diff --git a/src/keyboard-lomiri.c b/src/keyboard-lomiri.c
index ae2f7961..176d576b 100644
--- a/src/keyboard-lomiri.c
+++ b/src/keyboard-lomiri.c
@@ -373,7 +373,7 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
{
gchar *sId = g_slist_nth_data (pKeyboard->pPrivate->lLayoutRecOSK, nLayout);
guint nId = 0;
- gchar *sLayout = NULL;
+ gchar *sLayoutOSK = NULL;
while (LOMIRI_TO_ISO[nId][0] != NULL)
{
@@ -381,7 +381,7 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
if (bEqual)
{
- sLayout = LOMIRI_TO_ISO[nId][0];
+ sLayoutOSK = LOMIRI_TO_ISO[nId][0];
break;
}
@@ -389,12 +389,53 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
nId++;
}
- if (!sLayout)
+ if (!sLayoutOSK)
{
- sLayout = sId;
+ sLayoutOSK = sId;
+ }
+
+ guint nEnabledLayoutsOSK = g_slist_length (pKeyboard->pPrivate->lLayoutRecOSK);
+
+ GVariantBuilder cLayoutsOSKBuilder;
+ g_variant_builder_init (&cLayoutsOSKBuilder, G_VARIANT_TYPE ("as"));
+ if (sLayoutOSK)
+ {
+ g_variant_builder_add (&cLayoutsOSKBuilder, "s", sLayoutOSK);
+ }
+
+ for (guint nLayout = 0; nLayout < nEnabledLayoutsOSK; nLayout++)
+ {
+ gchar *sIdIso = g_slist_nth_data (pKeyboard->pPrivate->lLayoutRecOSK, nLayout);
+
+ nId = 0;
+ gchar *sIdLomiri = NULL;
+ while (LOMIRI_TO_ISO[nId][0] != NULL)
+ {
+ gboolean bEqual = g_str_equal (LOMIRI_TO_ISO[nId][1], sIdIso);
+
+ if (bEqual)
+ {
+ sIdLomiri = LOMIRI_TO_ISO[nId][0];
+
+ break;
+ }
+
+ nId++;
+ }
+ if (!sIdLomiri)
+ {
+ sIdLomiri = sIdIso;
+ }
+
+ if (strcmp(sIdLomiri, sLayoutOSK))
+ {
+ g_variant_builder_add (&cLayoutsOSKBuilder, "s", sIdLomiri);
+ }
}
+ GVariant *pEnabledLayoutsOSK = g_variant_builder_end (&cLayoutsOSKBuilder);
- g_settings_set_string (pKeyboard->pPrivate->pMaliitSettings, "active-language", sLayout);
+ g_settings_set_string (pKeyboard->pPrivate->pMaliitSettings, "active-language", sLayoutOSK);
+ g_settings_set_value (pKeyboard->pPrivate->pMaliitSettings, "enabled-languages", pEnabledLayoutsOSK);
}
else
{