Re: [Nautilus-list] Icon directory contents caching



on 10/7/01 2:31 PM, Alex Larsson at alexl redhat com wrote:

> I would personally appreciate a separation of the
> icon-choosing parts of it (mapping icon name or mimetype + size +
> current theme -> icon pixmap filename) from the in-core pixbuf caching.

Reading the code now, it seems that these things are already mostly
separate.

The function that does the mapping of an icon name to an icon pixmap
filename is get_icon_file_path, and the function that gets the pixbuf is
load_icon_from_path. The function load_named_icon pulls these two together.

It seems that nothing outside of get_icon_file_path (and the 3 functions it
calls) looks at directories at all, and that's the only function you'd need
to modify. Those 4 functions could easily go in a separate file -- they
don't mix with the rest of nautilus-icon-factory.c at all, except for the
theme setting which get_icon_file_path gets from the global factory object
rather than having passed as a parameter. It would be pretty easy to clean
up the theme settings, and move get_icon_file_path into another source file.

Another way this could be more clearly separated would be to take away the
responsibility for reading the specifications of the icon out of
get_icon_file_path. Then we'd have to change get_icon_file_path return two
paths -- one for the icon itself and another for the icon's metafile that
contains additional icon specifications.

The mapping from a MIME type to an icon name is currently tied up with the
caching because we only have a single cache. Since a MIME type can lead to
multiple possible icons, we search and see which one exists as part of the
caching code to avoid searching for files when the icon is already cached.
That could easily be changed around once we have the directory cache in
place.

    -- Darin





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