Proposal for better handling of mimetype icon themeing

Alexander Larsson alexl at
Mon Dec 19 19:46:31 EET 2005

The way gnome and the icon naming specification handles mime icons
really is problematic. Each mimetype maps to a icon name, e.g.
gnome-mime-application-x-bzip in old gnome and application-x-bzip in the
icon nameing spec and in latest gnome. If that icon doesn't exist in the
theme a more generic one is tried (i.e. audio/* maps to

This one-to-one mapping of mimetype to icon causes problems in three
* It gives a lot of icons in the icon theme.
  Normally that is handled by making lots of symlinks for icons that 
  really are the same
* The generic fallback is limited. It really doesn't work for any of the
  application/* mimetypes.
* Inheritance causes problems with the generic callback. If some theme 
  has no icon for a mimetype, either itself or in an inherited them, but
  it has one for the generic theme, then if an inherited theme adds an
  icon for that mimetype the inherited icon will be used instead of the 
  generic icon that matches the icon theme.

I propose the following approach to fix this:
1) To fix the inheritance problem, add a way to the icon theme spec to
   find the right icon from a list of icons, looking on each of the
   icons in the list before moving on to its inherited theme.
2) Add to the mimetype database a generic-icons field. This allows us
   to give a list of generic icons to use for a mimetype if the normal
   mimetype is not found.

For example, say we add this to the jpeg mime type:
        <icon name="image-photo"/>
        <icon name="image"/>

Now, when we look up the icon for image/jpeg with this we first create a
list: image-jpeg, image-photo, image, image-x-generic
Then we use the new icon theme spec feature to find the fist match of
the list in the theme (such that if image-photo is in the current theme,
but image-jpeg in hicolor, image-photo from the current theme will still
be used).

Given this, and some work from the icon naming spec people we should be
able to make mimetype icon themeing much more sane. 

Attached files:
icon-theme-sepc.patch - The updates to the icon theme spec
shared-mime-info.patch - Updates to the shared mime spec and patches to
shared-mime-info-example.patch - Example of adding some generic icons
xdgmime.patch - Implementation of the new mime calls and caches

I've also started working on the required changes to Gnome to use this.

I think its about time we got this solved. When we get this in the icon
name spec people can decide on the core set of generic icons we should
use in the freedesktop.xml database.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl at    alla at 
He's a one-legged devious hairdresser who hangs with the wrong crowd. She's a 
sarcastic French-Canadian mercenary with an incredible destiny. They fight 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icon-theme-spec.patch
Type: text/x-patch
Size: 1649 bytes
Desc: not available
Url : 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shared-mime-info.patch
Type: text/x-patch
Size: 13377 bytes
Desc: not available
Url : 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shared-mime-info-example.patch
Type: text/x-patch
Size: 1277 bytes
Desc: not available
Url : 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdgmime.patch
Type: text/x-patch
Size: 15850 bytes
Desc: not available
Url : 

More information about the xdg mailing list