Re: Getting the icons used by GtkFileChooser



On Tue, 2004-03-02 at 11:58, Michael Natterer wrote:

> With the new automatic backend choosing of GtkFileChooser most people
> will sooner or later use the gnome-vfs backend without even knowing
> it, let alone explicitely linking against gnome-vfs.
> 
> The file chooser will then use nice icons for all kinds of
> mime-types. What I hacked up for GIMP looks like this:
> 
> http://mitch.gimp.org/filechooser/chooser-shot-5.png
> 
> You'll notice the preview of the selected file is exactly the same as
> in the file tree view. To render the icon, I can safely use the
> semi-private GtkFileSystem API (if I #ifdef enough to be safe against
> API changes).

I don't think applications should display a preview for files they
*really* know they cannot open.  That is, the GIMP shouldn't display a
big socket icon as a preview for a Unix socket.  A text editor shouldn't
display a preview for image files, etcetera.

This is precisely what gtk_file_chooser_set_preview_active() is for.  In
your ::update_preview() callback, you call that function with FALSE if
you can't generate a preview for the file in question.  The file chooser
will hide the preview widget in that case.

As for thumbnailing in the GIMP, which is what we discussed on IRC:

1. There is no guarantee that the user will have the gnome-vfs backend
installed, so Nautilus or thumbnail-spec thumbnails may not be
available.  In that case, displaying a plain mime-type icon in the
preview as a fallback is useless to users.

2. The GIMP should *really* have a way to generate thumbnails
automatically, without waiting for the user to click on the Preview
button first --- at least for JPEG files which are ultra-common and
allow for quick generation of thumbnails.  I know you told me that this
is planned :)

I really fear that exposing data from the internal GtkFileInfo will lead
to all sorts of questions around GTK+/glib not providing a VFS interface
of its own.  This is beyond the scope of GTK+, and is rather a
Freedesktop.org issue.

  Federico




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