|
|
5731ec |
From 3252f05b8745a5d3118986474793fe3ecc2b041c Mon Sep 17 00:00:00 2001
|
|
|
671c89 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
671c89 |
Date: Tue, 19 Apr 2016 13:12:46 -0400
|
|
|
671c89 |
Subject: [PATCH] loginDialog: allow timed login with disabled user list
|
|
|
671c89 |
|
|
|
671c89 |
At the moment the timed login feature is implemented in the user list.
|
|
|
671c89 |
If there's no user list, we don't show the indicator anywhere and
|
|
|
671c89 |
don't proceed with timed login.
|
|
|
671c89 |
|
|
|
671c89 |
This commit allows timed login to work when the user list is disabled.
|
|
|
671c89 |
It accomplishes this by putting the timed login indicator on the
|
|
|
671c89 |
auth prompt, in that scenario.
|
|
|
671c89 |
---
|
|
|
671c89 |
data/theme/gnome-shell-sass/_common.scss | 4 +++
|
|
|
671c89 |
js/gdm/authPrompt.js | 41 +++++++++++++++++++++++-
|
|
|
5731ec |
js/gdm/loginDialog.js | 25 +++++++++++++--
|
|
|
5731ec |
3 files changed, 67 insertions(+), 3 deletions(-)
|
|
|
671c89 |
|
|
|
671c89 |
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
|
|
|
671c89 |
index a6357baad..c2df28279 100644
|
|
|
671c89 |
--- a/data/theme/gnome-shell-sass/_common.scss
|
|
|
671c89 |
+++ b/data/theme/gnome-shell-sass/_common.scss
|
|
|
671c89 |
@@ -1856,6 +1856,10 @@ StScrollBar {
|
|
|
671c89 |
padding-bottom: 12px;
|
|
|
671c89 |
spacing: 8px;
|
|
|
671c89 |
width: 23em;
|
|
|
671c89 |
+ .login-dialog-timed-login-indicator {
|
|
|
671c89 |
+ height: 2px;
|
|
|
671c89 |
+ background-color: darken($fg_color,40%);
|
|
|
671c89 |
+ }
|
|
|
671c89 |
}
|
|
|
671c89 |
|
|
|
671c89 |
.login-dialog-prompt-label {
|
|
|
671c89 |
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
|
|
|
671c89 |
index 27eb31a89..cf77b3f26 100644
|
|
|
671c89 |
--- a/js/gdm/authPrompt.js
|
|
|
671c89 |
+++ b/js/gdm/authPrompt.js
|
|
|
671c89 |
@@ -1,6 +1,6 @@
|
|
|
671c89 |
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
671c89 |
|
|
|
671c89 |
-const { Clutter, Pango, Shell, St } = imports.gi;
|
|
|
671c89 |
+const { Clutter, GLib, Pango, Shell, St } = imports.gi;
|
|
|
671c89 |
const Signals = imports.signals;
|
|
|
671c89 |
|
|
|
671c89 |
const Animation = imports.ui.animation;
|
|
|
671c89 |
@@ -111,6 +111,11 @@ var AuthPrompt = class {
|
|
|
671c89 |
|
|
|
671c89 |
this._entry.grab_key_focus();
|
|
|
671c89 |
|
|
|
671c89 |
+ this._timedLoginIndicator = new St.Bin({ style_class: 'login-dialog-timed-login-indicator',
|
|
|
671c89 |
+ scale_x: 0 });
|
|
|
671c89 |
+
|
|
|
671c89 |
+ this.actor.add(this._timedLoginIndicator);
|
|
|
671c89 |
+
|
|
|
671c89 |
this._message = new St.Label({ opacity: 0,
|
|
|
671c89 |
styleClass: 'login-dialog-message' });
|
|
|
671c89 |
this._message.clutter_text.line_wrap = true;
|
|
|
671c89 |
@@ -135,6 +140,40 @@ var AuthPrompt = class {
|
|
|
671c89 |
this._defaultButtonWell.add_child(this._spinner.actor);
|
|
|
671c89 |
}
|
|
|
671c89 |
|
|
|
671c89 |
+ showTimedLoginIndicator(time) {
|
|
|
671c89 |
+ let hold = new Batch.Hold();
|
|
|
671c89 |
+
|
|
|
671c89 |
+ this.hideTimedLoginIndicator();
|
|
|
671c89 |
+
|
|
|
671c89 |
+ let startTime = GLib.get_monotonic_time();
|
|
|
671c89 |
+
|
|
|
671c89 |
+ this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 33,
|
|
|
671c89 |
+ () => {
|
|
|
671c89 |
+ let currentTime = GLib.get_monotonic_time();
|
|
|
671c89 |
+ let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
|
|
|
671c89 |
+ this._timedLoginIndicator.scale_x = elapsedTime / time;
|
|
|
671c89 |
+ if (elapsedTime >= time) {
|
|
|
671c89 |
+ this._timedLoginTimeoutId = 0;
|
|
|
671c89 |
+ hold.release();
|
|
|
671c89 |
+ return GLib.SOURCE_REMOVE;
|
|
|
671c89 |
+ }
|
|
|
671c89 |
+
|
|
|
671c89 |
+ return GLib.SOURCE_CONTINUE;
|
|
|
671c89 |
+ });
|
|
|
671c89 |
+
|
|
|
671c89 |
+ GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId');
|
|
|
671c89 |
+
|
|
|
671c89 |
+ return hold;
|
|
|
671c89 |
+ }
|
|
|
671c89 |
+
|
|
|
671c89 |
+ hideTimedLoginIndicator() {
|
|
|
671c89 |
+ if (this._timedLoginTimeoutId) {
|
|
|
671c89 |
+ GLib.source_remove(this._timedLoginTimeoutId);
|
|
|
671c89 |
+ this._timedLoginTimeoutId = 0;
|
|
|
671c89 |
+ }
|
|
|
671c89 |
+ this._timedLoginIndicator.scale_x = 0.;
|
|
|
671c89 |
+ }
|
|
|
671c89 |
+
|
|
|
671c89 |
_onDestroy() {
|
|
|
671c89 |
if (this._preemptiveAnswerWatchId) {
|
|
|
671c89 |
this._idleMonitor.remove_watch(this._preemptiveAnswerWatchId);
|
|
|
671c89 |
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
|
|
|
5731ec |
index 6c4d1357d..b4df6e959 100644
|
|
|
671c89 |
--- a/js/gdm/loginDialog.js
|
|
|
671c89 |
+++ b/js/gdm/loginDialog.js
|
|
|
671c89 |
@@ -734,6 +734,9 @@ var LoginDialog = GObject.registerClass({
|
|
|
671c89 |
|
|
|
671c89 |
if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
|
|
671c89 |
this._authPrompt.reset();
|
|
|
671c89 |
+
|
|
|
671c89 |
+ if (this._disableUserList && this._timedLoginUserListHold)
|
|
|
671c89 |
+ this._timedLoginUserListHold.release();
|
|
|
671c89 |
}
|
|
|
671c89 |
}
|
|
|
671c89 |
|
|
|
5731ec |
@@ -1020,16 +1023,31 @@ var LoginDialog = GObject.registerClass({
|
|
|
671c89 |
let loginItem = null;
|
|
|
671c89 |
let animationTime;
|
|
|
671c89 |
|
|
|
671c89 |
- let tasks = [() => this._waitForItemForUser(userName),
|
|
|
671c89 |
+ let tasks = [() => {
|
|
|
671c89 |
+ if (this._disableUserList)
|
|
|
671c89 |
+ return;
|
|
|
671c89 |
+
|
|
|
671c89 |
+ this._timedLoginUserListHold = this._waitForItemForUser(userName);
|
|
|
671c89 |
+
|
|
|
671c89 |
+ return this._timedLoginUserListHold;
|
|
|
671c89 |
+ },
|
|
|
671c89 |
|
|
|
671c89 |
() => {
|
|
|
5731ec |
- loginItem = this._userList.getItemFromUserName(userName);
|
|
|
671c89 |
+ this._timedLoginUserListHold = null;
|
|
|
671c89 |
+
|
|
|
671c89 |
+
|
|
|
5731ec |
+ loginItem = this._disableUserList
|
|
|
5731ec |
+ ? this._authPrompt
|
|
|
5731ec |
+ : this._userList.getItemFromUserName(userName);
|
|
|
671c89 |
|
|
|
671c89 |
// If there is an animation running on the item, reset it.
|
|
|
5731ec |
loginItem.hideTimedLoginIndicator();
|
|
|
671c89 |
},
|
|
|
671c89 |
|
|
|
671c89 |
() => {
|
|
|
671c89 |
+ if (this._disableUserList)
|
|
|
671c89 |
+ return;
|
|
|
671c89 |
+
|
|
|
671c89 |
// If we're just starting out, start on the right item.
|
|
|
671c89 |
if (!this._userManager.is_loaded) {
|
|
|
671c89 |
this._userList.jumpToItem(loginItem);
|
|
|
671c89 |
@@ -1051,6 +1069,9 @@ var LoginDialog = GObject.registerClass({
|
|
|
671c89 |
},
|
|
|
671c89 |
|
|
|
671c89 |
() => {
|
|
|
671c89 |
+ if (this._disableUserList)
|
|
|
671c89 |
+ return;
|
|
|
671c89 |
+
|
|
|
671c89 |
// If idle timeout is done, make sure the timed login indicator is shown
|
|
|
671c89 |
if (delay > _TIMED_LOGIN_IDLE_THRESHOLD &&
|
|
|
671c89 |
this._authPrompt.actor.visible)
|
|
|
671c89 |
--
|
|
|
5731ec |
2.26.2
|
|
|
671c89 |
|