aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-07-12 02:03:13 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-07-12 02:03:13 -0500
commit98d1379784757b63e317bcd9ac7af69836e473d9 (patch)
treeee960cfd6593540d48bc7b57c92754c8e5e0b76d /tests
parentf71bc96e3131f4241256a850ab8c0b556bdac4dd (diff)
downloadayatana-indicator-session-98d1379784757b63e317bcd9ac7af69836e473d9.tar.gz
ayatana-indicator-session-98d1379784757b63e317bcd9ac7af69836e473d9.tar.bz2
ayatana-indicator-session-98d1379784757b63e317bcd9ac7af69836e473d9.zip
Add a 'can-reboot' property to the Actions class.
This is used for handling a couple of pathological cases where features and states mix and match: 1. unity has the same dialog for 'reboot' and 'power off', so remove the duplicate menuitem, EXCEPT: 2. if the unity prompt isn't available (such as in the greeter), show both menuitems, OR 3. if the user has prompting disabled we need both, OR 4. if the user has the 'power off' button disabled, don't treat 'reboot' as redundant.
Diffstat (limited to 'tests')
-rw-r--r--tests/backend-mock-actions.c7
-rw-r--r--tests/com.canonical.indicator.session.backendmock.gschema.xml4
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/backend-mock-actions.c b/tests/backend-mock-actions.c
index d5a506b..af4afd9 100644
--- a/tests/backend-mock-actions.c
+++ b/tests/backend-mock-actions.c
@@ -44,6 +44,12 @@ my_can_logout (IndicatorSessionActions * self G_GNUC_UNUSED)
}
static gboolean
+my_can_reboot (IndicatorSessionActions * self G_GNUC_UNUSED)
+{
+ return g_settings_get_boolean (mock_settings, "can-reboot");
+}
+
+static gboolean
my_can_switch (IndicatorSessionActions * self G_GNUC_UNUSED)
{
return g_settings_get_boolean (mock_settings, "can-switch-sessions");
@@ -177,6 +183,7 @@ indicator_session_actions_mock_class_init (IndicatorSessionActionsMockClass * kl
actions_class = INDICATOR_SESSION_ACTIONS_CLASS (klass);
actions_class->can_lock = my_can_lock;
actions_class->can_logout = my_can_logout;
+ actions_class->can_reboot = my_can_reboot;
actions_class->can_switch = my_can_switch;
actions_class->can_suspend = my_can_suspend;
actions_class->can_hibernate = my_can_hibernate;
diff --git a/tests/com.canonical.indicator.session.backendmock.gschema.xml b/tests/com.canonical.indicator.session.backendmock.gschema.xml
index 34479df..79d0c02 100644
--- a/tests/com.canonical.indicator.session.backendmock.gschema.xml
+++ b/tests/com.canonical.indicator.session.backendmock.gschema.xml
@@ -21,6 +21,10 @@
<default>true</default>
<summary>Is logging out allowed?</summary>
</key>
+ <key type="b" name="can-reboot">
+ <default>true</default>
+ <summary>Is rebooting allowed?</summary>
+ </key>
<key type="b" name="can-lock">
<default>true</default>
<summary>Is locking the session allowed?</summary>