diff options
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 6 | ||||
-rw-r--r-- | mail/mail-local.c | 37 |
3 files changed, 40 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2999bb83c5..e35d90de12 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2001-10-03 <NotZed@Ximian.com> + + * mail-local.c (local_storage_new_folder_cb): Handle vtrash case, + emit 'folder_created' event for the folder-cache to work, etc. + 2001-10-03 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (mail_write_authenticity): Don't use the wax-seal diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 3212fce3ff..c99637cb09 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -205,7 +205,7 @@ folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data) { struct _folder_info *mfi = user_data; - d(printf("Folder finalised!\n")); + (printf("Folder finalised '%s'!\n", ((CamelFolder *)o)->full_name)); mfi->folder = NULL; } @@ -265,7 +265,7 @@ real_folder_created(CamelStore *store, void *event_data, CamelFolderInfo *fi) { struct _store_info *si; - (printf("real_folder_created: %s (%s)\n", fi->full_name, fi->url)); + d(printf("real_folder_created: %s (%s)\n", fi->full_name, fi->url)); LOCK(info_lock); si = g_hash_table_lookup(stores, store); @@ -293,7 +293,7 @@ store_folder_created(CamelObject *o, void *event_data, void *data) static void real_folder_deleted(CamelStore *store, void *event_data, CamelFolderInfo *fi) { - (printf("real_folder_deleted: %s (%s)\n", fi->full_name, fi->url)); + d(printf("real_folder_deleted: %s (%s)\n", fi->full_name, fi->url)); if (strstr(fi->url, ";noselect") == NULL) mail_vfolder_remove_uri(store, fi->url); diff --git a/mail/mail-local.c b/mail/mail-local.c index 7ee5bbf841..6f1c92f2a8 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -40,6 +40,7 @@ #include "gal/widgets/e-gui-utils.h" #include "e-util/e-path.h" +#include "e-util/e-unicode-i18n.h" #include "Evolution.h" #include "evolution-storage.h" @@ -47,6 +48,7 @@ #include "evolution-storage-listener.h" #include "camel/camel.h" +#include "camel/camel-vtrash-folder.h" #include "mail.h" #include "mail-local.h" @@ -938,16 +940,41 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, const GNOME_Evolution_Folder *folder, void *data) { - if (strcmp (folder->type, "mail") != 0) - return; - d(printf("Local folder new:\n")); d(printf(" path = '%s'\n uri = '%s'\n display = '%s'\n", path, folder->physicalUri, folder->displayName)); - mail_local_store_add_folder(global_local_store, folder->physicalUri, path, folder->displayName); + /* We dont actually add the trash to our local folders list, get_trash is handled + outside our internal folder list */ + + if (strcmp(folder->type, "mail") == 0) { + mail_local_store_add_folder(global_local_store, folder->physicalUri, path, folder->displayName); + } else if (strcmp(folder->type, "vtrash") == 0) { + CamelFolderInfo info; + CamelURL *url; - /* are we supposed to say anything about it? */ + url = camel_url_new(folder->physicalUri, NULL); + if (url == NULL) { + g_warning("Shell trying to add invalid folder url: %s", folder->physicalUri); + return; + } + if (url->path == NULL || url->path[0] == 0) { + g_warning("Shell trying to add invalid folder url: %s", folder->physicalUri); + camel_url_free(url); + return; + } + + memset(&info, 0, sizeof(info)); + info.full_name = CAMEL_VTRASH_NAME; + info.name = folder->displayName; + info.url = g_strdup_printf("vtrash:%s", folder->physicalUri); + info.unread_message_count = 0; + info.path = (char *)path; + + camel_object_trigger_event((CamelObject *)global_local_store, "folder_created", &info); + g_free(info.url); + camel_url_free(url); + } } |