From 86d2d39580ff3aa27f17766dd117765f4786b924 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Wed, 24 Jul 2002 19:37:57 +0000 Subject: Call camel_session_get_service instead of camel_session_get_store, as 2002-07-23 Peter Williams * mail-ops.c (get_store_get): Call camel_session_get_service instead of camel_session_get_store, as _get_store calls _get_service_connected which is not what we want to do on startup. (set_offline_do): Rework the logic here. It was failing when trying to go online with a disco store that couldn't work offline. * mail-folder-cache.c (mail_note_store): If we're using an offline (well, non-online) disco store that cannot work offline, don't get the folderinfo as that will fail. svn path=/trunk/; revision=17576 --- mail/ChangeLog | 12 ++++++++++++ mail/mail-folder-cache.c | 16 +++++++++++----- mail/mail-ops.c | 31 +++++++++++++++++++++---------- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index e5ff4dbe80..42112d8cd4 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2002-07-23 Peter Williams + + * mail-ops.c (get_store_get): Call camel_session_get_service + instead of camel_session_get_store, as _get_store calls + _get_service_connected which is not what we want to do on startup. + (set_offline_do): Rework the logic here. It was failing when + trying to go online with a disco store that couldn't work offline. + + * mail-folder-cache.c (mail_note_store): If we're using an offline + (well, non-online) disco store that cannot work offline, don't get + the folderinfo as that will fail. + 2002-07-24 Radek Doulik * mail-composer-prefs.c (sig_add): use diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 0e352bd634..5d7f1c879e 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "mail-mt.h" @@ -761,12 +762,17 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St camel_object_hook_event((CamelObject *)store, "folder_unsubscribed", store_folder_unsubscribed, NULL); } - ud = g_malloc(sizeof(*ud)); - ud->done = done; - ud->data = data; - ud->id = mail_get_folderinfo(store, update_folders, ud); - e_dlist_addtail(&si->folderinfo_updates, (EDListNode *)ud); + if (!CAMEL_IS_DISCO_STORE (store) || + camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_ONLINE || + camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) { + ud = g_malloc(sizeof(*ud)); + ud->done = done; + ud->data = data; + ud->id = mail_get_folderinfo(store, update_folders, ud); + + e_dlist_addtail(&si->folderinfo_updates, (EDListNode *)ud); + } UNLOCK(info_lock); } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index f5dc731dde..c3b652d6fc 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1337,7 +1337,12 @@ get_store_get (struct _mail_msg *mm) { struct _get_store_msg *m = (struct _get_store_msg *)mm; - m->store = camel_session_get_store (session, m->uri, &mm->ex); + /*camel_session_get_store connects us, which we don't want to do on startup. */ + + m->store = camel_session_get_service (session, m->uri, + CAMEL_PROVIDER_STORE, + &mm->ex); + } static void @@ -2205,17 +2210,23 @@ static void set_offline_do(struct _mail_msg *mm) { struct _set_offline_msg *m = (struct _set_offline_msg *)mm; - if (!CAMEL_IS_DISCO_STORE (m->store) || - !camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (m->store))) { - if (m->offline) { - camel_service_disconnect (CAMEL_SERVICE (m->store), - TRUE, &mm->ex); + if (CAMEL_IS_DISCO_STORE (m->store)) { + if (!m->offline) { + camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), + CAMEL_DISCO_STORE_ONLINE, + &mm->ex); + return; + } else if (camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (m->store))) { + camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), + CAMEL_DISCO_STORE_OFFLINE, + &mm->ex); + return; } - } else { - camel_disco_store_set_status (CAMEL_DISCO_STORE (m->store), - m->offline ? CAMEL_DISCO_STORE_OFFLINE : CAMEL_DISCO_STORE_ONLINE, - &mm->ex); } + + if (m->offline) + camel_service_disconnect (CAMEL_SERVICE (m->store), + TRUE, &mm->ex); } static void set_offline_done(struct _mail_msg *mm) -- cgit v1.2.3