aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-04-30 17:52:56 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-04-30 17:52:56 +0800
commit05e8333292dc51f0b6c949d3aeb3496c08d4e613 (patch)
tree976156e2fab9640b3c86d914d79581843bcb0047 /mail/message-list.c
parent6d29300fdf6fe18576c54d3e1ed2d8c9982945a6 (diff)
downloadgsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.tar.gz
gsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.tar.zst
gsoc2013-evolution-05e8333292dc51f0b6c949d3aeb3496c08d4e613.zip
** Fix for bug #467892
2008-04-30 Milan Crha <mcrha@redhat.com> ** Fix for bug #467892 * em-folder-view.c: (em_folder_view_open_selected): Do not inherit search filters when opening messages in new window. * message-list.c: (regen_list_exec): If we are called from folder_changed even, then keep the actually selected message so it will not disappear when user reads it and it doesn't belong to actual filter anymore. svn path=/trunk/; revision=35454
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 01a1e6b4b8..b811941978 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -3845,6 +3845,7 @@ regen_list_exec (struct _regen_list_msg *m)
CamelMessageInfo *info;
ETreePath cursor;
int i;
+ char *expr = NULL;
if (m->folder != m->ml->folder)
return;
@@ -3858,10 +3859,8 @@ regen_list_exec (struct _regen_list_msg *m)
/* if we have hidedeleted on, use a search to find it out, merge with existing search if set */
if (!camel_folder_has_search_capability(m->folder)) {
/* if we have no search capability, dont let search or hide deleted work */
- uids = camel_folder_get_uids(m->folder);
+ expr = NULL;
} else if (m->hidedel) {
- char *expr;
-
if (m->hidejunk) {
if (m->search) {
expr = alloca(strlen(m->search) + 92);
@@ -3875,25 +3874,36 @@ regen_list_exec (struct _regen_list_msg *m)
} else
expr = "(match-all (not (system-flag \"deleted\")))";
}
- searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex);
} else {
- char *expr;
-
if (m->hidejunk) {
if (m->search) {
expr = alloca(strlen(m->search) + 64);
sprintf(expr, "(and (match-all (not (system-flag \"junk\")))\n %s)", m->search);
} else
expr = "(match-all (not (system-flag \"junk\")))";
- searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex);
} else {
- if (m->search)
- searchuids = uids = camel_folder_search_by_expression (m->folder, m->search, &m->base.ex);
- else
- uids = camel_folder_get_uids (m->folder);
+ expr = m->search;
}
}
+ if (expr == NULL) {
+ uids = camel_folder_get_uids (m->folder);
+ } else {
+ char *tmp_expr = NULL;
+
+ /* If m->changes is not NULL, then it means we are called from folder_changed event,
+ thus we will keep the selected message to be sure it doesn't disappear because
+ it no longer belong to our search filter. */
+ if (m->changes && m->ml->search && m->ml->cursor_uid) {
+ tmp_expr = g_strdup_printf ("(or %s (match-all (uid \"%s\")))", expr, m->ml->cursor_uid);
+ expr = tmp_expr;
+ }
+
+ searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex);
+
+ g_free (tmp_expr);
+ }
+
if (camel_exception_is_set (&m->base.ex))
return;