[Nautilus-list] Re: How does Nautilus choose an icon?



on 11/2/01 9:35 AM, David Moles at david moles vykor com wrote:

> One other question (specifically a Nautilus one this time): What
> determines the icon Nautilus uses for a particular MIME type?

Heh. You'd think that was a Nautilus one.

The gnome-vfs MIME database can have an icon filename listed for each MIME
type under the key icon_filename. If there's no icon filename listed for a
MIME type, then the icon code uses the MIME type itself, turned into a
filename by adding a "gnome-" prefix, and changing the "/" to a "-".
Explicit icon filenames are only needed when the file is shared with another
MIME type, or if the file already exists with some specific name for some
other purpose.

That algorithm gives you the base of the icon's name, without a file type
extension -- there's also code to strip off extensions for compatibility
with old MIME database entries.

There's more to it, including special cases for special types of files like
sockets that probably could be handled with MIME types too, but is not for
historical reasons. The code is in get_icon_name_for_file and
load_specific_icon in nautilus-icon-factory.c.

Some day, after we add the metadata API into gnome-vfs, we'll be moving more
of this icon logic into there too. It should be possible for any program to
get the appropriate themed icon for any particular file or even for a
particular MIME type using gnome-vfs.

    -- Darin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]