[Thunar-dev] ThunarVFS Questions

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Sun Nov 5 23:38:22 CET 2006


Ori Bernstein wrote:
> Hi.
> 
> I'm writing a panel applet with ThunarVFS, and I have a couple of API
> questions and suggestions:
> 
>  - Is there any way to test if a file exists?
>     I need this because a large number of apps save by writing to a temporary
>     file, and then unlinking the file. Of course, this causes a "Delete" event
>     for the file, so I'm working around this by adding a timeout on delete that
>     checks if the file exists a short time after it gets deleted. Right now,
>     I'm getting the filename from ThunarVFS, and stat(2)'ing the file, but it
>     would be better if ThunarVFS let me do this directly: 
> 	gboolean thunar_vfs_path_exists (ThunarVfsPath *path);
>     or some such function would be ideal.

The thunar-vfs pendant for stat(2) is thunar_vfs_info_new_for_path(),
which is overhead IMHO, since it also determines the MIME type, etc.

>  - Is there any way of getting thumbnails with ThunarVFS? It seems to me that
>    thunar_vfs_get_custom_icon() should probably return the thumbnail for a
>    file if it exists (grepping the Thunar sources, it seems like it's currently
>    only used for trash and desktop files) or possibly a new function in
>    thunar-vfs could be implemented that wraps all the details of getting an
>    icon:
> 	const gchar *thunar_vfs_path_load_icon(ThunarVfsPath *path);
> 
> Feel free to flame me for being blind and simply not seeing a function that
> does exactly what I want =)

That's what the ThunarVfsThumbnailFactory does. Thumbnails are generated
asynchronously and require some special treatment in Thunar, so such a
wrapper does not make sense atleast for Thunar.

Benedikt



More information about the Thunar-dev mailing list