authPrompt: fade out message if user starts to type

If there are no messages in the queue and a user starts to
type then we can safely hide the message label since the
user has probably already read it.

This fixes a weirdness where "Incorrect Password" messages stay
around, even as the user types in the new correct password.

https://bugzilla.gnome.org/show_bug.cgi?id=704817
This commit is contained in:
Ray Strode 2013-07-24 10:53:48 -04:00
parent d730fd0a5f
commit 82ee6aed7f

View File

@ -17,6 +17,8 @@ const DEFAULT_BUTTON_WELL_ICON_SIZE = 24;
const DEFAULT_BUTTON_WELL_ANIMATION_DELAY = 1.0; const DEFAULT_BUTTON_WELL_ANIMATION_DELAY = 1.0;
const DEFAULT_BUTTON_WELL_ANIMATION_TIME = 0.3; const DEFAULT_BUTTON_WELL_ANIMATION_TIME = 0.3;
const MESSAGE_FADE_OUT_ANIMATION_TIME = 0.5;
const AuthPromptMode = { const AuthPromptMode = {
UNLOCK_ONLY: 0, UNLOCK_ONLY: 0,
UNLOCK_OR_LOG_IN: 1 UNLOCK_OR_LOG_IN: 1
@ -166,6 +168,9 @@ const AuthPrompt = new Lang.Class({
this._entry.clutter_text.connect('text-changed', this._entry.clutter_text.connect('text-changed',
Lang.bind(this, function() { Lang.bind(this, function() {
if (!this._userVerifier.hasPendingMessages)
this._fadeOutMessage();
this._updateNextButtonSensitivity(this._entry.text.length > 0); this._updateNextButtonSensitivity(this._entry.text.length > 0);
})); }));
this._entry.clutter_text.connect('activate', Lang.bind(this, function() { this._entry.clutter_text.connect('activate', Lang.bind(this, function() {
@ -331,8 +336,20 @@ const AuthPrompt = new Lang.Class({
return text; return text;
}, },
_fadeOutMessage: function() {
if (this._message.opacity == 0)
return;
Tweener.removeTweens(this._message);
Tweener.addTween(this._message,
{ opacity: 0,
time: MESSAGE_FADE_OUT_ANIMATION_TIME,
transition: 'easeOutQuad'
});
},
setMessage: function(message, styleClass) { setMessage: function(message, styleClass) {
if (message) { if (message) {
Tweener.removeTweens(this._message);
this._message.text = message; this._message.text = message;
this._message.styleClass = styleClass; this._message.styleClass = styleClass;
this._message.opacity = 255; this._message.opacity = 255;