[nautilus/wip/antoniof/flow-box-preparation: 7/26] view-icon-item-ui: Add more width for labels




commit bfa79761acab264f0ff4445c7f80808232fa9b19
Author: António Fernandes <antoniof gnome org>
Date:   Mon Dec 13 13:22:43 2021 +0000

    view-icon-item-ui: Add more width for labels
    
    Except for the largest icon size, where there is plenty width already.
    
    This effectively adds more horizontal padding to icons. The result
    looks more similar to the canvas view, while still having better
    space efficiency for larger icons sizes.

 src/nautilus-view-icon-item-ui.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index 8b8c4a73d..f2a37613a 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -23,6 +23,8 @@ enum
     N_PROPS
 };
 
+#define EXTRA_WIDTH_FOR_TEXT 36
+
 static void
 update_icon (NautilusViewIconItemUi *self)
 {
@@ -45,6 +47,12 @@ update_icon (NautilusViewIconItemUi *self)
     gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon), icon_pixbuf);
 
     gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size);
+    if (icon_size < NAUTILUS_CANVAS_ICON_SIZE_LARGEST)
+    {
+        int extra_margins = 0.5 * EXTRA_WIDTH_FOR_TEXT;
+        gtk_widget_set_margin_start (self->fixed_height_box, extra_margins);
+        gtk_widget_set_margin_end (self->fixed_height_box, extra_margins);
+    }
     style_context = gtk_widget_get_style_context (self->icon);
     thumbnail_path = nautilus_file_get_thumbnail_path (file);
     if (thumbnail_path != NULL &&


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