2007-02-21 [colin] 2.7.2cvs60
[claws.git] / src / main.c
index b68eaff4eb9ce6d02899e46b95cc7056c1e01373..da489941957cb8df1a0278f3df8e3881b267c566 100644 (file)
@@ -956,9 +956,11 @@ int main(int argc, char *argv[])
 
        prefs_destroy_cache();
        
+       compose_reopen_exit_drafts();
+
        sc_starting = FALSE;
        END_TIMING();
-       
+
        gtk_main();
 
        exit_claws(mainwin);
@@ -1005,6 +1007,7 @@ static void exit_claws(MainWindow *mainwin)
 
        main_window_get_size(mainwin);
        main_window_get_position(mainwin);
+
        prefs_common_write_config();
        account_write_config_all();
        addressbook_export_to_file();
@@ -1229,19 +1232,6 @@ static void parse_cmd_opt(int argc, char *argv[])
        }
 }
 
-static gint get_queued_message_num(void)
-{
-       FolderItem *queue;
-
-       queue = folder_get_default_queue();
-       if (!queue) {
-               return -1;
-       }
-
-       folder_item_scan(queue);
-       return queue->total_msgs;
-}
-
 static void initial_processing(FolderItem *item, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -1266,9 +1256,10 @@ static void draft_all_messages(void)
 {
        GList *compose_list = NULL;
        
+       compose_clear_exit_drafts();
        while ((compose_list = compose_get_compose_list()) != NULL) {
                Compose *c = (Compose*)compose_list->data;
-               compose_draft(c);
+               compose_draft(c, COMPOSE_DRAFT_FOR_EXIT);
        }       
 }
 gboolean clean_quit(gpointer data)
@@ -1315,24 +1306,10 @@ void app_will_exit(GtkWidget *widget, gpointer data)
        sc_exiting = TRUE;
        debug_print("exiting\n");
        if (compose_get_compose_list()) {
-               gint val = alertpanel(_("Really quit?"),
-                              _("Composing message exists."),
-                              _("_Save to Draft"), _("_Discard them"), _("Do_n't quit"));
-               switch (val) {
-                       case G_ALERTOTHER:
-                               main_window_popup(mainwin);
-                               sc_exiting = FALSE;
-                               return;
-                       case G_ALERTALTERNATE:
-                               break;
-                       default:
-                               draft_all_messages();
-               }
-
-               manage_window_focus_in(mainwin->window, NULL, NULL);
+               draft_all_messages();
        }
 
-       if (prefs_common.warn_queued_on_exit && get_queued_message_num() > 0) {
+       if (prefs_common.warn_queued_on_exit && procmsg_have_queued_mails_fast()) {
                if (alertpanel(_("Queued messages"),
                               _("Some unsent messages are queued. Exit now?"),
                               GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL)
@@ -1345,6 +1322,7 @@ void app_will_exit(GtkWidget *widget, gpointer data)
        }
 
        sock_cleanup();
+       summary_clear_list(mainwin->summaryview);
        if (folderview_get_selected_item(mainwin->folderview))
                folder_item_close(folderview_get_selected_item(mainwin->folderview));
        gtk_main_quit();