[gnome-games/wip/exalm/unified-window: 58/60] preferences-window: Port to HdyWindow



commit 50046e5fd20a73318bafb0807c1eeb8cb2d1370c
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Apr 10 19:15:53 2020 +0500

    preferences-window: Port to HdyWindow

 data/ui/preferences-window.ui  | 256 ++++++++++++++++++++---------------------
 src/ui/preferences-window.vala |   6 +-
 2 files changed, 127 insertions(+), 135 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index 1a579859..6b96dccf 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -1,164 +1,176 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.24"/>
-  <template class="GamesPreferencesWindow" parent="GtkWindow">
+  <template class="GamesPreferencesWindow" parent="HdyWindow">
     <property name="title" translatable="yes">Preferences</property>
     <property name="default-width">800</property>
     <property name="default-height">500</property>
     <property name="window-position">center-on-parent</property>
-    <child type="titlebar">
-      <object class="HdyTitleBar" id="titlebar">
+    <child>
+      <object class="HdyDeck" id="content_deck">
         <property name="visible">True</property>
+        <signal name="notify::transition-running" handler="subpage_transition_finished"/>
+        <signal name="notify::visible-child" handler="on_visible_child_changed"/>
         <child>
-          <object class="HdyDeck" id="titlebar_deck">
+          <object class="HdyLeaflet" id="content_leaflet">
             <property name="visible">True</property>
+            <property name="can-swipe-back">True</property>
+            <signal name="notify::folded" handler="on_folded_changed" after="yes"/>
+            <signal name="notify::visible-child" handler="update_header_group"/>
             <child>
-              <object class="HdyLeaflet" id="titlebar_leaflet">
+              <object class="GtkBox">
                 <property name="visible">True</property>
-                <signal name="notify::visible-child" handler="update_header_group"/>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkHeaderBar" id="left_header_bar">
-                    <property name="name">left_header_bar</property>
+                  <object class="HdyWindowHandle">
                     <property name="visible">True</property>
-                    <property name="title" translatable="yes">Preferences</property>
-                    <property name="show-close-button">True</property>
                     <child>
-                      <object class="GtkButton" id="window_back_button">
-                        <property name="visible">False</property>
-                        <signal name="clicked" handler="on_back_clicked"/>
+                      <object class="GtkHeaderBar" id="left_header_bar">
+                        <property name="visible">True</property>
+                        <property name="title" translatable="yes">Preferences</property>
+                        <property name="show-close-button">True</property>
                         <style>
-                          <class name="image-button"/>
+                          <class name="titlebar"/>
                         </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject">
-                            <property name="accessible-name" translatable="yes">Back</property>
-                          </object>
-                        </child>
                         <child>
-                          <object class="GtkImage">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-previous-symbolic</property>
-                            <property name="icon-size">1</property>
+                          <object class="GtkButton" id="window_back_button">
+                            <property name="visible">False</property>
+                            <signal name="clicked" handler="on_back_clicked"/>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                            <child internal-child="accessible">
+                              <object class="AtkObject">
+                                <property name="accessible-name" translatable="yes">Back</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">True</property>
+                                <property name="icon-name">go-previous-symbolic</property>
+                                <property name="icon-size">1</property>
+                              </object>
+                            </child>
                           </object>
+                          <packing>
+                            <property name="pack-type">start</property>
+                          </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="pack-type">start</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkSeparator" id="header_separator">
-                    <property name="orientation">vertical</property>
+                  <object class="GamesPreferencesSidebar" id="sidebar">
                     <property name="visible">True</property>
-                    <style>
-                      <class name="sidebar"/>
-                    </style>
+                    <property name="stack">stack</property>
+                    <property name="vexpand">True</property>
+                    <property name="width-request">150</property>
+                    <signal name="row-selected" handler="sidebar_row_selected"/>
                   </object>
-                  <packing>
-                    <property name="allow-visible">False</property>
-                  </packing>
                 </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="vexpand">True</property>
                 <child>
-                  <object class="GtkHeaderBar" id="right_header_bar">
-                    <property name="name">right_header_bar</property>
+                  <object class="HdyWindowHandle">
                     <property name="visible">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="show-close-button">True</property>
                     <child>
-                      <object class="GtkButton" id="page_back_button">
-                        <property name="visible">False</property>
-                        <signal name="clicked" handler="on_back_clicked"/>
+                      <object class="GtkSeparator" id="header_separator">
+                        <property name="orientation">vertical</property>
+                        <property name="visible">True</property>
                         <style>
-                          <class name="image-button"/>
+                          <class name="sidebar"/>
                         </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject">
-                            <property name="accessible-name" translatable="yes">Back</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkImage">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-previous-symbolic</property>
-                            <property name="icon-size">1</property>
-                          </object>
-                        </child>
                       </object>
-                      <packing>
-                        <property name="pack-type">start</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkBox" id="titlebar_subpage_box">
-                <property name="visible">True</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="HdyDeck" id="content_deck">
-        <property name="visible">True</property>
-        <signal name="notify::transition-running" handler="subpage_transition_finished"/>
-        <signal name="notify::visible-child" handler="on_visible_child_changed"/>
-        <child>
-          <object class="HdyLeaflet" id="content_leaflet">
-            <property name="visible">True</property>
-            <property name="can-swipe-back">True</property>
-            <signal name="notify::folded" handler="on_folded_changed" after="yes"/>
-            <child>
-              <object class="GamesPreferencesSidebar" id="sidebar">
-                <property name="stack">stack</property>
-                <property name="vexpand">True</property>
-                <property name="visible">True</property>
-                <property name="width-request">150</property>
-                <signal name="row-selected" handler="sidebar_row_selected"/>
-              </object>
-            </child>
-            <child>
-              <object class="GtkSeparator" id="separator">
-                <property name="orientation">vertical</property>
-                <property name="visible">True</property>
-                <style>
-                  <class name="sidebar"/>
-                </style>
+                <child>
+                  <object class="GtkSeparator">
+                    <property name="orientation">vertical</property>
+                    <property name="visible">True</property>
+                    <property name="vexpand">True</property>
+                    <style>
+                      <class name="sidebar"/>
+                    </style>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="allow-visible">False</property>
               </packing>
             </child>
             <child>
-              <object class="GtkStack" id="stack">
+              <object class="GtkBox">
                 <property name="visible">True</property>
-                <property name="expand">True</property>
-                <property name="visible-child">video_page</property>
-                <property name="transition-type">crossfade</property>
-                <property name="width-request">300</property>
-                <child>
-                  <object class="GamesPreferencesPageVideo" id="video_page">
-                    <property name="visible">True</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GamesPreferencesPageControllers" id="controllers_page">
-                    <property name="visible">True</property>
-                  </object>
-                </child>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GamesPreferencesPagePlatforms" id="platforms_page">
+                  <object class="HdyWindowHandle">
                     <property name="visible">True</property>
+                    <child>
+                      <object class="GtkHeaderBar" id="right_header_bar">
+                        <property name="visible">True</property>
+                        <property name="show-close-button">True</property>
+                        <child>
+                          <object class="GtkButton" id="page_back_button">
+                            <property name="visible">False</property>
+                            <signal name="clicked" handler="on_back_clicked"/>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                            <child internal-child="accessible">
+                              <object class="AtkObject">
+                                <property name="accessible-name" translatable="yes">Back</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">True</property>
+                                <property name="icon-name">go-previous-symbolic</property>
+                                <property name="icon-size">1</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="pack-type">start</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
-                  <object class="GamesPreferencesPageImportExport" id="import_export_page">
+                  <object class="GtkStack" id="stack">
                     <property name="visible">True</property>
+                    <property name="expand">True</property>
+                    <property name="visible-child">video_page</property>
+                    <property name="transition-type">crossfade</property>
+                    <property name="width-request">300</property>
+                    <child>
+                      <object class="GamesPreferencesPageVideo" id="video_page">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GamesPreferencesPageControllers" id="controllers_page">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GamesPreferencesPagePlatforms" id="platforms_page">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GamesPreferencesPageImportExport" id="import_export_page">
+                        <property name="visible">True</property>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
@@ -175,17 +187,11 @@
     </child>
   </template>
   <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
+    <property name="mode">vertical</property>
     <widgets>
       <widget name="left_header_bar"/>
-      <widget name="sidebar"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
-    <widgets>
+      <widget name="header_separator"/>
       <widget name="right_header_bar"/>
-      <widget name="stack"/>
     </widgets>
   </object>
   <object class="HdyHeaderGroup" id="header_group">
@@ -194,16 +200,4 @@
       <headerbar name="right_header_bar"/>
     </headerbars>
   </object>
-  <object class="HdySwipeGroup">
-    <swipeables>
-      <swipeable name="titlebar_deck"/>
-      <swipeable name="content_deck"/>
-    </swipeables>
-  </object>
-  <object class="HdySwipeGroup">
-    <swipeables>
-      <swipeable name="titlebar_leaflet"/>
-      <swipeable name="content_leaflet"/>
-    </swipeables>
-  </object>
 </interface>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 533eae8c..5ff4def4 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -1,9 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 [GtkTemplate (ui = "/org/gnome/Games/ui/preferences-window.ui")]
-private class Games.PreferencesWindow : Gtk.Window {
-       [GtkChild]
-       private Hdy.Leaflet titlebar_leaflet;
+private class Games.PreferencesWindow : Hdy.Window {
        [GtkChild]
        private Gtk.HeaderBar right_header_bar;
        [GtkChild]
@@ -133,7 +131,7 @@ private class Games.PreferencesWindow : Gtk.Window {
        [GtkCallback]
        private void update_header_group () {
                var folded = content_leaflet.folded;
-               var visible_header_bar = titlebar_leaflet.visible_child as Gtk.HeaderBar;
+               var visible_header_bar = content_leaflet.visible_child as Gtk.HeaderBar;
 
                if (folded)
                        header_group.focus = visible_header_bar;


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