[Commits] [SCM] claws branch, master, updated. 3.9.3-195-g08057fc

colin at claws-mail.org colin at claws-mail.org
Thu May 15 12:01:22 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  08057fc6b0e71a9178f95d63514be5260916b2c1 (commit)
       via  0d5ac87f0826041691f209f5fdd25c48d0098a64 (commit)
       via  66573e98e915749e91dfae49859881c561bb107d (commit)
      from  06a575da21dcdeb693ef9f8c2f8f84c6b5240f9f (commit)


- Log -----------------------------------------------------------------
commit 08057fc6b0e71a9178f95d63514be5260916b2c1
Author: Colin Leroy <colin at colino.net>
Date:   Thu May 15 12:01:01 2014 +0200

    Don't enter draft folders when navigating to next unread/new/marked

diff --git a/src/folderview.c b/src/folderview.c
index 457affb..f3df646 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -880,7 +880,7 @@ static GtkCMCTreeNode *folderview_find_next_with_flag(GtkCMCTree *ctree,
 
 	for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
 		item = gtk_cmctree_node_get_row_data(ctree, node);
-		if (item->stype == F_TRASH)
+		if (item->stype == F_TRASH || item->stype == F_DRAFT)
 			continue;
 		switch (flag) {
 		case MSG_UNREAD:

commit 0d5ac87f0826041691f209f5fdd25c48d0098a64
Author: Colin Leroy <colin at colino.net>
Date:   Thu May 15 12:00:06 2014 +0200

    Factorize folderview_find_next_{unread,new,marked}

diff --git a/src/folderview.c b/src/folderview.c
index 94d708d..457affb 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -867,8 +867,9 @@ void folderview_unselect(FolderView *folderview)
 	folderview->selected = folderview->opened = NULL;
 }
 
-static GtkCMCTreeNode *folderview_find_next_marked(GtkCMCTree *ctree,
-						 GtkCMCTreeNode *node)
+static GtkCMCTreeNode *folderview_find_next_with_flag(GtkCMCTree *ctree,
+						      GtkCMCTreeNode *node,
+						      MsgPermFlags flag)
 {
 	FolderItem *item;
 
@@ -879,73 +880,51 @@ static GtkCMCTreeNode *folderview_find_next_marked(GtkCMCTree *ctree,
 
 	for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
 		item = gtk_cmctree_node_get_row_data(ctree, node);
-		if (item && item->marked_msgs > 0 && item->stype != F_TRASH)
-			return node;
+		if (item->stype == F_TRASH)
+			continue;
+		switch (flag) {
+		case MSG_UNREAD:
+			if(item->unread_msgs > 0)
+				return node;
+			break;
+		case MSG_NEW:
+			if(item->new_msgs > 0)
+				return node;
+			break;
+		case MSG_MARKED:
+			if(item->marked_msgs > 0)
+				return node;
+			break;
+		}
 	}
 
 	return NULL;
 }
 
-void folderview_select_next_marked(FolderView *folderview)
+void folderview_select_next_with_flag(FolderView *folderview,
+				      MsgPermFlags flag,
+				      gboolean force_open)
 {
 	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 	GtkCMCTreeNode *node = NULL;
 	EntryAction last_summary_select_prio = prefs_common.summary_select_prio[0];
 	gboolean last_open = prefs_common.always_show_msg;
 	
-	prefs_common.summary_select_prio[0] = ACTION_MARKED;
-	prefs_common.always_show_msg = OPENMSG_ALWAYS;
-
-	if ((node = folderview_find_next_marked(ctree, folderview->opened))
-	    != NULL) {
-		folderview_select_node(folderview, node);
-		goto out;
-	}
-
-	if (!folderview->opened ||
-	    folderview->opened == GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list)) {
-		goto out;
-	}
-	/* search again from the first node */
-	if ((node = folderview_find_next_marked(ctree, NULL)) != NULL)
-		folderview_select_node(folderview, node);
-
-out:
-	prefs_common.summary_select_prio[0] = last_summary_select_prio;
-	prefs_common.always_show_msg = last_open;
-}
-
-static GtkCMCTreeNode *folderview_find_next_unread(GtkCMCTree *ctree,
-						 GtkCMCTreeNode *node)
-{
-	FolderItem *item;
-
-	if (node)
-		node = gtkut_ctree_node_next(ctree, node);
-	else
-		node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
-
-	for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-		item = gtk_cmctree_node_get_row_data(ctree, node);
-		if (item && item->unread_msgs > 0 && item->stype != F_TRASH)
-			return node;
+	switch (flag) {
+	case MSG_UNREAD:
+		prefs_common.summary_select_prio[0] = ACTION_UNREAD;
+		break;
+	case MSG_NEW:
+		prefs_common.summary_select_prio[0] = ACTION_NEW;
+		break;
+	case MSG_MARKED:
+		prefs_common.summary_select_prio[0] = ACTION_MARKED;
+		break;
 	}
-
-	return NULL;
-}
-
-void folderview_select_next_unread(FolderView *folderview, gboolean force_open)
-{
-	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
-	GtkCMCTreeNode *node = NULL;
-	EntryAction last_summary_select_prio = prefs_common.summary_select_prio[0];
-	gboolean last_open = prefs_common.always_show_msg;
-	
-	prefs_common.summary_select_prio[0] = ACTION_UNREAD;
 	prefs_common.always_show_msg = force_open ? OPENMSG_ALWAYS : last_open;
 
-	if ((node = folderview_find_next_unread(ctree, folderview->opened))
-	    != NULL) {
+	node = folderview_find_next_with_flag(ctree, folderview->opened, flag);
+	if (node != NULL) {
 		folderview_select_node(folderview, node);
 		goto out;
 	}
@@ -954,56 +933,10 @@ void folderview_select_next_unread(FolderView *folderview, gboolean force_open)
 	    folderview->opened == GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list)) {
 		goto out;
 	}
-	/* search again from the first node */
-	if ((node = folderview_find_next_unread(ctree, NULL)) != NULL)
-		folderview_select_node(folderview, node);
-
-out:
-	prefs_common.summary_select_prio[0] = last_summary_select_prio;
-	prefs_common.always_show_msg = last_open;
-}
 
-static GtkCMCTreeNode *folderview_find_next_new(GtkCMCTree *ctree,
-						 GtkCMCTreeNode *node)
-{
-	FolderItem *item;
-
-	if (node)
-		node = gtkut_ctree_node_next(ctree, node);
-	else
-		node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
-
-	for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-		item = gtk_cmctree_node_get_row_data(ctree, node);
-		if (item && item->new_msgs > 0 && item->stype != F_TRASH)
-			return node;
-	}
-
-	return NULL;
-}
-
-void folderview_select_next_new(FolderView *folderview)
-{
-	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
-	GtkCMCTreeNode *node = NULL;
-	EntryAction last_summary_select_prio = prefs_common.summary_select_prio[0];
-	gboolean last_open = prefs_common.always_show_msg;
-	
-	prefs_common.summary_select_prio[0] = ACTION_NEW;
-	prefs_common.always_show_msg = OPENMSG_ALWAYS;
-
-	if ((node = folderview_find_next_new(ctree, folderview->opened))
-	    != NULL) {
-		folderview_select_node(folderview, node);
-		goto out;
-	}
-
-	if (!folderview->opened ||
-	    folderview->opened == GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list)) {
-		goto out;
-	}
 	/* search again from the first node */
-	if ((node = folderview_find_next_new(ctree, NULL)) != NULL)
+	node = folderview_find_next_with_flag(ctree, NULL, flag);
+	if (node != NULL)
 		folderview_select_node(folderview, node);
 
 out:
@@ -2011,7 +1944,7 @@ static gboolean folderview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 			if (folderview->opened == folderview->selected &&
 			    (!folderview->summaryview->folder_item ||
 			     folderview->summaryview->folder_item->total_msgs == 0))
-				folderview_select_next_unread(folderview, TRUE);
+				folderview_select_next_with_flag(folderview, MSG_UNREAD, TRUE);
 			else
 				folderview_select_node(folderview,
 						       folderview->selected);
diff --git a/src/folderview.h b/src/folderview.h
index 95093ff..cc36427 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -113,10 +113,9 @@ void folderview_set_all			(void);
 void folderview_select			(FolderView	*folderview,
 					 FolderItem	*item);
 void folderview_unselect		(FolderView	*folderview);
-void folderview_select_next_unread	(FolderView	*folderview, 
+void folderview_select_next_with_flag	(FolderView	*folderview,
+					 MsgPermFlags    flag,
 					 gboolean 	 force_open);
-void folderview_select_next_new		(FolderView	*folderview);
-void folderview_select_next_marked	(FolderView	*folderview);
 
 FolderItem *folderview_get_selected_item(FolderView	*folderview);
 
diff --git a/src/mainwindow.c b/src/mainwindow.c
index dd560e8..517db91 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1393,7 +1393,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
 				    && mainwin->summaryview->folder_item->total_msgs == 0))) {
 				g_signal_stop_emission_by_name(G_OBJECT(widget), 
                                 	       "key_press_event");
-				folderview_select_next_unread(mainwin->folderview, TRUE);
+				folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, TRUE);
 			}
 		}
 		break;
@@ -4833,7 +4833,7 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
-	folderview_select_next_unread(mainwin->folderview, FALSE);
+	folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, FALSE);
 }
 
 static void scroll_prev_line_cb(GtkAction *action, gpointer data)
diff --git a/src/messageview.c b/src/messageview.c
index 30cd460..b3b815b 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -2584,8 +2584,9 @@ static void parent_cb(GtkAction *action, gpointer data)
 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
 {
 	MessageView *messageview = (MessageView *)data;
+
 	messageview->updating = TRUE;
-	folderview_select_next_unread(messageview->mainwin->folderview, FALSE);
+	folderview_select_next_with_flag(messageview->mainwin->folderview, MSG_UNREAD, FALSE);
 	messageview->updating = FALSE;
 
 	if (messageview->deferred_destroy) {
diff --git a/src/summaryview.c b/src/summaryview.c
index f874bc6..13ad155 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1903,7 +1903,7 @@ void summary_select_next_unread(SummaryView *summaryview)
  			}
 
 			if (val == G_ALERTALTERNATE)
-				folderview_select_next_unread(summaryview->folderview, TRUE);
+				folderview_select_next_with_flag(summaryview->folderview, MSG_UNREAD, TRUE);
 		} else {
 			summary_select_node(summaryview, node, TRUE, FALSE);
 		}
@@ -1998,7 +1998,7 @@ void summary_select_next_new(SummaryView *summaryview)
  			}
 
 			if (val == G_ALERTALTERNATE) {
-				folderview_select_next_new(summaryview->folderview);
+				folderview_select_next_with_flag(summaryview->folderview, MSG_NEW, TRUE);
 				return;
 			} 
 			else
@@ -2077,7 +2077,7 @@ void summary_select_next_marked(SummaryView *summaryview)
  			}
 
 			if (val == G_ALERTALTERNATE) {
-				folderview_select_next_marked(summaryview->folderview);
+				folderview_select_next_with_flag(summaryview->folderview, MSG_MARKED, TRUE);
 				return;
 			} 
 			else

commit 66573e98e915749e91dfae49859881c561bb107d
Author: Colin Leroy <colin at colino.net>
Date:   Thu May 15 11:26:21 2014 +0200

    Remove useless returns

diff --git a/src/summaryview.c b/src/summaryview.c
index d45091f..f874bc6 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1902,15 +1902,11 @@ void summary_select_next_unread(SummaryView *summaryview)
  						_("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
  			}
 
-			if (val == G_ALERTALTERNATE) {
+			if (val == G_ALERTALTERNATE)
 				folderview_select_next_unread(summaryview->folderview, TRUE);
-				return;
-			} 
-			else
-				return;
-		} else
+		} else {
 			summary_select_node(summaryview, node, TRUE, FALSE);
-
+		}
 	}
 }
 

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

Summary of changes:
 src/folderview.c  |  141 ++++++++++++++---------------------------------------
 src/folderview.h  |    5 +-
 src/mainwindow.c  |    4 +-
 src/messageview.c |    3 +-
 src/summaryview.c |   16 +++---
 5 files changed, 49 insertions(+), 120 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list