[gtk+] iconview: Fix negative natural size request on empty iconview
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconview: Fix negative natural size request on empty iconview
- Date: Mon, 7 May 2012 16:05:35 +0000 (UTC)
commit 86cebc9b43cfad08f6d4ad5a268d26b2285394c8
Author: Benjamin Otte <otte redhat com>
Date: Mon May 7 17:12:36 2012 +0200
iconview: Fix negative natural size request on empty iconview
gtk/gtkiconview.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index c891509..6670098 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1543,8 +1543,16 @@ gtk_icon_view_get_preferred_width (GtkWidget *widget,
{
int n_items = gtk_icon_view_get_n_items (icon_view);
- *minimum = n_items ? item_min : 0;
- *natural = item_nat * n_items + priv->column_spacing * (n_items - 1);
+ if (n_items == 0)
+ {
+ *minimum = 0;
+ *natural = 0;
+ }
+ else
+ {
+ *minimum = item_min;
+ *natural = item_nat * n_items + priv->column_spacing * (n_items - 1);
+ }
}
*minimum += 2 * priv->margin;
@@ -1595,8 +1603,16 @@ gtk_icon_view_get_preferred_height (GtkWidget *widget,
}
else
{
- *minimum = n_items ? item_min : 0;
- *natural = item_nat * n_items + priv->row_spacing * (n_items - 1);
+ if (n_items == 0)
+ {
+ *minimum = 0;
+ *natural = 0;
+ }
+ else
+ {
+ *minimum = item_min;
+ *natural = item_nat * n_items + priv->row_spacing * (n_items - 1);
+ }
}
*minimum += 2 * priv->margin;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]