diff options
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/component-factory.c | 22 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 12 |
3 files changed, 24 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index fd29e14998..134c4beb53 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-08-20 Jeffrey Stedfast <fejj@ximian.com> + + * component-factory.c (storage_create_folder): + camel_folder_create_folder can now return a heirachial tree so + subscribe to down the tree. + 2001-08-20 Damon Chaplin <damon@ximian.com> * folder-browser-ui.c: use new Cut/Copy/Paste icons. diff --git a/mail/component-factory.c b/mail/component-factory.c index f01e9147b2..21e2a5ed30 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -793,14 +793,14 @@ storage_create_folder (EvolutionStorage *storage, gpointer user_data) { CamelStore *store = user_data; + CamelFolderInfo *root, *fi; char *prefix, *name; CamelURL *url; CamelException ex; - CamelFolderInfo *fi; - + if (strcmp (type, "mail") != 0) return EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE; - + name = strrchr (path, '/'); if (!name++) return EVOLUTION_STORAGE_ERROR_INVALID_URI; @@ -811,10 +811,10 @@ storage_create_folder (EvolutionStorage *storage, if (!url) return EVOLUTION_STORAGE_ERROR_INVALID_URI; - fi = camel_store_create_folder (store, url->path + 1, name, &ex); + root = camel_store_create_folder (store, url->path + 1, name, &ex); camel_url_free (url); } else - fi = camel_store_create_folder (store, NULL, name, &ex); + root = camel_store_create_folder (store, NULL, name, &ex); if (camel_exception_is_set (&ex)) { /* FIXME: do better than this */ @@ -822,14 +822,16 @@ storage_create_folder (EvolutionStorage *storage, return EVOLUTION_STORAGE_ERROR_INVALID_URI; } - if (camel_store_supports_subscriptions (store)) - camel_store_subscribe_folder (store, fi->full_name, NULL); + if (camel_store_supports_subscriptions (store)) { + for (fi = root; fi; fi = fi->child) + camel_store_subscribe_folder (store, fi->full_name, NULL); + } prefix = g_strndup (path, name - path - 1); - folder_created (store, prefix, fi); + folder_created (store, prefix, root); g_free (prefix); - - camel_store_free_folder_info (store, fi); + + camel_store_free_folder_info (store, root); return EVOLUTION_STORAGE_OK; } diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index ed98392aa1..167ac0af55 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -2115,12 +2115,12 @@ static void create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo *fi) { char *path; - + mail_folder_cache_set_update_estorage (fi->url, storage); mail_folder_cache_note_folderinfo (fi->url, fi); - + path = g_strdup_printf ("%s/%s", prefix, fi->name); - + if (!strncmp (fi->url, "vtrash:", 7)) evolution_storage_new_folder (storage, path, fi->name, "vtrash", fi->url, @@ -2131,7 +2131,7 @@ create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo * "mail", fi->url, fi->name, /* description */ fi->unread_message_count > 0); - + if (fi->child) create_folders (storage, path, fi->child); g_free (path); @@ -2141,12 +2141,12 @@ create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo * } void -folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *fi) +folder_created (CamelStore *store, const char *prefix, CamelFolderInfo *root) { EvolutionStorage *storage; if ((storage = mail_lookup_storage (store))) { - create_folders (storage, prefix, fi); + create_folders (storage, prefix, root); bonobo_object_unref (BONOBO_OBJECT (storage)); } } |