aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-26 22:02:56 +0800
committerDan Winship <danw@src.gnome.org>2001-03-26 22:02:56 +0800
commit3eb45d09d2546975d001bfc295f9a105be5a9921 (patch)
treeef3f41c8a0a64db9fd2138b0bb0cee57ad83acb3
parentd3ce110bb79d7e5fc7966e8375d79201ac6ffbaf (diff)
downloadgsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar.gz
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar.bz2
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar.lz
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar.xz
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.tar.zst
gsoc2013-evolution-3eb45d09d2546975d001bfc295f9a105be5a9921.zip
Simplify a bit using camel_session_get_provider.
* component-factory.c (mail_load_storages): Simplify a bit using camel_session_get_provider. * mail-callbacks.c (empty_trash): Ditto, and fix up use of CamelException. svn path=/trunk/; revision=8942
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/component-factory.c53
-rw-r--r--mail/mail-callbacks.c15
3 files changed, 41 insertions, 35 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 87901893bb..1d96a3f937 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-26 Dan Winship <danw@ximian.com>
+
+ * component-factory.c (mail_load_storages): Simplify a bit using
+ camel_session_get_provider.
+
+ * mail-callbacks.c (empty_trash): Ditto, and fix up use of
+ CamelException.
+
2001-03-26 Radek Doulik <rodo@ximian.com>
* mail-format.c (write_address): clear name and email data after
diff --git a/mail/component-factory.c b/mail/component-factory.c
index d3a88ca197..5e3ece1f61 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -414,7 +414,8 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
const MailConfigService *service = NULL;
CamelService *store;
CamelProvider *prov;
-
+ char *name;
+
if (is_account_data) {
account = iter->data;
service = account->source;
@@ -425,9 +426,8 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
if (service->url == NULL || service->url[0] == '\0')
continue;
- store = camel_session_get_service (session, service->url,
- CAMEL_PROVIDER_STORE, &ex);
- if (store == NULL) {
+ prov = camel_session_get_provider (session, service->url, &ex);
+ if (prov == NULL) {
/* FIXME: real error dialog */
g_warning ("couldn't get service %s: %s\n", service->url,
camel_exception_get_description (&ex));
@@ -435,31 +435,38 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
continue;
}
- prov = camel_service_get_provider (store);
-
/* FIXME: this case is ambiguous for things like the
* mbox provider, which can really be a spool
* (/var/spool/mail/user) or a storage (~/mail/, eg).
* That issue can't be resolved on the provider level
* -- it's a per-URL problem.
*/
- if (prov->flags & CAMEL_PROVIDER_IS_STORAGE && prov->flags & CAMEL_PROVIDER_IS_REMOTE) {
- char *name;
-
- if (is_account_data) {
- name = g_strdup (account->name);
- } else {
- name = camel_service_get_name (store, TRUE);
- }
- add_storage (name, service->url, store, shell, &ex);
- g_free (name);
-
- if (camel_exception_is_set (&ex)) {
- /* FIXME: real error dialog */
- g_warning ("Cannot load storage: %s",
- camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- }
+ if (!(prov->flags & (CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_REMOTE)))
+ continue;
+
+ store = camel_session_get_service (session, service->url,
+ CAMEL_PROVIDER_STORE, &ex);
+ if (store == NULL) {
+ /* FIXME: real error dialog */
+ g_warning ("couldn't get service %s: %s\n", service->url,
+ camel_exception_get_description (&ex));
+ camel_exception_clear (&ex);
+ continue;
+ }
+
+ if (is_account_data)
+ name = g_strdup (account->name);
+ else
+ name = camel_service_get_name (store, TRUE);
+
+ add_storage (name, service->url, store, shell, &ex);
+ g_free (name);
+
+ if (camel_exception_is_set (&ex)) {
+ /* FIXME: real error dialog */
+ g_warning ("Cannot load storage: %s",
+ camel_exception_get_description (&ex));
+ camel_exception_clear (&ex);
}
camel_object_unref (CAMEL_OBJECT (store));
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 9ee434d16c..8d6a5aa57e 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1459,7 +1459,6 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path)
{
MailConfigAccount *account;
CamelProvider *provider;
- CamelService *service;
CamelFolder *vtrash;
const GSList *accounts;
CamelException *ex;
@@ -1473,30 +1472,22 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path)
/* make sure this is a valid source */
if (account->source && account->source->url) {
- service = camel_session_get_service (session, account->source->url,
- CAMEL_PROVIDER_STORE, ex);
-
- if (service) {
- provider = camel_service_get_provider (service);
-
+ provider = camel_session_get_provider (session, account->source->url, NULL);
+ if (provider) {
/* make sure this store is a remote store */
if (provider->flags & CAMEL_PROVIDER_IS_STORAGE &&
provider->flags & CAMEL_PROVIDER_IS_REMOTE) {
char *url;
url = g_strdup_printf ("vtrash:%s", account->source->url);
- vtrash = mail_tool_uri_to_folder (url, ex);
+ vtrash = mail_tool_uri_to_folder (url, NULL);
g_free (url);
if (vtrash)
mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL);
}
-
- camel_object_unref (CAMEL_OBJECT (service));
}
}
-
- camel_exception_clear (ex);
accounts = accounts->next;
}