loginScreen: Add support for 'disable-restart-buttons'

GDM's GSettings schema contains a 'disable-restart-buttons' key
that currently is only supported by the fallback greeter.
Implement support in the shell greeter as well.

https://bugzilla.gnome.org/show_bug.cgi?id=686247
This commit is contained in:
Florian Müllner 2012-10-16 21:32:05 +02:00
parent 3de0ebf7fd
commit 86c85a752e

View File

@ -18,11 +18,13 @@
* 02111-1307, USA.
*/
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const UPowerGlib = imports.gi.UPowerGlib;
const LoginManager = imports.misc.loginManager;
const GdmUtil = imports.gdm.util;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
@ -37,6 +39,10 @@ const PowerMenuButton = new Lang.Class({
this._loginManager = LoginManager.getLoginManager();
this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
this._settings.connect('changed::disable-restart-buttons',
Lang.bind(this, this._updateVisibility));
this._createSubMenu();
this._upClient.connect('notify::can-suspend',
@ -58,7 +64,7 @@ const PowerMenuButton = new Lang.Class({
_updateVisibility: function() {
let shouldBeVisible = (this._haveSuspend || this._haveShutdown || this._haveRestart);
this.actor.visible = shouldBeVisible;
this.actor.visible = shouldBeVisible && !this._settings.get_boolean('disable-restart-buttons');
},
_updateHaveShutdown: function() {