2019-08-09 22:56:47 +00:00
|
|
|
From 5f81215e9771b14be1562d82f54db3fdb92521e3 Mon Sep 17 00:00:00 2001
|
2018-09-27 07:26:30 +00:00
|
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
Date: Wed, 15 Aug 2018 14:26:19 +0200
|
|
|
|
Subject: [PATCH 1/2] 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.
|
|
|
|
---
|
2019-08-09 22:56:47 +00:00
|
|
|
js/ui/endSessionDialog.js | 28 +++++++++++++++-------------
|
|
|
|
1 file changed, 15 insertions(+), 13 deletions(-)
|
2018-09-27 07:26:30 +00:00
|
|
|
|
|
|
|
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
|
2019-08-09 22:56:47 +00:00
|
|
|
index 0b475b6f9..301d8c9bf 100644
|
2018-09-27 07:26:30 +00:00
|
|
|
--- a/js/ui/endSessionDialog.js
|
|
|
|
+++ b/js/ui/endSessionDialog.js
|
2019-08-09 22:56:47 +00:00
|
|
|
@@ -440,25 +440,27 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
2019-02-07 01:50:26 +00:00
|
|
|
}
|
2018-09-27 07:26:30 +00:00
|
|
|
|
|
|
|
_updateButtons() {
|
|
|
|
- let dialogContent = DialogContent[this._type];
|
|
|
|
- let buttons = [{ action: this.cancel.bind(this),
|
|
|
|
+ this.clearButtons();
|
|
|
|
+
|
|
|
|
+ this.addButton({ action: this.cancel.bind(this),
|
2019-07-20 16:42:26 +00:00
|
|
|
label: _("Cancel"),
|
|
|
|
- key: Clutter.Escape }];
|
|
|
|
+ key: Clutter.Escape });
|
2018-09-27 07:26:30 +00:00
|
|
|
|
|
|
|
+ let dialogContent = DialogContent[this._type];
|
|
|
|
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
|
|
|
let signal = dialogContent.confirmButtons[i].signal;
|
|
|
|
let label = dialogContent.confirmButtons[i].label;
|
|
|
|
- buttons.push({ action: () => {
|
2019-08-09 22:56:47 +00:00
|
|
|
- this.close(true);
|
|
|
|
- let signalId = this.connect('closed', () => {
|
|
|
|
- this.disconnect(signalId);
|
|
|
|
- this._confirm(signal);
|
|
|
|
- });
|
2018-09-27 07:26:30 +00:00
|
|
|
- },
|
|
|
|
- label: label });
|
2019-08-09 22:56:47 +00:00
|
|
|
+ let button = this.addButton({
|
|
|
|
+ action: () => {
|
|
|
|
+ this.close(true);
|
|
|
|
+ let signalId = this.connect('closed', () => {
|
|
|
|
+ this.disconnect(signalId);
|
|
|
|
+ this._confirm(signal);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ label
|
|
|
|
+ });
|
2018-09-27 07:26:30 +00:00
|
|
|
}
|
|
|
|
-
|
|
|
|
- this.setButtons(buttons);
|
2019-02-07 01:50:26 +00:00
|
|
|
}
|
2018-09-27 07:26:30 +00:00
|
|
|
|
|
|
|
close(skipSignal) {
|
|
|
|
--
|
2019-07-20 16:42:26 +00:00
|
|
|
2.21.0
|
2018-09-27 07:26:30 +00:00
|
|
|
|