* Add new dimming rules for copy,cut and paste operations.
[modest] / src / modest-init.c
index 8f81f3d..b805bff 100644 (file)
@@ -172,7 +172,7 @@ modest_init_get_default_header_view_column_ids (TnyFolderType folder_type, Modes
 }
 
 gboolean
-modest_init_init_core (void)
+modest_init_init_core (int argc, char *argv[])
 {
        gboolean reset;
        static gboolean invoked = FALSE;
@@ -187,6 +187,13 @@ modest_init_init_core (void)
        init_i18n();
        init_debug_g_type();
        init_debug_logging();
+
+       if (!gnome_vfs_initialized()) {
+               if (!gnome_vfs_init ()) {
+                       g_printerr ("modest: failed to init gnome-vfs\n");
+                       return FALSE;
+               }
+       }
        
        if (!modest_runtime_init()) {
                modest_init_uninit ();
@@ -194,11 +201,12 @@ modest_init_init_core (void)
                return FALSE;
        }
 
-
+       
        /* do an initial guess for the device name */
        init_device_name (modest_runtime_get_conf());
 
-       if (!modest_platform_init()) {
+       
+       if (!modest_platform_init(argc, argv)) {
                modest_init_uninit ();
                g_printerr ("modest: failed to run platform-specific initialization\n");
                return FALSE;
@@ -245,10 +253,11 @@ modest_init_init_ui (gint argc, gchar** argv)
        init_stock_icons ();
 
        /* Init notification system */
-       #ifdef MODEST_HAVE_HILDON_NOTIFY
+#ifdef MODEST_HAVE_HILDON_NOTIFY
        notify_init ("Basics");
-       #endif
+#endif
 
+       
        return TRUE;
 }
 
@@ -258,7 +267,10 @@ modest_init_uninit (void)
 {
        if (!modest_runtime_uninit())
                g_printerr ("modest: failed to uninit runtime\n");
-               
+
+       if (gnome_vfs_initialized())
+               gnome_vfs_shutdown ();
+       
        return TRUE;
 }
 
@@ -292,6 +304,7 @@ save_header_settings (ModestConf *conf, TnyFolderType type,
         * there was nothing before */
        if (!overwrite &&  modest_conf_key_exists(conf, key, NULL)) {
                g_free (key);
+               g_free (sort_key);
                return TRUE;
        }
 
@@ -419,15 +432,31 @@ gboolean modest_init_one_local_folder (gchar *maildir_path)
 gboolean
 modest_init_local_folders (const gchar* location_filepath)
 {      
+       gboolean retval = TRUE;
+
        gchar *maildir_path = modest_local_folder_info_get_maildir_path (location_filepath);
 
        if (location_filepath) {
-               /* For instance, for memory card, just create the top-level .modest folder: */
+               /* For instance, for memory card, just create the top-level .modest folder
+                * and one "archive" folder (so that messages can be put somewhere):
+                */
+
+               gchar *dir = g_build_filename (maildir_path,
+                               "Archive", NULL);                       
+               const gboolean created = modest_init_one_local_folder (dir);
+               g_free(dir);
+                       
+               if (!created) {
+                       retval = FALSE;
+               }
+
+               #if 0
+               /* Do this if we only create the top-level dir: */
                if (g_mkdir_with_parents (maildir_path, 0755) < 0) {
                        g_printerr ("modest: %s: failed to create %s\n", __FUNCTION__, location_filepath);
-                       g_free (maildir_path);
-                       return FALSE;
+                       retval = FALSE;
                }
+               #endif
        }
        else {
                /* Create each of the standard on-disk folders.
@@ -441,14 +470,13 @@ modest_init_local_folders (const gchar* location_filepath)
                        g_free(dir);
                        
                        if (!created) {
-                               g_free (maildir_path);
-                               return FALSE;
+                               retval = FALSE;
                        }
                }
        }
        
        g_free (maildir_path);
-       return TRUE;
+       return retval;
 }
 
 /**