loginDialog: Stop using Shell.GenericContainer

Removing the Shell.GenericContainer from the login dialog
was remarkably easier, since it only overrides 'allocate'.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
This commit is contained in:
Georges Basile Stavracas Neto 2018-07-07 13:30:18 +02:00
parent dd225713a1
commit 0c0d76f7d6
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -408,16 +408,18 @@ Signals.addSignalMethods(SessionMenuButton.prototype);
var LoginDialog = new Lang.Class({ var LoginDialog = new Lang.Class({
Name: 'LoginDialog', Name: 'LoginDialog',
Extends: St.Widget,
Signals: { 'failed': {} },
_init(parentActor) { _init(parentActor) {
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog', this.parent({ style_class: 'login-dialog',
visible: false }); visible: false });
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
this.actor.add_constraint(new Layout.MonitorConstraint({ primary: true })); this.get_accessible().set_role(Atk.Role.WINDOW);
this.actor.connect('allocate', this._onAllocate.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this)); this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
parentActor.add_child(this.actor); this.connect('destroy', this._onDestroy.bind(this));
parentActor.add_child(this);
this._userManager = AccountsService.UserManager.get_default() this._userManager = AccountsService.UserManager.get_default()
this._gdmClient = new Gdm.Client(); this._gdmClient = new Gdm.Client();
@ -442,7 +444,7 @@ var LoginDialog = new Lang.Class({
y_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER,
vertical: true, vertical: true,
visible: false }); visible: false });
this.actor.add_child(this._userSelectionBox); this.add_child(this._userSelectionBox);
this._userList = new UserList(); this._userList = new UserList();
this._userSelectionBox.add(this._userList.actor, this._userSelectionBox.add(this._userList.actor,
@ -454,7 +456,7 @@ var LoginDialog = new Lang.Class({
this._authPrompt.connect('prompted', this._onPrompted.bind(this)); this._authPrompt.connect('prompted', this._onPrompted.bind(this));
this._authPrompt.connect('reset', this._onReset.bind(this)); this._authPrompt.connect('reset', this._onReset.bind(this));
this._authPrompt.hide(); this._authPrompt.hide();
this.actor.add_child(this._authPrompt.actor); this.add_child(this._authPrompt.actor);
// translators: this message is shown below the user list on the // translators: this message is shown below the user list on the
// login screen. It can be activated to reveal an entry for // login screen. It can be activated to reveal an entry for
@ -482,7 +484,7 @@ var LoginDialog = new Lang.Class({
opacity: 0, opacity: 0,
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC, vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
hscrollbar_policy: Gtk.PolicyType.NEVER }); hscrollbar_policy: Gtk.PolicyType.NEVER });
this.actor.add_child(this._bannerView); this.add_child(this._bannerView);
let bannerBox = new St.BoxLayout({ vertical: true }); let bannerBox = new St.BoxLayout({ vertical: true });
@ -497,7 +499,7 @@ var LoginDialog = new Lang.Class({
this._logoBin = new St.Widget({ style_class: 'login-dialog-logo-bin', this._logoBin = new St.Widget({ style_class: 'login-dialog-logo-bin',
x_align: Clutter.ActorAlign.CENTER, x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.END }); y_align: Clutter.ActorAlign.END });
this.actor.add_child(this._logoBin); this.add_child(this._logoBin);
this._updateLogo(); this._updateLogo();
this._userList.connect('activate', (userList, item) => { this._userList.connect('activate', (userList, item) => {
@ -576,7 +578,12 @@ var LoginDialog = new Lang.Class({
return actorBox; return actorBox;
}, },
_onAllocate(actor, dialogBox, flags) { vfunc_allocate(dialogBox, flags) {
this.set_allocation(dialogBox, flags);
let themeNode = this.get_theme_node();
dialogBox = themeNode.get_content_box(dialogBox);
let dialogWidth = dialogBox.x2 - dialogBox.x1; let dialogWidth = dialogBox.x2 - dialogBox.x1;
let dialogHeight = dialogBox.y2 - dialogBox.y1; let dialogHeight = dialogBox.y2 - dialogBox.y1;
@ -919,10 +926,10 @@ var LoginDialog = new Lang.Class({
}, },
_loginScreenSessionActivated() { _loginScreenSessionActivated() {
if (this.actor.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING) if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
return; return;
Tweener.addTween(this.actor, Tweener.addTween(this,
{ opacity: 255, { opacity: 255,
time: _FADE_ANIMATION_TIME, time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
@ -931,7 +938,7 @@ var LoginDialog = new Lang.Class({
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
if (children[i] != Main.layoutManager.screenShieldGroup) if (children[i] != Main.layoutManager.screenShieldGroup)
children[i].opacity = this.actor.opacity; children[i].opacity = this.opacity;
} }
}, },
onUpdateScope: this, onUpdateScope: this,
@ -952,7 +959,7 @@ var LoginDialog = new Lang.Class({
}, },
_startSession(serviceName) { _startSession(serviceName) {
Tweener.addTween(this.actor, Tweener.addTween(this,
{ opacity: 0, { opacity: 0,
time: _FADE_ANIMATION_TIME, time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
@ -961,7 +968,7 @@ var LoginDialog = new Lang.Class({
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
if (children[i] != Main.layoutManager.screenShieldGroup) if (children[i] != Main.layoutManager.screenShieldGroup)
children[i].opacity = this.actor.opacity; children[i].opacity = this.opacity;
} }
}, },
onUpdateScope: this, onUpdateScope: this,
@ -1230,17 +1237,17 @@ var LoginDialog = new Lang.Class({
}, },
open() { open() {
Main.ctrlAltTabManager.addGroup(this.actor, Main.ctrlAltTabManager.addGroup(this,
_("Login Window"), _("Login Window"),
'dialog-password-symbolic', 'dialog-password-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.MIDDLE }); { sortGroup: CtrlAltTab.SortGroup.MIDDLE });
this._userList.actor.grab_key_focus(); this._userList.actor.grab_key_focus();
this.actor.show(); this.show();
this.actor.opacity = 0; this.opacity = 0;
Main.pushModal(this.actor, { actionMode: Shell.ActionMode.LOGIN_SCREEN }); Main.pushModal(this, { actionMode: Shell.ActionMode.LOGIN_SCREEN });
Tweener.addTween(this.actor, Tweener.addTween(this,
{ opacity: 255, { opacity: 255,
time: 1, time: 1,
transition: 'easeInQuad' }); transition: 'easeInQuad' });
@ -1249,8 +1256,8 @@ var LoginDialog = new Lang.Class({
}, },
close() { close() {
Main.popModal(this.actor); Main.popModal(this);
Main.ctrlAltTabManager.removeGroup(this.actor); Main.ctrlAltTabManager.removeGroup(this);
}, },
cancel() { cancel() {
@ -1265,4 +1272,3 @@ var LoginDialog = new Lang.Class({
this._authPrompt.finish(onComplete); this._authPrompt.finish(onComplete);
}, },
}); });
Signals.addSignalMethods(LoginDialog.prototype);