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 597618 - make gtk_image_new_from_icon_name use the GTK_ICON_LOOKUP_GENERIC_FALLBACK flag and thus honour the icon naming spec
make gtk_image_new_from_icon_name use the GTK_ICON_LOOKUP_GENERIC_FALLBACK fl...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-10-06 22:42 UTC by Robert Collins
Modified: 2018-04-15 00:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to set the default lookup to include a generic fallback (586 bytes, patch)
2010-03-08 14:56 UTC, Ted Gould
none Details | Review
patch: icontheme: Fallback from symbolic to non-symbolic icon (2.09 KB, patch)
2014-04-12 08:34 UTC, Kjell Ahlstedt
none Details | Review

Description Robert Collins 2009-10-06 22:42:20 UTC
this means changing ensure_pixbuf_for_icon_name to set GTK_ICON_LOOKUP_GENERIC_FALLBACK.

The spec - http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html says that a lookup for e.g. 'input-mouse-usb' should take 'input-mouse' from the current theme before 'input-mouse-usb' from the parent theme; setting this flag will make that happen.
Comment 1 Ted Gould 2010-03-08 14:56:52 UTC
Created attachment 155563 [details] [review]
Patch to set the default lookup to include a generic fallback
Comment 2 Ted Gould 2010-03-08 15:26:20 UTC
I will try to paraphrase a conversation on #gnome-hackers regarding this about 15 minutes ago (so you can look in the logs).

mclasen and haddess are concerned that changing this would have far reaching effects.  One concern is that currently the set_icon_name function specifically states that an icon that can't be found will be replaced with a broken icon image.  So people may have relied on that functionality.  Another is that there are certain cases where the fallback might not apply, and that applying it genericly could create bad results in those cases.  The example given was: "you probably don't want to fall back from document-print-preview to document-print."

There is a work around.  And that is to use a GIcon as an intermediary, which will handle the fallback.  And then set the GtkImage using the GIcon.

Personally, I still believe that default behavor should be to use the fallback mechanism that is defined in the icon-naming-specification.  It seems that the function name "*icon_name" should tie as closely to that specification as is reasonably possible.
Comment 3 Bastien Nocera 2010-03-08 16:49:48 UTC
Given that the GtkImage API docs don't explicitely say that "icon-name" will use fallback, and that the icon naming specification doesn't allow for some types of icons to be fallen back on (eg. not for apps), this could break a number of things (eg. make some images show something wrong when they should show a broken image).

I'm pretty sure the GTK+ devels would take a patch to add documentation and/or an example for using GIcon instead.
Comment 4 Kjell Ahlstedt 2014-04-12 08:34:26 UTC
Created attachment 274154 [details] [review]
patch: icontheme: Fallback from symbolic to non-symbolic icon

I agree with Bastien that it's risky to always use generic fallback in
GtkImage. But there is a less far-reaching kind of fallback that I think is
usually (perhaps even always) wanted: fallback from a symbolic icon to the
corresponding non-symbolic icon. If icon x-y-z-symbolic is not found,
look for x-y-z.

There are several widgets that now show the "broken image" icon if you have
selected an icon theme without symbolic icons. The attached patch fixes some,
but not all, of those.

These are files where I have found the use of symbolic icons without fallback
to non-symbolic icons:
  gtkappchooserdialog.c
  entry.c
  filechooserwidget.c
  headerbar.c (4 out of 5 symbolic icons use fallback)
  printbackend.c
  searchentry.c
  trashmonitor.c (not fixed by my patch)
  volumenbutton.c
  gtkappchooserwidget.ui
  gtkfontchooserwidget.ui
  gtkinfobar.ui
  gtkprintunixdialog.ui
  gtkscalebutton.ui
  gtksearchbar.ui

https://git.gnome.org/browse/gnome-icon-theme-symbolic/tree/README says:
"If a -symbolic icon is missing, the app will fall back to the regular name."
That is not automatically true. The app must explicitly ask for a fallback.

The documentation of the GtkVolumeButton:use-symbolic property says:
"If the symbolic icons are not available in your installed
theme, then the normal (potentially colorful) icons will be used."
That is not true. It becomes true when my patch is applied.

Other symbolic icon bugs: bug 680926, bug 708163, bug 722642.
Comment 5 Matthias Clasen 2018-02-10 04:58:45 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 6 Kjell Ahlstedt 2018-02-14 18:09:54 UTC
This issue is not important to me.
But I did not file this bug. My opinion is not important, either.
Comment 7 Matthias Clasen 2018-04-15 00:08:22 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new