diff options
author | 9 <NotZed@Ximian.com> | 2001-10-19 13:40:42 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-19 13:40:42 +0800 |
commit | 3e6cd9a7e55a6c19d73a86195ff320b6dff76d54 (patch) | |
tree | b0a58e239142420e6fbf3220ea18a55b617cc406 /mail/mail-vfolder.c | |
parent | 0515ef5e4d5d138f1f7e9956b7a643cc01d7cf19 (diff) | |
download | gsoc2013-evolution-3e6cd9a7e55a6c19d73a86195ff320b6dff76d54.tar.gz gsoc2013-evolution-3e6cd9a7e55a6c19d73a86195ff320b6dff76d54.tar.zst gsoc2013-evolution-3e6cd9a7e55a6c19d73a86195ff320b6dff76d54.zip |
Free folders_uri. (real_folder_deleted): If folder is deleted, remove it
2001-10-19 <NotZed@Ximian.com>
* mail-folder-cache.c (store_finalised): Free folders_uri.
(real_folder_deleted): If folder is deleted, remove it from the
hashtables.
* subscribe-dialog.c (get_short_folderinfo_get): Remove the
register/unregister, they're already done above us.
* mail-vfolder.c
(mail_vfolder_delete_uri): Dont do any work to remove the actual
folder from the vfolder (we'd have to look it up first), let the
vfolder remove it itself. Just update the rules.
svn path=/trunk/; revision=13787
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 477ae0d028..12c70d0e0c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -308,9 +308,11 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) if (CAMEL_IS_VEE_STORE(store) || !strncmp(uri, "vtrash:", 7)) return; + g_assert(pthread_self() == mail_gui_thread); + LOCK(); - d(printf("Removing uri to check: %s\n", remove?"Removing":"Adding", uri)); + d(printf("%s uri to check: %s\n", remove?"Removing":"Adding", uri)); /* maintain the source folders lists for changed rules later on */ if (remove) { @@ -368,9 +370,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) void mail_vfolder_delete_uri(CamelStore *store, const char *uri) { - int remote = (((CamelService *)store)->provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0; GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name; - GList *link; FilterRule *rule; const char *source; CamelVeeFolder *vf; @@ -387,41 +387,22 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri) LOCK(); - /* maintain remote/local lists */ - if (remote) { - if ((link = my_list_find(source_folders_remote, (void *)uri, uri_cmp)) != NULL) { - g_free(link->data); - source_folders_remote = g_list_remove_link(source_folders_remote, link); - } - } else { - if ((link = my_list_find(source_folders_local, (void *)uri, uri_cmp)) != NULL) { - g_free(link->data); - source_folders_local = g_list_remove_link(source_folders_local, link); - } - } - - /* check to see if a rule needs updating, if it does, make out it changed which will re-build it */ + /* see if any rules directly reference this removed uri */ rule = NULL; while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - int found = FALSE; - source = NULL; - while ( !found && (source = vfolder_rule_next_source((VfolderRule *)rule, source)) ) - found = uri_cmp(uri, source); - - if (found - || (rule->source - && ((!strcmp(rule->source, "local") && !remote) - || (!strcmp(rule->source, "remote_active") && remote) - || (!strcmp(rule->source, "local_remote_active"))))) { - - vf = g_hash_table_lookup(vfolder_hash, rule->name); - g_assert(vf); - if (source) { + while ( (source = vfolder_rule_next_source((VfolderRule *)rule, source)) ) { + /* Remove all sources that match, ignore changed events though + because the adduri call above does the work async */ + if (uri_cmp(uri, source)) { + vf = g_hash_table_lookup(vfolder_hash, rule->name); + g_assert(vf); + gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, vf); vfolder_rule_remove_source((VfolderRule *)rule, source); + gtk_signal_connect((GtkObject *)rule, "changed", rule_changed, vf); g_string_sprintfa(changed, " %s\n", rule->name); - } else - rule_changed(rule, (CamelFolder *)vf); + source = NULL; + } } } |