[gnome-shell] location: Make insensitive when locked



commit e70fd5a57a758b802a777f484e2947d0fb7c1e43
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Mar 15 09:01:50 2014 +0100

    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

 js/ui/status/location.js |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index 6498a5e..7bb33fa 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -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");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]