[gnome-todo] task-lists-workspace: Use AdwFlap for sidebar



commit 24f6e9a119bdd6ad73ce2b01347473fcf27f6010
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Apr 4 16:39:28 2021 -0300

    task-lists-workspace: Use AdwFlap for sidebar

 src/gui/gtd-window.c                               |  4 +-
 src/gui/gtd-window.ui                              |  4 +-
 .../gtd-task-lists-workspace.ui                    | 44 ++++++++++++----------
 3 files changed, 29 insertions(+), 23 deletions(-)
---
diff --git a/src/gui/gtd-window.c b/src/gui/gtd-window.c
index d72e9a5d..bc87bd8f 100644
--- a/src/gui/gtd-window.c
+++ b/src/gui/gtd-window.c
@@ -58,7 +58,7 @@ struct _GtdWindow
 {
   AdwApplicationWindow application;
 
-  GtkHeaderBar       *headerbar;
+  AdwHeaderBar       *headerbar;
   GtkBox             *headerbar_box;
   GtkRevealer        *headerbar_overlay_revealer;
   GtkStack           *stack;
@@ -291,7 +291,7 @@ on_action_toggle_fullscreen_state_changed_cb (GSimpleAction *simple,
 
   g_clear_handle_id (&self->toggle_headerbar_revealer_id, g_source_remove);
 
-  gtk_header_bar_set_show_title_buttons (self->headerbar, !fullscreen);
+  adw_header_bar_set_show_end_title_buttons (self->headerbar, !fullscreen);
 
   g_object_ref (self->headerbar);
   if (fullscreen)
diff --git a/src/gui/gtd-window.ui b/src/gui/gtd-window.ui
index c7b74f05..9d6f345a 100644
--- a/src/gui/gtd-window.ui
+++ b/src/gui/gtd-window.ui
@@ -37,9 +37,9 @@
               <child>
                 <object class="GtkBox" id="headerbar_box">
                   <child>
-                    <object class="GtkHeaderBar" id="headerbar">
+                    <object class="AdwHeaderBar" id="headerbar">
                       <property name="hexpand">1</property>
-                      <property name="show-title-buttons">1</property>
+                      <property name="show-end-title-buttons">1</property>
 
                       <!-- Workspace Button -->
                       <child>
diff --git a/src/plugins/task-lists-workspace/gtd-task-lists-workspace.ui 
b/src/plugins/task-lists-workspace/gtd-task-lists-workspace.ui
index 4db4eba1..271dacd7 100644
--- a/src/plugins/task-lists-workspace/gtd-task-lists-workspace.ui
+++ b/src/plugins/task-lists-workspace/gtd-task-lists-workspace.ui
@@ -2,31 +2,36 @@
 <interface>
   <template class="GtdTaskListsWorkspace" parent="GtkBox">
 
-    <!-- Sidebar -->
     <child>
-      <object class="GtkRevealer" id="sidebar_revealer">
-        <property name="transition-type">slide-left</property>
-        <property name="reveal-child" bind-source="toggle_sidebar_button" bind-property="active" 
bind-flags="default" />
-        <child>
+      <object class="AdwFlap" id="flap">
+        <property name="hexpand">true</property>
+        <property name="vexpand">true</property>
+        <property name="modal">true</property>
+        <property name="swipe-to-open">true</property>
+        <property name="swipe-to-close">true</property>
+
+        <!-- Sidebar -->
+        <property name="flap">
           <object class="GtdSidebar" id="sidebar">
             <property name="can_focus">False</property>
             <property name="vexpand">True</property>
           </object>
-        </child>
-      </object>
-    </child>
+        </property>
+
+        <!-- Panels Stack -->
+        <property name="content">
+          <object class="GtkStack" id="stack">
+            <property name="hexpand">true</property>
+            <property name="vexpand">true</property>
+            <property name="transition_duration">250</property>
+            <property name="transition_type">crossfade</property>
+            <signal name="notify::visible-child" handler="on_stack_visible_child_cb" 
object="GtdTaskListsWorkspace" swapped="yes"/>
+            <style>
+              <class name="background"/>
+            </style>
+          </object>
+        </property>
 
-    <!-- Panels Stack -->
-    <child>
-      <object class="GtkStack" id="stack">
-        <property name="hexpand">true</property>
-        <property name="vexpand">true</property>
-        <property name="transition_duration">250</property>
-        <property name="transition_type">crossfade</property>
-        <signal name="notify::visible-child" handler="on_stack_visible_child_cb" 
object="GtdTaskListsWorkspace" swapped="yes"/>
-        <style>
-          <class name="background"/>
-        </style>
       </object>
     </child>
 
@@ -62,6 +67,7 @@
       <object class="GtkToggleButton" id="toggle_sidebar_button">
         <property name="can_focus">1</property>
         <property name="icon-name">builder-view-left-pane-symbolic</property>
+        <property name="active" bind-source="flap" bind-property="reveal-flap" 
bind-flags="sync-create|bidirectional"/>
       </object>
     </child>
 


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