summaryrefslogtreecommitdiff
path: root/gtk/gtkiconview.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-06-10 16:28:47 +0200
committerBenjamin Otte <otte@redhat.com>2012-06-14 07:41:39 +0200
commitec755541ab695ce6cde530cf2d8ad5f031de85d1 (patch)
tree89ca95f5597fde2254421f5c0e59ad919d7a80d6 /gtk/gtkiconview.c
parentad63d1b59ee5da3b0a962d6ea315c032873b6b29 (diff)
downloadgtk+-ec755541ab695ce6cde530cf2d8ad5f031de85d1.tar.gz
iconview: Don't shrink items
The previous code assumed that the width was always enough for more than one column, which is obviously not correct when a number of columns is hardcoded. With this patch, it will now always check that the width is enough and otherwise cause scrolling. https://bugzilla.gnome.org/show_bug.cgi?id=677809
Diffstat (limited to 'gtk/gtkiconview.c')
-rw-r--r--gtk/gtkiconview.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index ca058425f5..a451735a25 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -2868,16 +2868,9 @@ gtk_icon_view_layout (GtkIconView *icon_view)
&n_columns, &item_width);
n_rows = (n_items + n_columns - 1) / n_columns;
- if (n_columns <= 1)
- {
- /* We might need vertical scrolling here */
- int min_width = item_width + 2 * priv->item_padding + 2 * priv->margin;
- priv->width = MAX (min_width, gtk_widget_get_allocated_width (widget));
- }
- else
- {
- priv->width = gtk_widget_get_allocated_width (widget);
- }
+ priv->width = n_columns * (item_width + 2 * priv->item_padding + priv->column_spacing) - priv->column_spacing;
+ priv->width += 2 * priv->margin;
+ priv->width = MAX (priv->width, gtk_widget_get_allocated_width (widget));
/* Clear the per row contexts */
g_ptr_array_set_size (icon_view->priv->row_contexts, 0);