[libadwaita] preferences-window: Make the search result margin adaptive



commit a4c90bc6c2142b28e36c02caadd0266e5302e400
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Apr 2 14:57:04 2021 +0200

    preferences-window: Make the search result margin adaptive
    
    This makes the top and bottom margins of the search results match the
    ones of preference pages, which depends of their clamp's width. This
    also avoids hardcoding the margins as properties.

 src/adw-preferences-window.c  | 5 +++++
 src/adw-preferences-window.ui | 7 +++----
 src/stylesheet/_custom.scss   | 1 +
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/adw-preferences-window.c b/src/adw-preferences-window.c
index 37cef92..bddc71f 100644
--- a/src/adw-preferences-window.c
+++ b/src/adw-preferences-window.c
@@ -26,6 +26,11 @@
  * The #AdwPreferencesWindow widget presents an application's preferences
  * gathered into pages and groups. The preferences are searchable by the user.
  *
+ * # CSS nodes
+ *
+ * #AdwPreferencesWindow has a main CSS node with the name window and the style
+ * class .preferences.
+ *
  * Since: 1.0
  */
 
diff --git a/src/adw-preferences-window.ui b/src/adw-preferences-window.ui
index 72e4a70..8f8da4b 100644
--- a/src/adw-preferences-window.ui
+++ b/src/adw-preferences-window.ui
@@ -8,6 +8,9 @@
     <property name="title" translatable="yes">Preferences</property>
     <property name="default-width">640</property>
     <property name="default-height">576</property>
+    <style>
+      <class name="preferences"/>
+    </style>
     <child>
       <object class="AdwLeaflet" id="subpages_leaflet">
         <property name="can-swipe-back" bind-source="AdwPreferencesWindow" bind-property="can-swipe-back" 
bind-flags="sync-create"/>
@@ -111,10 +114,6 @@
                                     <property name="scroll-to-focus">True</property>
                                     <property name="child">
                                       <object class="AdwClamp">
-                                        <property name="margin_bottom">18</property>
-                                        <property name="margin_end">12</property>
-                                        <property name="margin_start">12</property>
-                                        <property name="margin_top">18</property>
                                         <child>
                                           <object class="GtkListBox" id="search_results">
                                             <property name="selection-mode">none</property>
diff --git a/src/stylesheet/_custom.scss b/src/stylesheet/_custom.scss
index 2537277..7882843 100644
--- a/src/stylesheet/_custom.scss
+++ b/src/stylesheet/_custom.scss
@@ -506,6 +506,7 @@ avatar {
 
 // Preferences
 
+window.preferences > contents > leaflet > box > stack > stack > scrolledwindow > viewport > clamp > list,
 preferencespage > scrolledwindow > viewport > clamp > box {
   margin: 0 12px;
 


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