aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-16 17:23:32 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-06-16 17:23:32 +0800
commitb7155af74b4c0d3d1c7811ffb12056d17a9e6604 (patch)
tree903ee79e328e0a7e2d7f2282d4e1627d02823ba8 /mail/message-list.c
parentfe835e14c2815d4d174229cdb08c2385f6167cd7 (diff)
downloadgsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar.gz
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar.bz2
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar.lz
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar.xz
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.tar.zst
gsoc2013-evolution-b7155af74b4c0d3d1c7811ffb12056d17a9e6604.zip
** Fix for bug #467892
2008-06-16 Milan Crha <mcrha@redhat.com> ** Fix for bug #467892 * message-list.h: (struct _MessageList), (message_list_ensure_message): * message-list.c: (message_list_init), (message_list_finalise), (message_list_ensure_message), (regen_list_exec), (regen_list_done): Be able to set a message uid to keep in a list after regeneration. * em-folder-view.c: (em_folder_view_open_selected): Inherit search criteria and ensure keeping the selected message in the view even it may not belong to the filter anymore. svn path=/trunk/; revision=35640
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index e598fa2de5..14e177771a 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2159,6 +2159,7 @@ message_list_init (MessageList *message_list)
message_list->hide_after = ML_HIDE_NONE_END;
message_list->search = NULL;
+ message_list->ensure_uid = NULL;
message_list->hide_lock = g_mutex_new();
@@ -2260,6 +2261,7 @@ message_list_finalise (GObject *object)
}
g_free(message_list->search);
+ g_free(message_list->ensure_uid);
g_free(message_list->frozen_search);
g_free(message_list->cursor_uid);
@@ -3573,6 +3575,16 @@ message_list_set_search (MessageList *ml, const char *search)
}
}
+/* will ensure that the message with UID uid will be in the message list after the next rebuild */
+void
+message_list_ensure_message (MessageList *ml, const char *uid)
+{
+ g_return_if_fail (ml != NULL);
+
+ g_free (ml->ensure_uid);
+ ml->ensure_uid = g_strdup (uid);
+}
+
/* returns the number of messages displayable *after* expression hiding has taken place */
unsigned int
message_list_length (MessageList *ml)
@@ -3887,15 +3899,21 @@ regen_list_exec (struct _regen_list_msg *m)
/* 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 && uids) {
+ if (uids && m->ml->search && ((m->changes && m->ml->cursor_uid) || m->ml->ensure_uid)) {
+ const char *looking_for = m->ml->cursor_uid;
+
+ /* ensure_uid has precedence of cursor_uid */
+ if (m->ml->ensure_uid)
+ looking_for = m->ml->ensure_uid;
+
for (i = 0; i < uids->len; i++) {
- if (g_str_equal (m->ml->cursor_uid, uids->pdata [i]))
+ if (g_str_equal (looking_for, uids->pdata [i]))
break;
}
/* cursor_uid has been filtered out */
if (i == uids->len) {
- gboolean was_deleted = (camel_folder_get_message_flags (m->folder, m->ml->cursor_uid) & CAMEL_MESSAGE_DELETED) != 0;
+ gboolean was_deleted = (camel_folder_get_message_flags (m->folder, looking_for) & CAMEL_MESSAGE_DELETED) != 0;
/* I would really like to check for CAMEL_MESSAGE_FOLDER_FLAGGED on a message,
so I would know whether it was changed locally, and then just check the changes
@@ -3904,7 +3922,7 @@ regen_list_exec (struct _regen_list_msg *m)
on the flag whether we can view deleted messages or not. */
if (!was_deleted || (was_deleted && !m->hidedel))
- g_ptr_array_add (uids, g_strdup (m->ml->cursor_uid));
+ g_ptr_array_add (uids, g_strdup (looking_for));
}
}
}
@@ -4037,6 +4055,11 @@ regen_list_done (struct _regen_list_msg *m)
if (m->ml->priv->destroyed)
return;
+ if (m->ml->ensure_uid) {
+ g_free (m->ml->ensure_uid);
+ m->ml->ensure_uid = NULL;
+ }
+
if (!m->complete)
return;