gdm: Clean up pending messages handling
Introduce a new doAfterPendingMessages helper to wait until we have no more pending messages before doing an action.
This commit is contained in:
parent
82b8b32355
commit
ebef4ff174
@ -205,16 +205,21 @@ const ShellUserVerifier = new Lang.Class({
|
|||||||
this._clearMessageQueue();
|
this._clearMessageQueue();
|
||||||
},
|
},
|
||||||
|
|
||||||
answerQuery: function(serviceName, answer) {
|
_doAfterPendingMessages: function(func) {
|
||||||
if (!this.hasPendingMessages) {
|
if (this.hasPendingMessages) {
|
||||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
let signalId = this.connect('no-more-messages', Lang.bind(this, function() {
|
||||||
} else {
|
|
||||||
let signalId = this.connect('no-more-messages',
|
|
||||||
Lang.bind(this, function() {
|
|
||||||
this.disconnect(signalId);
|
this.disconnect(signalId);
|
||||||
|
func();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
answerQuery: function(serviceName, answer) {
|
||||||
|
this._doAfterPendingMessages(Lang.bind(this, function() {
|
||||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIntervalForMessage: function(message) {
|
_getIntervalForMessage: function(message) {
|
||||||
@ -503,27 +508,12 @@ const ShellUserVerifier = new Lang.Class({
|
|||||||
|
|
||||||
this.emit('verification-failed');
|
this.emit('verification-failed');
|
||||||
|
|
||||||
if (canRetry) {
|
this._doAfterPendingMessages(Lang.bind(this, function() {
|
||||||
if (!this.hasPendingMessages) {
|
if (canRetry)
|
||||||
this._retry();
|
this._retry();
|
||||||
} else {
|
else
|
||||||
let signalId = this.connect('no-more-messages',
|
|
||||||
Lang.bind(this, function() {
|
|
||||||
this.disconnect(signalId);
|
|
||||||
this._retry();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!this.hasPendingMessages) {
|
|
||||||
this.cancel();
|
|
||||||
} else {
|
|
||||||
let signalId = this.connect('no-more-messages',
|
|
||||||
Lang.bind(this, function() {
|
|
||||||
this.disconnect(signalId);
|
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onConversationStopped: function(client, serviceName) {
|
_onConversationStopped: function(client, serviceName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user