location: Make insensitive when locked

Most system menu entries are disabled on the lock/login screen,
there is no good reason for the location entry to be an exception.

https://bugzilla.gnome.org/show_bug.cgi?id=726319
This commit is contained in:
Florian Müllner 2014-03-15 09:01:50 +01:00
parent 4589ce4d78
commit e70fd5a57a

View File

@ -4,9 +4,10 @@ const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const Shell = imports.gi.Shell;
const LOCATION_SCHEMA = 'org.gnome.shell.location';
const MAX_ACCURACY_LEVEL = 'max-accuracy-level';
@ -65,6 +66,8 @@ const Indicator = new Lang.Class({
0,
Lang.bind(this, this._connectToGeoclue),
Lang.bind(this, this._onGeoclueVanished));
Main.sessionMode.connect('updated', Lang.bind(this, this._onSessionUpdated));
this._onSessionUpdated();
this._onMaxAccuracyLevelChanged();
this._connectToGeoclue();
},
@ -150,6 +153,11 @@ const Indicator = new Lang.Class({
this._settings.set_enum(MAX_ACCURACY_LEVEL, 0);
},
_onSessionUpdated: function() {
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
this.menu.setSensitive(sensitive);
},
_onMaxAccuracyLevelChanged: function() {
if (this._getMaxAccuracyLevel() == 0) {
this._item.status.text = _("Off");