Re: GtkIconView set_item_width question



Hi,


 maximum_layout_width = MAX (item_width, item->pixbuf_width);

...

 item->width = MAX (item->layout_width + padding, item->pixbuf_width);

Maybe we miss a maxmium_layout_width -= padding there.

Matthias


I have just tried your solution and it works fine. I have included the
patch that was taken against gtk+-2.6.4.


--- gtkiconview.c       2005-03-14 20:15:41.000000000 +0530
+++ mod-gtkiconview.c   2005-03-14 20:17:10.000000000 +0530
@@ -1876,6 +1876,7 @@
                        NULL);
 
   spacing = icon_view->priv->spacing;
+  padding = 2 * (ICON_TEXT_PADDING + focus_width + focus_pad);
 
   if (icon_view->priv->pixbuf_column != -1)
     {
@@ -1895,10 +1896,12 @@
       item_width > 0)
     {
       colspan = item->pixbuf_width / item_width + 1;
-      maximum_layout_width = MAX (colspan * item_width -
item->pixbuf_width - icon_view->priv->spacing - 2 * (ICON_TEXT_PADDING
+ focus_width + focus_pad), 50);
+      maximum_layout_width = MAX (colspan * item_width -
item->pixbuf_width - icon_view->priv->spacing - padding, 50);
     }
-  else
+  else {
     maximum_layout_width = MAX (item_width, item->pixbuf_width);
+       maximum_layout_width -= padding;
+  }
     
   if (icon_view->priv->markup_column != -1 ||
       icon_view->priv->text_column != -1)
@@ -1912,7 +1915,6 @@
       
       item->layout_width = layout_width;
       item->layout_height = layout_height;
-      padding = 2 * (ICON_TEXT_PADDING + focus_width + focus_pad);
     }
   else
     {


Now, all the items will take same amount of width. I propose the
default width to be around 100 (it will be helpful for those who
doesn't bother to set the item width).

Santhosh.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]