aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-08-22 23:02:58 +0800
committerMilan Crha <mcrha@redhat.com>2011-08-22 23:02:58 +0800
commit279722df7c777a2e8d3e39a38cb95a08ba526e76 (patch)
tree575e6e8f04e1d1c51d288faf351d96ef2a78075c /plugins
parent00cf6c2db043301f3fe1f53c2c5c7976e9bff1ee (diff)
downloadgsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar.gz
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar.bz2
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar.lz
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar.xz
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.tar.zst
gsoc2013-evolution-279722df7c777a2e8d3e39a38cb95a08ba526e76.zip
Bug #652092 - 'Mark messages as read' doesn't work with search folder
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mark-all-read/mark-all-read.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 147b779217..81e220c19d 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -252,6 +252,7 @@ static gboolean
scan_folder_tree_for_unread_helper (GtkTreeModel *model,
GtkTreeIter *iter,
GtkTreePath *path,
+ gboolean is_first_node,
gint initial_depth,
gint *relative_depth)
{
@@ -263,16 +264,21 @@ scan_folder_tree_for_unread_helper (GtkTreeModel *model,
gboolean folder_has_unread;
gboolean is_draft = FALSE;
gboolean is_store = FALSE;
- guint unread = 0;
+ guint unread = 0, folder_flags = 0;
gtk_tree_model_get (
model, iter,
+ COL_UINT_FLAGS, &folder_flags,
COL_UINT_UNREAD, &unread,
COL_BOOL_IS_STORE, &is_store,
COL_BOOL_IS_DRAFT, &is_draft, -1);
folder_has_unread =
!is_store && !is_draft &&
+ (folder_flags & CAMEL_FOLDER_VTRASH) == 0 &&
+ ((folder_flags & CAMEL_FOLDER_VIRTUAL) == 0 ||
+ ((folder_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_TRASH &&
+ (folder_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_JUNK)) &&
unread > 0 && unread != ~((guint) 0);
if (folder_has_unread) {
@@ -291,13 +297,17 @@ scan_folder_tree_for_unread_helper (GtkTreeModel *model,
gtk_tree_path_down (path);
if (scan_folder_tree_for_unread_helper (
- model, &child, path,
+ model, &child, path, FALSE,
initial_depth, relative_depth))
return TRUE;
gtk_tree_path_up (path);
}
+ /* do not check sibling nodes of the selected folder */
+ if (is_first_node)
+ break;
+
gtk_tree_path_next (path);
} while (gtk_tree_model_iter_next (model, iter));
@@ -337,7 +347,7 @@ scan_folder_tree_for_unread (const gchar *folder_uri)
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
scan_folder_tree_for_unread_helper (
- GTK_TREE_MODEL (model), &iter, path,
+ GTK_TREE_MODEL (model), &iter, path, TRUE,
gtk_tree_path_get_depth (path), &relative_depth);
gtk_tree_path_free (path);
@@ -396,10 +406,8 @@ mar_got_folder (CamelStore *store,
g_return_if_fail (CAMEL_IS_FOLDER (folder));
- /* XXX Skip virtual folders. I guess this is intended for
- * virtual Junk and Trash folders. But what if I want
- * to mark messages in a Search Folder? */
- if (!CAMEL_IS_VEE_FOLDER (folder)) {
+ /* Skip virtual trash/junk folders. */
+ if (!CAMEL_IS_VTRASH_FOLDER (folder)) {
GPtrArray *uids;
gint ii;