[gnome-shell/uajain/adapt-user-avatar-part2: 23/26] authPrompt: Refactor 'next' signal



commit e031b88cab5fff31e1d87082405fa8add85516dc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Feb 11 10:27:36 2020 -0300

    authPrompt: Refactor 'next' signal
    
    Currently, AuthPrompt is connecting to its own 'next' signal
    signal to react to any of the entries being activated, and do
    some actions like starting the spinner and answering the PAM
    question.
    
    Refactor this code into another method, and don't connect to
    our own signal.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/922

 js/gdm/authPrompt.js | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index a9e1fc93fc..096db02b15 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -73,15 +73,6 @@ var AuthPrompt = GObject.registerClass({
         this._userVerifier.connect('ovirt-user-authenticated', this._onOVirtUserAuthenticated.bind(this));
         this.smartcardDetected = this._userVerifier.smartcardDetected;
 
-        this.connect('next', () => {
-            this.updateSensitivity(false);
-            this.startSpinning();
-            if (this._queryingService)
-                this._userVerifier.answerQuery(this._queryingService, this._entry.text);
-            else
-                this._preemptiveAnswer = this._entry.text;
-        });
-
         this.connect('destroy', this._onDestroy.bind(this));
 
         this._userWell = new St.Bin({
@@ -167,7 +158,7 @@ var AuthPrompt = GObject.registerClass({
 
             entry.clutter_text.connect('activate', () => {
                 if (entry.reactive)
-                    this.emit('next');
+                    this._prepareAndEmitNext();
             });
         });
 
@@ -186,6 +177,17 @@ var AuthPrompt = GObject.registerClass({
         this._defaultButtonWell.add_child(this._spinner);
     }
 
+    _prepareAndEmitNext() {
+        this.updateSensitivity(false);
+        this.startSpinning();
+        if (this._queryingService)
+            this._userVerifier.answerQuery(this._queryingService, this._entry.text);
+        else
+            this._preemptiveAnswer = this._entry.text;
+
+        this.emit('next');
+    }
+
     _updateEntry(secret) {
         if (secret && this._entry !== this._passwordEntry) {
             this._mainBox.replace_child(this._entry, this._passwordEntry);


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