GNOME Bugzilla – Bug 735247
gtk_icon_theme_add_builtin_icon doesn't properly handle symbolic icons
Last modified: 2014-08-27 18:39:49 UTC
What I'm trying to do is store a custom symbolic icon as a GResource and at application startup register it via gtk_icon_theme_add_builtin_icon(). The file is a 16x16 SVG. The code loads it with gdk_pixbuf_new_from_resource and registers it like so: gtk_icon_theme_add_builtin_icon("edit-symbolic", 16, pixbuf); This partially works. I have a Glade file that references the icon in a GtkToolButton and it is loaded and displayed. However, it's displayed exactly as it looks in the SVG (i.e. the parts that should be black are grayed). The symbolic icon is not processed as a symbolic icon. However, if I leave the icon file on disk and prepend the directory to GtkIconTheme's search directory, the icon is properly loaded and processed as symbolic. I was expecting add_builtin_icon() to recognize the icon as symbolic by its suffix, but it appears it's not doing this.
That is one of the reasons why gtk_icon_theme_add_builtin_icon() has been deprecated in favor of gtk_icon_theme_add_resource_path(),