* src/compose.c
[claws.git] / src / main.c
index 610f84692efe91a39559cc40d44b4409aa260cc7..6d1ab1b7917767def2fc58b18732e3cf02776871 100644 (file)
@@ -507,7 +507,7 @@ static void initial_processing(FolderItem *item, gpointer data)
        main_window_cursor_normal(mainwin);
 }
 
-void clean_quit(void)  
+static void draft_all_messages(void)
 {
        GList * compose_list = compose_get_compose_list();
        GList * elem = NULL;
@@ -516,7 +516,13 @@ void clean_quit(void)
                        Compose *c = (Compose*)elem->data;
                        compose_draft(c);
                }
-       }
+       }       
+}
+
+void clean_quit(void)  
+{
+       draft_all_messages();
+
        if (prefs_common.warn_queued_on_exit)
        {       /* disable the popup */ 
                prefs_common.warn_queued_on_exit = FALSE;       
@@ -533,12 +539,20 @@ void app_will_exit(GtkWidget *widget, gpointer data)
 {
        MainWindow *mainwin = data;
        gchar *filename;
-
+       
        if (compose_get_compose_list()) {
-               if (alertpanel(_("Notice"),
-                              _("Composing message exists. Really quit?"),
-                              _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
-                       return;
+               gint val = alertpanel(_("Notice"),
+                              _("Composing message exists."),
+                              _("Draft them"), _("Discard them"), _("Don't quit"));
+               switch (val) {
+                       case G_ALERTOTHER:
+                               return;
+                       case G_ALERTALTERNATE:
+                               break;
+                       default:
+                               draft_all_messages();
+               }
+               
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
 
@@ -794,9 +808,8 @@ static void send_queue(void)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
                        statusbar_pop_all();
                        folder_item_scan(folder->queue);
-                       folderview_update_item(folder->queue, TRUE);
                        if (prefs_common.savemsg && folder->outbox) {
-                               folderview_update_item(folder->outbox, TRUE);
+                               folder_update_item(folder->outbox, TRUE);
                                if (folder->outbox == def_outbox)
                                        def_outbox = NULL;
                        }
@@ -804,5 +817,5 @@ static void send_queue(void)
        }
 
        if (prefs_common.savemsg && def_outbox)
-               folderview_update_item(def_outbox, TRUE);
+               folder_update_item(def_outbox, TRUE);
 }