X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-utils.c;h=fd3227af3814e980aad0a63910829fb25f74161c;hp=0128966f5d1c16a40a93c87db9fff14cf6b1d990;hb=e7614cfd41389c341a19295585adccb00ea8b761;hpb=f409f0b767f36788ce88995246dfeb087797acaa diff --git a/src/modest-utils.c b/src/modest-utils.c index 0128966..fd3227a 100644 --- a/src/modest-utils.c +++ b/src/modest-utils.c @@ -43,6 +43,7 @@ #include #include "modest-utils.h" #include "modest-platform.h" +#include GQuark modest_utils_get_supported_secure_authentication_error_quark (void) @@ -59,16 +60,18 @@ modest_utils_folder_writable (const gchar *filename) return FALSE; if (g_strncasecmp (filename, "obex", 4) != 0) { - GnomeVFSFileInfo folder_info; + GnomeVFSFileInfo *folder_info; gchar *folder; folder = g_path_get_dirname (filename); - gnome_vfs_get_file_info (folder, &folder_info, + folder_info = gnome_vfs_file_info_new (); + gnome_vfs_get_file_info (folder, folder_info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS); g_free (folder); - if (!((folder_info.permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) || - (folder_info.permissions & GNOME_VFS_PERM_USER_WRITE))) { + if (!((folder_info->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) || + (folder_info->permissions & GNOME_VFS_PERM_USER_WRITE))) { return FALSE; } + gnome_vfs_file_info_unref (folder_info); } return TRUE; } @@ -462,3 +465,28 @@ modest_list_index (TnyList *list, GObject *object) g_object_unref (iter); return index; } + +guint64 +modest_folder_available_space (const gchar *maildir_path) +{ + gchar *folder; + gchar *uri_string; + GnomeVFSURI *uri; + GnomeVFSFileSize size; + + folder = modest_local_folder_info_get_maildir_path (maildir_path); + uri_string = gnome_vfs_get_uri_from_local_path (folder); + uri = gnome_vfs_uri_new (uri_string); + g_free (folder); + g_free (uri_string); + + if (uri) { + if (gnome_vfs_get_volume_free_space (uri, &size) != GNOME_VFS_OK) + size = -1; + gnome_vfs_uri_unref (uri); + } else { + size = -1; + } + + return (guint64) size; +}