endSessionDialog: Immediately add buttons to the dialog
Immediately add buttons to the dialog instead of first building an array of button-info structs. This is a preparation patch for adding support changing the "Reboot" button into a "Boot Options" button when Alt is pressed. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/199
This commit is contained in:
parent
2af7264cff
commit
9d4a3a614d
@ -364,15 +364,17 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateButtons() {
|
_updateButtons() {
|
||||||
let dialogContent = DialogContent[this._type];
|
this.clearButtons();
|
||||||
let buttons = [{ action: this.cancel.bind(this),
|
|
||||||
label: _("Cancel"),
|
|
||||||
key: Clutter.KEY_Escape }];
|
|
||||||
|
|
||||||
|
this.addButton({ action: this.cancel.bind(this),
|
||||||
|
label: _("Cancel"),
|
||||||
|
key: Clutter.KEY_Escape });
|
||||||
|
|
||||||
|
let dialogContent = DialogContent[this._type];
|
||||||
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
||||||
let signal = dialogContent.confirmButtons[i].signal;
|
let signal = dialogContent.confirmButtons[i].signal;
|
||||||
let label = dialogContent.confirmButtons[i].label;
|
let label = dialogContent.confirmButtons[i].label;
|
||||||
buttons.push({
|
let button = this.addButton({
|
||||||
action: () => {
|
action: () => {
|
||||||
this.close(true);
|
this.close(true);
|
||||||
let signalId = this.connect('closed', () => {
|
let signalId = this.connect('closed', () => {
|
||||||
@ -383,8 +385,6 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
label,
|
label,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setButtons(buttons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close(skipSignal) {
|
close(skipSignal) {
|
||||||
|
Loading…
Reference in New Issue
Block a user