[gnome-shell/gbsneto/multi-user-button: 4/5] unlockDialog: Hide switch users button when showing clock



commit 17a0e4a7a2400a8b605bc54666eac17446694a41
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Feb 14 13:10:44 2020 -0300

    unlockDialog: Hide switch users button when showing clock
    
    The switch users button is distraction when now showing the other
    authentication widgets. It also shares the same position on the
    screen with the login screen's session menu button, which is also
    visible only when the authentication widgetry is.
    
    Hide the switch users button when showing the clock.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1006

 js/ui/unlockDialog.js | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 7a6c936121..af6a26c4fa 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -566,9 +566,14 @@ var UnlockDialog = GObject.registerClass({
         });
         this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this));
 
-        let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
-        screenSaverSettings.bind('user-switch-enabled',
-            this._otherUserButton, 'visible', Gio.SettingsBindFlags.GET);
+        this._promptBox.connect('notify::visible',
+            this._updateOtherUserButton.bind(this));
+
+        this._screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
+        this._screenSaverSettings.connect('changed::user-switch-enabled',
+            this._updateOtherUserButton.bind(this));
+
+        this._updateOtherUserButton();
 
         // Main Box
         let mainBox = new Clutter.Actor();
@@ -649,6 +654,14 @@ var UnlockDialog = GObject.registerClass({
             this._createBackground(i);
     }
 
+    _updateOtherUserButton() {
+        const promptVisible = this._promptBox.visible;
+        const userSwitchEnabled =
+            this._screenSaverSettings.get_boolean('user-switch-enabled');
+
+        this._otherUserButton.visible = promptVisible && userSwitchEnabled;
+    }
+
     _ensureAuthPrompt() {
         if (this._authPrompt)
             return;


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