aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-10-04 01:56:56 +0200
committerRobert Tari <robert@tari.in>2022-10-04 21:40:10 +0200
commit8352ae86e10b73e736d7556cf17f29607c73796e (patch)
tree84e15b35722c4e91b7fd07efcafa416a9a339854
parent7407056db015131eef02578e8d0b49cf9ab49f0e (diff)
downloadayatana-indicator-display-8352ae86e10b73e736d7556cf17f29607c73796e.tar.gz
ayatana-indicator-display-8352ae86e10b73e736d7556cf17f29607c73796e.tar.bz2
ayatana-indicator-display-8352ae86e10b73e736d7556cf17f29607c73796e.zip
src/rotation-lock.cpp: Add display setting menu item
fixes https://github.com/AyatanaIndicators/ayatana-indicator-display/issues/54
-rw-r--r--src/rotation-lock.cpp33
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);
}