diff options
author | Peter Williams <peterw@src.gnome.org> | 2000-08-31 01:09:42 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2000-08-31 01:09:42 +0800 |
commit | 2bdcfe5c47e9add476eab5d848b30d9d1715c153 (patch) | |
tree | 03ea965b34ee45f22bc00a737e9d9af1dd1992f7 /mail/component-factory.c | |
parent | e8df3eea83688f5656c076952dfcffb297c08ad1 (diff) | |
download | gsoc2013-evolution-2bdcfe5c47e9add476eab5d848b30d9d1715c153.tar.gz 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/component-factory.c')
-rw-r--r-- | mail/component-factory.c | 84 |
1 files changed, 12 insertions, 72 deletions
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 |