diff options
author | 4 <NotZed@Ximian.com> | 2001-09-15 16:12:58 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-09-15 16:12:58 +0800 |
commit | 466e05c024510d8019989f8bf8f04541c3ca792d (patch) | |
tree | a744a404a3861eb09836240628b5f8480ced01c2 /camel/camel-store.c | |
parent | 576a04e67d0f059992afbb1afdca67fb668288f4 (diff) | |
download | gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar.gz gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar.bz2 gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar.lz gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar.xz gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.tar.zst gsoc2013-evolution-466e05c024510d8019989f8bf8f04541c3ca792d.zip |
New function, set the complete list of folders on a vfolder, all at once.
2001-09-14 <NotZed@Ximian.com>
* camel-vee-folder.c (camel_vee_folder_set_folders): New function,
set the complete list of folders on a vfolder, all at once.
(camel_vee_folder_set_expression): If we set the query to be the
same thing, dont do anything.
* camel-vee-store.c (camel_vee_store_init): Turn off vtrash for
this store.
* camel-store.c (camel_store_init): Enable vtrash by default via
flags.
(camel_store_get_trash): REturn NULL if the store doesn't support
vtrash.
(init_trash): Dont init if store doesn't support vtrash.
* camel-store.h: Add a new flags CAMEL_STORE_VTRASH -> store
supports vtrash.
2001-09-13 <NotZed@Ximian.com>
* camel-vee-store.c (vee_get_folder_info): Implement.
(build_info): Used to build a folder record from the folders
hashtable.
(vee_delete_folder): Implemented, remove folder from hashtable.
(vee_rename_folder): Implemented, remove old folder from
hashtable, add new one and rename its guts too.
* camel-store.c (camel_store_rename_folder): Do nothing if we're
not asked to actually change names. Also dont do the renamed
cache check till after we've called the subclass.
(camel_store_delete_folder): Call the subclass delete firs,t then
make sure the cache is right.
* camel-vee-folder.c (vee_folder_construct): Remove support for
name?query syntax to setup vfolder. Abort if such syntax is used.
(camel_vee_folder_new): Removed code that handles ? syntax, etc.
(vee_folder_build_folder): Handle unset expression, treat it as an
empty search.
(camel_vee_folder_set_expression): Oops, actually set the
expression.
* camel-vtrash-folder.c (camel_vtrash_folder_new): Dont use
name?query syntax to setup vfolder, but set the expression
directly. Also fixes a small memleak.
2001-09-12 <NotZed@Ximian.com>
* camel-store.c (camel_store_delete_folder): Fixed warnings with a cast.
(camel_store_rename_folder): "
svn path=/trunk/; revision=12854
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r-- | camel/camel-store.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c index 470ada7baf..9722163cec 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -111,7 +111,8 @@ camel_store_init (void *o) } else store->folders = NULL; - store->flags = 0; + /* set vtrash on by default */ + store->flags = CAMEL_STORE_VTRASH; store->priv = g_malloc0 (sizeof (*store->priv)); #ifdef ENABLE_THREADS @@ -226,11 +227,15 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag if (store->folders) { CAMEL_STORE_LOCK(store, cache_lock); + printf("adding folder '%s' to folders hashtable\n", folder_name); g_hash_table_insert (store->folders, g_strdup (folder_name), folder); + printf("store folders size = %d\n", g_hash_table_size(store->folders)); + camel_object_hook_event (CAMEL_OBJECT (folder), "finalize", folder_finalize, store); CAMEL_STORE_UNLOCK(store, cache_lock); - } + } else + printf("not adding folder '%s' to folders hashtable\n", folder_name); } } @@ -296,13 +301,15 @@ camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelExce CAMEL_STORE_LOCK(store, folder_lock); + CS_CLASS (store)->delete_folder (store, folder_name, ex); + /* if we deleted a folder, force it out of the cache, and also out of the vtrash if setup */ if (store->folders) { CamelFolder *folder; char *key; CAMEL_STORE_LOCK(store, cache_lock); - if (g_hash_table_lookup_extended(store->folders, folder_name, &key, (void **)&folder)) { + if (g_hash_table_lookup_extended(store->folders, folder_name, (void **)&key, (void **)&folder)) { g_hash_table_remove(store->folders, key); g_free(key); CAMEL_STORE_UNLOCK(store, cache_lock); @@ -313,7 +320,6 @@ camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelExce } } - CS_CLASS (store)->delete_folder (store, folder_name, ex); CAMEL_STORE_UNLOCK(store, folder_lock); } @@ -341,17 +347,20 @@ camel_store_rename_folder (CamelStore *store, const char *old_name, const char * char *key; CamelFolder *folder; + if (strcmp(old_name, new_name) == 0) + return; + CAMEL_STORE_LOCK(store, folder_lock); + CS_CLASS (store)->rename_folder (store, old_name, new_name, ex); /* remove the old name from the cache if it is there */ CAMEL_STORE_LOCK(store, cache_lock); - if (g_hash_table_lookup_extended(store->folders, old_name, &key, (void **)&folder)) { + if (g_hash_table_lookup_extended(store->folders, old_name, (void **)&key, (void **)&folder)) { g_hash_table_remove(store->folders, key); g_free(key); } CAMEL_STORE_UNLOCK(store, cache_lock); - CS_CLASS (store)->rename_folder (store, old_name, new_name, ex); CAMEL_STORE_UNLOCK(store, folder_lock); } @@ -406,6 +415,9 @@ trash_finalize (CamelObject *trash, gpointer event_data, gpointer user_data) static void init_trash (CamelStore *store) { + if ((store->flags & CAMEL_STORE_VTRASH) == 0) + return; + store->vtrash = camel_vtrash_folder_new (store, CAMEL_VTRASH_NAME); if (store->vtrash) { @@ -455,6 +467,9 @@ CamelFolder * camel_store_get_trash (CamelStore *store, CamelException *ex) { CamelFolder *folder; + + if ((store->flags & CAMEL_STORE_VTRASH) == 0) + return NULL; CAMEL_STORE_LOCK(store, folder_lock); folder = CS_CLASS (store)->get_trash (store, ex); |