Skip to content

Commit eb5f4cf

Browse files
author
houssemko
committed
Grid cell gaps on the list item, not the inner box
Themes paint the chip on the gridview > child node, which spans the whole cell: margins on the inner box only inset the content inside the chip, so inter-cell gaps never widened (visible in beta.16). Put the uniform 3px margins on the ListItem itself; restore the box margins.
1 parent eecd103 commit eb5f4cf

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎src/gallery_grid.rs‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ impl GalleryGrid {
9898
let list_item = object
9999
.downcast_ref::<gtk4::ListItem>()
100100
.expect("setup handler gets a ListItem");
101+
// The gaps between grid cells (GridView has no spacing
102+
// properties) are margins on the list item: themes paint
103+
// the chip on the `gridview > child` node, which spans the
104+
// whole cell, so margins on the inner box only move content
105+
// inside the chip. 3px uniform = 6px gap between cells.
106+
list_item.set_margin_top(3);
107+
list_item.set_margin_bottom(3);
108+
list_item.set_margin_start(3);
109+
list_item.set_margin_end(3);
101110
let label = gtk4::Label::builder()
102111
.ellipsize(pango::EllipsizeMode::End)
103112
.max_width_chars(24)
@@ -110,17 +119,13 @@ impl GalleryGrid {
110119
let check = gtk4::CheckButton::new();
111120
check.set_can_target(false);
112121
check.set_focusable(false);
113-
// The margins create the gaps between grid cells (GridView
114-
// has no spacing properties; only the space between cells,
115-
// both axes, at one uniform value) and keep focus rings
116-
// from clipping at the scroll edges.
122+
// The margins keep focus rings from clipping at the scroll
123+
// edges.
117124
let cell = gtk4::Box::builder()
118125
.orientation(gtk4::Orientation::Horizontal)
119126
.spacing(6)
120-
.margin_top(3)
121-
.margin_bottom(3)
122-
.margin_start(3)
123-
.margin_end(3)
127+
.margin_top(2)
128+
.margin_bottom(2)
124129
.focusable(true)
125130
.build();
126131
cell.append(&check);

0 commit comments

Comments
 (0)