[gnome-shell] loginDialog: Move reset of timed login into _startTimedLogin



commit 58063d9ee11b2e5b165a4ed6465ff43b4ed943ff
Author: verdre <gitlab v0yd nl>
Date:   Tue Apr 17 14:38:36 2018 +0200

    loginDialog: Move reset of timed login into _startTimedLogin
    
    This way we can make sure that already running timed logins are
    always reset when starting a new one.

 js/gdm/loginDialog.js | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 3470bf749..4cb79664c 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -1019,6 +1019,12 @@ var LoginDialog = new Lang.Class({
     },
 
     _startTimedLogin(userName, delay) {
+        // Cancel execution of old batch
+        if (this._timedLoginBatch) {
+            this._timedLoginBatch.cancel();
+            this._timedLoginBatch = null;
+        }
+
         this._timedLoginItem = null;
         this._timedLoginDelay = delay;
         this._timedLoginAnimationTime = delay;
@@ -1027,11 +1033,13 @@ var LoginDialog = new Lang.Class({
 
                      () => {
                          this._timedLoginItem = this._userList.getItemFromUserName(userName);
+
+                         // If there is an animation running on the item, reset it.
+                         this._timedLoginItem.hideTimedLoginIndicator();
                      },
 
                      () => {
-                         // If we're just starting out, start on the right
-                         // item.
+                         // If we're just starting out, start on the right item.
                          if (!this._userManager.is_loaded) {
                              this._userList.jumpToItem(this._timedLoginItem);
                          }
@@ -1055,32 +1063,14 @@ var LoginDialog = new Lang.Class({
         return this._timedLoginBatch.run();
     },
 
-    _resetTimedLogin() {
-        if (this._timedLoginBatch) {
-            this._timedLoginBatch.cancel();
-            this._timedLoginBatch = null;
-        }
-
-        if (this._timedLoginItem)
-            this._timedLoginItem.hideTimedLoginIndicator();
-
-        let userName = this._timedLoginItem.user.get_user_name();
-
-        if (userName)
-            this._startTimedLogin(userName, this._timedLoginDelay);
-    },
-
     _onTimedLoginRequested(client, userName, seconds) {
         this._startTimedLogin(userName, seconds);
 
         // Restart timed login on user interaction
         global.stage.connect('captured-event', (actor, event) => {
-           if (this._timedLoginDelay == undefined)
-               return Clutter.EVENT_PROPAGATE;
-
            if (event.type() == Clutter.EventType.KEY_PRESS ||
                event.type() == Clutter.EventType.BUTTON_PRESS) {
-               this._resetTimedLogin();
+               this._startTimedLogin(userName, seconds);
            }
 
            return Clutter.EVENT_PROPAGATE;


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