Hi,
On Sat, Mar 19, 2011 at 05:31:38PM -0400, Adam Lewis wrote:
> Here is a rough approximation of what the patch would look like:
>
> GFile *root;
> GFileInfo *info;
> guint64 capacity, free;
>
> root = g_file_new_for_path (device->mountpoint);
>
> info = g_file_query_filesystem_info (root, "*", NULL, NULL);
> g_object_unref (G_OBJECT (root));
> if (info == NULL) {
> return 0;
> }
>
> capacity = g_file_info_get_attribute_uint64 (info,
> G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);
> free = g_file_info_get_attribute_uint64 (info,
> G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
> g_object_unref (G_OBJECT (info));
I tend to think this kind of things should be handled by the application
using, it's at the same level as detecting whether a newly plugged device
is an iPod and this kind of things. On the other hand, this is at least the
2nd time such an API is requested which means there's a real need for it :)
However, if we add this API, we'll probably also want a way to get the
space used by music/movies/ebooks/other files.
Christophe
|