aboutsummaryrefslogtreecommitdiff
path: root/src/rotation-lock.cpp
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-03 01:36:46 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-10 22:17:42 +0200
commitb40cd9a05d14764bd2a37d2936a0fdd7fd88b91d (patch)
tree6cfba12a46a3e15bbe50be30ceb5c208f92e557f /src/rotation-lock.cpp
parent165c508b461eed85cb1ff52bab1cd4d2d306b33d (diff)
downloadayatana-indicator-display-b40cd9a05d14764bd2a37d2936a0fdd7fd88b91d.tar.gz
ayatana-indicator-display-b40cd9a05d14764bd2a37d2936a0fdd7fd88b91d.tar.bz2
ayatana-indicator-display-b40cd9a05d14764bd2a37d2936a0fdd7fd88b91d.zip
Fix rotation lock switch display
- src/rotation-lock.cpp: Add missing rotation lock section to menu Fix wrong action parameter type - src/rotation-lock.cpp: Add missing GVariantType to g_simple_action_new_stateful
Diffstat (limited to 'src/rotation-lock.cpp')
-rw-r--r--src/rotation-lock.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp
index a7d1f12..e655eaf 100644
--- a/src/rotation-lock.cpp
+++ b/src/rotation-lock.cpp
@@ -105,9 +105,11 @@ private:
GSimpleAction* action;
group = g_simple_action_group_new();
+ GVariantType *pVariantType = g_variant_type_new("b");
action = g_simple_action_new_stateful("rotation-lock",
- nullptr,
+ pVariantType,
g_variant_new_boolean(false));
+ g_variant_type_free(pVariantType);
g_settings_bind_with_mapping(m_settings, "rotation-lock",
action, "state",
G_SETTINGS_BIND_DEFAULT,
@@ -136,13 +138,34 @@ private:
GMenuModel* create_phone_menu()
{
GMenu* menu;
+ GMenu* section;
GMenuItem* menu_item;
menu = g_menu_new();
+ section = g_menu_new();
+ menu_item = g_menu_item_new(_("Rotation Lock"), "indicator.rotation-lock");
+ g_menu_item_set_attribute(menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.switch");
+ g_menu_append_item(section, menu_item);
+ g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+ g_object_unref(section);
+ g_object_unref(menu_item);
+ return G_MENU_MODEL(menu);
+ }
+
+ GMenuModel* create_desktop_menu()
+ {
+ GMenu* menu;
+ GMenu* section;
+ GMenuItem* menu_item;
+
+ menu = g_menu_new();
+ section = g_menu_new();
menu_item = g_menu_item_new(_("Rotation Lock"), "indicator.rotation-lock");
g_menu_item_set_attribute(menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.switch");
- g_menu_append_item(menu, menu_item);
+ g_menu_append_item(section, menu_item);
+ g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
+ g_object_unref(section);
g_object_unref(menu_item);
return G_MENU_MODEL(menu);