[Commits] [SCM] claws branch, master, updated. 3.18.0-49-g44f2f01d2

wwp at claws-mail.org wwp at claws-mail.org
Wed Sep 1 09:58:46 UTC 2021


The branch, master has been updated
       via  44f2f01d2ad5e4eb3c13dda22fd29d20396b7ab8 (commit)
      from  c66ece0bb1e4e2de82a09e97ea83ae0775704533 (commit)

Summary of changes:
 src/folderutils.c     |  2 ++
 src/folderview.c      | 16 ++++++++++++++--
 src/folderview.h      |  2 ++
 src/prefs_common.c    |  2 ++
 src/prefs_common.h    |  1 +
 src/prefs_summaries.c | 11 +++++++++++
 6 files changed, 32 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 44f2f01d2ad5e4eb3c13dda22fd29d20396b7ab8
Author: wwp <subscript at free.fr>
Date:   Wed Sep 1 11:57:34 2021 +0200

    Add a global option to allow executing per-folder processing rules prior to
    mark all messages read/unread in folder (also works when marking recursively).

diff --git a/src/folderutils.c b/src/folderutils.c
index 9d71a51d6..650e2a1c6 100644
--- a/src/folderutils.c
+++ b/src/folderutils.c
@@ -176,6 +176,8 @@ static gboolean folderutils_mark_all_read_node_func(GNode *node, gpointer data)
 {
 	if (node) {
 		FolderItem *sub_item = (FolderItem *) node->data;
+		if (prefs_common.run_processingrules_before_mark_all)
+			folderview_run_processing(sub_item);
 		folderutils_mark_all_read(sub_item, (gboolean) GPOINTER_TO_INT(data));
 	}
 	return(FALSE);
diff --git a/src/folderview.c b/src/folderview.c
index c281192a3..ba472c204 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -897,13 +897,19 @@ static void mark_all_read_unread_handler(GtkAction *action, gpointer data,
 	if (read) {
 		if (recursive)
 			folderutils_mark_all_read_recursive(item, TRUE);
-		else
+		else {
+			if (prefs_common.run_processingrules_before_mark_all)
+				folderview_run_processing(item);
 			folderutils_mark_all_read(item, TRUE);
+		}
 	} else {
 		if (recursive)
 			folderutils_mark_all_read_recursive(item, FALSE);
-		else
+		else {
 			folderutils_mark_all_read(item, FALSE);
+			if (prefs_common.run_processingrules_before_mark_all)
+				folderview_run_processing(item);
+		}
 	}
 	if (folderview->summaryview->folder_item != item && !recursive)
 		summary_unlock(folderview->summaryview);
@@ -2575,6 +2581,12 @@ static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 	if (!folderview->selected) return;
 
 	item = folderview_get_selected_item(folderview);
+
+	folderview_run_processing(item);
+}
+
+void folderview_run_processing(FolderItem *item)
+{
 	cm_return_if_fail(item != NULL);
 	cm_return_if_fail(item->folder != NULL);
 
diff --git a/src/folderview.h b/src/folderview.h
index 24f7e75aa..9f7979bb2 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -127,6 +127,8 @@ void folderview_check_new_all		(void);
 
 void folderview_update_all_updated	(gboolean	 update_summary);
 
+void folderview_run_processing(FolderItem *item);
+
 void folderview_move_folder		(FolderView 	*folderview,
 					 FolderItem 	*from_folder,
 					 FolderItem 	*to_folder,
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 8ca507ab0..491ef8455 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -899,6 +899,8 @@ static PrefParam param[] = {
 	 NULL, NULL, NULL},
 #endif
 
+	{"run_processingrules_before_mark_all", "FALSE", &prefs_common.run_processingrules_before_mark_all, P_BOOL,
+	 NULL, NULL, NULL},
 	{"ask_mark_all_read", "TRUE", &prefs_common.ask_mark_all_read, P_BOOL,
 	 NULL, NULL, NULL},
 	{"ask_override_colorlabel", "TRUE", &prefs_common.ask_override_colorlabel, P_BOOL,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index fe179457f..ba7eb723e 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -421,6 +421,7 @@ struct _PrefsCommon
 #endif
 	int hover_timeout; /* msecs mouse hover timeout */
 	gboolean ask_mark_all_read;
+	gboolean run_processingrules_before_mark_all;
 	gboolean ask_override_colorlabel;
 	gboolean ask_apply_per_account_filtering_rules;
 	gint apply_per_account_filtering_rules;
diff --git a/src/prefs_summaries.c b/src/prefs_summaries.c
index fe0f94215..411412891 100644
--- a/src/prefs_summaries.c
+++ b/src/prefs_summaries.c
@@ -73,6 +73,7 @@ typedef struct _SummariesPage
 	GtkWidget *spinbtn_mark_as_read_delay;
 	GtkWidget *checkbtn_immedexec;
 	GtkWidget *checkbtn_ask_mark_all_read;
+	GtkWidget *checkbtn_run_processingrules_mark_all_read;
 	GtkWidget *checkbtn_ask_override_colorlabel;
   	GtkWidget *optmenu_sort_key;
   	GtkWidget *optmenu_sort_type;
@@ -352,6 +353,7 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkAdjustment *spinbtn_mark_as_read_delay_adj;
 	GtkWidget *checkbtn_immedexec;
 	GtkWidget *checkbtn_ask_mark_all_read;
+	GtkWidget *checkbtn_run_processingrules_mark_all_read;
 	GtkWidget *checkbtn_ask_override_colorlabel;
 	GtkWidget *label, *label_fill;
 	GtkListStore *menu;
@@ -416,6 +418,10 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 		(vbox1, checkbtn_reopen_last_folder,
 		 _("Open last opened folder at start-up"));
 
+	PACK_CHECK_BUTTON
+		(vbox1, checkbtn_run_processingrules_mark_all_read,
+		 _("Run processing rules before marking all messages in a folder as read or unread"));
+
 	hbox1 = gtk_hbox_new (FALSE, 8);
 	gtk_widget_show (hbox1);
 	gtk_box_pack_start(GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
@@ -691,6 +697,7 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	prefs_summaries->spinbtn_mark_as_read_delay = spinbtn_mark_as_read_delay;
 	prefs_summaries->checkbtn_immedexec = checkbtn_immedexec;
 	prefs_summaries->checkbtn_ask_mark_all_read = checkbtn_ask_mark_all_read;
+	prefs_summaries->checkbtn_run_processingrules_mark_all_read = checkbtn_run_processingrules_mark_all_read;
 	prefs_summaries->checkbtn_ask_override_colorlabel = checkbtn_ask_override_colorlabel;
 	prefs_summaries->optmenu_sort_key = optmenu_sort_key;
 	prefs_summaries->optmenu_sort_type = optmenu_sort_type;
@@ -750,6 +757,8 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 			prefs_common.immediate_exec);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_mark_all_read),
 			prefs_common.ask_mark_all_read);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_run_processingrules_mark_all_read),
+			prefs_common.run_processingrules_before_mark_all);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_override_colorlabel),
 			prefs_common.ask_override_colorlabel);
 
@@ -824,6 +833,8 @@ static void prefs_summaries_save(PrefsPage *_page)
 		GTK_TOGGLE_BUTTON(page->checkbtn_immedexec));
 	prefs_common.ask_mark_all_read = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_ask_mark_all_read));
+	prefs_common.run_processingrules_before_mark_all = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_run_processingrules_mark_all_read));
 	prefs_common.ask_override_colorlabel = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_ask_override_colorlabel));
 	prefs_common.mark_as_read_delay = gtk_spin_button_get_value_as_int(

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list