#include "folderview.h"
#include "summaryview.h"
#include "prefs_common.h"
-#include "prefs_filter.h"
#include "prefs_account.h"
#include "prefs_actions.h"
#include "scoring.h"
} \
}
+static MainWindow *static_mainwindow;
int main(int argc, char *argv[])
{
gchar *userrc;
prefs_common_read_config();
#if USE_GPGME
+ gpg_started = FALSE;
if (gpgme_check_engine()) { /* Also does some gpgme init */
rfc2015_disable_all();
debug_print("gpgme_engine_version:\n%s\n",
if (val & G_ALERTDISABLE)
prefs_common.gpg_warning = FALSE;
}
- }
+ } else
+ gpg_started = TRUE;
+
gpgme_register_idle(idle_function_for_gpgme);
#endif
prefs_common_save_config();
- prefs_filter_read_config();
- prefs_filter_write_config();
prefs_actions_read_config();
prefs_actions_write_config();
prefs_display_header_read_config();
if (cmd.online_mode == ONLINE_MODE_ONLINE)
main_window_toggle_work_offline(mainwin, FALSE);
+ static_mainwindow = mainwin;
gtk_main();
addressbook_destroy();
main_window_cursor_normal(mainwin);
}
+static void draft_all_messages(void)
+{
+ GList * compose_list = compose_get_compose_list();
+ GList * elem = NULL;
+ if(compose_list) {
+ for (elem = compose_list; elem != NULL && elem->data != NULL; elem = elem->next) {
+ 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;
+ app_will_exit(NULL, static_mainwindow);
+ prefs_common.warn_queued_on_exit = TRUE;
+ prefs_common_save_config();
+ } else {
+ app_will_exit(NULL, static_mainwindow);
+ }
+ exit(0);
+}
+
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);
}
main_window_get_size(mainwin);
main_window_get_position(mainwin);
prefs_common_save_config();
- prefs_filter_write_config();
account_save_config_all();
addressbook_export_to_file();
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;
}
}
if (prefs_common.savemsg && def_outbox)
- folderview_update_item(def_outbox, TRUE);
+ folder_update_item(def_outbox, TRUE);
}