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

f3cbb9
From f3f5643134c317546c88ff11b974f1a04ad780ff 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
---
f3cbb9
 data/theme/gnome-shell-high-contrast.css |  3 +++
f3cbb9
 data/theme/gnome-shell.css               |  3 +++
f3cbb9
 js/gdm/authPrompt.js                     | 41 ++++++++++++++++++++++++++++++++
f3cbb9
 js/gdm/loginDialog.js                    | 29 +++++++++++++++++++---
f3cbb9
 4 files changed, 73 insertions(+), 3 deletions(-)
ab48da
f3cbb9
diff --git a/data/theme/gnome-shell-high-contrast.css b/data/theme/gnome-shell-high-contrast.css
f3cbb9
index 3ce5278e1..0325fea87 100644
f3cbb9
--- a/data/theme/gnome-shell-high-contrast.css
f3cbb9
+++ b/data/theme/gnome-shell-high-contrast.css
f3cbb9
@@ -1691,6 +1691,9 @@ StScrollBar {
f3cbb9
   padding-bottom: 12px;
f3cbb9
   spacing: 8px;
f3cbb9
   width: 23em; }
f3cbb9
+  .login-dialog-prompt-layout .login-dialog-timed-login-indicator {
f3cbb9
+    height: 2px;
f3cbb9
+    background-color: #8b8b8b; }
f3cbb9
 
f3cbb9
 .login-dialog-prompt-label {
f3cbb9
   color: #bebeb6;
ab48da
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
f3cbb9
index 342bebe9d..e2a442ecb 100644
ab48da
--- a/data/theme/gnome-shell.css
ab48da
+++ b/data/theme/gnome-shell.css
f3cbb9
@@ -1691,6 +1691,9 @@ StScrollBar {
f3cbb9
   padding-bottom: 12px;
f3cbb9
   spacing: 8px;
f3cbb9
   width: 23em; }
f3cbb9
+  .login-dialog-prompt-layout .login-dialog-timed-login-indicator {
ab48da
+    height: 2px;
f3cbb9
+    background-color: #8b8b8b; }
f3cbb9
 
f3cbb9
 .login-dialog-prompt-label {
f3cbb9
   color: #bebeb6;
ab48da
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
f3cbb9
index 6327633d9..ae03a5b49 100644
ab48da
--- a/js/gdm/authPrompt.js
ab48da
+++ b/js/gdm/authPrompt.js
f3cbb9
@@ -2,6 +2,7 @@
ab48da
 
ab48da
 const Clutter = imports.gi.Clutter;
f3cbb9
 const Gio = imports.gi.Gio;
ab48da
+const GLib = imports.gi.GLib;
ab48da
 const Lang = imports.lang;
ab48da
 const Signals = imports.signals;
ab48da
 const St = imports.gi.St;
f3cbb9
@@ -118,6 +119,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;
f3cbb9
@@ -142,6 +148,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
f3cbb9
index 45eca18f7..9034d732e 100644
ab48da
--- a/js/gdm/loginDialog.js
ab48da
+++ b/js/gdm/loginDialog.js
f3cbb9
@@ -729,6 +729,9 @@ const LoginDialog = new Lang.Class({
ab48da
 
ab48da
             if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
ab48da
                 this._authPrompt.reset();
f3cbb9
+
ab48da
+            if (this._disableUserList && this._timedLoginUserListHold)
ab48da
+                this._timedLoginUserListHold.release();
ab48da
         }
ab48da
     },
ab48da
 
f3cbb9
@@ -984,6 +987,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
     },
f3cbb9
@@ -1011,19 +1017,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) {
f3cbb9
@@ -1034,6 +1052,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
 
f3cbb9
@@ -1058,7 +1079,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
-- 
f3cbb9
2.12.0
ab48da