aboutsummaryrefslogtreecommitdiff
path: root/src/actions.c
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 /src/actions.c
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 'src/actions.c')
-rw-r--r--src/actions.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index babc285..ca086b7 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -34,6 +34,7 @@ enum
PROP_CAN_SUSPEND,
PROP_CAN_LOCK,
PROP_CAN_LOGOUT,
+ PROP_CAN_REBOOT,
PROP_CAN_PROMPT,
PROP_HAS_ONLINE_ACCOUNT_ERROR,
PROP_LAST
@@ -71,6 +72,10 @@ my_get_property (GObject * o,
g_value_set_boolean (value, indicator_session_actions_can_logout (self));
break;
+ case PROP_CAN_REBOOT:
+ g_value_set_boolean (value, indicator_session_actions_can_reboot (self));
+ break;
+
case PROP_CAN_PROMPT:
g_value_set_boolean (value, indicator_session_actions_can_prompt (self));
break;
@@ -96,6 +101,7 @@ indicator_session_actions_class_init (IndicatorSessionActionsClass * klass)
klass->can_lock = NULL;
klass->can_logout = NULL;
+ klass->can_reboot = NULL;
klass->can_switch = NULL;
klass->can_suspend = NULL;
klass->can_hibernate = NULL;
@@ -144,6 +150,12 @@ indicator_session_actions_class_init (IndicatorSessionActionsClass * klass)
"Whether or not the system services allow the user to logout",
TRUE, flags);
+ properties[PROP_CAN_REBOOT] =
+ g_param_spec_boolean (INDICATOR_SESSION_ACTIONS_PROP_CAN_REBOOT,
+ "Can Reboot",
+ "Whether or not the system services allow the user to reboot",
+ TRUE, flags);
+
properties[PROP_CAN_PROMPT] =
g_param_spec_boolean (INDICATOR_SESSION_ACTIONS_PROP_CAN_PROMPT,
"Can Show End Session Dialog",
@@ -186,6 +198,14 @@ indicator_session_actions_can_logout (IndicatorSessionActions * self)
}
gboolean
+indicator_session_actions_can_reboot (IndicatorSessionActions * self)
+{
+ g_return_val_if_fail (INDICATOR_IS_SESSION_ACTIONS (self), FALSE);
+
+ return INDICATOR_SESSION_ACTIONS_GET_CLASS (self)->can_reboot (self);
+}
+
+gboolean
indicator_session_actions_can_switch (IndicatorSessionActions * self)
{
g_return_val_if_fail (INDICATOR_IS_SESSION_ACTIONS (self), FALSE);
@@ -353,6 +373,12 @@ indicator_session_actions_notify_can_logout (IndicatorSessionActions * self)
}
void
+indicator_session_actions_notify_can_reboot (IndicatorSessionActions * self)
+{
+ notify_func (self, PROP_CAN_REBOOT);
+}
+
+void
indicator_session_actions_notify_can_switch (IndicatorSessionActions * self)
{
notify_func (self, PROP_CAN_SWITCH);