Don't manually ellipsize file names, prevent breaking GTK's markup parsing
@jeff
Submitted by Jeff F.T. Assigned to Jeff F.T. @jeff
Description
In Pitivi, we use the same modelfilter object to populate the iconview and the listview in the pitivi media library.
However, GTK sometimes chokes with:
Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &
...which makes iconview corrupt its state, with cellrenderertext items exchanging their labels when you mouse over them or select them. Fun.
Turns out the cause is that in the iconview, we use a "shortened" version of the filenames that relies on ancient homebrew ellipsizing code that shortens the name to a hardcoded length (34 characters?) in a rather stupid way. Since it deals with strings containing escaped HTML entities (ex: ", &, etc.), there is a non-nil chance that it tries to split right in the middle of one of those entities before proceeding to burn the village to the ground. That's not even entering the endless headaches of trying to have unicode mixed up in there for the ellipsis character "…").
My solution is to ditch this whole flimsy piece of code and to let CellRendererText handle the ellipsizing through Pango, which guarantees we won't be mangling our filenames and bumping into criticals anymore. To top it all, the result looks better now.
I'll make a patch for this when GES Assets/Projects/Metadata get merged.
Imported from https://bugzilla.gnome.org/show_bug.cgi?id=691679