iconview: Include column spacing in calculation
authorBenjamin Otte <otte@redhat.com>
Wed, 13 Jun 2012 02:56:22 +0000 (04:56 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 14 Jun 2012 05:41:40 +0000 (07:41 +0200)
The function is probably almost never used, so nobody has ever seen this
bug, but we should still get it right.

https://bugzilla.gnome.org/show_bug.cgi?id=677809

gtk/gtkiconview.c

index df40fb6fe940949d2e3085f662a9a2f97677c944..cdce24cc3474b5bcce162d06cb7d0379d014a8fe 100644 (file)
@@ -1668,8 +1668,8 @@ gtk_icon_view_get_preferred_width_for_height (GtkWidget *widget,
   n_items = gtk_icon_view_get_n_items (icon_view);
 
   gtk_icon_view_get_preferred_item_size (icon_view, GTK_ORIENTATION_HORIZONTAL, row_height, &item_min, &item_nat);
-  *minimum = item_min * ((n_items + rows - 1) / rows);
-  *natural = item_nat * ((n_items + rows - 1) / rows);
+  *minimum = (item_min + priv->column_spacing) * ((n_items + rows - 1) / rows) - priv->column_spacing;
+  *natural = (item_nat + priv->column_spacing) * ((n_items + rows - 1) / rows) - priv->column_spacing;
 
   *minimum += 2 * priv->margin;
   *natural += 2 * priv->margin;