summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcaja-private/caja-icon-container.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 1a92caec..a6064905 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -1356,6 +1356,7 @@ lay_down_icons_horizontal (CajaIconContainer *container,
double max_text_width, max_icon_width;
int icon_width;
int i;
+ int num_columns;
GtkAllocation allocation;
g_assert (CAJA_IS_ICON_CONTAINER (container));
@@ -1390,7 +1391,11 @@ lay_down_icons_horizontal (CajaIconContainer *container,
}
else
{
- grid_width = STANDARD_ICON_GRID_WIDTH;
+ num_columns = floor(canvas_width / STANDARD_ICON_GRID_WIDTH);
+ num_columns = fmax(num_columns, 1);
+ /* Minimum of one column */
+ grid_width = canvas_width / num_columns - 1;
+ /* -1 prevents jitter */
}
gridded_layout = !caja_icon_container_is_tighter_layout (container);