GNOME Bugzilla – Bug 753510
iconhelper: allow to fall back from pixbuf, to gicon, to named icon
Last modified: 2016-01-23 06:26:35 UTC
Iconhelper is to eager to clear the area when setting a null pixbuf or gicon etc. This prevents fallback from pixbuf to named-icon or similar cases. This is in turn needed to allow a CellRendererPixbuf to use a model that has colums for pixbuf, gicons, and icon-names
I am marking this as dependent on #753506, even if they are not strictly dependendent, but both patches are needed to make the CellRenderer use case work
Created attachment 309070 [details] [review] patch
Created attachment 309078 [details] [review] reftest This reftest fails before the patches and passes with the patches applied
Review of attachment 309070 [details] [review]: Where are the precedence rules documented ?
In the gtkcellrenderepixbuf properties: for instance "The name of the themed icon to display. This property only has an effect if not overridden by "stock_id" or "pixbuf" properties."
Review of attachment 309070 [details] [review]: To be honest, I don't really understand why you would call set_pixuf(helper, pixbuf) if pixbuf is NULL and expect the icon helper to not be cleared afterwards. Why not just do if (pixbuf) set_pixbuf (helper, pixbuf) else set_icon_name (helper, "named-icon") ?
The example was clearly not realistic. I need this because I have a tree model with three columns (pixbuf, icon name and gicon) and each row can set one of the columns. Without this patch only rows that set the pixbuf show an icon sbecause for the other rows the null pixbuf wins over the icon name. The final use case is to support symbolic icons in the completion popular of builder. See the patch in the dependent gtksourceview bug.
Popular -> popup Yay phone automatic spelling
I'm not convinced that it is right to hardcode such fallback in the icon helper
I can understand that... not however that with the patch, widgets are still able to obtain the current behavior by calling helper_clear() themselves, while without the patch the problem in gtkcellrendererpixbuf cannot be fixed. (For the GtkSourceView patch in the mean time I changed approach so this bug is not blocking it anymore)