* Updated files to fit the last Modest APIs
[modest] / src / modest-init.c
index d9e530e..908142a 100644 (file)
@@ -33,7 +33,7 @@
 #include <modest-tny-platform-factory.h>
 #include <modest-widget-memory.h>
 #include <modest-widget-memory-priv.h>
-#include <modest-tny-folder.h>
+#include <modest-local-folder-info.h>
 #include <modest-init.h>
 #include <glib/gstdio.h>
 
@@ -43,7 +43,6 @@ typedef struct {
 } FolderCols;
 
 
-
 #if MODEST_PLATFORM_ID==1   /*gtk*/
 static const FolderCols INBOX_COLUMNS[] = {
        {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 20},
@@ -187,36 +186,31 @@ gboolean
 modest_init_local_folders  (void)
 {
        int i;
-       gchar *path;
+       gchar *maildir_path;
        static const gchar* maildirs[] = {
                "cur", "new", "tmp"
        };
        
-       path = g_build_filename (g_get_home_dir(), ".modest", NULL);
-
-       if (g_access (path, W_OK) != 0) {
-               g_printerr ("modest: cannot write into %s\n", path);
-               g_free (path);
-               return FALSE;
-       }
+       maildir_path = modest_local_folder_info_get_maildir_path ();
 
        for (i = 0; i != G_N_ELEMENTS(LOCAL_FOLDERS); ++i) {
                int j;
                for (j = 0; j != G_N_ELEMENTS(maildirs); ++j) {
                        gchar *dir;
-                       dir = g_build_filename (path, "local_folders",
-                                               modest_tny_folder_get_local_folder_type_name(LOCAL_FOLDERS[i]),
+                       dir = g_build_filename (maildir_path,
+                                               modest_local_folder_info_get_type_name(LOCAL_FOLDERS[i]),
                                                maildirs[j],
                                                NULL);
                        if (g_mkdir_with_parents (dir, 0755) < 0) {
                                g_printerr ("modest: failed to create %s\n", dir);
                                g_free (dir);
+                               g_free (maildir_path);
                                return FALSE;
                        }
                        g_free(dir);
                }
        }
        
-       g_free (path);
+       g_free (maildir_path);
        return TRUE;
 }