* Deleted unused code
[modest] / src / modest-utils.c
index 0128966..fd3227a 100644 (file)
@@ -43,6 +43,7 @@
 #include <modest-defs.h>
 #include "modest-utils.h"
 #include "modest-platform.h"
+#include <modest-local-folder-info.h>
 
 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;
+}