aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-07-21 08:45:00 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-07-22 11:56:19 +0200
commit891c2ebcb8f1b001e8bd366d8fc6df70ad4e463a (patch)
tree0d16fc0140941c1cc84d83e2def9b523ce2672a0
parentcad4f9b0712b7816624636d56feebcfebd3d6025 (diff)
downloadayatana-indicator-keyboard-891c2ebcb8f1b001e8bd366d8fc6df70ad4e463a.tar.gz
ayatana-indicator-keyboard-891c2ebcb8f1b001e8bd366d8fc6df70ad4e463a.tar.bz2
ayatana-indicator-keyboard-891c2ebcb8f1b001e8bd366d8fc6df70ad4e463a.zip
src/service.c: Move 'Show Current Layout' menuitem closer HWK settings (i.e. drop one menu separator).
-rw-r--r--src/service.c45
1 files changed, 11 insertions, 34 deletions
diff --git a/src/service.c b/src/service.c
index ee37ef96..54d2327f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -43,8 +43,7 @@ enum
{
SECTION_HEADER = (1 << 0),
SECTION_LAYOUTS = (1 << 1),
- SECTION_DISPLAY = (1 << 2),
- SECTION_SETTINGS = (1 << 3)
+ SECTION_SETTINGS = (1 << 2)
};
enum
@@ -239,6 +238,7 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
{
GMenu * pMenu = g_menu_new();
gboolean bUbuntuTouch = ayatana_common_utils_is_ubuntutouch ();
+ gboolean bDisplay = FALSE;
if (self->pPrivate->bLomiri && bOSK && !bUbuntuTouch)
{
@@ -259,6 +259,7 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
if (bHardwareKeyboard)
{
sAction = "indicator.settings";
+ bDisplay = TRUE;
}
}
else if (bOSK)
@@ -274,8 +275,13 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
else if (!bOSK)
{
sAction = "indicator.settings";
+ bDisplay = TRUE;
}
+ if (bDisplay)
+ {
+ g_menu_append (pMenu, _("Show Current Layout"), "indicator.display");
+ }
if (sAction)
{
g_menu_append(pMenu, _("Keyboard Settings…"), sAction);
@@ -284,29 +290,6 @@ static GMenuModel* createSettingsSection(IndicatorKeyboardService *self, gboolea
return G_MENU_MODEL(pMenu);
}
-static GMenuModel* createDisplaySection (IndicatorKeyboardService *self)
-{
- GMenu * pMenu = g_menu_new ();
- gboolean bDisplay = TRUE;
-
- if (self->pPrivate->bLomiri)
- {
- gboolean bHardwareKeyboard = m_fnKeyboardHasHardwareKeyboard (self->pPrivate->pKeyboard);
-
- if (!bHardwareKeyboard)
- {
- bDisplay = FALSE;
- }
- }
-
- if (bDisplay)
- {
- g_menu_append (pMenu, _("Show Current Layout"), "indicator.display");
- }
-
- return G_MENU_MODEL (pMenu);
-}
-
static void rebuildSection(GMenu *pMenu, int nPos, GMenuModel *pModel)
{
g_menu_remove(pMenu, nPos);
@@ -335,22 +318,17 @@ static void rebuildNow(IndicatorKeyboardService *self, guint nSections)
if (nSections & SECTION_LAYOUTS)
{
rebuildSection(pInfoDesktop->pSubmenu, 0, createLayoutSection(self, HWKBD));
- rebuildSection(pInfoDesktop->pSubmenu, 3, createLayoutSection(self, OSK));
+ rebuildSection(pInfoDesktop->pSubmenu, 2, createLayoutSection(self, OSK));
rebuildSection(pInfoPhone->pSubmenu, 0, createLayoutSection(self, HWKBD));
rebuildSection(pInfoPhone->pSubmenu, 2, createLayoutSection(self, OSK));
rebuildSection(pInfoGreeter->pSubmenu, 0, createLayoutSection(self, HWKBD));
rebuildSection(pInfoGreeter->pSubmenu, 1, createLayoutSection(self, OSK));
}
- if (nSections & SECTION_DISPLAY)
- {
- rebuildSection (pInfoDesktop->pSubmenu, 1, createDisplaySection (self));
- }
-
if (nSections & SECTION_SETTINGS)
{
- rebuildSection(pInfoDesktop->pSubmenu, 2, createSettingsSection(self, HWKBD));
- rebuildSection(pInfoDesktop->pSubmenu, 4, createSettingsSection(self, OSK));
+ rebuildSection(pInfoDesktop->pSubmenu, 1, createSettingsSection(self, HWKBD));
+ rebuildSection(pInfoDesktop->pSubmenu, 3, createSettingsSection(self, OSK));
rebuildSection(pInfoPhone->pSubmenu, 1, createSettingsSection(self, HWKBD));
rebuildSection(pInfoPhone->pSubmenu, 3, createSettingsSection(self, OSK));
}
@@ -378,7 +356,6 @@ static void createMenu(IndicatorKeyboardService *self, int nProfile)
else if (nProfile == PROFILE_DESKTOP)
{
lSections[nSection++] = createLayoutSection(self, HWKBD);
- lSections[nSection++] = createDisplaySection(self);
lSections[nSection++] = createSettingsSection(self, HWKBD);
lSections[nSection++] = createLayoutSection(self, OSK);
lSections[nSection++] = createSettingsSection(self, OSK);