diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2015-01-22 16:51:53 -0800 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-01-24 02:06:05 +0100 |
commit | f22548576af338920ac2385cbcff0c7684740b17 (patch) | |
tree | 0d7332e075d17aeb30fdcb3fffc15e00961dc580 | |
parent | 8b53911af454e9ceabf6425fa88a352c4e4286f2 (diff) | |
download | nautilus-f22548576af338920ac2385cbcff0c7684740b17.tar.gz |
canvas-container: take the canvas icon size into account for icon size
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.c | 11 |
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); |