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 396901 - Generic icon fallback a la icon naming spec
Generic icon fallback a la icon naming spec
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-01-15 15:20 UTC by Luca Ferretti
Modified: 2007-05-18 20:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
generic fallback (1.76 KB, patch)
2007-01-29 05:00 UTC, Matthias Clasen
committed Details | Review
choose-icon.patch (5.94 KB, patch)
2007-04-19 05:18 UTC, Matthias Clasen
committed Details | Review

Description Luca Ferretti 2007-01-15 15:20:01 UTC
From Icon Naming Spec:

  The dash “-” character is used to separate levels of specificity in
  icon names, for all contexts other than MimeTypes. For instance, we
  use “input-mouse” as the generic item for all mouse devices, and we
  use “input-mouse-usb” for a USB mouse device. However, if the more
  specific item does not exist in the current theme, and does exist in
  a parent theme, the generic icon from the current theme is preferred,
  in order to keep consistent style.
  < http://standards.freedesktop.org/icon-naming-spec/latest/ar01s03.html >

GTK+ should allow applications to fallback to generic icon when requested specific icon is not available in current theme.

Example: currently gnome-icon-theme is providing only "media-optical" named icon for a generic optical disk media, as defined in Icon Naming Spec. But HAL and gnome-vfs are able to identify the exact type of media, so they should be able to use named icons "media-optical-cd", "media-optical-cdr", "media-optical-cdrw", "media-optical-dvd-video", ... "media-optical-blueray" in sources, even if those icons are not defined in the standard or provided by the icon theme.
Comment 1 Matthias Clasen 2007-01-16 16:32:06 UTC
One way to expose this in the api would be to just add a
GTK_ICON_LOOKUP_DO_NAME_FALLBACKS flag that would make gtk do the right
thing (split the icon name at '-' and try the more generic names before
falling back to other themes)

Comment 2 Luca Ferretti 2007-01-16 17:32:42 UTC
Rodney, what about RTL/LTR support in Icon Naming Spec? Simply add a trailing -rtl suffing to use the icon in the right context?
Comment 3 Matthias Clasen 2007-01-16 17:38:00 UTC
FWIW, gtk currently uses explicit -ltr/-rtl for both directions currently, if 
icons have variants.
Comment 4 Matthias Clasen 2007-01-29 05:00:20 UTC
Created attachment 81407 [details] [review]
generic fallback
Comment 5 Rodney Dawes 2007-02-16 04:54:19 UTC
Luca, we haven't made a decision on how to do ltr/rtl in the naming spec yet. It seems to me that appending rtl to the icon might work best. I am not sure yet though. Perhaps some discussion on xdg list will render a conclusion.
Comment 6 Matthias Clasen 2007-03-07 19:57:26 UTC
FWIW, Alex' recommends that we add a new function that takes a list of icon names to look for instead of hardcoding the "-"-fallback.
Comment 7 Rodney Dawes 2007-03-20 20:51:29 UTC
We should do both actually. I think alex's recommendation is mostly based on his proposal for the MIME type fallback icons, which I mostly agree with. However, I think for icons in the contexts other than mimetypes, the simple "-" fallback mechanism is the best solution. This would be optimal for the device icons, for example, where we can fall back through the hierarchy, without having to specify every level by hand.

So, my vote is that we get this patch in, as well as continue working toward better solutions for special case needs, such as MIME types.
Comment 8 Matthias Clasen 2007-04-19 05:16:58 UTC
Here is an untested patch to add a lookup_iocn variant that takes an array of names.
Comment 9 Matthias Clasen 2007-04-19 05:18:40 UTC
Created attachment 86619 [details] [review]
choose-icon.patch
Comment 10 Matthias Clasen 2007-05-18 20:18:34 UTC
2007-05-18  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtk.symbols:
        * gtk/gtkicontheme.h:
        * gtk/gtkicontheme.c: Add a function to look up an icon from
        a list of icon names.  (#396901, Luca Ferretti)