diff options
author | Milan Crha <mcrha@redhat.com> | 2008-06-16 17:23:32 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-06-16 17:23:32 +0800 |
commit | b7155af74b4c0d3d1c7811ffb12056d17a9e6604 (patch) | |
tree | 903ee79e328e0a7e2d7f2282d4e1627d02823ba8 | |
parent | fe835e14c2815d4d174229cdb08c2385f6167cd7 (diff) | |
download | gsoc2013-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
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/em-folder-view.c | 5 | ||||
-rw-r--r-- | mail/message-list.c | 31 | ||||
-rw-r--r-- | mail/message-list.h | 5 |
4 files changed, 47 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index e030558c67..1e8ce2d191 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +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. + 2008-06-13 Milan Crha <mcrha@redhat.com> ** Fix for bug #337160 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index c2493d98be..bcb303617c 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -559,8 +559,9 @@ em_folder_view_open_selected(EMFolderView *emfv) emmb = (EMMessageBrowser *)em_message_browser_window_new(); message_list_set_threaded(((EMFolderView *)emmb)->list, emfv->list->threaded); - /* do not inherit search filter, because it can hide actual message for some filters */ - /*message_list_set_search(((EMFolderView *)emmb)->list, emfv->list->search);*/ + /* always keep actual message in a list view, even it doesn't belong to the filter anymore */ + message_list_ensure_message (((EMFolderView *)emmb)->list, views->pdata[i]); + message_list_set_search (((EMFolderView *)emmb)->list, emfv->list->search); em_folder_view_set_hide_deleted((EMFolderView *)emmb, emfv->hide_deleted); /* FIXME: session needs to be passed easier than this */ em_format_set_session((EMFormat *)((EMFolderView *)emmb)->preview, ((EMFormat *)emfv->preview)->session); 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; diff --git a/mail/message-list.h b/mail/message-list.h index 61f3264d41..0f8758895d 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -113,6 +113,10 @@ struct _MessageList { /* Current search string, or %NULL */ char *search; + /* which message uid should be left in the list even not in a search after rebuild; + rebuild will clear the value to NULL */ + char *ensure_uid; + /* are we regenerating the message_list because set_folder was just called? */ guint just_set_folder : 1; @@ -220,6 +224,7 @@ void message_list_set_threaded_collapse_all (MessageList *ml); void message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted); void message_list_set_search (MessageList *ml, const char *search); +void message_list_ensure_message (MessageList *ml, const char *uid); void message_list_save_state (MessageList *ml); |