userWidget: Adapt if user is not mentioned for username login
If username-based login flow is followed, we need a default avatar for the userWidget. Hence, check if the user passed to userWidget is (null) which implies a username-based login flow. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/922
This commit is contained in:
parent
aebea82474
commit
654093dc40
@ -424,11 +424,9 @@ var AuthPrompt = GObject.registerClass({
|
|||||||
if (oldChild)
|
if (oldChild)
|
||||||
oldChild.destroy();
|
oldChild.destroy();
|
||||||
|
|
||||||
if (user) {
|
|
||||||
let userWidget = new UserWidget.UserWidget(user, Clutter.Orientation.VERTICAL);
|
let userWidget = new UserWidget.UserWidget(user, Clutter.Orientation.VERTICAL);
|
||||||
this._userWell.set_child(userWidget);
|
this._userWell.set_child(userWidget);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
let oldStatus = this.verificationStatus;
|
let oldStatus = this.verificationStatus;
|
||||||
|
@ -86,9 +86,12 @@ class Avatar extends St.Bin {
|
|||||||
update() {
|
update() {
|
||||||
let iconSize = this._getIconSize();
|
let iconSize = this._getIconSize();
|
||||||
|
|
||||||
let iconFile = this._user.get_icon_file();
|
let iconFile = null;
|
||||||
|
if (this._user) {
|
||||||
|
iconFile = this._user.get_icon_file();
|
||||||
if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
|
if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
|
||||||
iconFile = null;
|
iconFile = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (iconFile) {
|
if (iconFile) {
|
||||||
this.child = null;
|
this.child = null;
|
||||||
@ -192,6 +195,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, orientation = Clutter.Orientation.HORIZONTAL) {
|
_init(user, orientation = Clutter.Orientation.HORIZONTAL) {
|
||||||
|
// If user is null, that implies a username-based login authorization.
|
||||||
this._user = user;
|
this._user = user;
|
||||||
|
|
||||||
let vertical = orientation == Clutter.Orientation.VERTICAL;
|
let vertical = orientation == Clutter.Orientation.VERTICAL;
|
||||||
@ -210,6 +214,9 @@ class UserWidget extends St.BoxLayout {
|
|||||||
this._avatar.x_align = Clutter.ActorAlign.CENTER;
|
this._avatar.x_align = Clutter.ActorAlign.CENTER;
|
||||||
this.add_child(this._avatar);
|
this.add_child(this._avatar);
|
||||||
|
|
||||||
|
this._userLoadedId = 0;
|
||||||
|
this._userChangedId = 0;
|
||||||
|
if (user) {
|
||||||
this._label = new UserWidgetLabel(user);
|
this._label = new UserWidgetLabel(user);
|
||||||
this.add_child(this._label);
|
this.add_child(this._label);
|
||||||
|
|
||||||
@ -218,6 +225,8 @@ 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));
|
||||||
|
}
|
||||||
|
|
||||||
this._updateUser();
|
this._updateUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user