After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 318763 - Improve GtkIconView layout
Improve GtkIconView layout
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkIconView
2.8.x
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on: 318761
Blocks:
 
 
Reported: 2005-10-13 12:07 UTC by Ross Burton
Modified: 2006-12-29 04:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improve layout (913 bytes, patch)
2005-10-13 12:08 UTC, Ross Burton
needs-work Details | Review
Before screenshot (95.31 KB, image/png)
2005-10-13 12:49 UTC, Ross Burton
  Details
After (117.64 KB, image/png)
2005-10-13 12:50 UTC, Ross Burton
  Details
Revised patch (2.28 KB, patch)
2006-03-17 12:10 UTC, Ross Burton
accepted-commit_now Details | Review
Before (38.77 KB, image/png)
2006-03-17 12:12 UTC, Ross Burton
  Details
After (39.47 KB, image/png)
2006-03-17 12:13 UTC, Ross Burton
  Details

Description Ross Burton 2005-10-13 12:07:01 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.
Comment 1 Ross Burton 2005-10-13 12:08:19 UTC
Created attachment 53415 [details] [review]
Improve layout

Note that this patch depends on 318761.
Comment 2 Nelson Benitez 2005-10-13 12:37:45 UTC
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 .
Comment 3 Matthias Clasen 2005-10-13 12:46:00 UTC
Ross, while not required, I would certainly enjoy them...
Comment 4 Ross Burton 2005-10-13 12:47:09 UTC
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.
Comment 5 Ross Burton 2005-10-13 12:49:34 UTC
Created attachment 53416 [details]
Before screenshot

Before: notice the odd wrapping on Gazpacho and Inkscape, and the alignment of
the wrapped lines.
Comment 6 Ross Burton 2005-10-13 12:50:09 UTC
Created attachment 53417 [details]
After
Comment 7 Ross Burton 2005-10-13 12:50:43 UTC
Note that I've discovered a slight alignment problem with this patch so it needs
a little bit more work.
Comment 8 Matthias Clasen 2005-10-26 18:11:56 UTC
Any update on this, Ross ?
Comment 9 Ross Burton 2005-10-26 18:19:59 UTC
Fixing the alignment of labels is "fun".  I'll attach my latest patch shortly.
Comment 10 Matthias Clasen 2005-11-07 17:30:10 UTC
Ross, any news ? 
2.8.7 is coming up next week
Comment 11 Ross Burton 2005-11-07 17:37:51 UTC
Doubt I'll have time to get it all sorted before then.  Will there be a .8?
Comment 12 Matthias Clasen 2005-11-07 19:08:13 UTC
Sure
Comment 13 Matthias Clasen 2006-03-06 05:08:59 UTC
There will even be a .14 if you are still working on the patch...
Comment 14 Ross Burton 2006-03-17 12:10:09 UTC
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)
Comment 15 Ross Burton 2006-03-17 12:12:47 UTC
Created attachment 61434 [details]
Before
Comment 16 Ross Burton 2006-03-17 12:13:34 UTC
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.
Comment 17 Matthias Clasen 2006-03-17 13:12:38 UTC
You would need pango enhancements to make that work. 
I'm sure I have seen a bug for that...
Comment 18 Nelson Benitez 2006-03-17 18:44:22 UTC
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.
Comment 19 Matthias Clasen 2006-12-29 04:39:55 UTC
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.