summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2015-01-21 17:51:19 -0800
committerCosimo Cecchi <cosimoc@gnome.org>2015-01-22 17:02:22 -0800
commit4f3446428fb3cf9a36d49e2b48755577e2204066 (patch)
tree249903bd89428b549f0755941e120e36593e59b3
parentbf90ee134944b0d0d34ded47891536f65b72c0ce (diff)
downloadnautilus-4f3446428fb3cf9a36d49e2b48755577e2204066.tar.gz
canvas-container: add a comment to explain STANDARD_ICON_GRID_WIDTH
This constant is very important and needs explaining.
-rw-r--r--libnautilus-private/nautilus-canvas-container.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 20bd5bdb7..7f347c932 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -93,6 +93,12 @@
#define CONTAINER_PAD_TOP 4
#define CONTAINER_PAD_BOTTOM 4
+/* Width of a "grid unit". Canvas items will always take up one or more
+ * grid units, rounding up their size relative to the unit width.
+ * So with an 80px grid unit, a 100px canvas item would take two grid units,
+ * where a 76px canvas item would only take one.
+ * Canvas items are then centered in the extra available space.
+ */
#define STANDARD_ICON_GRID_WIDTH 80
/* Desktop layout mode defines */
@@ -1275,6 +1281,7 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
&bounds.x0, &bounds.y0,
&bounds.x1, &bounds.y1);
+ /* Normalize the icon width to the grid unit */
icon_width = ceil ((bounds.x1 - bounds.x0)/grid_width) * grid_width;
/* Calculate size above/below baseline */