diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-02-25 01:44:28 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-02-25 01:44:28 +0800 |
commit | 585f905ecdc05ba1ccd52ed81935304a303dd28c (patch) | |
tree | 83171b2c7f17ce7144176c410fa76119e7c6a502 | |
parent | 28aea3d4dfb0ed14f65805235babde1530d9cd22 (diff) | |
download | gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar.gz gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar.bz2 gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar.lz gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar.xz gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.tar.zst gsoc2013-evolution-585f905ecdc05ba1ccd52ed81935304a303dd28c.zip |
init the vTrash folder here instead of in store_init.
2001-02-24 Jeffrey Stedfast <fejj@ximian.com>
* camel-store.c (construct): init the vTrash folder here instead
of in store_init.
(camel_store_class_init): init service_class->construct.
(camel_store_finalize): We only need to unref the vtrash folder.
(init_trash): don't create a vstore since we don't need it.
svn path=/trunk/; revision=8378
-rw-r--r-- | camel/ChangeLog | 8 | ||||
-rw-r--r-- | camel/camel-store.c | 46 |
2 files changed, 36 insertions, 18 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 2572ce3763..0ab171ce23 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2001-02-24 Jeffrey Stedfast <fejj@ximian.com> + + * camel-store.c (construct): init the vTrash folder here instead + of in store_init. + (camel_store_class_init): init service_class->construct. + (camel_store_finalize): We only need to unref the vtrash folder. + (init_trash): don't create a vstore since we don't need it. + 2001-02-23 Jeffrey Stedfast <fejj@ximian.com> * camel-store.c (camel_store_class_init): init get_trash and diff --git a/camel/camel-store.c b/camel/camel-store.c index 86a2a88871..ec2eec6b87 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -27,6 +27,8 @@ #include <config.h> #include <string.h> +#include "camel-session.h" + #include "camel-store.h" #include "camel-folder.h" #include "camel-vee-store.h" @@ -40,6 +42,10 @@ static CamelServiceClass *parent_class = NULL; /* Returns the class for a CamelStore */ #define CS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +static void construct (CamelService *service, CamelSession *session, + CamelProvider *provider, CamelURL *url, + CamelException *ex); + static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex); static CamelFolder *get_inbox (CamelStore *store, CamelException *ex); @@ -72,10 +78,14 @@ camel_store_class_init (CamelStoreClass *camel_store_class) { CamelObjectClass *camel_object_class = CAMEL_OBJECT_CLASS (camel_store_class); + CamelServiceClass *camel_service_class = + CAMEL_SERVICE_CLASS (camel_store_class); parent_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ())); /* virtual method definition */ + camel_service_class->construct = construct; + camel_store_class->hash_folder_name = g_str_hash; camel_store_class->compare_folder_name = g_str_equal; camel_store_class->get_folder = get_folder; @@ -113,8 +123,6 @@ camel_store_init (void *o) store->flags = 0; - store_class->init_trash (store); - store->priv = g_malloc0 (sizeof (*store->priv)); #ifdef ENABLE_THREADS store->priv->folder_lock = g_mutex_new(); @@ -123,10 +131,23 @@ camel_store_init (void *o) } static void +construct (CamelService *service, CamelSession *session, CamelProvider *provider, + CamelURL *url, CamelException *ex) +{ + CamelStoreClass *store_class; + + parent_class->construct (service, session, provider, url, ex); + + /* initialize the vTrash folder */ + store_class = (CamelStoreClass *) CAMEL_OBJECT_GET_CLASS (service); + store_class->init_trash (CAMEL_STORE (service)); +} + +static void camel_store_finalize (CamelObject *object) { CamelStore *store = CAMEL_STORE (object); - + if (store->folders) { if (g_hash_table_size (store->folders) != 0) { g_warning ("Folder cache for store %p contains " @@ -136,12 +157,8 @@ camel_store_finalize (CamelObject *object) g_hash_table_destroy (store->folders); } - if (store->vtrash) { - CamelStore *vstore = camel_folder_get_parent_store (store->vtrash); - + if (store->vtrash) camel_object_unref (CAMEL_OBJECT (store->vtrash)); - camel_object_unref (CAMEL_OBJECT (vstore)); - } #ifdef ENABLE_THREADS g_mutex_free (store->priv->folder_lock); @@ -366,20 +383,13 @@ static void init_trash (CamelStore *store) { CamelStore *vstore; - char *uri, *name; - CamelURL *url; + char *name; - uri = g_strdup_printf ("vfolder:%p/%s", store, "vTrash"); name = g_strdup_printf ("%s?(match-all (system-flag \"Deleted\"))", "vTrash"); - vstore = CAMEL_STORE (camel_vee_store_new ()); - - url = camel_url_new (uri, NULL); - g_free (uri); - CAMEL_SERVICE (vstore)->url = url; + store->vtrash = camel_vee_folder_new (store, name, CAMEL_STORE_FOLDER_CREATE | + CAMEL_STORE_VEE_FOLDER_AUTO, NULL); - store->vtrash = camel_store_get_folder (vstore, name, CAMEL_STORE_FOLDER_CREATE | - CAMEL_STORE_VEE_FOLDER_AUTO, NULL); g_free (name); } |