[gnome-shell] userMenu: Make the user menu insensitive in the lock screen



commit ec01f5d5ee983a3338421262a9fd817ca8c08aaf
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Sep 1 18:44:46 2012 -0300

    userMenu: Make the user menu insensitive in the lock screen
    
    And show a lock icon as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683156

 js/ui/panelMenu.js   |    6 ++++++
 js/ui/sessionMode.js |    2 ++
 js/ui/userMenu.js    |    9 ++++++++-
 3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index 28b9851..0476375 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -115,6 +115,12 @@ const Button = new Lang.Class({
         this.setName(nameText);
     },
 
+    setSensitive: function(sensitive) {
+        this.actor.reactive = sensitive;
+        this.actor.can_focus = sensitive;
+        this.actor.track_hover = sensitive;
+    },
+
     setName: function(text) {
         if (text != null) {
             // This is the easiest way to provide a accessible name to
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 5728643..62c6da6 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -36,6 +36,7 @@ const _modes = {
         hasRunDialog: false,
         hasWorkspaces: false,
         hasWindows: false,
+        isLocked: true,
         components: ['networkAgent', 'polkitAgent', 'telepathyClient'],
         panel: {
             left: ['userMenu'],
@@ -68,6 +69,7 @@ const _modes = {
               hasWorkspaces: true,
               hasWindows: true,
               createUnlockDialog: Main.createSessionUnlockDialog,
+              isLocked: false,
               components: ['networkAgent', 'polkitAgent', 'telepathyClient',
                            'keyring', 'recorder', 'autorunManager', 'automountManager'],
               panel: {
diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js
index 49b2226..bb3e1a5 100644
--- a/js/ui/userMenu.js
+++ b/js/ui/userMenu.js
@@ -505,6 +505,8 @@ const UserMenuButton = new Lang.Class({
                                        style_class: 'popup-menu-icon' });
         this._pendingIcon = new St.Icon({ icon_name: 'user-status-pending-symbolic',
                                           style_class: 'popup-menu-icon' });
+        this._lockedIcon = new St.Icon({ icon_name: 'changes-prevent-symbolic',
+                                         style_class: 'popup-menu-icon' });
 
         this._accountMgr.connect('most-available-presence-changed',
                                   Lang.bind(this, this._updatePresenceIcon));
@@ -578,6 +580,9 @@ const UserMenuButton = new Lang.Class({
         let allowSettings = Main.sessionMode.allowSettings;
         this._statusChooser.setSensitive(allowSettings);
         this._systemSettings.visible = allowSettings;
+
+        this.setSensitive(!Main.sessionMode.isLocked);
+        this._updatePresenceIcon();
     },
 
     _onDestroy: function() {
@@ -661,7 +666,9 @@ const UserMenuButton = new Lang.Class({
     },
 
     _updatePresenceIcon: function(accountMgr, presence, status, message) {
-        if (presence == Tp.ConnectionPresenceType.AVAILABLE)
+        if (Main.sessionMode.isLocked)
+            this._iconBox.child = this._lockedIcon;
+        else if (presence == Tp.ConnectionPresenceType.AVAILABLE)
             this._iconBox.child = this._availableIcon;
         else if (presence == Tp.ConnectionPresenceType.BUSY)
             this._iconBox.child = this._busyIcon;



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