diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-11-02 16:39:16 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-11-02 16:39:16 +0100 |
commit | 982a0e9df058154330d46352f488279590fbae35 (patch) | |
tree | 7ce8ec5bf2c06ee35a207a0ae83e0645b0d815f4 | |
parent | d1091356f9ea2b812b4ee7ac5a09dab3947fe54c (diff) | |
parent | 76e4d65da8d64961654bad0ea8b4f094dd5608ad (diff) | |
download | ayatana-indicator-keyboard-982a0e9df058154330d46352f488279590fbae35.tar.gz ayatana-indicator-keyboard-982a0e9df058154330d46352f488279590fbae35.tar.bz2 ayatana-indicator-keyboard-982a0e9df058154330d46352f488279590fbae35.zip |
Merge branch 'tari01-pr/accoutsservice-prefixed'
Attributes GH PR #59: https://github.com/AyatanaIndicators/ayatana-indicator-keyboard/pull/59
-rw-r--r-- | src/keyboard-lomiri.c | 36 | ||||
-rw-r--r-- | src/keyboard-x11.c | 42 |
2 files changed, 43 insertions, 35 deletions
diff --git a/src/keyboard-lomiri.c b/src/keyboard-lomiri.c index e5e0f623..1455b95e 100644 --- a/src/keyboard-lomiri.c +++ b/src/keyboard-lomiri.c @@ -431,7 +431,6 @@ static void keyboard_init(Keyboard *self) } } - guint nLayouts = g_strv_length(lLayouts); guint nVariants = 0; if (lVariants != NULL) @@ -439,34 +438,39 @@ static void keyboard_init(Keyboard *self) g_strv_length(lVariants); } - for (guint nLayout = 0; nLayout < nLayouts; nLayout++) + if (lLayouts != NULL) { - gchar *sId = NULL; + guint nLayouts = g_strv_length(lLayouts); - if (nVariants > nLayout) + for (guint nLayout = 0; nLayout < nLayouts; nLayout++) { - guint nVariant = strlen(lVariants[nLayout]); + gchar *sId = NULL; - if (nVariants == nLayouts && nVariant > 0) + if (nVariants > nLayout) { - sId = g_strconcat(lLayouts[nLayout], "+", lVariants[nLayout], NULL); + guint nVariant = strlen(lVariants[nLayout]); + + if (nVariants == nLayouts && nVariant > 0) + { + sId = g_strconcat(lLayouts[nLayout], "+", lVariants[nLayout], NULL); + } + else + { + sId = g_strdup(lLayouts[nLayout]); + } } else { sId = g_strdup(lLayouts[nLayout]); } - } - else - { - sId = g_strdup(lLayouts[nLayout]); - } - self->pPrivate->lLayoutRec = g_slist_append(self->pPrivate->lLayoutRec, sId); - } + self->pPrivate->lLayoutRec = g_slist_append(self->pPrivate->lLayoutRec, sId); + } - self->pPrivate->nLayout = 0; + self->pPrivate->nLayout = 0; - g_strfreev(lLayouts); + g_strfreev(lLayouts); + } if (lVariants != NULL) { diff --git a/src/keyboard-x11.c b/src/keyboard-x11.c index 141a23ee..fa945f01 100644 --- a/src/keyboard-x11.c +++ b/src/keyboard-x11.c @@ -139,9 +139,9 @@ static void getAccountsService(Keyboard *pKeyboard, ActUser *pUser) g_variant_get (pUser, "(s)", &pKeyboard->pPrivate->sUser); } - gboolean bGuest = g_str_equal (pKeyboard->pPrivate->sUser, "*guest"); + gboolean bPrefix = g_str_has_prefix (pKeyboard->pPrivate->sUser, "*"); - if (bGuest) + if (bPrefix) { if (pKeyboard->pPrivate->lLayoutRec) { @@ -702,7 +702,6 @@ static void keyboard_init(Keyboard *self) } } - guint nLayouts = g_strv_length(lLayouts); guint nVariants = 0; if (lVariants != NULL) @@ -710,35 +709,40 @@ static void keyboard_init(Keyboard *self) nVariants = g_strv_length(lVariants); } - for (guint nLayout = 0; nLayout < nLayouts; nLayout++) + if (lLayouts != NULL) { - gchar *sId = NULL; + guint nLayouts = g_strv_length(lLayouts); - if (nVariants > nLayout) + for (guint nLayout = 0; nLayout < nLayouts; nLayout++) { - guint nVariant = strlen(lVariants[nLayout]); + gchar *sId = NULL; - if (nVariants == nLayouts && nVariant > 0) + if (nVariants > nLayout) { - sId = g_strconcat(lLayouts[nLayout], "+", lVariants[nLayout], NULL); + guint nVariant = strlen(lVariants[nLayout]); + + if (nVariants == nLayouts && nVariant > 0) + { + sId = g_strconcat(lLayouts[nLayout], "+", lVariants[nLayout], NULL); + } + else + { + sId = g_strdup(lLayouts[nLayout]); + } } else { sId = g_strdup(lLayouts[nLayout]); } - } - else - { - sId = g_strdup(lLayouts[nLayout]); - } - self->pPrivate->lLayoutRec = g_slist_append(self->pPrivate->lLayoutRec, sId); - self->pPrivate->sSystemLayout = g_strdup(sId); - } + self->pPrivate->lLayoutRec = g_slist_append(self->pPrivate->lLayoutRec, sId); + self->pPrivate->sSystemLayout = g_strdup(sId); + } - self->pPrivate->nLayout = 0; + self->pPrivate->nLayout = 0; - g_strfreev(lLayouts); + g_strfreev(lLayouts); + } if (lVariants != NULL) { |