diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-10 22:18:54 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-10 22:18:54 +0200 |
commit | 392eb319f4a9c44736a2a584ee320658c593a9ba (patch) | |
tree | 6cfba12a46a3e15bbe50be30ceb5c208f92e557f | |
parent | 165c508b461eed85cb1ff52bab1cd4d2d306b33d (diff) | |
parent | b40cd9a05d14764bd2a37d2936a0fdd7fd88b91d (diff) | |
download | ayatana-indicator-display-392eb319f4a9c44736a2a584ee320658c593a9ba.tar.gz ayatana-indicator-display-392eb319f4a9c44736a2a584ee320658c593a9ba.tar.bz2 ayatana-indicator-display-392eb319f4a9c44736a2a584ee320658c593a9ba.zip |
Merge branch 'tari01-pr/fix-switch'
Attributes GH PR #20: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/20
-rw-r--r-- | src/rotation-lock.cpp | 27 |
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); |