diff options
author | Not Zed <NotZed@Ximian.com> | 2002-07-24 15:21:15 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-07-24 15:21:15 +0800 |
commit | 0c43bcb20b82f8da6e6ffb71f85d27b251537e79 (patch) | |
tree | 2f3cbb1b59a87a5d0c03da7adb596d3906d8c788 /mail | |
parent | 1080bf46a19e63965b11a93b4fe0ea2035fbd8a9 (diff) | |
download | gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar.gz gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar.bz2 gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar.lz gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar.xz gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.tar.zst gsoc2013-evolution-0c43bcb20b82f8da6e6ffb71f85d27b251537e79.zip |
Propagate name changes or removes to the mail config. #15951. Doesn't
2002-07-24 Not Zed <NotZed@Ximian.com>
* mail-folder-cache.c (real_flush_updates): Propagate name changes
or removes to the mail config. #15951. Doesn't enitrely work for
local folders, because they are never renamed only removed and
added thanks to the shell's api.
* mail-config.c (mail_config_uri_renamed): If a store folder is
renamed, this checks for any config that needs updating, so far
sent and drafts folders.
(mail_config_uri_deleted): Same, for deleted folders.
svn path=/trunk/; revision=17568
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/mail-config.c | 58 | ||||
-rw-r--r-- | mail/mail-config.h | 5 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 3 |
4 files changed, 78 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 340e595bf7..0635273d3d 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2002-07-24 Not Zed <NotZed@Ximian.com> + + * mail-folder-cache.c (real_flush_updates): Propagate name changes + or removes to the mail config. #15951. Doesn't enitrely work for + local folders, because they are never renamed only removed and + added thanks to the shell's api. + + * mail-config.c (mail_config_uri_renamed): If a store folder is + renamed, this checks for any config that needs updating, so far + sent and drafts folders. + (mail_config_uri_deleted): Same, for deleted folders. + 2002-07-24 Jeffrey Stedfast <fejj@ximian.com> * mail-format.c (handle_multipart_encrypted): Commit a fix that I diff --git a/mail/mail-config.c b/mail/mail-config.c index 9e639ee2a5..a6b47e92ad 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -2420,6 +2420,64 @@ mail_config_get_default_transport (void) return NULL; } +void +mail_config_uri_renamed(GCompareFunc uri_cmp, const char *old, const char *new) +{ + MailConfigAccount *ac; + const GSList *l; + int work = 0; + + l = mail_config_get_accounts(); + while (l) { + ac = l->data; + if (ac->sent_folder_uri && uri_cmp(ac->sent_folder_uri, old)) { + g_free(ac->sent_folder_uri); + ac->sent_folder_uri = g_strdup(new); + work = 1; + } + if (ac->drafts_folder_uri && uri_cmp(ac->drafts_folder_uri, old)) { + g_free(ac->drafts_folder_uri); + ac->drafts_folder_uri = g_strdup(new); + work = 1; + } + l = l->next; + } + + /* nasty ... */ + if (work) + mail_config_write(); +} + +void +mail_config_uri_deleted(GCompareFunc uri_cmp, const char *uri) +{ + MailConfigAccount *ac; + const GSList *l; + int work = 0; + /* assumes these can't be removed ... */ + extern char *default_sent_folder_uri, *default_drafts_folder_uri; + + l = mail_config_get_accounts(); + while (l) { + ac = l->data; + if (ac->sent_folder_uri && uri_cmp(ac->sent_folder_uri, uri)) { + g_free(ac->sent_folder_uri); + ac->sent_folder_uri = g_strdup(default_sent_folder_uri); + work = 1; + } + if (ac->drafts_folder_uri && uri_cmp(ac->drafts_folder_uri, uri)) { + g_free(ac->drafts_folder_uri); + ac->drafts_folder_uri = g_strdup(default_drafts_folder_uri); + work = 1; + } + l = l->next; + } + + /* nasty again */ + if (work) + mail_config_write(); +} + GSList * mail_config_get_sources (void) { diff --git a/mail/mail-config.h b/mail/mail-config.h index b6dd15bd80..1e4699f773 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -274,6 +274,11 @@ const MailConfigIdentity *mail_config_get_default_identity (void); const MailConfigService *mail_config_get_default_transport (void); +/* uri's got changed by the store, etc */ +void mail_config_uri_renamed(GCompareFunc uri_cmp, const char *old, const char *new); +void mail_config_uri_deleted(GCompareFunc uri_cmp, const char *uri); + + GtkType evolution_mail_config_get_type (void); /* convenience functions to help ease the transition over to the new codebase */ diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 91001fa577..0e352bd634 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -45,6 +45,7 @@ /* For notifications of changes */ #include "mail-vfolder.h" #include "mail-autofilter.h" +#include "mail-config.h" #define w(x) #define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__), (x))*/ @@ -156,6 +157,7 @@ real_flush_updates(void *o, void *event_data, void *data) if (up->delete) { mail_vfolder_delete_uri(up->store, up->uri); mail_filter_delete_uri(up->store, up->uri); + mail_config_uri_deleted(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(up->store))->compare_folder_name, up->uri); } else mail_vfolder_add_uri(up->store, up->uri, TRUE); } else { @@ -173,6 +175,7 @@ real_flush_updates(void *o, void *event_data, void *data) d(printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri)); mail_vfolder_rename_uri(up->store, up->olduri, up->uri); mail_filter_rename_uri(up->store, up->olduri, up->uri); + mail_config_uri_renamed(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(up->store))->compare_folder_name, up->olduri, up->uri); } if (up->name == NULL) { |