From 01903d77332392d5692a152abc07aa1dd2e6a4bd Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 9 Feb 2007 14:52:37 +0000 Subject: [PATCH] 2007-02-09 [paul] 2.7.2cvs36 * src/main.c * src/mainwindow.c * src/procmsg.c * src/procmsg.h fix "warn if there are queued messages" (on exit) option, which only checked the first mailbox's queue don't ask before emptying trash if there are no messages in trash, also check and empty all trash folders * src/prefs_other.c move "Ask before emptying trash" option outside of the "On exit" frame as it's not only an "On exit" option --- ChangeLog | 17 +++++++++++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/main.c | 15 +-------------- src/mainwindow.c | 2 +- src/prefs_other.c | 19 ++++++++++--------- src/procmsg.c | 16 ++++++++++++++++ src/procmsg.h | 1 + 8 files changed, 48 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9392709ea..6b97b9175 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2007-02-09 [paul] 2.7.2cvs36 + + * src/main.c + * src/mainwindow.c + * src/procmsg.c + * src/procmsg.h + fix "warn if there are queued messages" (on exit) + option, which only checked the first mailbox's + queue + don't ask before emptying trash if there are no + messages in trash, also check and empty all trash + folders + * src/prefs_other.c + move "Ask before emptying trash" option + outside of the "On exit" frame as it's + not only an "On exit" option + 2007-02-09 [paul] 2.7.2cvs35 * src/addrgather.c diff --git a/PATCHSETS b/PATCHSETS index ba2c19536..ce12b2c68 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2353,3 +2353,4 @@ ( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/plugins/pgpinline/pgpinline.c; ) > 2.7.2cvs33.patchset ( cvs diff -u -r 1.382.2.358 -r 1.382.2.359 src/compose.c; cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/prefs_other.c; cvs diff -u -r 1.1.2.14 -r 1.1.2.15 src/prefs_send.c; cvs diff -u -r 1.5.2.52 -r 1.5.2.53 src/gtk/gtkutils.c; ) > 2.7.2cvs34.patchset ( cvs diff -u -r 1.5.10.17 -r 1.5.10.18 src/addrgather.c; cvs diff -u -r 1.17.2.30 -r 1.17.2.31 src/alertpanel.c; cvs diff -u -r 1.8.2.20 -r 1.8.2.21 src/editldap.c; cvs diff -u -r 1.105.2.85 -r 1.105.2.86 src/prefs_account.c; cvs diff -u -r 1.52.2.37 -r 1.52.2.38 src/prefs_folder_item.c; cvs diff -u -r 1.5.2.12 -r 1.5.2.13 src/prefs_gtk.h; cvs diff -u -r 1.43.2.53 -r 1.43.2.54 src/prefs_matcher.c; cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/prefs_message.c; cvs diff -u -r 1.1.2.31 -r 1.1.2.32 src/prefs_msg_colors.c; cvs diff -u -r 1.1.2.37 -r 1.1.2.38 src/prefs_summaries.c; cvs diff -u -r 1.1.2.49 -r 1.1.2.50 src/wizard.c; cvs diff -u -r 1.2.2.22 -r 1.2.2.23 src/gtk/inputdialog.c; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/plugins/bogofilter/bogofilter_gtk.c; ) > 2.7.2cvs35.patchset +( cvs diff -u -r 1.115.2.135 -r 1.115.2.136 src/main.c; cvs diff -u -r 1.274.2.172 -r 1.274.2.173 src/mainwindow.c; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/prefs_other.c; cvs diff -u -r 1.150.2.91 -r 1.150.2.92 src/procmsg.c; cvs diff -u -r 1.60.2.41 -r 1.60.2.42 src/procmsg.h; ) > 2.7.2cvs36.patchset diff --git a/configure.ac b/configure.ac index 088b1966d..defae6f24 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=7 MICRO_VERSION=2 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=35 +EXTRA_VERSION=36 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/main.c b/src/main.c index 7974f5f69..12321a4ab 100644 --- a/src/main.c +++ b/src/main.c @@ -1232,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; @@ -1322,7 +1309,7 @@ void app_will_exit(GtkWidget *widget, gpointer data) 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) diff --git a/src/mainwindow.c b/src/mainwindow.c index f052f1d6d..895e8ddcf 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -2043,7 +2043,7 @@ void main_window_progress_set(MainWindow *mainwin, gint cur, gint total) void main_window_empty_trash(MainWindow *mainwin, gboolean confirm) { - if (confirm) { + if (confirm && procmsg_have_trashed_mails_fast()) { if (alertpanel(_("Empty trash"), _("Delete all messages in trash folders?"), GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL) diff --git a/src/prefs_other.c b/src/prefs_other.c index 242d6c46b..c8502c924 100644 --- a/src/prefs_other.c +++ b/src/prefs_other.c @@ -501,9 +501,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window, GtkWidget *vbox_exit; GtkWidget *checkbtn_confonexit; GtkWidget *checkbtn_cleanonexit; - GtkWidget *checkbtn_askonclean; GtkWidget *checkbtn_warnqueued; - GtkWidget *checkbtn_askonfilter; GtkWidget *frame_keys; GtkWidget *vbox_keys; @@ -515,6 +513,10 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window, GtkWidget *spinbtn_iotimeout; GtkObject *spinbtn_iotimeout_adj; + GtkWidget *vbox2; + GtkWidget *checkbtn_askonclean; + GtkWidget *checkbtn_askonfilter; + vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); @@ -574,9 +576,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window, PACK_CHECK_BUTTON (hbox1, checkbtn_cleanonexit, _("Empty trash on exit")); - PACK_CHECK_BUTTON (hbox1, checkbtn_askonclean, - _("Ask before emptying")); - SET_TOGGLE_SENSITIVITY (checkbtn_cleanonexit, checkbtn_askonclean); PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued, _("Warn if there are queued messages")); @@ -625,11 +624,13 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window, gtk_widget_show (label_iotimeout); gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0); - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); + vbox2 = gtk_vbox_new (FALSE, 8); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - PACK_CHECK_BUTTON (hbox1, checkbtn_askonfilter, + PACK_CHECK_BUTTON (vbox2, checkbtn_askonclean, + _("Ask before emptying trash")); + PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter, _("Ask about account specific filtering rules when " "filtering manually")); diff --git a/src/procmsg.c b/src/procmsg.c index 5b34da38c..dca1f9845 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -2328,3 +2328,19 @@ gboolean procmsg_have_queued_mails_fast (void) folder_func_to_all_folders(item_has_queued_mails, &result); return result; } + +static void item_has_trashed_mails(FolderItem *item, gpointer data) +{ + gboolean *result = (gboolean *)data; + if (*result == TRUE) + return; + if (folder_has_parent_of_type(item, F_TRASH) && item->total_msgs > 0) + *result = TRUE; +} + +gboolean procmsg_have_trashed_mails_fast (void) +{ + gboolean result = FALSE; + folder_func_to_all_folders(item_has_trashed_mails, &result); + return result; +} diff --git a/src/procmsg.h b/src/procmsg.h index 81b74eafc..ce57945b0 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -357,6 +357,7 @@ void procmsg_spam_set_folder (const char *item_identifier, FolderItem *(*spam_g FolderItem *procmsg_spam_get_folder (MsgInfo *msginfo); int procmsg_spam_learner_learn (MsgInfo *msginfo, GSList *msglist, gboolean spam); gboolean procmsg_have_queued_mails_fast (void); +gboolean procmsg_have_trashed_mails_fast (void); gboolean procmsg_is_sending(void); #endif /* __PROCMSG_H__ */ -- 2.25.1