From f30f7c9229f581132a2fdebe61f16e877e11c68b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 26 May 2001 17:22:53 +0000 Subject: When unreffing a folder we got ourselves (as opposed to one passed in by * mail-ops.c (mail_send_message, transfer_messages_transfer, set_offline_do): When unreffing a folder we got ourselves (as opposed to one passed in by the caller), sync before unreffing, since we might be holding the only reference to it. (mail_refresh_folder): New op, like mail_sync_folder, but does a camel_folder_refresh_info instead. * folder-browser-factory.c (control_activate): Call mail_refresh_folder, not mail_sync_folder. (The goal is to see new messages: sync used to work with imap because imap_sync was broken, but it doesn't work for that any more.) svn path=/trunk/; revision=10011 --- mail/ChangeLog | 14 ++++++++++++++ mail/folder-browser-factory.c | 2 +- mail/mail-ops.c | 41 ++++++++++++++++++++++++++++++++++++++++- mail/mail-ops.h | 4 ++++ 4 files changed, 59 insertions(+), 2 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index a5a1b9d628..5a7891e70f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2001-05-26 Dan Winship + + * mail-ops.c (mail_send_message, transfer_messages_transfer, + set_offline_do): When unreffing a folder we got ourselves (as + opposed to one passed in by the caller), sync before unreffing, + since we might be holding the only reference to it. + (mail_refresh_folder): New op, like mail_sync_folder, but does a + camel_folder_refresh_info instead. + + * folder-browser-factory.c (control_activate): Call + mail_refresh_folder, not mail_sync_folder. (The goal is to see new + messages: sync used to work with imap because imap_sync was + broken, but it doesn't work for that any more.) + 2001-05-25 Peter Williams * Makefile.am: Reference libeshell.la instead of libeshell.a. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index a8a4c09b3f..558308a6f7 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -278,7 +278,7 @@ control_activate (BonoboControl *control, bonobo_ui_component_thaw (uic, NULL); if (fb->folder) - mail_sync_folder (fb->folder, NULL, NULL); + mail_refresh_folder (fb->folder, NULL, NULL); } static void diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 34a88a7b51..ba12baa140 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -565,6 +565,7 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte if (folder) { camel_folder_append_message (folder, message, info, ex); + camel_folder_sync (folder, FALSE, NULL); camel_object_unref (CAMEL_OBJECT (folder)); } @@ -744,7 +745,7 @@ send_queue_send(struct _mail_msg *mm) camel_folder_expunge (m->queue, &mm->ex); if (sent_folder) - camel_folder_sync (sent_folder, FALSE, &mm->ex); + camel_folder_sync (sent_folder, FALSE, NULL); if (m->cancel) camel_operation_unregister (m->cancel); @@ -929,6 +930,7 @@ static void transfer_messages_transfer(struct _mail_msg *mm) camel_folder_thaw(m->source); camel_folder_thaw(dest); + camel_folder_sync(dest, FALSE, NULL); camel_object_unref((CamelObject *)dest); } @@ -1636,6 +1638,42 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *d /* ******************************************************************************** */ +static char *refresh_folder_desc(struct _mail_msg *mm, int done) +{ + return g_strdup(_("Refreshing folder")); +} + +static void refresh_folder_refresh(struct _mail_msg *mm) +{ + struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; + + camel_folder_refresh_info(m->folder, &mm->ex); +} + +/* we just use the sync stuff where we can, since it would be the same */ +static struct _mail_msg_op refresh_folder_op = { + refresh_folder_desc, + refresh_folder_refresh, + sync_folder_synced, + sync_folder_free, +}; + +void +mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data) +{ + struct _sync_folder_msg *m; + + m = mail_msg_new(&refresh_folder_op, NULL, sizeof(*m)); + m->folder = folder; + camel_object_ref((CamelObject *)folder); + m->data = data; + m->done = done; + + e_thread_put(mail_thread_new, (EMsg *)m); +} + +/* ******************************************************************************** */ + static char *expunge_folder_desc(struct _mail_msg *mm, int done) { return g_strdup(_("Expunging folder")); @@ -2149,6 +2187,7 @@ static void set_offline_do(struct _mail_msg *mm) CAMEL_DISCO_FOLDER (inbox), "(match-all (not (system-flag \"Seen\")))", &mm->ex); + camel_folder_sync (inbox, FALSE, NULL); camel_object_unref (CAMEL_OBJECT (inbox)); if (camel_exception_is_set (&mm->ex)) return; diff --git a/mail/mail-ops.h b/mail/mail-ops.h index e6677c4443..205684da94 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -81,6 +81,10 @@ void mail_sync_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data); +void mail_refresh_folder (CamelFolder *folder, + void (*done) (CamelFolder *folder, void *data), + void *data); + void mail_expunge_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, void *data), void *data); -- cgit v1.2.3