Hi John,
The change in 11365 to shorten text when it gets too long looks great. Quite a handy feature, and very good to pull it out to its own function.
What would make it even nicer would be to use C++ strings instead of C ones. In this case that could change the function declaration to be
Glib::ustring gr_ellipsize_text(Glib::ustring const &src, size_t maxlen);
Overall I thought this is also a good chance for us to call out a few specifics to the rest of the devs out there, as they might not know all the points you and I are already familiar with.
For everyone out there, some reasoning for a few of those differences:
* Glib::ustring and std::string manage their memory automatically, can share internal buffers, etc. Solves the huge issue of memory management with C strings.
* Using Glib::ustring instead of std::string denotes the intent that the string contents have been standardized into UTF-8. Good to use Glib::ustring wherever applicable.
* Passing in a reference to a constant Glib::ustring allows things to work, with automatic conversion even happening with gchar*'s being passed in. It also allows one to use .size() or .length() on the passed in parameter and not have to resort to strlen().
* Using size_t for sizes instead of guint. This is mainly a minor clarity point, but can matter for certain overloads, etc. And when we get to dealing with 32-bit vs. 64-bit code, using size_t for all sizes avoids a lot of problems.
* Renaming to 'gr_ellipsize_text' (from 'gr_ellipse_text') changes it from a set of nouns to a verb. It's better to name methods and functions as verbs, and variables as nouns.