Blame SOURCES/allow-timed-login-with-no-user-list.patch

ab48da
From a08995020936b425a98970b686ff5f9169d8968b Mon Sep 17 00:00:00 2001
ab48da
From: Ray Strode <rstrode@redhat.com>
ab48da
Date: Tue, 19 Apr 2016 13:12:46 -0400
ab48da
Subject: [PATCH] loginDialog: allow timed login with disabled user list
ab48da
ab48da
---
ab48da
 data/theme/gnome-shell.css |  5 +++++
ab48da
 js/gdm/authPrompt.js       | 41 +++++++++++++++++++++++++++++++++++++++++
ab48da
 js/gdm/loginDialog.js      | 29 ++++++++++++++++++++++++++---
ab48da
 3 files changed, 72 insertions(+), 3 deletions(-)
ab48da
ab48da
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
ab48da
index f1e9a23..97f8b0a 100644
ab48da
--- a/data/theme/gnome-shell.css
ab48da
+++ b/data/theme/gnome-shell.css
ab48da
@@ -2455,6 +2455,11 @@ StScrollBar StButton#vhandle:active {
ab48da
     background-size: contain;
ab48da
 }
ab48da
 
ab48da
+.login-dialog-prompt-layout .login-dialog-timed-login-indicator {
ab48da
+    height: 2px;
ab48da
+    background-color: #8b8b8b;
ab48da
+}
ab48da
+
ab48da
 .login-dialog-user-list-item .login-dialog-timed-login-indicator {
ab48da
     background-color: rgba(0,0,0,0.0);
ab48da
     height: 2px;
ab48da
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
ab48da
index fe80519..4370721 100644
ab48da
--- a/js/gdm/authPrompt.js
ab48da
+++ b/js/gdm/authPrompt.js
ab48da
@@ -1,6 +1,7 @@
ab48da
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
ab48da
 
ab48da
 const Clutter = imports.gi.Clutter;
ab48da
+const GLib = imports.gi.GLib;
ab48da
 const Lang = imports.lang;
ab48da
 const Signals = imports.signals;
ab48da
 const St = imports.gi.St;
ab48da
@@ -117,6 +118,11 @@ const AuthPrompt = new Lang.Class({
ab48da
 
ab48da
         this._entry.grab_key_focus();
ab48da
 
ab48da
+        this._timedLoginIndicator = new St.Bin({ style_class: 'login-dialog-timed-login-indicator',
ab48da
+                                                 scale_x: 0 });
ab48da
+
ab48da
+        this.actor.add(this._timedLoginIndicator);
ab48da
+
ab48da
         this._message = new St.Label({ opacity: 0,
ab48da
                                        styleClass: 'login-dialog-message' });
ab48da
         this._message.clutter_text.line_wrap = true;
ab48da
@@ -141,6 +147,41 @@ const AuthPrompt = new Lang.Class({
ab48da
         this._defaultButtonWell.add_child(this._spinner.actor);
ab48da
     },
ab48da
 
ab48da
+    showTimedLoginIndicator: function(time) {
ab48da
+        let hold = new Batch.Hold();
ab48da
+
ab48da
+        this.hideTimedLoginIndicator();
ab48da
+
ab48da
+        let startTime = GLib.get_monotonic_time();
ab48da
+
ab48da
+        this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT,
ab48da
+                                                      33,
ab48da
+                                                      Lang.bind(this, function() {
ab48da
+                                                          let currentTime = GLib.get_monotonic_time();
ab48da
+                                                          let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
ab48da
+                                                          this._timedLoginIndicator.scale_x = elapsedTime / time;
ab48da
+                                                          if (elapsedTime >= time) {
ab48da
+                                                              this._timedLoginTimeoutId = 0;
ab48da
+                                                              hold.release();
ab48da
+                                                              return GLib.SOURCE_REMOVE;
ab48da
+                                                          }
ab48da
+
ab48da
+                                                          return GLib.SOURCE_CONTINUE;
ab48da
+                                                      }));
ab48da
+
ab48da
+        GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId');
ab48da
+
ab48da
+        return hold;
ab48da
+    },
ab48da
+
ab48da
+    hideTimedLoginIndicator: function() {
ab48da
+        if (this._timedLoginTimeoutId) {
ab48da
+            GLib.source_remove(this._timedLoginTimeoutId);
ab48da
+            this._timedLoginTimeoutId = 0;
ab48da
+        }
ab48da
+        this._timedLoginIndicator.scale_x = 0.;
ab48da
+    },
ab48da
+
ab48da
     _onDestroy: function() {
ab48da
         if (this._preemptiveAnswerWatchId) {
ab48da
             this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
ab48da
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
ab48da
index b577520..a370e1c 100644
ab48da
--- a/js/gdm/loginDialog.js
ab48da
+++ b/js/gdm/loginDialog.js
ab48da
@@ -734,6 +734,9 @@ const LoginDialog = new Lang.Class({
ab48da
 
ab48da
             if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
ab48da
                 this._authPrompt.reset();
ab48da
+            
ab48da
+            if (this._disableUserList && this._timedLoginUserListHold)
ab48da
+                this._timedLoginUserListHold.release();
ab48da
         }
ab48da
     },
ab48da
 
ab48da
@@ -971,6 +974,9 @@ const LoginDialog = new Lang.Class({
ab48da
     },
ab48da
 
ab48da
     _showTimedLoginAnimation: function() {
ab48da
+        if (this._disableUserList) {
ab48da
+                return this._authPrompt.showTimedLoginIndicator(this._timedLoginAnimationTime);
ab48da
+        }
ab48da
         this._timedLoginItem.actor.grab_key_focus();
ab48da
         return this._timedLoginItem.showTimedLoginIndicator(this._timedLoginAnimationTime);
ab48da
     },
ab48da
@@ -998,19 +1004,31 @@ const LoginDialog = new Lang.Class({
ab48da
     },
ab48da
 
ab48da
     _startTimedLogin: function(userName, delay) {
ab48da
+        this._timedLoginUserName = userName;
ab48da
         this._timedLoginItem = null;
ab48da
         this._timedLoginDelay = delay;
ab48da
         this._timedLoginAnimationTime = delay;
ab48da
-
ab48da
         let tasks = [function() {
ab48da
-                         return this._waitForItemForUser(userName);
ab48da
+                         if (this._disableUserList)
ab48da
+                             return;
ab48da
+
ab48da
+                         this._timedLoginUserListHold = this._waitForItemForUser(userName);
ab48da
+
ab48da
+                         return this._timedLoginUserListHold;
ab48da
                      },
ab48da
 
ab48da
                      function() {
ab48da
+                         this._timedLoginUserListHold = null;
ab48da
+
ab48da
+                         if (this._disableUserList)
ab48da
+                             return;
ab48da
                          this._timedLoginItem = this._userList.getItemFromUserName(userName);
ab48da
                      },
ab48da
 
ab48da
                      function() {
ab48da
+                         if (this._disableUserList)
ab48da
+                             return;
ab48da
+
ab48da
                          // If we're just starting out, start on the right
ab48da
                          // item.
ab48da
                          if (!this._userManager.is_loaded) {
ab48da
@@ -1021,6 +1039,9 @@ const LoginDialog = new Lang.Class({
ab48da
                      this._blockTimedLoginUntilIdle,
ab48da
 
ab48da
                      function() {
ab48da
+                         if (this._disableUserList)
ab48da
+                             return;
ab48da
+
ab48da
                          this._userList.scrollToItem(this._timedLoginItem);
ab48da
                      },
ab48da
 
ab48da
@@ -1045,7 +1066,9 @@ const LoginDialog = new Lang.Class({
ab48da
         if (this._timedLoginItem)
ab48da
             this._timedLoginItem.hideTimedLoginIndicator();
ab48da
 
ab48da
-        let userName = this._timedLoginItem.user.get_user_name();
ab48da
+        this._authPrompt.hideTimedLoginIndicator();
ab48da
+
ab48da
+        let userName = this._timedLoginUserName;
ab48da
 
ab48da
         if (userName)
ab48da
             this._startTimedLogin(userName, this._timedLoginDelay);
ab48da
-- 
ab48da
1.8.3.1
ab48da