From a68b5681353d9999b208cdbada9b40586eb09c18 Mon Sep 17 00:00:00 2001 From: 0 Date: Fri, 21 Sep 2001 00:56:49 +0000 Subject: Update the status bar here, assuming we've just been activated. 2001-09-20 * folder-browser.c (folder_browser_set_shell_view): Update the status bar here, assuming we've just been activated. * mail-ops.c (add_vtrash_info): Scan whole list, rather than missing the last one. Also dont assume its always the last, otherwise we could lose following folders. * mail-vfolder.c (all): d(x) out debug printfs * mail-folder-cache.c (update_1folder): If its a vtrash folder, or the outbox_folder, and we have a folder, then make the 'count' the total message count, not unread messages count. svn path=/trunk/; revision=13036 --- mail/ChangeLog | 13 +++++++++++++ mail/component-factory.c | 4 ++-- mail/folder-browser.c | 4 ++++ mail/mail-folder-cache.c | 15 ++++++++++----- mail/mail-ops.c | 21 +++++++++++++-------- mail/mail-vfolder.c | 14 +++++++------- 6 files changed, 49 insertions(+), 22 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 10b6ac4d71..04bc6ce808 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2001-09-20 + + * folder-browser.c (folder_browser_set_shell_view): Update the + status bar here, assuming we've just been activated. + + * mail-ops.c (add_vtrash_info): Scan whole list, rather than + missing the last one. Also dont assume its always the last, + otherwise we could lose following folders. + 2001-09-20 Jeffrey Stedfast * mail-tools.c (mail_tool_uri_to_folder): Don't "note" the folder @@ -18,6 +27,7 @@ (context_rule_added): Lock around hash access. (context_rule_removed): " (rule_changed): Lock around list access. + (all): d(x) out debug printfs * mail-local.c (storage_listener_startup): Fix for api change. (local_storage_new_folder_cb): Dont skip over leading / in path. @@ -32,6 +42,9 @@ (mail_note_store): Consolidate note_store interface, pass storage or corba_storage to it. (mail_note_local_store): Removed. + (update_1folder): If its a vtrash folder, or the outbox_folder, + and we have a folder, then make the 'count' the total message + count, not unread messages count. 2001-09-20 Jeffrey Stedfast diff --git a/mail/component-factory.c b/mail/component-factory.c index 8d656185e3..bcade8d39e 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -1016,7 +1016,7 @@ mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const ch * see if this belongs in the shell's folder list. If so, add * it. */ - + prov = camel_session_get_provider (session, uri, &ex); if (prov == NULL) { /* FIXME: real error dialog */ @@ -1040,7 +1040,7 @@ mail_load_storage_by_uri (GNOME_Evolution_Shell shell, const char *uri, const ch || (strcmp (prov->protocol, "maildir") == 0) || (strcmp (prov->protocol, "vfolder") == 0))) return; - + store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex); if (store == NULL) { /* FIXME: real error dialog */ diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 672c8d8724..f577d46e88 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -803,6 +803,10 @@ folder_browser_set_shell_view(FolderBrowser *fb, GNOME_Evolution_ShellView shell fb->shell_view = CORBA_Object_duplicate(shell_view, &ev); CORBA_exception_free(&ev); + + /* small hack, at this point we've just been activated */ + if (fb->shell_view != CORBA_OBJECT_NIL) + update_status_bar(fb); } extern CamelFolder *drafts_folder, *sent_folder, *outbox_folder; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index c6e361746f..520cdc4afb 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -35,12 +35,13 @@ #include #include #include +#include #include "mail-mt.h" #include "mail-folder-cache.h" #include "mail-ops.h" -#define d(x) +#define d(x) /* note that many things are effectively serialised by having them run in the main loop thread which they need to do because of corba/gtk calls */ @@ -75,14 +76,18 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info) CamelFolder *folder; int unread; CORBA_Environment ev; + extern CamelFolder *outbox_folder; si = mfi->store_info; LOCK(info_lock); folder = mfi->folder; - if (folder) - unread = camel_folder_get_unread_message_count(folder); - else if (info) + if (folder) { + if (CAMEL_IS_VTRASH_FOLDER(folder) || folder == outbox_folder) + unread = camel_folder_get_message_count(folder); + else + unread = camel_folder_get_unread_message_count(folder); + } else if (info) unread = info->unread_message_count; else unread = -1; @@ -170,7 +175,7 @@ real_note_folder(CamelFolder *folder, void *event_data, void *data) si = g_hash_table_lookup(stores, store); UNLOCK(info_lock); if (si == NULL) { - g_warning("Adding a folder `%s' to a store which hasn't been added yet?\n", folder->full_name); + g_warning("Adding a folder `%s' to a store %p which hasn't been added yet?\n", folder->full_name, store); camel_object_unref((CamelObject *)folder); return; } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index a9f300baad..7b01917c98 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1064,15 +1064,17 @@ get_folderinfo_desc (struct _mail_msg *mm, int done) static void add_vtrash_info (CamelStore *store, CamelFolderInfo *info) { - CamelFolderInfo *fi, *vtrash; + CamelFolderInfo *fi, *vtrash, *parent; char *uri, *path; CamelURL *url; g_return_if_fail (info != NULL); - - for (fi = info; fi->sibling; fi = fi->sibling) { + + parent = NULL; + for (fi = info; fi; fi = fi->sibling) { if (!strcmp (fi->name, CAMEL_VTRASH_NAME)) break; + parent = fi; } /* create our vTrash URL */ @@ -1083,7 +1085,7 @@ add_vtrash_info (CamelStore *store, CamelFolderInfo *info) uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free (url); - if (fi->sibling) { + if (fi) { /* We're going to replace the physical Trash folder with our vTrash folder */ vtrash = fi; g_free (vtrash->full_name); @@ -1092,8 +1094,12 @@ add_vtrash_info (CamelStore *store, CamelFolderInfo *info) } else { /* There wasn't a Trash folder so create a new folder entry */ vtrash = g_new0 (CamelFolderInfo, 1); - vtrash->parent = fi; - fi->sibling = vtrash; + + g_assert(parent != NULL); + + /* link it into the right spot */ + vtrash->sibling = parent->sibling; + parent->sibling = vtrash; } /* Fill in the new fields */ @@ -1108,9 +1114,8 @@ add_vtrash_info (CamelStore *store, CamelFolderInfo *info) static void add_unmatched_info(CamelFolderInfo *fi) { - for (; fi->sibling; fi = fi->sibling) { + for (; fi; fi = fi->sibling) { if (!strcmp(fi->full_name, CAMEL_UNMATCHED_NAME)) { - printf("renaming unmatched!\n"); g_free(fi->name); fi->name = g_strdup(U_("Unmatched")); g_free(fi->path); diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 13da061abc..5967280ef1 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -36,7 +36,7 @@ #include "e-util/e-unicode-i18n.h" -#define d(x) x +#define d(x) struct _vfolder_info { char *name; @@ -163,7 +163,7 @@ vfolder_setup_do(struct _mail_msg *mm) GList *l, *list = NULL; CamelFolder *folder; - printf("Setting up vfolder: %s\n", m->folder->full_name); + d(printf("Setting up vfolder: %s\n", m->folder->full_name)); camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query); @@ -295,7 +295,7 @@ rule_changed(FilterRule *rule, CamelFolder *folder) return; } - printf("Filter rule changed? for folder '%s'!!\n", folder->name); + d(printf("Filter rule changed? for folder '%s'!!\n", folder->name)); /* work out the work to do, then do it in another thread */ sourceuri = NULL; @@ -326,7 +326,7 @@ static void context_rule_added(RuleContext *ctx, FilterRule *rule) { CamelFolder *folder; - printf("rule added: %s\n", rule->name); + d(printf("rule added: %s\n", rule->name)); /* this always runs quickly */ folder = camel_store_get_folder(vfolder_store, rule->name, 0, NULL); @@ -347,7 +347,7 @@ static void context_rule_removed(RuleContext *ctx, FilterRule *rule) char *key, *path; CamelFolder *folder; - printf("rule removed; %s\n", rule->name); + d(printf("rule removed; %s\n", rule->name)); /* TODO: remove from folder info cache? */ @@ -385,7 +385,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) FilterRule *rule; char *user; - printf("Folder deleted: %s\n", info->name); + d(printf("Folder deleted: %s\n", info->name)); store = store; /* delete it from our list */ @@ -426,7 +426,7 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) camel_object_hook_event((CamelObject *)vfolder_store, "folder_deleted", (CamelObjectEventHookFunc)store_folder_deleted, NULL); - printf("got store '%s' = %p\n", storeuri, vfolder_store); + d(printf("got store '%s' = %p\n", storeuri, vfolder_store)); mail_load_storage_by_uri(shell, storeuri, U_("VFolders")); /* load our rules */ -- cgit v1.2.3