userWidget: Pack vertically and align in the center
This commit is contained in:
parent
4c288bd122
commit
ca046cd29b
@ -1884,6 +1884,7 @@ StScrollBar {
|
|||||||
.user-icon {
|
.user-icon {
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
color: $osd_fg_color;
|
color: $osd_fg_color;
|
||||||
|
text-align: center;
|
||||||
border-radius: 99px;
|
border-radius: 99px;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: lighten($osd_fg_color,30%);
|
color: lighten($osd_fg_color,30%);
|
||||||
@ -2010,15 +2011,11 @@ StScrollBar {
|
|||||||
.login-dialog-username,
|
.login-dialog-username,
|
||||||
.user-widget-label {
|
.user-widget-label {
|
||||||
color: $osd_fg_color;
|
color: $osd_fg_color;
|
||||||
font-size: 120%;
|
font-size: 11pt;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: left;
|
text-align: center;
|
||||||
padding-left: 15px;
|
padding-top: 24px;
|
||||||
}
|
}
|
||||||
.user-widget-label {
|
|
||||||
&:ltr { padding-left: 14px; }
|
|
||||||
&:rtl { padding-right: 14px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-dialog-prompt-layout {
|
.login-dialog-prompt-layout {
|
||||||
padding-top: 24px;
|
padding-top: 24px;
|
||||||
|
@ -445,7 +445,7 @@ var AuthPrompt = GObject.registerClass({
|
|||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
let userWidget = new UserWidget.UserWidget(user);
|
let userWidget = new UserWidget.UserWidget(user);
|
||||||
userWidget.x_align = Clutter.ActorAlign.START;
|
userWidget.x_align = Clutter.ActorAlign.CENTER;
|
||||||
this._userWell.set_child(userWidget);
|
this._userWell.set_child(userWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ const { Clutter, GLib, GObject, St } = imports.gi;
|
|||||||
|
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
var AVATAR_ICON_SIZE = 64;
|
var AVATAR_ICON_SIZE = 128;
|
||||||
|
|
||||||
// Adapted from gdm/gui/user-switch-applet/applet.c
|
// Adapted from gdm/gui/user-switch-applet/applet.c
|
||||||
//
|
//
|
||||||
@ -20,7 +20,8 @@ class Avatar extends St.Bin {
|
|||||||
let themeContext = St.ThemeContext.get_for_stage(global.stage);
|
let themeContext = St.ThemeContext.get_for_stage(global.stage);
|
||||||
params = Params.parse(params, { reactive: false,
|
params = Params.parse(params, { reactive: false,
|
||||||
iconSize: AVATAR_ICON_SIZE,
|
iconSize: AVATAR_ICON_SIZE,
|
||||||
styleClass: 'user-icon' });
|
styleClass: 'user-icon',
|
||||||
|
x_align: St.Align.MIDDLE, });
|
||||||
|
|
||||||
super._init({
|
super._init({
|
||||||
style_class: params.styleClass,
|
style_class: params.styleClass,
|
||||||
@ -73,7 +74,9 @@ class Avatar extends St.Bin {
|
|||||||
} else {
|
} else {
|
||||||
this.style = null;
|
this.style = null;
|
||||||
this.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
|
this.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
|
||||||
icon_size: this._iconSize });
|
icon_size: this._iconSize,
|
||||||
|
x_expand: true,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -86,11 +89,13 @@ class UserWidgetLabel extends St.Widget {
|
|||||||
this._user = user;
|
this._user = user;
|
||||||
|
|
||||||
this._realNameLabel = new St.Label({ style_class: 'user-widget-label',
|
this._realNameLabel = new St.Label({ style_class: 'user-widget-label',
|
||||||
y_align: Clutter.ActorAlign.CENTER });
|
x_expand: true,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER });
|
||||||
this.add_child(this._realNameLabel);
|
this.add_child(this._realNameLabel);
|
||||||
|
|
||||||
this._userNameLabel = new St.Label({ style_class: 'user-widget-label',
|
this._userNameLabel = new St.Label({ style_class: 'user-widget-label',
|
||||||
y_align: Clutter.ActorAlign.CENTER });
|
x_expand: true,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER });
|
||||||
this.add_child(this._userNameLabel);
|
this.add_child(this._userNameLabel);
|
||||||
|
|
||||||
this._currentLabel = null;
|
this._currentLabel = null;
|
||||||
@ -160,7 +165,7 @@ class UserWidgetLabel extends St.Widget {
|
|||||||
var UserWidget = GObject.registerClass(
|
var UserWidget = GObject.registerClass(
|
||||||
class UserWidget extends St.BoxLayout {
|
class UserWidget extends St.BoxLayout {
|
||||||
_init(user) {
|
_init(user) {
|
||||||
super._init({ style_class: 'user-widget', vertical: false });
|
super._init({ style_class: 'user-widget', vertical: true });
|
||||||
|
|
||||||
this._user = user;
|
this._user = user;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user