[gnome-shell/wip/rstrode/make-lock-down-keys-rule] unlockDialog: Honor switch user lockdown settings




commit ea2568f713a224105f6b3c891cc035a73b24c337
Author: Ray Strode <rstrode redhat com>
Date:   Thu May 6 09:32:48 2021 -0400

    unlockDialog: Honor switch user lockdown settings
    
    At the moment user switching functionality is controlled by two
    settings:
    
    org.gnome.desktop.lockdown disable-user-switching
    
    for the panel when the session is unlocked, and
    
    org.gnome.desktop.screensaver user-switch-enabled
    
    for the unlock dialog when the session is locked.
    
    Having the lockdown setting not apply when the screen is
    locked is counterintuitive.
    
    This commit makes the unlock dialog honor both settings.

 js/ui/unlockDialog.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 8ddae8b036..33fac9ce9e 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -9,6 +9,7 @@ const Layout = imports.ui.layout;
 const Main = imports.ui.main;
 const MessageTray = imports.ui.messageTray;
 const SwipeTracker = imports.ui.swipeTracker;
+const SystemActions = imports.misc.systemActions;
 
 const AuthPrompt = imports.gdm.authPrompt;
 
@@ -483,6 +484,7 @@ var UnlockDialog = GObject.registerClass({
         parentActor.add_child(this);
 
         this._gdmClient = new Gdm.Client();
+        this._systemActions = new SystemActions.getDefault();
 
         this._adjustment = new St.Adjustment({
             actor: this,
@@ -580,6 +582,9 @@ var UnlockDialog = GObject.registerClass({
         this._userLoadedId = this._user.connect('notify::is-loaded',
             this._updateUserSwitchVisibility.bind(this));
 
+        this._canSwitchUserId = this._systemActions.connect('notify::can-switch-user',
+            this._updateUserSwitchVisibility.bind(this));
+
         this._updateUserSwitchVisibility();
 
         // Main Box
@@ -854,11 +859,17 @@ var UnlockDialog = GObject.registerClass({
             this._screenSaverSettings.disconnect(this._userSwitchEnabledId);
             this._userSwitchEnabledId = 0;
         }
+
+        if (this._canSwitchUserId) {
+            this._systemActions.disconnect(this._canSwitchUserId);
+            this._canSwitchUserId = 0;
+        }
     }
 
     _updateUserSwitchVisibility() {
         this._otherUserButton.visible = this._userManager.can_switch() &&
-            this._screenSaverSettings.get_boolean('user-switch-enabled');
+            this._screenSaverSettings.get_boolean('user-switch-enabled') &&
+            this._systemActions.can_switch_user;
     }
 
     cancel() {


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