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/service.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/service.c') diff --git a/src/service.c b/src/service.c index 166f729..3de37e3 100644 --- a/src/service.c +++ b/src/service.c @@ -529,8 +529,7 @@ create_session_section (IndicatorSessionService * self, int profile) menu = g_menu_new (); if ((profile == PROFILE_DESKTOP) && - (indicator_session_actions_can_logout (p->backend_actions)) && - (!g_settings_get_boolean (s, "suppress-logout-menuitem"))) + (indicator_session_actions_can_logout (p->backend_actions))) { const char * label = ellipsis ? _("Log Out…") : _("Log Out"); g_menu_append (menu, label, "indicator.logout"); @@ -542,9 +541,7 @@ create_session_section (IndicatorSessionService * self, int profile) if (indicator_session_actions_can_hibernate (p->backend_actions)) g_menu_append (menu, _("Hibernate"), "indicator.hibernate"); - /* NB: check 'ellipsis' here to skip this item if prompting is enabled - because this shows the same prompt as 'Shut Down' in Unity */ - if (!ellipsis && !g_settings_get_boolean (s, "suppress-restart-menuitem")) + if (indicator_session_actions_can_reboot (p->backend_actions)) { const char * label = ellipsis ? _("Restart…") : _("Restart"); g_menu_append (menu, label, "indicator.reboot"); @@ -1021,10 +1018,6 @@ indicator_session_service_init (IndicatorSessionService * self) G_CALLBACK(rebuild_switch_section_soon), self); g_signal_connect_swapped (gp, "changed::suppress-logout-restart-shutdown", G_CALLBACK(rebuild_session_section_soon), self); - g_signal_connect_swapped (gp, "changed::suppress-logout-menuitem", - G_CALLBACK(rebuild_session_section_soon), self); - g_signal_connect_swapped (gp, "changed::suppress-restart-menuitem", - G_CALLBACK(rebuild_session_section_soon), self); g_signal_connect_swapped (gp, "changed::suppress-shutdown-menuitem", G_CALLBACK(rebuild_session_section_soon), self); g_signal_connect_swapped (gp, "changed::show-real-name-on-panel", -- cgit v1.2.3