2006-12-13 [colin] 2.6.1cvs26
[claws.git] / src / main.c
index 3b92373d132146e4d8ad6528189b67b72785b46b..0c98552c2bf8353624953617a676b5e137b704af 100644 (file)
@@ -501,6 +501,9 @@ static void sc_session_manager_connect(MainWindow *mainwin)
 }
 #endif
 
+static gboolean sc_exiting = FALSE;
+static gboolean sc_starting = FALSE;
+
 int main(int argc, char *argv[])
 {
        gchar *userrc;
@@ -511,6 +514,8 @@ int main(int argc, char *argv[])
        gint num_folder_class = 0;
        START_TIMING("startup");
        
+       sc_starting = TRUE;
+
        if (!claws_init(&argc, &argv)) {
                return 0;
        }
@@ -728,8 +733,10 @@ int main(int argc, char *argv[])
                if (!run_wizard(mainwin, FALSE))
                        exit(1);
                account_read_config_all();
-               if(!account_get_list())
+               if(!account_get_list()) {
                        exit_claws(mainwin);
+                       exit(1);
+               }
        }
 
        
@@ -811,13 +818,21 @@ int main(int argc, char *argv[])
        if (!folder_have_mailbox()) {
                prefs_destroy_cache();
                main_window_cursor_normal(mainwin);
-               alertpanel_error(_("Claws Mail has detected a configured "
+               if (folder_get_list() != NULL) {
+                       alertpanel_error(_("Claws Mail has detected a configured "
+                                  "mailbox, but is it incomplete. It is "
+                                  "possibly due to a failing IMAP account. Use "
+                                  "\"Rebuild folder tree\" on the mailbox's folder "
+                                  "to try to fix it."));
+               } else {
+                       alertpanel_error(_("Claws Mail has detected a configured "
                                   "mailbox, but could not load it. It is "
                                   "probably provided by an out-of-date "
                                   "external plugin. Please reinstall the "
-                                  "plugin and try again.\nIt may also be "
-                                  "due to a failing IMAP account."));
-               exit(1);
+                                  "plugin and try again."));
+                       exit_claws(mainwin);
+                       exit(1);
+               }
        }
        
        static_mainwindow = mainwin;
@@ -863,7 +878,10 @@ int main(int argc, char *argv[])
        }
 
        prefs_destroy_cache();
+       
+       sc_starting = FALSE;
        END_TIMING();
+       
        gtk_main();
 
        exit_claws(mainwin);
@@ -883,8 +901,6 @@ static void save_all_caches(FolderItem *item, gpointer data)
        folder_item_free_cache(item, TRUE);
 }
 
-static gboolean sc_exiting = FALSE;
-
 static void exit_claws(MainWindow *mainwin)
 {
        gchar *filename;
@@ -1246,6 +1262,11 @@ gboolean claws_is_exiting(void)
        return sc_exiting;
 }
 
+gboolean claws_is_starting(void)
+{
+       return sc_starting;
+}
+
 /*
  * CLAWS: want this public so crash dialog can delete the
  * lock file too