From 98d1379784757b63e317bcd9ac7af69836e473d9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 12 Jul 2013 02:03:13 -0500 Subject: 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. --- src/actions.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/actions.c') 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", @@ -185,6 +197,14 @@ indicator_session_actions_can_logout (IndicatorSessionActions * self) return INDICATOR_SESSION_ACTIONS_GET_CLASS (self)->can_logout (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) { @@ -352,6 +372,12 @@ indicator_session_actions_notify_can_logout (IndicatorSessionActions * self) notify_func (self, PROP_CAN_LOGOUT); } +void +indicator_session_actions_notify_can_reboot (IndicatorSessionActions * self) +{ + notify_func (self, PROP_CAN_REBOOT); +} + void indicator_session_actions_notify_can_switch (IndicatorSessionActions * self) { -- cgit v1.2.3