[Commits] [SCM] claws branch, master, updated. 3.16.0-152-g436f743

wwp at claws-mail.org wwp at claws-mail.org
Sat May 5 14:22:31 CEST 2018


The branch, master has been updated
       via  436f7434bd3cd4a07b0e02f969f7ff344f134509 (commit)
      from  3765ab6deb44a24f6bf3a94b732e04312b39f7ea (commit)

Summary of changes:
 src/summaryview.c |   50 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit 436f7434bd3cd4a07b0e02f969f7ff344f134509
Author: wwp <wwp at free.fr>
Date:   Sat May 5 14:21:53 2018 +0200

    Really ask for confirmation when marking *all* messages as read or
    unread from the message list (as it's done from the folder context
    menu). This confirmation dialog is still discardable and still
    obeys to the option "Confirm before marking all messages in a folder
    as read or unread" in preferences.
    A bit of code factorization.

diff --git a/src/summaryview.c b/src/summaryview.c
index cb3d125..66a0526 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -193,6 +193,8 @@ static void summary_mark_row_as_read	(SummaryView		*summaryview,
 					 GtkCMCTreeNode		*row);
 static void summary_mark_row_as_unread	(SummaryView		*summaryview,
 					 GtkCMCTreeNode		*row);
+static gboolean summary_mark_all_read_confirm(gboolean ask_if_needed);
+static gboolean summary_mark_all_unread_confirm(gboolean ask_if_needed);
 static void summary_delete_row		(SummaryView		*summaryview,
 					 GtkCMCTreeNode		*row);
 static void summary_unmark_row		(SummaryView		*summaryview,
@@ -4142,6 +4144,11 @@ void summary_mark_as_read(SummaryView *summaryview)
 
 	if (summary_is_locked(summaryview))
 		return;
+
+	if ((summaryview->folder_item->total_msgs == (gint)g_list_length(GTK_CMCLIST(ctree)->selection))
+		 && !summary_mark_all_read_confirm(TRUE))
+		return;
+
 	START_LONG_OPERATION(summaryview, FALSE);
 	folder_item_set_batch(summaryview->folder_item, TRUE);
 	for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
@@ -4161,6 +4168,11 @@ void summary_mark_as_unread(SummaryView *summaryview)
 
 	if (summary_is_locked(summaryview))
 		return;
+
+	if ((summaryview->folder_item->total_msgs == (gint)g_list_length(GTK_CMCLIST(ctree)->selection))
+		 && !summary_mark_all_unread_confirm(TRUE))
+		return;
+
 	START_LONG_OPERATION(summaryview, FALSE);
 	folder_item_set_batch(summaryview->folder_item, TRUE);
 	for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
@@ -4206,12 +4218,9 @@ void summary_msgs_unlock(SummaryView *summaryview)
 	summary_status_show(summaryview);
 }
 
-void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
+static gboolean summary_mark_all_read_confirm(gboolean ask_if_needed)
 {
-	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
-	GtkCMCTreeNode *node;
 	AlertValue val;
-	gboolean froze = FALSE;
 
 	/* ask_if_needed is FALSE when user-asking is performed by caller,
 	   commonly when the caller is a mark-as-read-recursive func */
@@ -4222,13 +4231,25 @@ void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
 			  TRUE, NULL, ALERT_QUESTION);
 
 		if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
-			return;
+			return FALSE;
 		else if (val & G_ALERTDISABLE)
 			prefs_common.ask_mark_all_read = FALSE;
 	}
+	return TRUE;
+}
+
+void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
+{
+	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+	GtkCMCTreeNode *node;
+	gboolean froze = FALSE;
 	
 	if (summary_is_locked(summaryview))
 		return;
+
+	if (!summary_mark_all_read_confirm(ask_if_needed))
+		return;
+
 	START_LONG_OPERATION(summaryview, TRUE);
 	folder_item_set_batch(summaryview->folder_item, TRUE);
 	for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
@@ -4245,12 +4266,9 @@ void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
 	summary_status_show(summaryview);
 }
 
-void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed)
+static gboolean summary_mark_all_unread_confirm(gboolean ask_if_needed)
 {
-	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
-	GtkCMCTreeNode *node;
 	AlertValue val;
-	gboolean froze = FALSE;
 
 	/* ask_if_needed is FALSE when user-asking is performed by caller,
 	   commonly when the caller is a mark-as-unread-recursive func */
@@ -4261,13 +4279,25 @@ void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed)
 			  TRUE, NULL, ALERT_QUESTION);
 
 		if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
-			return;
+			return FALSE;
 		else if (val & G_ALERTDISABLE)
 			prefs_common.ask_mark_all_read = FALSE;
 	}
+	return TRUE;
+}
+
+void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed)
+{
+	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+	GtkCMCTreeNode *node;
+	gboolean froze = FALSE;
 	
 	if (summary_is_locked(summaryview))
 		return;
+
+	if (!summary_mark_all_unread_confirm(ask_if_needed))
+		return;
+
 	START_LONG_OPERATION(summaryview, TRUE);
 	folder_item_set_batch(summaryview->folder_item, TRUE);
 	for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list