Florian Müllner ccbb314
From ec93430e77cd572cfd313a399128744d9b05e7b9 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 ccbb314
index 1d6efc5ec..d107c87d9 100644
22f01e4
--- a/js/ui/endSessionDialog.js
22f01e4
+++ b/js/ui/endSessionDialog.js
Florian Müllner ccbb314
@@ -432,25 +432,26 @@ var EndSessionDialog = 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),
22f01e4
                          label:  _("Cancel"),
22f01e4
-                         key:    Clutter.Escape }];
22f01e4
+                         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 ccbb314
2.20.1
22f01e4