|
Florian Müllner |
108bb2b |
From a6da8cb41e5e2a19f790770efb5c241d476ae7b7 Mon Sep 17 00:00:00 2001
|
|
|
22f01e4 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
22f01e4 |
Date: Wed, 15 Aug 2018 14:26:19 +0200
|
|
|
22f01e4 |
Subject: [PATCH 1/2] endSessionDialog: Immediately add buttons to the dialog
|
|
|
22f01e4 |
|
|
|
22f01e4 |
Immediately add buttons to the dialog instead of first building an
|
|
|
22f01e4 |
array of button-info structs.
|
|
|
22f01e4 |
|
|
|
22f01e4 |
This is a preparation patch for adding support changing the "Reboot"
|
|
|
22f01e4 |
button into a "Boot Options" button when Alt is pressed.
|
|
|
22f01e4 |
---
|
|
|
22f01e4 |
js/ui/endSessionDialog.js | 17 +++++++++--------
|
|
|
22f01e4 |
1 file changed, 9 insertions(+), 8 deletions(-)
|
|
|
22f01e4 |
|
|
|
22f01e4 |
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
|
|
Florian Müllner |
108bb2b |
index ead7eae78..faeefe276 100644
|
|
|
22f01e4 |
--- a/js/ui/endSessionDialog.js
|
|
|
22f01e4 |
+++ b/js/ui/endSessionDialog.js
|
|
Florian Müllner |
108bb2b |
@@ -439,25 +439,26 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|
Florian Müllner |
ccbb314 |
}
|
|
|
22f01e4 |
|
|
|
22f01e4 |
_updateButtons() {
|
|
|
22f01e4 |
- let dialogContent = DialogContent[this._type];
|
|
|
22f01e4 |
- let buttons = [{ action: this.cancel.bind(this),
|
|
|
22f01e4 |
+ this.clearButtons();
|
|
|
22f01e4 |
+
|
|
|
22f01e4 |
+ this.addButton({ action: this.cancel.bind(this),
|
|
Florian Müllner |
108bb2b |
label: _("Cancel"),
|
|
Florian Müllner |
108bb2b |
- key: Clutter.Escape }];
|
|
Florian Müllner |
108bb2b |
+ key: Clutter.Escape });
|
|
|
22f01e4 |
|
|
|
22f01e4 |
+ let dialogContent = DialogContent[this._type];
|
|
|
22f01e4 |
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
|
|
22f01e4 |
let signal = dialogContent.confirmButtons[i].signal;
|
|
|
22f01e4 |
let label = dialogContent.confirmButtons[i].label;
|
|
|
22f01e4 |
- buttons.push({ action: () => {
|
|
|
22f01e4 |
+ let button = this.addButton(
|
|
|
22f01e4 |
+ { action: () => {
|
|
|
22f01e4 |
this.close(true);
|
|
|
22f01e4 |
let signalId = this.connect('closed', () => {
|
|
|
22f01e4 |
this.disconnect(signalId);
|
|
|
22f01e4 |
this._confirm(signal);
|
|
|
22f01e4 |
});
|
|
|
22f01e4 |
- },
|
|
|
22f01e4 |
- label: label });
|
|
|
22f01e4 |
+ },
|
|
|
22f01e4 |
+ label: label });
|
|
|
22f01e4 |
}
|
|
|
22f01e4 |
-
|
|
|
22f01e4 |
- this.setButtons(buttons);
|
|
Florian Müllner |
ccbb314 |
}
|
|
|
22f01e4 |
|
|
|
22f01e4 |
close(skipSignal) {
|
|
|
22f01e4 |
--
|
|
Florian Müllner |
108bb2b |
2.21.0
|
|
|
22f01e4 |
|