diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-10-08 23:42:27 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-10-08 23:42:27 +0200 |
commit | 8923620727dd56185ae5e71fe883d311048c96b9 (patch) | |
tree | 84e15b35722c4e91b7fd07efcafa416a9a339854 /src | |
parent | 7407056db015131eef02578e8d0b49cf9ab49f0e (diff) | |
parent | 8352ae86e10b73e736d7556cf17f29607c73796e (diff) | |
download | ayatana-indicator-display-8923620727dd56185ae5e71fe883d311048c96b9.tar.gz ayatana-indicator-display-8923620727dd56185ae5e71fe883d311048c96b9.tar.bz2 ayatana-indicator-display-8923620727dd56185ae5e71fe883d311048c96b9.zip |
Merge branch 'tari01-pr/add-display-settings'
Attributes GH PR #61: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/61
Diffstat (limited to 'src')
-rw-r--r-- | src/rotation-lock.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp index 9eeca1f..196d674 100644 --- a/src/rotation-lock.cpp +++ b/src/rotation-lock.cpp @@ -1,6 +1,6 @@ /* * Copyright 2014 Canonical Ltd. - * Copyright 2021 Robert Tari + * Copyright 2022 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,6 +161,11 @@ private: g_signal_connect_swapped(m_settings, "changed::rotation-lock", G_CALLBACK(on_rotation_lock_setting_changed), this); + action = g_simple_action_new ("settings", NULL); + g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); + g_object_unref (G_OBJECT (action)); + g_signal_connect (action, "activate", G_CALLBACK (onSettings), this); + return group; } @@ -191,6 +196,22 @@ private: return G_MENU_MODEL(menu); } + static void onSettings (GSimpleAction *pAction, GVariant *pVariant, gpointer pData) + { + if (ayatana_common_utils_is_mate ()) + { + ayatana_common_utils_execute_command ("mate-display-properties"); + } + else if (ayatana_common_utils_is_xfce ()) + { + ayatana_common_utils_execute_command ("xfce4-display-settings"); + } + else + { + ayatana_common_utils_execute_command ("gnome-control-center display"); + } + } + GMenuModel* create_desktop_menu() { GMenu* menu; @@ -206,6 +227,16 @@ private: g_object_unref(section); g_object_unref(menu_item); + if (ayatana_common_utils_is_lomiri() == FALSE) + { + section = g_menu_new (); + menu_item = g_menu_item_new (_("Display settingsā¦"), "indicator.settings"); + 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); } |