aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Azzarone andrea.azzarone@canonical.com <Unknown>2015-09-15 07:47:21 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-09-15 07:47:21 +0000
commitcad6ce970e37479de14310bb45ecd29bb9ed2c3b (patch)
tree689c714996c7bd4c8cade77fc51a9d0e1481dec1
parentffe4d92c8e76fd8385c5d3ed9907faf9b6bf1617 (diff)
parent47e85742d81326bad56f476719109a0e71bc8237 (diff)
downloadayatana-indicator-session-cad6ce970e37479de14310bb45ecd29bb9ed2c3b.tar.gz
ayatana-indicator-session-cad6ce970e37479de14310bb45ecd29bb9ed2c3b.tar.bz2
ayatana-indicator-session-cad6ce970e37479de14310bb45ecd29bb9ed2c3b.zip
Disable shutdown/reboot in the lockscreen. Fixes: #1460626
Approved by: PS Jenkins bot, Marco Trevisan (Treviño)
-rw-r--r--src/service.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/service.c b/src/service.c
index 9fda2f1..d9bd8e1 100644
--- a/src/service.c
+++ b/src/service.c
@@ -775,7 +775,7 @@ create_logout_section (IndicatorSessionService * self)
}
static GMenuModel *
-create_session_section (IndicatorSessionService * self)
+create_session_section (IndicatorSessionService * self, int profile)
{
GMenu * menu;
const priv_t * const p = self->priv;
@@ -790,13 +790,15 @@ create_session_section (IndicatorSessionService * self)
if (indicator_session_actions_can_hibernate (p->backend_actions))
g_menu_append (menu, _("Hibernate"), "indicator.hibernate");
- if (indicator_session_actions_can_reboot (p->backend_actions))
+ if (profile != PROFILE_LOCKSCREEN &&
+ indicator_session_actions_can_reboot (p->backend_actions))
{
const char * label = ellipsis ? _("Restart…") : _("Restart");
g_menu_append (menu, label, "indicator.reboot");
}
- if (!g_settings_get_boolean (s, "suppress-shutdown-menuitem"))
+ if (profile != PROFILE_LOCKSCREEN &&
+ !g_settings_get_boolean (s, "suppress-shutdown-menuitem"))
{
const char * label = ellipsis ? _("Shut Down…") : _("Shut Down");
g_menu_append (menu, label, "indicator.power-off");
@@ -824,16 +826,16 @@ create_menu (IndicatorSessionService * self, int profile)
sections[n++] = create_settings_section (self);
sections[n++] = create_switch_section (self, profile);
sections[n++] = create_logout_section (self);
- sections[n++] = create_session_section (self);
+ sections[n++] = create_session_section (self, profile);
}
else if (profile == PROFILE_GREETER)
{
- sections[n++] = create_session_section (self);
+ sections[n++] = create_session_section (self, profile);
}
else if (profile == PROFILE_LOCKSCREEN)
{
sections[n++] = create_switch_section (self, profile);
- sections[n++] = create_session_section (self);
+ sections[n++] = create_session_section (self, profile);
}
/* add sections to the submenu */
@@ -1080,9 +1082,9 @@ rebuild_now (IndicatorSessionService * self, int sections)
if (sections & SECTION_SESSION)
{
- rebuild_section (desktop->submenu, 4, create_session_section(self));
- rebuild_section (greeter->submenu, 0, create_session_section(self));
- rebuild_section (lockscreen->submenu, 1, create_session_section(self));
+ rebuild_section (desktop->submenu, 4, create_session_section(self, PROFILE_DESKTOP));
+ rebuild_section (greeter->submenu, 0, create_session_section(self, PROFILE_GREETER));
+ rebuild_section (lockscreen->submenu, 1, create_session_section(self, PROFILE_LOCKSCREEN));
}
}