From 26a0aa2823f6411916f5ad37437bb797cf2cff26 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 7 Apr 2017 16:08:59 +0200 Subject: Expand grid width to canvas Minimum of one column taken from: https://github.com/linuxmint/nemo/commit/78d4a4f https://github.com/linuxmint/nemo/commit/21ea094 fix --- libcaja-private/caja-icon-container.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libcaja-private') 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); -- cgit v1.2.1