aboutsummaryrefslogtreecommitdiffstats
path: root/mail/component-factory.c
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 /mail/component-factory.c
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
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r--mail/component-factory.c53
1 files changed, 30 insertions, 23 deletions
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));