[Commits] folder.c 1.213.2.202 1.213.2.203 folder.h 1.87.2.64 1.87.2.65 folder_item_prefs.c 1.2.2.37 1.2.2.38 folderview.c 1.207.2.225 1.207.2.226 mainwindow.c 1.274.2.337 1.274.2.338 mainwindow.h 1.39.2.61 1.39.2.62 summaryview.c 1.395.2.438 1.395.2.439 summaryview.h 1.68.2.57 1.68.2.58

pawel at claws-mail.org pawel at claws-mail.org
Sat Nov 19 16:14:03 CET 2011


Update of /home/claws-mail/claws/src
In directory claws-mail:/tmp/cvs-serv30012/src

Modified Files:
      Tag: gtk2
	folder.c folder.h folder_item_prefs.c folderview.c 
	mainwindow.c mainwindow.h summaryview.c summaryview.h 
Log Message:
2011-11-19 [pawel]	3.7.10cvs90

	* src/folder.c
	* src/folder.h
	* src/folder_item_prefs.c
	* src/folderview.c
	* src/mainwindow.c
	* src/mainwindow.h
	* src/summaryview.c
	* src/summaryview.h
	* src/gtk/authors.h
		Fix bug #1563 'Folder view: show complete threads if they
		contain unread messages'
		Add option to show only threads with unread messages
		initial patch by Paul Ollis, my small additions:
		- when checking thread for unread finish on first unread
		- make thread options unavailable when threading is off
		- hide_unread_msgs and hide_unread_threads are mutually
		  exclusive options, set menus sensitivity accordingly
		- set folder item icon type similiar to hide_unread_msgs

Index: summaryview.h
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.h,v
retrieving revision 1.68.2.57
retrieving revision 1.68.2.58
diff -u -d -r1.68.2.57 -r1.68.2.58
--- summaryview.h	16 Feb 2011 07:16:17 -0000	1.68.2.57
+++ summaryview.h	19 Nov 2011 15:14:01 -0000	1.68.2.58
@@ -302,6 +302,8 @@
 
 void summary_toggle_show_read_messages
 				  (SummaryView *summaryview);
+void summary_toggle_show_read_threads
+				  (SummaryView *summaryview);
 void summary_toggle_show_del_messages
 				  (SummaryView *summaryview);
 

Index: mainwindow.h
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.h,v
retrieving revision 1.39.2.61
retrieving revision 1.39.2.62
diff -u -d -r1.39.2.61 -r1.39.2.62
--- mainwindow.h	3 Jul 2011 13:17:49 -0000	1.39.2.61
+++ mainwindow.h	19 Nov 2011 15:14:01 -0000	1.39.2.62
@@ -66,7 +66,8 @@
 	M_FOLDER_SELECTED     = 1 << 25,
 	M_SESSION_PASSWORDS   = 1 << 26,
 	M_DELETED_EXISTS      = 1 << 27,
-	M_NOT_TRASH	      = 1 << 28
+	M_NOT_TRASH	      = 1 << 28,
+	M_HIDE_READ_THREADS   = 1 << 29
 } SensitiveCond;
 
 typedef enum

Index: folderview.c
===================================================================
RCS file: /home/claws-mail/claws/src/folderview.c,v
retrieving revision 1.207.2.225
retrieving revision 1.207.2.226
diff -u -d -r1.207.2.225 -r1.207.2.226
--- folderview.c	29 Oct 2011 08:24:06 -0000	1.207.2.225
+++ folderview.c	19 Nov 2011 15:14:01 -0000	1.207.2.226
@@ -1461,7 +1461,7 @@
 	}
 	switch (stype) {
 	case F_INBOX:
-		if (item->hide_read_msgs) {
+		if (item->hide_read_msgs || item->hide_read_threads) {
 			xpm = mark?m_inboxhrmxpm:inboxhrmxpm;
 			openxpm = mark?m_inboxopenhrmxpm:inboxopenhrmxpm;
 		} else {
@@ -1470,7 +1470,7 @@
 		}
 		break;
 	case F_OUTBOX:
-		if (item->hide_read_msgs) {
+		if (item->hide_read_msgs || item->hide_read_threads) {
 			xpm = mark?m_outboxhrmxpm:outboxhrmxpm;
 			openxpm = mark?m_outboxopenhrmxpm:outboxopenhrmxpm;
 		} else {
@@ -1479,7 +1479,7 @@
 		}
 		break;
 	case F_QUEUE:
-		if (item->hide_read_msgs) {
+		if (item->hide_read_msgs || item->hide_read_threads) {
 			xpm = mark?m_queuehrmxpm:queuehrmxpm;
 			openxpm = mark?m_queueopenhrmxpm:queueopenhrmxpm;
 		} else {
@@ -1488,7 +1488,7 @@
 		}
 		break;
 	case F_TRASH:
-		if (item->hide_read_msgs) {
+		if (item->hide_read_msgs || item->hide_read_threads) {
 			xpm = mark?m_trashhrmxpm:trashhrmxpm;
 			openxpm = mark?m_trashopenhrmxpm:trashopenhrmxpm;
 		} else {
@@ -1501,7 +1501,7 @@
 		openxpm = mark?m_draftsopenxpm:draftsopenxpm;
 		break;
 	default:
-		if (item->hide_read_msgs) {
+		if (item->hide_read_msgs || item->hide_read_threads) {
 			xpm = mark?m_folderhrmxpm:folderhrmxpm;
 			openxpm = mark?m_folderopenhrmxpm:folderopenhrmxpm;
 		} else {

Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.438
retrieving revision 1.395.2.439
diff -u -d -r1.395.2.438 -r1.395.2.439
--- summaryview.c	11 Nov 2011 17:28:06 -0000	1.395.2.438
+++ summaryview.c	19 Nov 2011 15:14:01 -0000	1.395.2.439
@@ -125,6 +125,8 @@
 					     guint action);
 static void summary_set_hide_del_msgs_menu (SummaryView *summaryview,
 					     guint action);
+static void summary_set_hide_read_threads_menu (SummaryView *summaryview,
+					     guint action);
 
 static GtkCMCTreeNode *summary_find_prev_msg
 					(SummaryView		*summaryview,
@@ -1212,6 +1214,7 @@
 				item?item->no_select:FALSE);
 		summary_set_hide_read_msgs_menu(summaryview, FALSE);
 		summary_set_hide_del_msgs_menu(summaryview, FALSE);
+		summary_set_hide_read_threads_menu(summaryview, FALSE);
 		summary_clear_all(summaryview);
 		summaryview->folder_item = item;
 		summary_thaw(summaryview);
@@ -1252,12 +1255,15 @@
 		mlist = folder_item_get_msg_list(item);
 	}
 
-	if ((summaryview->folder_item->hide_read_msgs || summaryview->folder_item->hide_del_msgs) &&
+	if ((summaryview->folder_item->hide_read_msgs
+             || summaryview->folder_item->hide_del_msgs
+             || summaryview->folder_item->hide_read_threads) &&
 	    quicksearch_is_active(summaryview->quicksearch) == FALSE) {
 		GSList *not_killed;
 		
 		summary_set_hide_read_msgs_menu(summaryview, summaryview->folder_item->hide_read_msgs);
 		summary_set_hide_del_msgs_menu(summaryview, summaryview->folder_item->hide_del_msgs);
+		summary_set_hide_read_threads_menu(summaryview, summaryview->folder_item->hide_read_threads);
 		not_killed = NULL;
 		for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) {
 			MsgInfo * msginfo = (MsgInfo *) cur->data;
@@ -1292,6 +1298,7 @@
 	} else {
 		summary_set_hide_read_msgs_menu(summaryview, FALSE);
 		summary_set_hide_del_msgs_menu(summaryview, FALSE);
+		summary_set_hide_read_threads_menu(summaryview, FALSE);
 	}
 
 	if (quicksearch_is_active(summaryview->quicksearch)) {
@@ -2472,6 +2479,7 @@
 	
 	if (summaryview->folder_item->hide_read_msgs 
 	|| summaryview->folder_item->hide_del_msgs
+	|| summaryview->folder_item->hide_read_threads
 	|| quicksearch_is_active(summaryview->quicksearch)) {
 		rowlist = GTK_CMCLIST(summaryview->ctree)->row_list;
 		for (cur = rowlist; cur != NULL && cur->data != NULL; cur = cur->next) {
@@ -2918,6 +2926,30 @@
 	msginfo->thread_date = most_recent;
 }
 
+static gboolean summary_update_is_read(GNode *node, gpointer data)
+{
+	MsgInfo *msginfo = node->data;
+	gboolean *all_read = (gboolean *)data;
+
+	if (MSG_IS_UNREAD(msginfo->flags)) {
+		*all_read = FALSE;
+		return TRUE;
+	}
+	return FALSE;
+}	
+
+static gboolean summary_thread_is_read(GNode *gnode)
+{
+	MsgInfo *msginfo = (MsgInfo *)gnode->data;
+	gboolean all_read = TRUE;
+
+	if (!msginfo)
+		return all_read;
+
+	g_node_traverse(gnode, G_IN_ORDER, G_TRAVERSE_ALL, -1, summary_update_is_read, &all_read);
+    return all_read;
+}
+
 static gboolean summary_insert_gnode_func(GtkCMCTree *ctree, guint depth, GNode *gnode,
 				   GtkCMCTreeNode *cnode, gpointer data)
 {
@@ -3011,10 +3043,14 @@
 		
 		for (gnode = root->children; gnode != NULL;
 		     gnode = gnode->next) {
-			summary_find_thread_age(gnode);
-			node = gtk_sctree_insert_gnode
-				(ctree, NULL, node, gnode,
-				 summary_insert_gnode_func, summaryview);
+            if (!summaryview->folder_item->hide_read_threads ||
+                    !summary_thread_is_read(gnode))
+            {
+                summary_find_thread_age(gnode);
+                node = gtk_sctree_insert_gnode
+                    (ctree, NULL, node, gnode,
+                     summary_insert_gnode_func, summaryview);
+            }
 		}
 
 		g_node_destroy(root);
@@ -7650,6 +7686,21 @@
  	summary_show(summaryview, summaryview->folder_item);
 }
  
+void summary_toggle_show_read_threads(SummaryView *summaryview)
+{
+	FolderItemUpdateData source;
+	if (summaryview->folder_item->hide_read_threads)
+ 		summaryview->folder_item->hide_read_threads = 0;
+ 	else
+ 		summaryview->folder_item->hide_read_threads = 1;
+
+	source.item = summaryview->folder_item;
+	source.update_flags = F_ITEM_UPDATE_NAME;
+	source.msg = NULL;
+	hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
+ 	summary_show(summaryview, summaryview->folder_item);
+}
+ 
 static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
  					     guint action)
 {
@@ -7663,6 +7714,19 @@
  			  GINT_TO_POINTER(0));
 }
 
+static void summary_set_hide_read_threads_menu (SummaryView *summaryview,
+ 					     guint action)
+{
+ 	GtkWidget *widget;
+
+ 	widget = gtk_ui_manager_get_widget(summaryview->mainwin->ui_manager, "/Menu/View/HideReadThreads");
+ 	g_object_set_data(G_OBJECT(widget), "dont_toggle",
+ 			  GINT_TO_POINTER(1));
+ 	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), action);
+ 	g_object_set_data(G_OBJECT(widget), "dont_toggle",
+ 			  GINT_TO_POINTER(0));
+}
+
 static void summary_set_hide_del_msgs_menu (SummaryView *summaryview,
  					     guint action)
 {

Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.c,v
retrieving revision 1.274.2.337
retrieving revision 1.274.2.338
diff -u -d -r1.274.2.337 -r1.274.2.338
--- mainwindow.c	18 Nov 2011 21:41:55 -0000	1.274.2.337
+++ mainwindow.c	19 Nov 2011 15:14:01 -0000	1.274.2.338
@@ -247,6 +247,8 @@
 
 static void hide_read_messages   (GtkAction	*action,
 				  gpointer	 data);
+static void hide_read_threads   (GtkAction	*action,
+				  gpointer	 data);
 static void hide_del_messages   (GtkAction	*action,
 				  gpointer	 data);
 
@@ -763,6 +765,7 @@
 #endif
 	{"View/ShowHide/ColumnHeaders",		NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb) }, /* toggle */
 	{"View/ThreadView",			NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb) }, /* toggle */
+	{"View/HideReadThreads",		NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads) }, /* toggle */
 	{"View/HideReadMessages",		NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
 	{"View/HideDelMessages",		NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
 #ifndef MAEMO
@@ -1718,6 +1721,7 @@
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ThreadView", "View/ThreadView", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ExpandThreads", "View/ExpandThreads", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "CollapseThreads", "View/CollapseThreads", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadThreads", "View/HideReadThreads", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadMessages", "View/HideReadMessages", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideDelMessages", "View/HideDelMessages", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator3", "View/---", GTK_UI_MANAGER_SEPARATOR)
@@ -3080,6 +3084,10 @@
 		if ((selection == SUMMARY_NONE && item->hide_read_msgs)
 		    || selection != SUMMARY_NONE)
 			state |= M_HIDE_READ_MSG;
+
+		if ((selection == SUMMARY_NONE && item->hide_read_threads)
+		    || selection != SUMMARY_NONE)
+			state |= M_HIDE_READ_THREADS;
 	}		
 	if (mainwin->summaryview->threaded)
 		state |= M_THREADED;
@@ -3208,6 +3216,7 @@
 		{"Menu/View/ThreadView"               , M_EXEC|M_SUMMARY_ISLIST},
 		{"Menu/View/ExpandThreads"        , M_MSG_EXIST|M_SUMMARY_ISLIST},
 		{"Menu/View/CollapseThreads"      , M_MSG_EXIST|M_SUMMARY_ISLIST},
+		{"Menu/View/HideReadThreads"	   , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
 		{"Menu/View/HideReadMessages"	   , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
 		{"Menu/View/HideDelMessages"	   , M_SUMMARY_ISLIST},
 		{"Menu/View/Goto/Prev"        , M_MSG_EXIST},
@@ -3370,10 +3379,18 @@
 		cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
 			      mainwin->messageview->mimeview->textview->show_all_headers);
 	cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & M_THREADED) != 0);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & M_THREADED) != 0);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & M_THREADED) != 0);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & M_THREADED) != 0);
 	cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
 	cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
 	cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
 
+	if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
+		cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
+	if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
+		cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
+		
 	main_window_menu_callback_unblock(mainwin);
 }
 
@@ -4543,6 +4560,16 @@
 	summary_toggle_show_del_messages(mainwin->summaryview);
 }
 
+static void hide_read_threads (GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+	GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadThreads");
+	if (!mainwin->summaryview->folder_item
+	    || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
+		return;
+	summary_toggle_show_read_threads(mainwin->summaryview);
+}
+
 static void thread_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;

Index: folder.h
===================================================================
RCS file: /home/claws-mail/claws/src/folder.h,v
retrieving revision 1.87.2.64
retrieving revision 1.87.2.65
diff -u -d -r1.87.2.64 -r1.87.2.65
--- folder.h	8 Apr 2011 16:55:52 -0000	1.87.2.64
+++ folder.h	19 Nov 2011 15:14:01 -0000	1.87.2.65
@@ -672,6 +672,7 @@
 	guint ret_rcpt       : 1; /* return receipt       */
 	guint search_match   : 1;
 	guint hide_del_msgs : 1; /* hide deleted messages   */
+	guint hide_read_threads : 1; /* hide threads with only read messages   */
 
 	gint op_count;
 	guint opened         : 1; /* opened by summary view */
@@ -711,6 +712,7 @@
 	guint		hide_read_msgs	: 1; /* CLAWS */
 	guint		ret_rcpt	: 1; /* CLAWS */
 	guint		hide_del_msgs	: 1; /* CLAWS */
+	guint		hide_read_threads	: 1;
 };
 
 struct _FolderUpdateData

Index: folder.c
===================================================================
RCS file: /home/claws-mail/claws/src/folder.c,v
retrieving revision 1.213.2.202
retrieving revision 1.213.2.203
diff -u -d -r1.213.2.202 -r1.213.2.203
--- folder.c	10 Apr 2011 08:07:06 -0000	1.213.2.202
+++ folder.c	19 Nov 2011 15:14:01 -0000	1.213.2.203
@@ -572,6 +572,8 @@
 			item->hide_read_msgs =  *attr->value == '1' ? TRUE : FALSE;
 		else if (!strcmp(attr->name, "hidedelmsgs"))
 			item->hide_del_msgs =  *attr->value == '1' ? TRUE : FALSE;
+		else if (!strcmp(attr->name, "hidereadthreads"))
+			item->hide_read_threads =  *attr->value == '1' ? TRUE : FALSE;
 		else if (!strcmp(attr->name, "reqretrcpt"))
 			item->ret_rcpt =  *attr->value == '1' ? TRUE : FALSE;
 		else if (!strcmp(attr->name, "sort_key")) {
@@ -656,6 +658,7 @@
 	xml_tag_add_attr(tag, xml_attr_new("threaded", item->threaded ? "1" : "0"));
 	xml_tag_add_attr(tag, xml_attr_new("hidereadmsgs", item->hide_read_msgs ? "1" : "0"));
 	xml_tag_add_attr(tag, xml_attr_new("hidedelmsgs", item->hide_del_msgs ? "1" : "0"));
+	xml_tag_add_attr(tag, xml_attr_new("hidereadthreads", item->hide_read_threads ? "1" : "0"));
 	if (item->ret_rcpt)
 		xml_tag_add_attr(tag, xml_attr_new("reqretrcpt", "1"));
 
@@ -3278,6 +3281,7 @@
 	new_item->ret_rcpt  = src->ret_rcpt;
 	new_item->hide_read_msgs = src->hide_read_msgs;
 	new_item->hide_del_msgs = src->hide_del_msgs;
+	new_item->hide_read_threads = src->hide_read_threads;
 	new_item->sort_key  = src->sort_key;
 	new_item->sort_type = src->sort_type;
 
@@ -4350,6 +4354,7 @@
 	item->ret_rcpt  = pp->ret_rcpt;
 	item->hide_read_msgs = pp->hide_read_msgs;
 	item->hide_del_msgs = pp->hide_del_msgs;
+	item->hide_read_threads = pp->hide_read_threads;
 	item->sort_key  = pp->sort_key;
 	item->sort_type = pp->sort_type;
 }
@@ -4376,6 +4381,7 @@
 		pp->ret_rcpt  = item->ret_rcpt;	
 		pp->hide_read_msgs = item->hide_read_msgs;
 		pp->hide_del_msgs = item->hide_del_msgs;
+		pp->hide_read_threads = item->hide_read_threads;
 		pp->sort_key  = item->sort_key;
 		pp->sort_type = item->sort_type;
 		g_hash_table_insert(pptable, id, pp);

Index: folder_item_prefs.c
===================================================================
RCS file: /home/claws-mail/claws/src/folder_item_prefs.c,v
retrieving revision 1.2.2.37
retrieving revision 1.2.2.38
diff -u -d -r1.2.2.37 -r1.2.2.38
--- folder_item_prefs.c	8 Apr 2011 16:55:52 -0000	1.2.2.37
+++ folder_item_prefs.c	19 Nov 2011 15:14:01 -0000	1.2.2.38
@@ -331,6 +331,7 @@
 	dest->ret_rcpt  = src->ret_rcpt;
 	dest->hide_read_msgs = src->hide_read_msgs;
 	dest->hide_del_msgs = src->hide_del_msgs;
+	dest->hide_read_threads = src->hide_read_threads;
 	dest->sort_key  = src->sort_key;
 	dest->sort_type = src->sort_type;
 



More information about the Commits mailing list