[gnome-characters/bilelmoussaoui/gtk4] character dialog: use a leaflet



commit 8bf1068587828da49d84924787843fac9f0a2507
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Tue Nov 23 08:27:36 2021 +0100

    character dialog: use a leaflet

 data/character_dialog.ui | 7 ++++---
 src/characterDialog.js   | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/data/character_dialog.ui b/data/character_dialog.ui
index e5e158b..e35d51b 100644
--- a/data/character_dialog.ui
+++ b/data/character_dialog.ui
@@ -27,9 +27,10 @@
               </object>
             </child>
             <child>
-              <object class="GtkStack" id="mainStack">
+              <object class="AdwLeaflet" id="leaflet">
+                <property name="can-unfold">false</property>
                 <child>
-                  <object class="GtkStackPage">
+                  <object class="AdwLeafletPage">
                     <property name="name">character</property>
                     <property name="child">
                       <object class="GtkBox">
@@ -133,7 +134,7 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkStackPage">
+                  <object class="AdwLeafletPage">
                     <property name="name">related</property>
                     <property name="child">
                       <object class="GtkScrolledWindow" id="related-scrolled">
diff --git a/src/characterDialog.js b/src/characterDialog.js
index d45da7c..4837e54 100644
--- a/src/characterDialog.js
+++ b/src/characterDialog.js
@@ -27,7 +27,7 @@ var CharacterDialog = GObject.registerClass({
     },
     Template: 'resource:///org/gnome/Characters/character_dialog.ui',
     InternalChildren: [
-        'mainStack', 'characterStack',
+        'leaflet', 'characterStack',
         'characterLabel', 'missingLabel', 'detailLabel',
         'seeAlsoRow', 'relatedListbox',
         'windowTitle', 'revealer', 'toastOverlay',
@@ -139,12 +139,12 @@ var CharacterDialog = GObject.registerClass({
 
     _seeMore() {
         this._revealer.reveal_child = true;
-        this._mainStack.visible_child_name = 'related';
+        this._leaflet.navigate(Adw.NavigationDirection.FORWARD);
     }
 
     _seeCharacter() {
         this._revealer.reveal_child = false;
-        this._mainStack.visible_child_name = 'character';
+        this._leaflet.navigate(Adw.NavigationDirection.BACK);
     }
 
     _copyCharacter() {


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