[gnome-shell/uajain/adapt-user-avatar-part2: 2/8] authPrompt: Do not add "Next" button in UNLOCK_ONLY mode



commit ae9884ef1aca1de8d86ffa41d074513777d097d4
Author: Umang Jain <mailumangjain gmail com>
Date:   Wed Jan 8 15:22:15 2020 +0530

    authPrompt: Do not add "Next" button in UNLOCK_ONLY mode
    
    Branch out adding of "Next" button in the UNLOCK_ONLY mode.

 js/gdm/authPrompt.js  | 61 ++++++++++++++++++++++++++++-----------------------
 js/ui/unlockDialog.js |  1 -
 2 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 63a087a875..687f143eeb 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -180,31 +180,32 @@ var AuthPrompt = GObject.registerClass({
         this._buttonBox.add_child(this.cancelButton);
 
         this._buttonBox.add_child(this._defaultButtonWell);
-        this.nextButton = new St.Button({
-            style_class: 'modal-dialog-button button',
-            button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
-            reactive: true,
-            can_focus: true,
-            label: _("Next"),
-            x_align: Clutter.ActorAlign.END,
-            y_align: Clutter.ActorAlign.END,
-        });
-        this.nextButton.connect('clicked', () => this.emit('next'));
-        this.nextButton.add_style_pseudo_class('default');
-        this._buttonBox.add_child(this.nextButton);
-
-        this._updateNextButtonSensitivity(this._entry.text.length > 0);
+        if (this._mode != AuthPromptMode.UNLOCK_ONLY) {
+            this.nextButton = new St.Button({
+                style_class: 'modal-dialog-button button',
+                button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
+                reactive: true,
+                can_focus: true,
+                label: _("Next"),
+                x_align: Clutter.ActorAlign.END,
+                y_align: Clutter.ActorAlign.END,
+            });
+            this.nextButton.connect('clicked', () => this.emit('next'));
+            this.nextButton.add_style_pseudo_class('default');
+            this._buttonBox.add_child(this.nextButton);
+
+            this._updateNextButtonSensitivity(this._entry.text.length > 0);
+        }
 
         this._entry.clutter_text.connect('text-changed', () => {
             if (!this._userVerifier.hasPendingMessages)
                 this._fadeOutMessage();
 
-            this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == 
AuthPromptStatus.VERIFYING);
-        });
-        this._entry.clutter_text.connect('activate', () => {
-            if (this.nextButton.reactive)
-                this.emit('next');
+            if (this.nextButton)
+                this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == 
AuthPromptStatus.VERIFYING);
         });
+
+        this._entry.clutter_text.connect('activate', () => this.emit('next'));
     }
 
     _updateEntry(secret) {
@@ -232,13 +233,15 @@ var AuthPrompt = GObject.registerClass({
         this._updateEntry(secret);
         this.setQuestion(question);
 
-        if (secret) {
-            if (this._userVerifier.reauthenticating)
-                this.nextButton.label = _("Unlock");
-            else
-                this.nextButton.label = C_("button", "Sign In");
-        } else {
-            this.nextButton.label = _("Next");
+        if (this.nextButton) {
+            if (secret) {
+                if (this._userVerifier.reauthenticating)
+                    this.nextButton.label = _("Unlock");
+                else
+                    this.nextButton.label = C_("button", "Sign In");
+            } else {
+                this.nextButton.label = _("Next");
+            }
         }
 
         this.updateSensitivity(true);
@@ -441,7 +444,8 @@ var AuthPrompt = GObject.registerClass({
     }
 
     updateSensitivity(sensitive) {
-        this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || 
this.verificationStatus == AuthPromptStatus.VERIFYING));
+        if (this.nextButton)
+            this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || 
this.verificationStatus == AuthPromptStatus.VERIFYING));
         this._entry.reactive = sensitive;
         this._entry.clutter_text.editable = sensitive;
     }
@@ -476,7 +480,8 @@ var AuthPrompt = GObject.registerClass({
         let oldStatus = this.verificationStatus;
         this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
         this.cancelButton.reactive = true;
-        this.nextButton.label = _("Next");
+        if (this.nextButton)
+            this.nextButton.label = _("Next");
         this._preemptiveAnswer = null;
 
         if (this._userVerifier)
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 9598deb988..a8d041f338 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -537,7 +537,6 @@ var UnlockDialog = GObject.registerClass({
         this._authPrompt.connect('failed', this._fail.bind(this));
         this._authPrompt.connect('cancelled', this._fail.bind(this));
         this._authPrompt.connect('reset', this._onReset.bind(this));
-        this._authPrompt.nextButton.label = _("Unlock");
 
         this._promptBox.add_child(this._authPrompt);
 


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