[Thunar-dev] show total directory sizes?

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Thu Mar 23 12:09:45 CET 2006


Jani Monoses wrote:
> Hello Benedikt

Hey Jani,

> It would be nice if properties on a directory showed its total size 
> (maybe even the number of files) as it is (was?) the case in Windows 
> Explorer and in Nautilus.
> 
> Unless you think this is best implemented outside the thunar or it is an 
> unnecessary feature here's what I think:
> [snip]
> There needs to be either a new function or modifying thunar_vfs_scandir 
> which would take an extra callback function parameter.
> The latter would be called with each VfsInfo found, mainly to present an
> indication of progress, since when vfs_scandir is called recursively it
> can take a long time. This may be even used for recursive chmod/chown 
> operation to give the user some feedback on progress.
> 
> A new vfs-dirsize-job would call this function and have an 'update' 
> signal just like interactive jobs have 'percent', and it would be 
> emitted when the accumulated size increases with a specific amount (say 
> 1M) and at the end, so the properties dialog has an up-to-date dirsize
> label displayed. It need no be emmitted on every new vfsinfo since it
> would be too much overhead, hence the reason for the new callback 
> function in the vfs_scandir variant.
> 
> So in case we want to get directory size in a friendlier way than
> putting sh -c "zenity --info --text \"  `du -hs %f | cut -f 1`\""
> in a UCA script does the above plan seem ok to you?
> 
> I'd lean towards modifying vfs_scandir to add the extra param instead of
> duplicating most of the function. This way current callers would just 
> pass a NULL as the callback, but maybe other recursive callers could use
> it.

I think your idea makes sense, and I'll look into adding that for the
beta (shouldn't take too much time, hopefully).

thunar_vfs_scandir is however not the correct place to add this. It
shouldn't use ThunarVfsInfo either, as that'd mean to determine the MIME
type for each and every file, which would slow down the thing a lot.

It should be a simple job, which uses one or more threads to determine
the size of a directory using opendir(), readdir(), closedir() and lstat().

> thanks
> Jani

Benedikt



More information about the Thunar-dev mailing list