userWidget: Add empty label when user is null

Currently, when a null user is passed, we don't add any
username label. That makes the layout of user and no-user
cases inconsistent.

Add a ghost label with no opacity to mimic the username
label.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/922
This commit is contained in:
Georges Basile Stavracas Neto 2020-02-11 10:39:22 -03:00 committed by Florian Müllner
parent 0f34cbb658
commit 261d6d35f5

View File

@ -225,6 +225,14 @@ class UserWidget extends St.BoxLayout {
this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this)); this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this));
this._userChangedId = this._user.connect('changed', this._updateUser.bind(this)); this._userChangedId = this._user.connect('changed', this._updateUser.bind(this));
} else {
this._label = new St.Label({
style_class: 'user-widget-label',
text: 'Empty User',
opacity: 0,
});
this.add_child(this._label);
} }
this._updateUser(); this._updateUser();