diff options
author | Not Zed <NotZed@Ximian.com> | 2003-06-03 01:50:26 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-06-03 01:50:26 +0800 |
commit | 95d963dec575e1c6f451d36b0870e92c0de6cde3 (patch) | |
tree | 12faf7d49494c8a190f11e84b8e8b24f51038c20 /mail/mail-folder-cache.c | |
parent | 3bf07b8693c59ce11edb1eff5e2ae301d1a66544 (diff) | |
download | gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.gz gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.tar.zst gsoc2013-evolution-95d963dec575e1c6f451d36b0870e92c0de6cde3.zip |
** This and jeffs patch for #43862.
2003-06-02 Not Zed <NotZed@Ximian.com>
** This and jeffs patch for #43862.
* mail-folder-cache.c (store_online_cb): If the store is still
around, then flow on to a get folderinfo update, otherwise just
clear up.
* mail-ops.c (mail_store_set_offline): return the msgid of this so
it can be cancelled.
2003-05-30 Jeffrey Stedfast <fejj@ximian.com>
* mail-folder-cache.c (mail_note_store): If the session is
'online' and we are noting a CamelDiscoStore, make sure that it is
changed to online status and call mail_get_folderinfo().
svn path=/trunk/; revision=21369
Diffstat (limited to 'mail/mail-folder-cache.c')
-rw-r--r-- | mail/mail-folder-cache.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 2ec4e72912..6803119733 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -42,6 +42,7 @@ #include "mail-mt.h" #include "mail-folder-cache.h" #include "mail-ops.h" +#include "mail-session.h" /* For notifications of changes */ #include "mail-vfolder.h" @@ -640,7 +641,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) struct _update_data { struct _update_data *next; struct _update_data *prev; - + int id; /* id for cancellation */ void (*done)(CamelStore *store, CamelFolderInfo *info, void *data); @@ -799,6 +800,25 @@ ping_cb (gpointer user_data) return TRUE; } +static void +store_online_cb (CamelStore *store, void *data) +{ + struct _update_data *ud = data; + + LOCK(info_lock); + + if (g_hash_table_lookup(stores, store) != NULL) { + /* re-use the cancel id. we're already in the store update list too */ + ud->id = mail_get_folderinfo(store, update_folders, ud); + } else { + /* the store vanished, that means we were probably cancelled, or at any rate, + need to clean ourselves up */ + g_free(ud); + } + + UNLOCK(info_lock); +} + void mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_Storage corba_storage, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data) @@ -849,16 +869,27 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St camel_object_hook_event(store, "folder_unsubscribed", store_folder_unsubscribed, NULL); } - - 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))) { + /* We might get a race when setting up a store, such that it is still left in offline mode, + after we've gone online. This catches and fixes it up when the shell opens us */ + if (CAMEL_IS_DISCO_STORE(store) + && camel_session_is_online(session) + && camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) { 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); + /* Note: we use the 'id' here, even though its not the right id, its still ok */ + ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud); + + e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); + } else 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); |