diff options
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 4 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 9 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 3 | ||||
-rw-r--r-- | camel/providers/local/camel-maildir-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-folder.c | 4 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-store.c | 17 |
6 files changed, 23 insertions, 15 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 08c871cee3..a632c6f0d6 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -1542,14 +1542,11 @@ subscribe_folder (CamelStore *store, const char *folder_name, if (name) name++; - /* FIXME: we should probably relocate all code that generates - fi->path to a single location and have all code use that */ fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (folder_name); fi->name = g_strdup (name); fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, folder_name); fi->unread_message_count = -1; - camel_folder_info_build_path (fi, imap_store->dir_sep); camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", fi); @@ -1591,6 +1588,7 @@ unsubscribe_folder (CamelStore *store, const char *folder_name, fi->name = g_strdup (name); fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, folder_name); fi->unread_message_count = -1; + camel_folder_info_build_path (fi, imap_store->dir_sep); camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi); camel_folder_info_free (fi); diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index bce610bc70..2887fcce73 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -226,12 +226,9 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con fi->name = g_strdup (name); fi->url = g_strdup (lf->folder_path); fi->unread_message_count = -1; - fi->path = g_strdup (full_name); - - camel_object_trigger_event (CAMEL_OBJECT (parent_store), - "folder_created", fi); - - camel_folder_info_free (fi); + camel_folder_info_build_path(fi, '/'); + camel_object_trigger_event(CAMEL_OBJECT (parent_store), "folder_created", fi); + camel_folder_info_free(fi); return lf; } diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 20f90ce315..92e5159f1b 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -303,7 +303,8 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) fi->name = g_strdup (g_basename (folder_name)); fi->url = g_strdup_printf ("%s%s", CAMEL_SERVICE(store)->url->path, folder_name); fi->unread_message_count = -1; - + camel_folder_info_build_path(fi, '/'); + camel_object_trigger_event (CAMEL_OBJECT (store), "folder_deleted", fi); diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index 09188ad863..974a66a038 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -224,6 +224,7 @@ static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, fi->full_name = g_strdup(full); fi->name = g_strdup(name); fi->unread_message_count = unread; + camel_folder_info_build_path(fi, '/'); return fi; } diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c index 43b8abec60..8e8b3758a5 100644 --- a/camel/providers/local/camel-spool-folder.c +++ b/camel/providers/local/camel-spool-folder.c @@ -206,9 +206,9 @@ camel_spool_folder_construct(CamelSpoolFolder *lf, CamelStore *parent_store, con fi = g_malloc0(sizeof(*fi)); fi->full_name = g_strdup(full_name); fi->name = g_strdup(name); - fi->url = g_strdup(lf->folder_path); + fi->url = g_strdup_printf("spool:%s#%s", ((CamelService *)parent_store)->url->path, fi->name); fi->unread_message_count = camel_folder_get_unread_message_count(folder); - fi->path = g_strdup (full_name); + camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(CAMEL_OBJECT(parent_store), "folder_created", fi); camel_folder_info_free (fi); diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c index 998c97597c..c10c0f252d 100644 --- a/camel/providers/local/camel-spool-store.c +++ b/camel/providers/local/camel-spool-store.c @@ -34,6 +34,7 @@ #include "camel-spool-folder.h" #include "camel-exception.h" #include "camel-url.h" +#include "camel-private.h" #define d(x) @@ -186,14 +187,24 @@ get_folder_info (CamelStore *store, const char *top, { CamelFolderInfo *fi = NULL; CamelService *service = (CamelService *)store; + CamelFolder *folder; - if (top == NULL || strcmp(top, "/INBOX") == 0) { + if (top == NULL || strcmp(top, "INBOX") == 0) { /* FIXME: if the folder is opened we could look it up? */ fi = g_malloc0(sizeof(*fi)); - fi->full_name = "/INBOX"; + fi->full_name = "INBOX"; fi->name = "INBOX"; fi->url = g_strdup_printf("spool:%s#%s", service->url->path, fi->name); - fi->unread_message_count = -1; + + CAMEL_STORE_LOCK(store, cache_lock); + folder = g_hash_table_lookup(store->folders, fi->full_name); + if (folder) + fi->unread_message_count = camel_folder_get_message_count(folder); + else + fi->unread_message_count = -1; + CAMEL_STORE_UNLOCK(store, cache_lock); + + camel_folder_info_build_path(fi, '/'); } return fi; |