diff --git a/data/sm.puri.phosh.gschema.xml b/data/sm.puri.phosh.gschema.xml index fd03388a..2d07b795 100644 --- a/data/sm.puri.phosh.gschema.xml +++ b/data/sm.puri.phosh.gschema.xml @@ -108,6 +108,18 @@ + + + false + Enable poweroff button on lockscreen + + When this is disabled the you can't poweroff your phone + on lockscreen. + + + + diff --git a/src/power-menu-manager.c b/src/power-menu-manager.c index 04b2abed..e766c463 100644 --- a/src/power-menu-manager.c +++ b/src/power-menu-manager.c @@ -11,6 +11,8 @@ #include "shell.h" #include "util.h" +#define POWEROFF_ON_LOCKSCREEN "sm.puri.phosh.poweroff-on-lockscreen" + /** * PhoshPowerMenuManager: * @@ -141,7 +143,11 @@ on_shell_state_changed (PhoshPowerMenuManager *self, GParamSpec *pspec, PhoshShe action = g_action_map_lookup_action (G_ACTION_MAP (self->menu_actions), "screen-lock"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable); action = g_action_map_lookup_action (G_ACTION_MAP (self->menu_actions), "poweroff"); - g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable); + if (g_settings_get_boolean (self->settings, "enabled") == TRUE) { + g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE); + } else { + g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable); + } } @@ -187,6 +193,8 @@ phosh_power_menu_manager_init (PhoshPowerMenuManager *self) { GAction *src_action, *dst_action; + self->settings = g_settings_new(POWEROFF_ON_LOCKSCREEN); + g_action_map_add_action_entries (G_ACTION_MAP (phosh_shell_get_default ()), entries, G_N_ELEMENTS (entries),