[gnome-shell/uajain/adapt-user-avatar-part2: 9/16] unlockDialog: Remove 'Login as another user' Label



commit 34a6dbb5d3835e6bd3f9e3775f8099584ed991e7
Author: Umang Jain <mailumangjain gmail com>
Date:   Sat Feb 1 20:53:59 2020 +0530

    unlockDialog: Remove 'Login as another user' Label
    
    According to the new mockups, logging in as another user
    should be handled by the (<) button present on the lock-screen.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/922/

 js/gdm/authPrompt.js  | 13 +++++++++++--
 js/ui/unlockDialog.js | 40 ++--------------------------------------
 2 files changed, 13 insertions(+), 40 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 032d980b96..2d342ad4f0 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported AuthPrompt */
 
-const { Clutter, GObject, Pango, Shell, St } = imports.gi;
+const { Clutter, Gdm, Gio, GObject, Pango, Shell, St } = imports.gi;
 
 const Animation = imports.ui.animation;
 const Batch = imports.gdm.batch;
@@ -141,7 +141,7 @@ var AuthPrompt = GObject.registerClass({
             y_align: Clutter.ActorAlign.CENTER,
             child: new St.Icon({ icon_name: 'go-previous-symbolic' }),
         });
-        this.cancelButton.connect('clicked', () => this.cancel());
+        this.cancelButton.connect('clicked', () => this._onCancelButtonClicked());
         mainBox.add_child(this.cancelButton);
 
         let entryParams = {
@@ -378,6 +378,15 @@ var AuthPrompt = GObject.registerClass({
         });
     }
 
+    _onCancelButtonClicked() {
+        if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
+            let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
+            if (screenSaverSettings.get_boolean('user-switch-enabled'))
+                Gdm.goto_login_session_sync(null);
+        }
+        this.cancel();
+    }
+
     setMessage(message, type) {
         if (type == GdmUtil.MessageType.ERROR)
             this._message.add_style_class_name('login-dialog-message-warning');
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 3599fafd7e..89ff51ba21 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported UnlockDialog */
 
-const { AccountsService, Atk, Clutter, Gdm, Gio,
+const { AccountsService, Atk, Clutter, Gdm,
         GnomeDesktop, GLib, GObject, Meta, Shell, St } = imports.gi;
 
 const Background = imports.ui.background;
@@ -533,53 +533,23 @@ var UnlockDialog = GObject.registerClass({
 
         this._promptBox.add_child(this._authPrompt);
 
-        let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
-        if (screenSaverSettings.get_boolean('user-switch-enabled')) {
-            let otherUserLabel = new St.Label({
-                text: _('Log in as another user'),
-                style_class: 'login-dialog-not-listed-label',
-            });
-            this._otherUserButton = new St.Button({
-                style_class: 'login-dialog-not-listed-button',
-                can_focus: true,
-                child: otherUserLabel,
-                reactive: true,
-            });
-            this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this));
-            this._promptBox.add_child(this._otherUserButton);
-        } else {
-            this._otherUserButton = null;
-        }
-
         this._authPrompt.reset();
         this._updateSensitivity(true);
     }
 
     _maybeDestroyAuthPrompt() {
         let focus = global.stage.key_focus;
-        if (focus === null ||
-            (this._authPrompt && this._authPrompt.contains(focus)) ||
-            (this._otherUserButton && focus === this._otherUserButton))
+        if (this._authPrompt && this._authPrompt.contains(focus))
             this.grab_key_focus();
 
         if (this._authPrompt) {
             this._authPrompt.destroy();
             this._authPrompt = null;
         }
-
-        if (this._otherUserButton) {
-            this._otherUserButton.destroy();
-            this._otherUserButton = null;
-        }
     }
 
     _updateSensitivity(sensitive) {
         this._authPrompt.updateSensitivity(sensitive);
-
-        if (this._otherUserButton) {
-            this._otherUserButton.reactive = sensitive;
-            this._otherUserButton.can_focus = sensitive;
-        }
     }
 
     _showClock() {
@@ -651,12 +621,6 @@ var UnlockDialog = GObject.registerClass({
             this._authPrompt.cancel();
     }
 
-    _otherUserClicked() {
-        Gdm.goto_login_session_sync(null);
-
-        this._authPrompt.cancel();
-    }
-
     _onDestroy() {
         this.popModal();
 


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