[gnome-usage] performance-view: Make the search bar adaptive



commit fbfb6b5ed486137363913dc218364cee0456a3e0
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Sep 10 16:13:30 2019 +0200

    performance-view: Make the search bar adaptive
    
    Make the search bar a HdySearchBar to make it adaptive.

 data/ui/performance-view.ui | 22 ++++++++++++++++------
 src/performance-view.vala   |  2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/performance-view.ui b/data/ui/performance-view.ui
index dfc0741..a8974aa 100644
--- a/data/ui/performance-view.ui
+++ b/data/ui/performance-view.ui
@@ -10,7 +10,9 @@
       <object class="HdyLeaflet" id="leaflet">
         <property name="visible">True</property>
         <property name="orientation">horizontal</property>
-        <property name="mode-transition-type">slide</property>
+        <property name="can-swipe-back">True</property>
+        <property name="can-swipe-forward">True</property>
+        <property name="transition-type">under</property>
         <property name="visible-child">content_box</property>
 
         <child>
@@ -30,14 +32,22 @@
             <property name="orientation">vertical</property>
 
             <child>
-              <object class="GtkSearchBar" id="search_bar">
-                <property name="visible">True</property>
+              <object class="HdySearchBar" id="search_bar">
+                  <property name="visible">True</property>
 
                 <child>
-                  <object class="GtkSearchEntry" id="search_entry">
+                  <object class="HdyClamp">
                     <property name="visible">True</property>
-                    <property name="width-request">350</property>
-                    <signal name="search-changed" handler="on_search_entry_changed"/>
+                    <property name="hexpand">True</property>
+                    <property name="maximum-size">400</property>
+                    <property name="tightening-threshold">300</property>
+                    <child>
+                      <object class="GtkSearchEntry" id="search_entry">
+                        <property name="visible">True</property>
+                        <property name="hexpand">True</property>
+                        <signal name="search-changed" handler="on_search_entry_changed"/>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/src/performance-view.vala b/src/performance-view.vala
index 555dbde..eb06365 100644
--- a/src/performance-view.vala
+++ b/src/performance-view.vala
@@ -32,7 +32,7 @@ namespace Usage
         private Gtk.Box performance_content;
 
         [GtkChild]
-        private Gtk.SearchBar search_bar;
+        private Hdy.SearchBar search_bar;
 
         [GtkChild]
         private Gtk.SearchEntry search_entry;


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