Index: mail/ChangeLog
===================================================================
--- mail/ChangeLog	(revision 35294)
+++ mail/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-04-01  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #214238
+
+	* em-folder-tree.c: (subdirs_contain_unread), (render_display_name):
+	Show number of unread messages in actual folder and also
+	in subfolders for collapsed folders.
+
 2008-03-29  Matthew Barnes  <mbarnes@redhat.com>
 
 	* em-network-prefs.c (em_network_prefs_finalise),
Index: mail/em-folder-tree.c
===================================================================
--- mail/em-folder-tree.c	(revision 35294)
+++ mail/em-folder-tree.c	(working copy)
@@ -242,7 +242,7 @@ em_folder_tree_class_init (EMFolderTreeC
 }
 
 static gboolean
-subdirs_contain_unread (GtkTreeModel *model, GtkTreeIter *root)
+subdirs_contain_unread (GtkTreeModel *model, GtkTreeIter *root, unsigned int *sub_unread)
 {
 	unsigned int unread;
 	GtkTreeIter iter;
@@ -252,14 +252,20 @@ subdirs_contain_unread (GtkTreeModel *mo
 
 	do {
 		gtk_tree_model_get (model, &iter, COL_UINT_UNREAD, &unread, -1);
-		if (unread)
+		if (unread && !sub_unread)
 			return TRUE;
 
+		if (sub_unread)
+			*sub_unread += unread;
+
 		if (gtk_tree_model_iter_has_child (model, &iter))
-			if (subdirs_contain_unread (model, &iter))
+			if (subdirs_contain_unread (model, &iter, sub_unread) && !sub_unread)
 				return TRUE;
 	} while (gtk_tree_model_iter_next (model, &iter));
 
+	if (sub_unread)
+		return *sub_unread > 0;
+
 	return FALSE;
 }
 
@@ -341,7 +347,7 @@ render_display_name (GtkTreeViewColumn *
 		     GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 {
 	gboolean is_store, bold;
-	unsigned int unread;
+	unsigned int unread, sub_unread = 0;
 	char *display;
 	char *name;
 
@@ -349,28 +355,46 @@ render_display_name (GtkTreeViewColumn *
 			    COL_BOOL_IS_STORE, &is_store,
 			    COL_UINT_UNREAD, &unread, -1);
 
-	if (!(bold = is_store || unread)) {
-		if (gtk_tree_model_iter_has_child (model, iter))
-			bold = subdirs_contain_unread (model, iter);
-	}
-
-	if (!is_store && unread) {
-		/* Translators: This is the string used for displaying the
-		 * folder names in folder trees. "%s" will be replaced by
-		 * the folder's name and "%u" will be replaced with the
-		 * number of unread messages in the folder.
-		 *
-		 * Most languages should translate this as "%s (%u)". The
-		 * languages that use localized digits (like Persian) may
-		 * need to replace "%u" with "%Iu". Right-to-left languages
-		 * (like Arabic and Hebrew) may need to add bidirectional
-		 * formatting codes to take care of the cases the folder
-		 * name appears in either direction.
-		 *
-		 * Do not translate the "folder-display|" part. Remove it
-		 * from your translation.
-		 */
-		display = g_strdup_printf (Q_("folder-display|%s (%u)"), name, unread);
+	bold = is_store || unread;
+	if (!is_store && gtk_tree_model_iter_has_child (model, iter)) {
+		gboolean expanded;
+		unsigned int *num = NULL;
+
+		g_object_get (renderer, "is-expanded", &expanded, NULL);
+
+		if (!expanded)
+			num = &sub_unread;
+
+		if (!bold || !expanded)
+			bold = subdirs_contain_unread (model, iter, num) || bold;
+	}
+
+	if (!is_store && (unread || sub_unread)) {
+		if (!sub_unread) {
+			/* Translators: This is the string used for displaying the
+			 * folder names in folder trees. "%s" will be replaced by
+			 * the folder's name and "%u" will be replaced with the
+			 * number of unread messages in the folder.
+			 *
+			 * Most languages should translate this as "%s (%u)". The
+			 * languages that use localized digits (like Persian) may
+			 * need to replace "%u" with "%Iu". Right-to-left languages
+			 * (like Arabic and Hebrew) may need to add bidirectional
+			 * formatting codes to take care of the cases the folder
+			 * name appears in either direction.
+			 *
+			 * Do not translate the "folder-display|" part. Remove it
+			 * from your translation.
+			 */
+			display = g_strdup_printf (Q_("folder-display|%s (%u)"), name, unread);
+		} else {
+			/* Translators: Here applies same rules as for "folder-display|%s (%u)"
+			 * with one difference, first %u is for new messages in actual folder,
+			 * the second %u is number of new messages in subfolders.
+			 * This will be shown in case the folder is collapsed in a tree view.
+			 */
+			display = g_strdup_printf (Q_("folder-display|%s (%u/%u)"), name, unread, sub_unread);
+		}
 		g_free (name);
 	} else
 		display = name;
