[gnome-shell] gdm: Expose the source serviceName for messages and verification failures
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] gdm: Expose the source serviceName for messages and verification failures
- Date: Mon, 15 Feb 2021 17:05:28 +0000 (UTC)
commit 526f0711f1a7b7bd8e4913845b5a559f2c93be5c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Mon Feb 1 19:36:49 2021 +0100
gdm: Expose the source serviceName for messages and verification failures
By giving to the AuthPrompt information regarding the source service
name (and so the ability to know whether it's a foreground service) can
give it the ability to behave differently.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1652>
js/gdm/authPrompt.js | 8 ++++----
js/gdm/util.js | 22 ++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index feab52e892..4aba39f36d 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -273,12 +273,12 @@ var AuthPrompt = GObject.registerClass({
this.reset();
}
- _onShowMessage(userVerifier, message, type) {
- this.setMessage(message, type);
+ _onShowMessage(_userVerifier, serviceName, message, type) {
+ this.setMessage(serviceName, message, type);
this.emit('prompted');
}
- _onVerificationFailed(userVerifier, canRetry) {
+ _onVerificationFailed(userVerifier, serviceName, canRetry) {
this._queryingService = null;
this.clear();
@@ -410,7 +410,7 @@ var AuthPrompt = GObject.registerClass({
});
}
- setMessage(message, type) {
+ setMessage(serviceName, message, type) {
if (type == GdmUtil.MessageType.ERROR)
this._message.add_style_class_name('login-dialog-message-warning');
else
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 369bf89f1f..f6a980a2ae 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -296,7 +296,7 @@ var ShellUserVerifier = class {
let message = this._messageQueue.shift();
- this.emit('show-message', message.text, message.type);
+ this.emit('show-message', message.serviceName, message.text, message.type);
this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
message.interval,
@@ -308,11 +308,11 @@ var ShellUserVerifier = class {
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
}
- _queueMessage(message, messageType) {
+ _queueMessage(serviceName, message, messageType) {
let interval = this._getIntervalForMessage(message);
this.hasPendingMessages = true;
- this._messageQueue.push({ text: message, type: messageType, interval });
+ this._messageQueue.push({ serviceName, text: message, type: messageType, interval });
this._queueMessageTimeout();
}
@@ -323,7 +323,7 @@ var ShellUserVerifier = class {
GLib.source_remove(this._messageQueueTimeoutId);
this._messageQueueTimeoutId = 0;
}
- this.emit('show-message', null, MessageType.NONE);
+ this.emit('show-message', null, null, MessageType.NONE);
}
_checkForFingerprintReader() {
@@ -383,7 +383,7 @@ var ShellUserVerifier = class {
logError(error, where);
this._hold.release();
- this._queueMessage(_("Authentication error"), MessageType.ERROR);
+ this._queueMessage(serviceName, _('Authentication error'), MessageType.ERROR);
this._failCounter++;
this._verificationFailed(serviceName, false);
}
@@ -532,7 +532,7 @@ var ShellUserVerifier = class {
_onInfo(client, serviceName, info) {
if (this.serviceIsForeground(serviceName)) {
- this._queueMessage(info, MessageType.INFO);
+ this._queueMessage(serviceName, info, MessageType.INFO);
} else if (this.serviceIsFingerprint(serviceName)) {
// We don't show fingerprint messages directly since it's
// not the main auth service. Instead we use the messages
@@ -540,11 +540,13 @@ var ShellUserVerifier = class {
if (this._fingerprintReaderType === FingerprintReaderType.SWIPE) {
// Translators: this message is shown below the password entry field
// to indicate the user can swipe their finger on the fingerprint reader
- this._queueMessage(_('(or swipe finger across reader)'), MessageType.HINT);
+ this._queueMessage(serviceName, _('(or swipe finger across reader)'),
+ MessageType.HINT);
} else {
// Translators: this message is shown below the password entry field
// to indicate the user can place their finger on the fingerprint reader instead
- this._queueMessage(_('(or place finger on reader)'), MessageType.HINT);
+ this._queueMessage(serviceName, _('(or place finger on reader)'),
+ MessageType.HINT);
}
}
}
@@ -555,7 +557,7 @@ var ShellUserVerifier = class {
if (!this.serviceIsForeground(serviceName) && !isFingerprint)
return;
- this._queueMessage(problem, MessageType.ERROR);
+ this._queueMessage(serviceName, problem, MessageType.ERROR);
if (isFingerprint) {
this._failCounter++;
@@ -650,7 +652,7 @@ var ShellUserVerifier = class {
}
}
- this.emit('verification-failed', canRetry);
+ this.emit('verification-failed', serviceName, canRetry);
}
_onConversationStopped(client, serviceName) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]