ModalDialog: add 'default' pseudo-class to default button
Add 'default' parameter to setButtons, that controls the binding of Return (unless overridden) and applies the 'default' pseudo-class. Currently it has no effect, but it will start having after the login dialog redesign. https://bugzilla.gnome.org/show_bug.cgi?id=619955
This commit is contained in:
parent
ac6c808124
commit
8970e17911
@ -998,7 +998,8 @@ const LoginDialog = new Lang.Class({
|
|||||||
{ action: Lang.bind(this, function() {
|
{ action: Lang.bind(this, function() {
|
||||||
hold.release();
|
hold.release();
|
||||||
}),
|
}),
|
||||||
label: C_("button", "Sign In") }];
|
label: C_("button", "Sign In"),
|
||||||
|
default: true }];
|
||||||
|
|
||||||
this._promptEntryActivateCallbackId = this._promptEntry.clutter_text.connect('activate',
|
this._promptEntryActivateCallbackId = this._promptEntry.clutter_text.connect('activate',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
|
@ -197,7 +197,8 @@ const InstallExtensionDialog = new Lang.Class({
|
|||||||
key: Clutter.Escape
|
key: Clutter.Escape
|
||||||
},
|
},
|
||||||
{ label: _("Install"),
|
{ label: _("Install"),
|
||||||
action: Lang.bind(this, this._onInstallButtonPressed)
|
action: Lang.bind(this, this._onInstallButtonPressed),
|
||||||
|
default: true
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
let message = _("Download and install '%s' from extensions.gnome.org?").format(info.name);
|
let message = _("Download and install '%s' from extensions.gnome.org?").format(info.name);
|
||||||
|
@ -65,7 +65,8 @@ const KeyringDialog = new Lang.Class({
|
|||||||
key: Clutter.Escape
|
key: Clutter.Escape
|
||||||
},
|
},
|
||||||
{ label: '',
|
{ label: '',
|
||||||
action: Lang.bind(this, this._onContinueButton)
|
action: Lang.bind(this, this._onContinueButton),
|
||||||
|
default: true
|
||||||
}]
|
}]
|
||||||
|
|
||||||
this.setButtons(buttons);
|
this.setButtons(buttons);
|
||||||
|
@ -119,11 +119,17 @@ const ModalDialog = new Lang.Class({
|
|||||||
let label = buttonInfo['label'];
|
let label = buttonInfo['label'];
|
||||||
let action = buttonInfo['action'];
|
let action = buttonInfo['action'];
|
||||||
let key = buttonInfo['key'];
|
let key = buttonInfo['key'];
|
||||||
|
let isDefault = buttonInfo['default'];
|
||||||
|
|
||||||
|
if (isDefault && !key)
|
||||||
|
key = Clutter.KEY_Return;
|
||||||
|
|
||||||
buttonInfo.button = new St.Button({ style_class: 'modal-dialog-button',
|
buttonInfo.button = new St.Button({ style_class: 'modal-dialog-button',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
label: label });
|
label: label });
|
||||||
|
if (isDefault)
|
||||||
|
buttonInfo.button.add_style_pseudo_class('default');
|
||||||
|
|
||||||
let x_alignment;
|
let x_alignment;
|
||||||
if (buttons.length == 1)
|
if (buttons.length == 1)
|
||||||
|
@ -147,7 +147,7 @@ const NetworkSecretDialog = new Lang.Class({
|
|||||||
|
|
||||||
this._okButton = { label: _("Connect"),
|
this._okButton = { label: _("Connect"),
|
||||||
action: Lang.bind(this, this._onOk),
|
action: Lang.bind(this, this._onOk),
|
||||||
key: Clutter.KEY_Return,
|
default: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setButtons([{ label: _("Cancel"),
|
this.setButtons([{ label: _("Cancel"),
|
||||||
|
@ -178,7 +178,8 @@ const AuthenticationDialog = new Lang.Class({
|
|||||||
key: Clutter.Escape
|
key: Clutter.Escape
|
||||||
},
|
},
|
||||||
{ label: _("Authenticate"),
|
{ label: _("Authenticate"),
|
||||||
action: Lang.bind(this, this._onAuthenticateButtonPressed)
|
action: Lang.bind(this, this._onAuthenticateButtonPressed),
|
||||||
|
default: true
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
this._doneEmitted = false;
|
this._doneEmitted = false;
|
||||||
|
@ -398,7 +398,8 @@ const ShellMountPasswordDialog = new Lang.Class({
|
|||||||
key: Clutter.Escape
|
key: Clutter.Escape
|
||||||
},
|
},
|
||||||
{ label: _("Unlock"),
|
{ label: _("Unlock"),
|
||||||
action: Lang.bind(this, this._onUnlockButton)
|
action: Lang.bind(this, this._onUnlockButton),
|
||||||
|
default: true
|
||||||
}];
|
}];
|
||||||
|
|
||||||
this.setButtons(buttons);
|
this.setButtons(buttons);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user