GNOME Bugzilla – Bug 318763
Improve GtkIconView layout
Last modified: 2006-12-29 04:39:55 UTC
The layout of a GtkIconView isn't as good as it could be. 1) text is wrapped on character boundaries instead of word boundaries 2) wrapped text is left aligned Attaching a patch to fix these. I can attach before and after screenshots if required.
Created attachment 53415 [details] [review] Improve layout Note that this patch depends on 318761.
I wonder if this patch would prevent an application from using a character boundary for its icon-view, in concrete I think if this would conflict with nautilus bug 300790 .
Ross, while not required, I would certainly enjoy them...
Previously it broke at any character (I had "Foo Ba/r", where / represents the break), so this is an improvement to me. Note that Nautilus doesn't use IconView.
Created attachment 53416 [details] Before screenshot Before: notice the odd wrapping on Gazpacho and Inkscape, and the alignment of the wrapped lines.
Created attachment 53417 [details] After
Note that I've discovered a slight alignment problem with this patch so it needs a little bit more work.
Any update on this, Ross ?
Fixing the alignment of labels is "fun". I'll attach my latest patch shortly.
Ross, any news ? 2.8.7 is coming up next week
Doubt I'll have time to get it all sorted before then. Will there be a .8?
Sure
There will even be a .14 if you are still working on the patch...
Created attachment 61433 [details] [review] Revised patch New patch: - remove the special casing for single line text cells that unsets the width. This allows the alignment to always work - set the width as well as wrap width when working out the width of the text cell - Use word wrapping, center alignment, and 0.0 xalign. - Stop processing on invalid path (compiler warning) - Removed unused variable (ditto)
Created attachment 61434 [details] Before
Created attachment 61435 [details] After I just noticed that there is a small problem with wrapping, it's a shame that the word wrapping isn't also wrapping on _ and -. Any good ideas? Char-wrapping looks really bad.
You would need pango enhancements to make that work. I'm sure I have seen a bug for that...
In the bug I refered on comment 2 there is a patch (yet committed) to make the nautilus icon view wrap on that chars, the patch is small so maybe you could add it here too, but it would be better to add the functionality upstream in pango, see http://bugzilla.gnome.org/show_bug.cgi?id=323711#c13 for that.
2006-12-28 Matthias Clasen <mclasen@redhat.com> * gtk/gtkiconview.c: Use word wrapping by default, and center multiline labels. (#318763, Ross Burton) * gtk/gtkcellrenderertext.c (get_layout): Remove a special case for single-line layouts.