[nautilus/wip/corey/properties: 3/3] properties: Don't propagate height of subpages




commit cc8673375782c620a00896e56af8bd26ad1843c6
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 31 15:56:16 2022 +0100

    properties: Don't propagate height of subpages
    
    Generally, we want the properties window to be sized to fit the natural
    height of the content of the main page.
    
    However, the extensions subpage is propagating its natural height; in
    some cases, this can lead to the properties page being the full screen
    height in many cases.
    
    The natural height propagation is set internally by AdwPreferencesPage,
    so we have to drop its use here. It was probably a misuse anyway, given
    this is a subpage. Internally it's just a scrolled window and a clamp,
    so that's what it's gonig to be replaced with.

 src/nautilus-properties-window.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index dd4ed5e3e..ee5820324 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -976,8 +976,8 @@ add_extension_model_page (NautilusPropertiesModel  *model,
     GtkWidget *title;
     GtkWidget *header_bar;
     GtkWidget *list_box;
-    GtkWidget *group;
-    GtkWidget *page;
+    GtkWidget *clamp;
+    GtkWidget *scrolled_window;
     GtkWidget *up_button;
     GtkWidget *box;
 
@@ -1007,17 +1007,21 @@ add_extension_model_page (NautilusPropertiesModel  *model,
                              self,
                              NULL);
 
-    group = adw_preferences_group_new ();
-    adw_preferences_group_add (ADW_PREFERENCES_GROUP (group), list_box);
+    clamp = adw_clamp_new ();
+    adw_clamp_set_child (ADW_CLAMP (clamp), list_box);
+    gtk_widget_set_margin_top (clamp, 18);
+    gtk_widget_set_margin_bottom (clamp, 18);
+    gtk_widget_set_margin_start (clamp, 18);
+    gtk_widget_set_margin_end (clamp, 18);
 
-    page = adw_preferences_page_new ();
-    adw_preferences_page_add (ADW_PREFERENCES_PAGE (page), ADW_PREFERENCES_GROUP (group));
-    gtk_widget_set_vexpand (page, TRUE);
+    scrolled_window = gtk_scrolled_window_new ();
+    gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), clamp);
+    gtk_widget_set_vexpand (scrolled_window, TRUE);
 
     box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_append (GTK_BOX (box), header_bar);
-    gtk_box_append (GTK_BOX (box), page);
-    gtk_widget_add_css_class (page, "background");
+    gtk_box_append (GTK_BOX (box), scrolled_window);
+    gtk_widget_add_css_class (scrolled_window, "background");
 
     gtk_stack_add_named (self->page_stack,
                          box,


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