authPrompt: give message label an initial style
This commit consolidates the styles of the various message types into one 'login-dialog-message' style and then adds additional styles on top to cover the differences. This allows us to give the message label an initial style so that is padded properly before any messages are displayed. https://bugzilla.gnome.org/show_bug.cgi?id=706670
This commit is contained in:
parent
21a85832b3
commit
88e3f6af47
@ -2433,8 +2433,7 @@ StScrollBar StButton#vhandle:active {
|
||||
background-color: rgba(102, 102, 102, 0.15);
|
||||
}
|
||||
|
||||
.login-dialog-message-warning,
|
||||
.login-dialog-message-info {
|
||||
.login-dialog-message {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 16px;
|
||||
min-height: 2em;
|
||||
@ -2445,8 +2444,7 @@ StScrollBar StButton#vhandle:active {
|
||||
}
|
||||
|
||||
.login-dialog-message-hint {
|
||||
padding-bottom: 16px;
|
||||
min-height: 2em;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.user-widget-label {
|
||||
|
@ -36,8 +36,6 @@ const BeginRequestType = {
|
||||
DONT_PROVIDE_USERNAME: 1
|
||||
};
|
||||
|
||||
let _messageStyleMap;
|
||||
|
||||
const AuthPrompt = new Lang.Class({
|
||||
Name: 'AuthPrompt',
|
||||
|
||||
@ -109,7 +107,8 @@ const AuthPrompt = new Lang.Class({
|
||||
|
||||
this._entry.grab_key_focus();
|
||||
|
||||
this._message = new St.Label({ opacity: 0 });
|
||||
this._message = new St.Label({ opacity: 0,
|
||||
styleClass: 'login-dialog-message' });
|
||||
this._message.clutter_text.line_wrap = true;
|
||||
this.actor.add(this._message, { x_fill: true, y_align: St.Align.START });
|
||||
|
||||
@ -371,27 +370,22 @@ const AuthPrompt = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_initMessageStyleMap: function() {
|
||||
if (_messageStyleMap)
|
||||
return;
|
||||
|
||||
_messageStyleMap = {};
|
||||
_messageStyleMap[GdmUtil.MessageType.NONE] = '';
|
||||
_messageStyleMap[GdmUtil.MessageType.ERROR] = 'login-dialog-message-warning';
|
||||
_messageStyleMap[GdmUtil.MessageType.INFO] = 'login-dialog-message-info';
|
||||
_messageStyleMap[GdmUtil.MessageType.HINT] = 'login-dialog-message-hint';
|
||||
|
||||
},
|
||||
|
||||
setMessage: function(message, type) {
|
||||
this._initMessageStyleMap();
|
||||
if (type == GdmUtil.MessageType.ERROR)
|
||||
this._message.add_style_class_name('login-dialog-message-warning');
|
||||
else
|
||||
this._message.remove_style_class_name('login-dialog-message-warning');
|
||||
|
||||
if (type == GdmUtil.MessageType.HINT)
|
||||
this._message.add_style_class_name('login-dialog-message-hint');
|
||||
else
|
||||
this._message.remove_style_class_name('login-dialog-message-hint');
|
||||
|
||||
if (message) {
|
||||
Tweener.removeTweens(this._message);
|
||||
this._message.text = message;
|
||||
this._message.styleClass = _messageStyleMap[type];
|
||||
this._message.opacity = 255;
|
||||
} else {
|
||||
this._message.styleClass = null;
|
||||
this._message.opacity = 0;
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user