aboutsummaryrefslogtreecommitdiffstats
path: root/mail/component-factory.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-20 04:39:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-20 04:39:12 +0800
commit8a7a3f7770d9770d87b06a5641b28796efb02621 (patch)
tree772a331c5739ccabce5901767ef779cdfe7491dc /mail/component-factory.c
parent2012e35e52d580a20649c5a762465681274abd31 (diff)
downloadgsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.gz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.bz2
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.lz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.xz
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.tar.zst
gsoc2013-evolution-8a7a3f7770d9770d87b06a5641b28796efb02621.zip
#include "folder-browser-factory.h"
2001-06-19 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c: #include "folder-browser-factory.h" * component-factory.c (mail_remove_storage): New function to remove an EvolutionStorage. * mail-accounts.c (mail_delete): Remove the storage from the folder-tree. (news_delete): Same. svn path=/trunk/; revision=10304
Diffstat (limited to 'mail/component-factory.c')
-rw-r--r--mail/component-factory.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/mail/component-factory.c b/mail/component-factory.c
index e561a45c78..b38fb10528 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -535,9 +535,9 @@ owner_set_cb (EvolutionShellComponent *shell_component,
static void
free_storage (gpointer service, gpointer storage, gpointer data)
{
- camel_service_disconnect (service, TRUE, NULL);
- camel_object_unref (service);
- bonobo_object_unref (storage);
+ camel_service_disconnect (CAMEL_SERVICE (service), TRUE, NULL);
+ camel_object_unref (CAMEL_OBJECT (service));
+ bonobo_object_unref (BONOBO_OBJECT (storage));
}
static gboolean
@@ -761,19 +761,19 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
const GSList *iter;
camel_exception_init (&ex);
-
+
/* 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) {
const MailConfigAccount *account = NULL;
const MailConfigService *service = NULL;
CamelService *store;
CamelProvider *prov;
char *name;
-
+
if (is_account_data) {
account = iter->data;
service = account->source;
@@ -783,7 +783,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
if (service->url == NULL || service->url[0] == '\0')
continue;
-
+
prov = camel_session_get_provider (session, service->url, &ex);
if (prov == NULL) {
/* FIXME: real error dialog */
@@ -792,7 +792,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
camel_exception_clear (&ex);
continue;
}
-
+
/* 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).
@@ -805,7 +805,7 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
&& !((strcmp(prov->protocol, "spool") == 0)
|| strcmp(prov->protocol, "maildir") == 0))
continue;
-
+
store = camel_session_get_service (session, service->url,
CAMEL_PROVIDER_STORE, &ex);
if (store == NULL) {
@@ -815,15 +815,15 @@ mail_load_storages (GNOME_Evolution_Shell shell, const GSList *sources, gboolean
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",
@@ -846,20 +846,39 @@ EvolutionStorage*
mail_lookup_storage (CamelStore *store)
{
EvolutionStorage *storage;
-
+
/* Because the storages_hash holds a reference to each store
* used as a key in it, none of them will ever be gc'ed, meaning
* any call to camel_session_get_{service,store} with the same
* URL will always return the same object. So this works.
*/
-
+
storage = g_hash_table_lookup (storages_hash, store);
if (storage)
gtk_object_ref (GTK_OBJECT (storage));
-
+
return storage;
}
+void
+mail_remove_storage (CamelStore *store)
+{
+ EvolutionStorage *storage;
+
+ /* Because the storages_hash holds a reference to each store
+ * used as a key in it, none of them will ever be gc'ed, meaning
+ * any call to camel_session_get_{service,store} with the same
+ * URL will always return the same object. So this works.
+ */
+
+ storage = g_hash_table_lookup (storages_hash, store);
+ g_hash_table_remove (storages_hash, store);
+
+ camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL);
+ bonobo_object_unref (BONOBO_OBJECT (storage));
+ camel_object_unref (CAMEL_OBJECT (store));
+}
+
int
mail_storages_count (void)
{