[gtranslator/gtk4: 63/79] Use AdwFlap for Sidebar




commit 941aa73193ed927f11c7363b716786ddb7146c1b
Author: afshan ahmed khan <afshanahmeda2k gmail com>
Date:   Sun Aug 21 12:13:22 2022 +0530

    Use AdwFlap for Sidebar

 src/gtr-context.c |  9 ++++++++-
 src/gtr-tab.ui    | 16 ++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/gtr-context.c b/src/gtr-context.c
index 4786aac3..432e42ac 100644
--- a/src/gtr-context.c
+++ b/src/gtr-context.c
@@ -600,6 +600,13 @@ gtr_context_init_tm (GtrContextPanel *panel,
                                                                tm);
   gtk_widget_show (priv->translation_memory_ui);
   gtk_widget_set_size_request (priv->translation_memory_ui, 300, 400);
+
+  GtkWidget* scrolled_win = gtk_scrolled_window_new ();
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW(scrolled_win), priv->translation_memory_ui);
+  gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_win), 300);
+  gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_win), 400);
+
   gtk_box_append (GTK_BOX (priv->translation_memory_box),
-                  priv->translation_memory_ui);
+                  scrolled_win);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, 
GTK_POLICY_AUTOMATIC);
 }
diff --git a/src/gtr-tab.ui b/src/gtr-tab.ui
index d2121ce6..8c74bb63 100644
--- a/src/gtr-tab.ui
+++ b/src/gtr-tab.ui
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
+  <object class="GtkSeparator" id="sep">
+    <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
+  </object>
   <template class="GtrTab" parent="GtkBox">
     <property name="orientation">vertical</property>
     <child>
@@ -22,11 +25,16 @@
           </object>
         </child>
         <property name="child">
-          <object class="GtkPaned" id="hbox">
-            <property name="shrink-end-child">0</property>
+          <object class="AdwFlap" id="hbox">
+            <!--<property name="shrink-end-child">0</property>
             <property name="resize-end-child">0</property>
             <property name="shrink-start-child">0</property>
-            <property name="wide_handle">1</property>
+            <property name="wide_handle">1</property>-->
+            <property name="flap_position">end</property>
+            <property name="fold_policy">ADW_FLAP_FOLD_POLICY_NEVER</property>
+            <property name="locked">1</property>
+            <property name="reveal_flap">1</property>
+            <property name="separator">sep</property>
             <child>
               <object class="GtkPaned" id="vertical_box">
                 <property name="shrink-end-child">0</property>
@@ -137,7 +145,7 @@
                 </child>
               </object>
             </child>
-            <child>
+            <child type="flap">
               <object class="GtrContextPanel" id="context">
                 <property name="tab">GtrTab</property>
                 <!--<property name="width_request">150</property>-->


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