I more or less figured the GtkGridView layout, so here it is.
You cannot set the size of the GtkListItemWidget (GLIW); it will be set automatically with its own internal rules, of which at least the following apply in 4.14.4:
All boxes in the GLIW child widget and descendants will have top/bottom/start/end (depending if horizontal or vertical box) margins set to 20 pixels.
All other widgets will have top/bottom/start/end (depending if parent is horizontal or vertical box) margins set to 8 pixels.
The above is not currently configurable.
So to reduce the excess size of the GLIW, minimize the amount of boxes. Compare the previous image which has 3 boxes to the following with only 1 box:
The removal of 2 horizontal boxes allows for viewing 4 rows instead of the previous 2 1/2.
But the number of columns is the same, that takes us to the next rule:
3. The width and height of all GLIWs will be set to the dimensions of the largest child of all GLIWs (plus margins).
The reason only 4 columns are shown can be seen by scrolling down and noticing there are wider label widgets:
Hope this helps anyone else with similar doubts. And if you have any observations or corrections, please do.
The inspector is a great tool: it is clear that the “internal rules” are being set by the theme. Default-light (gtk/theme/Default/Default-light.css).
This theme sets margins top, bottom, left and right to 12 Px for vertical and horizontal boxes inside GtkListItemWidgets.
So the margins are indeed configurable. In order to have a consistent layout across themes, you may override the css for all boxes that go into the GtkListItemWidget. This can be done with: