aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-accounts.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2001-08-11 01:28:52 +0800
committerPeter Williams <peterw@src.gnome.org>2001-08-11 01:28:52 +0800
commit5ffaca0f8dc9d56783be9e8dd5c6661bde2269b2 (patch)
tree1dfdf5b18ce64dbafe1acd6717cab9cd82be97f7 /mail/mail-accounts.c
parent2f81032abc0e68f1a2cdbc88c23b0febd2524bb1 (diff)
downloadgsoc2013-evolution-5ffaca0f8dc9d56783be9e8dd5c6661bde2269b2.tar.gz
gsoc2013-evolution-5ffaca0f8dc9d56783be9e8dd5c6661bde2269b2.tar.zst
gsoc2013-evolution-5ffaca0f8dc9d56783be9e8dd5c6661bde2269b2.zip
Don't load the storage if it isn't enabled. (mail_remove_storage_by_uri):
2001-08-08 Peter Williams <peterw@ximian.com> * component-factory.c (mail_load_storages): Don't load the storage if it isn't enabled. (mail_remove_storage_by_uri): New function. Goes through the gymnastics of getting a CamelStore from the URI and calling mail_remove_storage. Copied from mail_delete(). (mail_load_storage_by_uri): Break out the storage-loading part of mail_load_storages into a single function. (mail_load_storages): Just call mail_load_storage_by_uri several times. * mail.h: Prototype our new _by_uri functions. * mail-accounts.c (news_add_destroyed): Instead of hacking around mail_load_storages, call mail_load_storage_by_uri. (mail_delete): Move this chunk of code into mail_remove_storage_by_uri. (mail_able): Add or remove the storage as necessary, with our new _by_uri functions. * mail-config-druid.c (druid_finish): See news_add_destroyed above. svn path=/trunk/; revision=11881
Diffstat (limited to 'mail/mail-accounts.c')
-rw-r--r--mail/mail-accounts.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 605b7e2eb9..69a75d9cb2 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -280,28 +280,8 @@ mail_delete (GtkButton *button, gpointer data)
account = gtk_clist_get_row_data (dialog->mail_accounts, sel);
/* remove it from the folder-tree in the shell */
- if (account->source && account->source->url) {
- MailConfigService *service = account->source;
- CamelProvider *prov;
- CamelException ex;
-
- camel_exception_init (&ex);
- prov = camel_session_get_provider (session, service->url, &ex);
- if (prov != NULL && prov->flags & CAMEL_PROVIDER_IS_STORAGE &&
- prov->flags & CAMEL_PROVIDER_IS_REMOTE) {
- CamelService *store;
-
- store = camel_session_get_service (session, service->url,
- CAMEL_PROVIDER_STORE, &ex);
- if (store != NULL) {
- g_warning ("removing storage: %s", service->url);
- mail_remove_storage (CAMEL_STORE (store));
- camel_object_unref (CAMEL_OBJECT (store));
- }
- } else
- g_warning ("%s is not a remote storage.", service->url);
- camel_exception_clear (&ex);
- }
+ if (account->source && account->source->url)
+ mail_remove_storage_by_uri (account->source->url);
/* remove it from the config file */
dialog->accounts = mail_config_remove_account (account);
@@ -355,6 +335,12 @@ mail_able (GtkButton *button, gpointer data)
row = dialog->accounts_row;
account = gtk_clist_get_row_data (dialog->mail_accounts, row);
account->source->enabled = !account->source->enabled;
+
+ if (account->source->enabled)
+ mail_load_storage_by_uri (dialog->shell, account->source->url, account->name);
+ else
+ mail_remove_storage_by_uri (account->source->url);
+
mail_autoreceive_setup ();
mail_config_write ();
load_accounts (dialog);
@@ -457,7 +443,6 @@ news_add_destroyed (GtkWidget *widget, gpointer data)
gpointer *send = data;
MailAccountsDialog *dialog;
MailConfigService *service;
- GSList *mini;
service = send[0];
dialog = send[1];
@@ -466,9 +451,7 @@ news_add_destroyed (GtkWidget *widget, gpointer data)
dialog->news = mail_config_get_news ();
load_news (dialog);
- mini = g_slist_prepend(NULL, service);
- mail_load_storages(dialog->shell, mini, FALSE);
- g_slist_free(mini);
+ mail_load_storage_by_uri(dialog->shell, account->source->url, account->name);
dialog->news = mail_config_get_news ();
load_news (dialog);