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




commit 443190ed4ccb3407e00a3c4d1e52331087c2dfec
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 | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index dd4ed5e3e..cfa500259 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;
 
@@ -1002,22 +1002,27 @@ add_extension_model_page (NautilusPropertiesModel  *model,
 
     list_box = gtk_list_box_new ();
     gtk_widget_add_css_class (list_box, "boxed-list");
+    gtk_widget_set_valign (list_box, GTK_ALIGN_START);
     gtk_list_box_bind_model (GTK_LIST_BOX (list_box), list_model,
                              (GtkListBoxCreateWidgetFunc) create_extension_group_row,
                              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]