summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2015-01-22 16:51:53 -0800
committerCosimo Cecchi <cosimoc@gnome.org>2015-01-22 17:02:23 -0800
commitf433006b42a62f52fe099904a62b006ba2199cf8 (patch)
treeafe8a475870b6fa67552cc0e6205ac5ec0fd3118
parentaba6f7d28b8a1ceb912626cb055e99ce807cfc85 (diff)
downloadnautilus-wip/gaction_.tar.gz
canvas-container: take the canvas icon size into account for icon sizewip/gaction_
When scaling the icon size with the grid unit, take the nominal icon size into account too, since the actual icon we get back might be smaller than that - e.g. if we have a narrow thumbnail with little text.
-rw-r--r--libnautilus-private/nautilus-canvas-container.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libnautilus-private/nautilus-canvas-container.c b/libnautilus-private/nautilus-canvas-container.c
index 7f347c932..c13c6f12a 100644
--- a/libnautilus-private/nautilus-canvas-container.c
+++ b/libnautilus-private/nautilus-canvas-container.c
@@ -1248,7 +1248,7 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
double height_above, height_below;
double line_width;
double grid_width;
- int icon_width;
+ int icon_width, icon_size;
int i;
GtkAllocation allocation;
@@ -1265,6 +1265,7 @@ lay_down_icons_horizontal (NautilusCanvasContainer *container,
canvas_width = CANVAS_WIDTH(container, allocation);
grid_width = STANDARD_ICON_GRID_WIDTH;
+ icon_size = nautilus_canvas_container_get_icon_size_for_zoom_level (container->details->zoom_level);
line_width = 0;
line_start = icons;
@@ -1281,8 +1282,12 @@ 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;
+ /* Normalize the icon width to the grid unit.
+ * Use the icon size for this zoom level too in the calculation, since
+ * the actual bounds might be smaller - e.g. because we have a very
+ * narrow thumbnail.
+ */
+ icon_width = ceil (MAX ((bounds.x1 - bounds.x0), icon_size) / grid_width) * grid_width;
/* Calculate size above/below baseline */
icon_bounds = nautilus_canvas_item_get_icon_rectangle (icon->item);