[Commits] [SCM] claws branch, master, updated. 3.14.1-53-ga34523c

wwp at claws-mail.org wwp at claws-mail.org
Tue Dec 13 08:57:55 CET 2016


The branch, master has been updated
       via  a34523c61866032b23efd90390990c5e114db1df (commit)
       via  884055d3bd0e34da2ea6d74705ed5c2a0e9ef0a2 (commit)
      from  1a505326d080b3711388595f5d630a757791005a (commit)

Summary of changes:
 src/folderutils.c |    4 +--
 src/mainwindow.c  |    8 ++---
 src/summaryview.c |  103 +++++++++++++++++++++++++++++++----------------------
 src/summaryview.h |    6 ++--
 src/toolbar.c     |    8 ++---
 5 files changed, 75 insertions(+), 54 deletions(-)


- Log -----------------------------------------------------------------
commit a34523c61866032b23efd90390990c5e114db1df
Merge: 884055d 1a50532
Author: wwp <wwp at free.fr>
Date:   Tue Dec 13 08:57:52 2016 +0100

    Merge branch 'master' of ssh+git://git.claws-mail.org/home/git/claws


commit 884055d3bd0e34da2ea6d74705ed5c2a0e9ef0a2
Author: wwp <wwp at free.fr>
Date:   Tue Dec 13 08:56:27 2016 +0100

    Internal API change: split read/unread marking features from functions used
    to mark as read/all read using a parameter.

diff --git a/src/folderutils.c b/src/folderutils.c
index 939b019..0a4c95c 100644
--- a/src/folderutils.c
+++ b/src/folderutils.c
@@ -132,7 +132,7 @@ void folderutils_mark_all_read(FolderItem *item)
 	if (mainwin && mainwin->summaryview &&
 	    mainwin->summaryview->folder_item == item) {
 		debug_print("folder opened, using summary\n");
-		summary_mark_all_read(mainwin->summaryview, TRUE);
+		summary_mark_all_read(mainwin->summaryview);
 	} else {
 		msglist = folder_item_get_msg_list(item);
 		debug_print("got msglist %p\n", msglist);
@@ -172,7 +172,7 @@ void folderutils_mark_all_unread(FolderItem *item)
 	if (mainwin && mainwin->summaryview &&
 	    mainwin->summaryview->folder_item == item) {
 		debug_print("folder opened, using summary\n");
-		summary_mark_all_read(mainwin->summaryview, FALSE);
+		summary_mark_all_unread(mainwin->summaryview);
 	} else {
 		msglist = folder_item_get_msg_list(item);
 		debug_print("got msglist %p\n", msglist);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 19b98bd..64b2583 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4468,25 +4468,25 @@ static void unmark_cb(GtkAction *action, gpointer data)
 static void mark_as_read_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
-	summary_mark_as_read(mainwin->summaryview, TRUE);
+	summary_mark_as_read(mainwin->summaryview);
 }
 
 static void mark_as_unread_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
-	summary_mark_as_read(mainwin->summaryview, FALSE);
+	summary_mark_as_unread(mainwin->summaryview);
 }
 
 static void mark_all_read_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
-	summary_mark_all_read(mainwin->summaryview, TRUE);
+	summary_mark_all_read(mainwin->summaryview);
 }
 
 static void mark_all_unread_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
-	summary_mark_all_read(mainwin->summaryview, FALSE);
+	summary_mark_all_unread(mainwin->summaryview);
 }
 
 static void mark_as_spam_cb(GtkAction *action, gpointer data)
diff --git a/src/summaryview.c b/src/summaryview.c
index 4757b10..c2a9362 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -4045,7 +4045,7 @@ static void summary_mark_row_as_unread(SummaryView *summaryview,
 		msginfo->msgnum);
 }
 
-void summary_mark_as_read(SummaryView *summaryview, gboolean read)
+void summary_mark_as_read(SummaryView *summaryview)
 {
 	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
 	GList *cur;
@@ -4056,12 +4056,27 @@ void summary_mark_as_read(SummaryView *summaryview, gboolean read)
 	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)
-		if (read)
-			summary_mark_row_as_read(summaryview,
-						 GTK_CMCTREE_NODE(cur->data));
-		else
-			summary_mark_row_as_unread(summaryview,
-						 GTK_CMCTREE_NODE(cur->data));
+		summary_mark_row_as_read(summaryview,
+					 GTK_CMCTREE_NODE(cur->data));
+	folder_item_set_batch(summaryview->folder_item, FALSE);
+	END_LONG_OPERATION(summaryview);
+	
+	summary_status_show(summaryview);
+}
+
+void summary_mark_as_unread(SummaryView *summaryview)
+{
+	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+	GList *cur;
+	gboolean froze = FALSE;
+
+	if (summary_is_locked(summaryview))
+		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)
+		summary_mark_row_as_unread(summaryview,
+					 GTK_CMCTREE_NODE(cur->data));
 	folder_item_set_batch(summaryview->folder_item, FALSE);
 	END_LONG_OPERATION(summaryview);
 	
@@ -4102,25 +4117,53 @@ void summary_msgs_unlock(SummaryView *summaryview)
 	summary_status_show(summaryview);
 }
 
-void summary_mark_all_read(SummaryView *summaryview, gboolean read)
+void summary_mark_all_read(SummaryView *summaryview)
 {
 	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
 	GtkCMCTreeNode *node;
 	AlertValue val;
 	gboolean froze = FALSE;
-	gchar *message;
-	gchar *title;
 
-	if (read) {
-		title = _("Mark all as read");
-		message = _("Do you really want to mark all mails in this folder as read?");
-	} else {
-		title = _("Mark all as unread");
-		message = _("Do you really want to mark all mails in this folder as unread?");
+	if (prefs_common.ask_mark_all_read) {
+		val = alertpanel_full(_("Mark all as read"),
+			  _("Do you really want to mark all mails in this folder as read?"),
+			  GTK_STOCK_NO, GTK_STOCK_YES, NULL,
+			  TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
+
+		if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
+			return;
+		else if (val & G_ALERTDISABLE)
+			prefs_common.ask_mark_all_read = FALSE;
 	}
+	
+	if (summary_is_locked(summaryview))
+		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;
+	     node = gtkut_ctree_node_next(ctree, node))
+		summary_mark_row_as_read(summaryview, node);
+	folder_item_set_batch(summaryview->folder_item, FALSE);
+	for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
+	     node = gtkut_ctree_node_next(ctree, node)) {
+		if (!GTK_CMCTREE_ROW(node)->expanded)
+			summary_set_row_marks(summaryview, node);
+	}
+	END_LONG_OPERATION(summaryview);
+	
+	summary_status_show(summaryview);
+}
+
+void summary_mark_all_unread(SummaryView *summaryview)
+{
+	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+	GtkCMCTreeNode *node;
+	AlertValue val;
+	gboolean froze = FALSE;
 
 	if (prefs_common.ask_mark_all_read) {
-		val = alertpanel_full(title, message,
+		val = alertpanel_full(_("Mark all as unread"),
+			  _("Do you really want to mark all mails in this folder as unread?"),
 			  GTK_STOCK_NO, GTK_STOCK_YES, NULL,
 			  TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
 
@@ -4136,10 +4179,7 @@ void summary_mark_all_read(SummaryView *summaryview, gboolean read)
 	folder_item_set_batch(summaryview->folder_item, TRUE);
 	for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
 	     node = gtkut_ctree_node_next(ctree, node))
-		if (read)
-			summary_mark_row_as_read(summaryview, node);
-		else
-			summary_mark_row_as_unread(summaryview, node);
+		summary_mark_row_as_unread(summaryview, node);
 	folder_item_set_batch(summaryview->folder_item, FALSE);
 	for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
 	     node = gtkut_ctree_node_next(ctree, node)) {
@@ -4218,27 +4258,6 @@ void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *wid
 	summary_status_show(summaryview);	
 }
 
-
-void summary_mark_as_unread(SummaryView *summaryview)
-{
-	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
-	GList *cur;
-	gboolean froze = FALSE;
-
-	if (summary_is_locked(summaryview))
-		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)
-		summary_mark_row_as_unread(summaryview,
-					   GTK_CMCTREE_NODE(cur->data));
-	folder_item_set_batch(summaryview->folder_item, FALSE);
-	END_LONG_OPERATION(summaryview);
-	
-	summary_status_show(summaryview);
-}
-
 static gboolean check_permission(SummaryView *summaryview, MsgInfo * msginfo)
 {
 	GList * cur;
diff --git a/src/summaryview.h b/src/summaryview.h
index dee8068..66c0c4d 100644
--- a/src/summaryview.h
+++ b/src/summaryview.h
@@ -272,10 +272,12 @@ void summary_save_as		  (SummaryView		*summaryview);
 void summary_print		  (SummaryView		*summaryview);
 void summary_mark		  (SummaryView		*summaryview);
 void summary_unmark		  (SummaryView		*summaryview);
-void summary_mark_as_read	  (SummaryView		*summaryview, gboolean);
+void summary_mark_as_read	  (SummaryView		*summaryview);
+void summary_mark_as_unread	  (SummaryView		*summaryview);
 void summary_msgs_lock		  (SummaryView		*summaryview);
 void summary_msgs_unlock	  (SummaryView		*summaryview);
-void summary_mark_all_read	  (SummaryView		*summaryview, gboolean);
+void summary_mark_all_read	  (SummaryView		*summaryview);
+void summary_mark_all_unread	  (SummaryView		*summaryview);
 void summary_mark_as_spam	  (SummaryView 		*summaryview, 
 				   guint 		 action, 
 				   GtkWidget 		*widget);
diff --git a/src/toolbar.c b/src/toolbar.c
index 13d58ed..b48b804 100644
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -1624,7 +1624,7 @@ static void toolbar_all_read_cb(GtkWidget *widget, gpointer data)
 	switch (toolbar_item->type) {
 	case TOOLBAR_MAIN:
 		mainwin = (MainWindow *) toolbar_item->parent;
-		summary_mark_all_read(mainwin->summaryview, TRUE);
+		summary_mark_all_read(mainwin->summaryview);
 		break;
 	case TOOLBAR_MSGVIEW:
 		/* TODO: see toolbar_next_unread_cb() if you need
@@ -1646,7 +1646,7 @@ static void toolbar_all_unread_cb(GtkWidget *widget, gpointer data)
 	switch (toolbar_item->type) {
 	case TOOLBAR_MAIN:
 		mainwin = (MainWindow *) toolbar_item->parent;
-		summary_mark_all_read(mainwin->summaryview, FALSE);
+		summary_mark_all_unread(mainwin->summaryview);
 		break;
 	case TOOLBAR_MSGVIEW:
 		/* TODO: see toolbar_next_unread_cb() if you need
@@ -1668,7 +1668,7 @@ static void toolbar_read_cb(GtkWidget *widget, gpointer data)
 	switch (toolbar_item->type) {
 	case TOOLBAR_MAIN:
 		mainwin = (MainWindow *) toolbar_item->parent;
-		summary_mark_as_read(mainwin->summaryview, TRUE);
+		summary_mark_as_read(mainwin->summaryview);
 		break;
 	case TOOLBAR_MSGVIEW:
 		/* TODO: see toolbar_next_unread_cb() if you need
@@ -1690,7 +1690,7 @@ static void toolbar_unread_cb(GtkWidget *widget, gpointer data)
 	switch (toolbar_item->type) {
 	case TOOLBAR_MAIN:
 		mainwin = (MainWindow *) toolbar_item->parent;
-		summary_mark_as_read(mainwin->summaryview, FALSE);
+		summary_mark_as_unread(mainwin->summaryview);
 		break;
 	case TOOLBAR_MSGVIEW:
 		/* TODO: see toolbar_next_unread_cb() if you need

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list