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




commit d35bec1016c7ef6cccb72feebe549bf756f4c1fa
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 | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 239e75ef5b..053deacc50 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,
@@ -577,7 +579,7 @@ var UnlockDialog = GObject.registerClass({
         this._userSwitchEnabledId = this._screenSaverSettings.connect('changed::user-switch-enabled',
             this._updateUserSwitchVisibility.bind(this));
 
-        this._userLoadedId = this._user.connect('notify::is-loaded',
+        this._canSwitchUserId = this._systemActions.connect('notify::can-switch-user',
             this._updateUserSwitchVisibility.bind(this));
 
         this._updateUserSwitchVisibility();
@@ -845,9 +847,9 @@ var UnlockDialog = GObject.registerClass({
             delete this._gdmClient;
         }
 
-        if (this._userLoadedId) {
-            this._user.disconnect(this._userLoadedId);
-            this._userLoadedId = 0;
+        if (this._canSwitchUserId) {
+            this._systemActions.disconnect(this._canSwitchUserId);
+            this._canSwitchUserId = 0;
         }
 
         if (this._userSwitchEnabledId) {
@@ -857,7 +859,7 @@ var UnlockDialog = GObject.registerClass({
     }
 
     _updateUserSwitchVisibility() {
-        this._otherUserButton.visible = this._userManager.can_switch() &&
+        this._otherUserButton.visible = this._systemActions.can_switch_user &&
             this._screenSaverSettings.get_boolean('user-switch-enabled');
     }
 


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