[polari] joinDialog: Move back button into template



commit 55daae5fdc8877aee5eb97041353916bd3a380e4
Author: ranfdev <ranfdev gmail com>
Date:   Mon May 18 23:05:55 2020 +0200

    joinDialog: Move back button into template
    
    Action widgets with a response ID other than `HELP` or `CANCEL`
    are packed at the end, but adding the back button as regular
    headerbar child does work.
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/158
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/215

 data/resources/join-room-dialog.ui | 18 ++++++++++++++++++
 src/joinDialog.js                  | 10 +---------
 2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/data/resources/join-room-dialog.ui b/data/resources/join-room-dialog.ui
index f8ba87a7..ce8104a4 100644
--- a/data/resources/join-room-dialog.ui
+++ b/data/resources/join-room-dialog.ui
@@ -6,6 +6,24 @@
     <property name="destroy-with-parent">True</property>
     <property name="default-width">500</property>
     <property name="default-height">500</property>
+    <child type="titlebar">
+      <object class="GtkHeaderBar">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkButton" id="backButton">
+            <property name="visible">True</property>
+            <property name="focus-on-click">False</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="valign">center</property>
+                <property name="icon-name">go-previous-symbolic</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
     <child type="action">
       <object class="GtkButton" id="cancelButton">
         <property name="label" translatable="yes">_Cancel</property>
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 40e97873..a22c6416 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -26,21 +26,13 @@ export default GObject.registerClass({
         'details',
         'addButton',
         'customToggle',
+        'backButton',
     ],
 }, class JoinDialog extends Gtk.Dialog {
     _init(params) {
         params['use-header-bar'] = 1;
         super._init(params);
 
-        // TODO: Is there really no way to do this in the template?
-        let icon = new Gtk.Image({ icon_name: 'go-previous-symbolic' });
-        this._backButton = new Gtk.Button({
-            image: icon,
-            valign: Gtk.Align.CENTER,
-            focus_on_click: false,
-        });
-        this.get_header_bar().pack_start(this._backButton);
-
         let accelGroup = new Gtk.AccelGroup();
         this._connectionButton.add_accelerator('clicked',
             accelGroup, Gdk.KEY_n, Gdk.ModifierType.CONTROL_MASK, 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]