aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-31 01:09:42 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-31 01:09:42 +0800
commit2bdcfe5c47e9add476eab5d848b30d9d1715c153 (patch)
tree03ea965b34ee45f22bc00a737e9d9af1dd1992f7 /mail
parente8df3eea83688f5656c076952dfcffb297c08ad1 (diff)
downloadgsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.gz
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.bz2
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.lz
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.xz
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.zst
gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.zip
Make CamelServices connect only when told to (old behavior). Make CamelRemoteStore do its stuff in service::connect, not ::post_connect.
svn path=/trunk/; revision=5116
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/component-factory.c84
-rw-r--r--mail/mail-config-gui.c11
3 files changed, 26 insertions, 78 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5b165ed3c2..7e7a873d8e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-30 Peter Williams <peterw@helixcode.com>
+
+ * mail-config-gui.c (do_test_service): Explicitly connect to
+ the service again.
+
+ * component-factory.c (mail_load_storages): Now that
+ camel_service_get_provider exists, use it to make this function
+ much simpler.
+
2000-08-29 Peter Williams <peterw@helixcode.com>
* folder-browser.c (folder_browser_new): Ref the Evolution_Shell.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 47153ad530..08dd3f73fc 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -202,95 +202,36 @@ void
mail_load_storages (Evolution_Shell corba_shell, GSList *sources)
{
CamelException ex;
- GList *providers;
- GSList *iter;
MailConfigService *svc;
- GPtrArray *protos;
- int i;
+ GSList *iter;
camel_exception_init (&ex);
- protos = g_ptr_array_new();
-
- /* First, open all the storages so that camel
- * loads only the providers that we're going
- * to need.
- *
- * We don't open the storage per se but we
- * slurp its protocol so that we don't try
- * to connect to it just yet.
- *
- * We remember the protocol associated with
- * each URI for the second pass.
+
+ /* Load each service (don't connect!). Check its provider and
+ * see if this belongs in the shell's folder list. If so, add
+ * it.
*/
-
+
for (iter = sources; iter; iter = iter->next) {
CamelService *temp;
- gchar *p;
- gchar *proto;
+ CamelProvider *prov = NULL;
svc = (MailConfigService *) iter->data;
if (svc->url == NULL || svc->url[0] == '\0')
continue;
- p = strchr (svc->url, ':');
- if (!p || *p == '\0') {
- g_warning ("Bad url (no protocol): %s", svc->url);
- continue;
- }
-
- p++; /* we're on the char after the colon */
-
- proto = g_strndup (svc->url, p - svc->url);
- g_ptr_array_add (protos, proto);
-
- temp = camel_session_get_service (session, proto,
+ temp = camel_session_get_service (session, svc->url,
CAMEL_PROVIDER_STORE, &ex);
if (temp == NULL) {
/* FIXME: real error dialog */
g_warning ("couldn't get service %s: %s\n",
svc->url, camel_exception_get_description (&ex));
- } else
- camel_object_unref (CAMEL_OBJECT (temp));
- }
-
- /* Okay. All the providers we need are loaded.
- * Now get the list of them.
- */
-
- providers = camel_session_list_providers (session, FALSE);
-
- /* Now zip through the sources a second time. This time
- * we check to see if its provider is a storage or not.
- * If so, add it to the shell.
- */
-
- for (iter = sources, i = 0; iter; iter = iter->next, i++) {
- CamelProvider *prov = NULL;
- GList *prov_iter;
- gchar *proto;
-
- svc = (MailConfigService *) iter->data;
-
- proto = g_ptr_array_index (protos, i);
-
- /* find its provider */
- for (prov_iter = providers; prov_iter; prov_iter = prov_iter->next) {
- CamelProvider *thisone = (CamelProvider *) prov_iter->data;
-
- if (!g_strncasecmp (proto, thisone->protocol, strlen (thisone->protocol))) {
- prov = thisone;
- break;
- }
- }
-
- g_free (proto);
-
- if (prov == NULL) {
- g_warning ("No provider for loaded URL \"%s\"?", svc->url);
continue;
}
+ prov = camel_service_get_provider (temp);
+
/* 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
@@ -306,10 +247,9 @@ mail_load_storages (Evolution_Shell corba_shell, GSList *sources)
camel_exception_get_description (&ex));
}
}
- }
- g_ptr_array_free (protos, TRUE);
- camel_exception_clear (&ex);
+ camel_object_unref (CAMEL_OBJECT (temp));
+ }
}
void
diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c
index e64e7a15be..8a007dc1c1 100644
--- a/mail/mail-config-gui.c
+++ b/mail/mail-config-gui.c
@@ -2266,15 +2266,14 @@ static void do_test_service (gpointer in_data, gpointer op_data, CamelException
service = camel_session_get_service (session, input->url,
input->type, ex);
-
+
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
data->success = FALSE;
- /*} else if (camel_service_connect (service, ex)) {
- *camel_service_disconnect (service, ex);
- *data->success = TRUE;
- */
+ } else if (camel_service_connect (service, ex)) {
+ camel_service_disconnect (service, ex);
+ data->success = TRUE;
} else {
- data->success = TRUE;
+ data->success = FALSE;
}
camel_object_unref (CAMEL_OBJECT (service));