diff options
author | Not Zed <NotZed@Ximian.com> | 2004-02-05 13:14:04 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-02-05 13:14:04 +0800 |
commit | ab318a91925aa31a10e0b225d2ef7fd9b0fa9a4c (patch) | |
tree | 0531c5e1372700ac9d7d2cbed113cfc3b5283d1a /camel/camel-vtrash-folder.c | |
parent | 1771797074cb50808f2b9fe4132be177d7fae2a8 (diff) | |
download | gsoc2013-evolution-ab318a91925aa31a10e0b225d2ef7fd9b0fa9a4c.tar.gz gsoc2013-evolution-ab318a91925aa31a10e0b225d2ef7fd9b0fa9a4c.tar.zst gsoc2013-evolution-ab318a91925aa31a10e0b225d2ef7fd9b0fa9a4c.zip |
** See bug #53553.
2004-02-05 Not Zed <NotZed@Ximian.com>
** See bug #53553.
* camel-provider.c (camel_provider_init): changed to return a
hashtable of url protocols to CamelProviderModule structs, rather
than simple strings.
* camel-session.c (get_provider): if we load a provider module,
mark it as loaded.
(ensure_loaded): Check the module loaded flag before trying to
load it.
* providers/local/libcamellocal.urls: Remove spoold from the list,
since it doesn't exist anymore. Actually fixes #53553, the rest
is to robustify the code.
2004-02-05 Not Zed <NotZed@Ximian.com>
* camel-session.c (CS_CLASS): dont typecheck cast.
* camel-store.c (camel_vjunk_folder_new): removed, use
vtrash_new(junk).
(setup_special): changed to get_special, with a type now, and
dont add vtrash folders to the sources.
(get_trash, get_junk): down to 1 liners, call get_special
* camel-vtrash-folder.c (CF_CLASS): dont use cast typecheck macros
here, makes debugging easier and removes redundant checks.
(camel_vtrash_folder_init): dont set flags here.
(camel_vtrash_folder_new): takes a new argument, type, for junk
folders too, removed name arg (taken from type).
(vtrash_transfer_messages_to): parameterise flag processing.
svn path=/trunk/; revision=24625
Diffstat (limited to 'camel/camel-vtrash-folder.c')
-rw-r--r-- | camel/camel-vtrash-folder.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c index aa21ce3c4c..cd5df81dc6 100644 --- a/camel/camel-vtrash-folder.c +++ b/camel/camel-vtrash-folder.c @@ -31,7 +31,17 @@ #include <string.h> /* Returns the class for a CamelFolder */ -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CF_CLASS(so) ((CamelFolderClass *)((CamelObject *)(so))->klass) + +static struct { + const char *name; + const char *expr; + guint32 bit; + guint32 flags; +} vdata[] = { + { CAMEL_VTRASH_NAME, "(match-all (system-flag \"Deleted\"))", CAMEL_MESSAGE_DELETED, CAMEL_FOLDER_IS_TRASH }, + { CAMEL_VJUNK_NAME, "(match-all (system-flag \"Junk\"))", CAMEL_MESSAGE_JUNK, CAMEL_FOLDER_IS_JUNK }, +}; static CamelVeeFolderClass *camel_vtrash_folder_parent; @@ -56,9 +66,7 @@ camel_vtrash_folder_class_init (CamelVTrashFolderClass *klass) static void camel_vtrash_folder_init (CamelVTrashFolder *vtrash) { - CamelFolder *folder = CAMEL_FOLDER (vtrash); - - folder->folder_flags |= CAMEL_FOLDER_IS_TRASH; + /*CamelFolder *folder = CAMEL_FOLDER (vtrash);*/ } CamelType @@ -83,7 +91,7 @@ camel_vtrash_folder_get_type (void) /** * camel_vtrash_folder_new: * @parent_store: the parent CamelVeeStore - * @name: the vfolder name + * @type: type of vfolder, CAMEL_VTRASH_FOLDER_TRASH or CAMEL_VTRASH_FOLDER_JUNK currently. * @ex: a CamelException * * Create a new CamelVeeFolder object. @@ -91,16 +99,21 @@ camel_vtrash_folder_get_type (void) * Return value: A new CamelVeeFolder widget. **/ CamelFolder * -camel_vtrash_folder_new (CamelStore *parent_store, const char *name) +camel_vtrash_folder_new (CamelStore *parent_store, enum _camel_vtrash_folder_t type) { - CamelFolder *vtrash; + CamelVTrashFolder *vtrash; - vtrash = (CamelFolder *)camel_object_new (camel_vtrash_folder_get_type ()); - camel_vee_folder_construct (CAMEL_VEE_FOLDER (vtrash), parent_store, name, - CAMEL_STORE_FOLDER_PRIVATE | CAMEL_STORE_FOLDER_CREATE | CAMEL_STORE_VEE_FOLDER_AUTO); - camel_vee_folder_set_expression((CamelVeeFolder *)vtrash, "(match-all (system-flag \"Deleted\"))"); + g_assert(type < CAMEL_VTRASH_FOLDER_LAST); + + vtrash = (CamelVTrashFolder *)camel_object_new(camel_vtrash_folder_get_type()); + camel_vee_folder_construct(CAMEL_VEE_FOLDER (vtrash), parent_store, vdata[type].name, + CAMEL_STORE_FOLDER_PRIVATE|CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_VEE_FOLDER_AUTO); - return vtrash; + ((CamelFolder *)vtrash)->folder_flags |= vdata[type].flags; + camel_vee_folder_set_expression((CamelVeeFolder *)vtrash, vdata[type].expr); + vtrash->bit = vdata[type].bit; + + return (CamelFolder *)vtrash; } static void @@ -143,6 +156,7 @@ vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids, GHashTable *batch = NULL; const char *tuid; struct _transfer_data *md; + guint32 sbit = ((CamelVTrashFolder *)source)->bit; /* This is a special case of transfer_messages_to: Either the * source or the destination is a vtrash folder (but not both @@ -157,14 +171,12 @@ vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids, if (!delete_originals) return; - /* Move to trash is the same as deleting the message */ + /* Move to trash is the same as setting the message flag */ for (i = 0; i < uids->len; i++) - camel_folder_delete_message (source, uids->pdata[i]); + camel_folder_set_message_flags(source, uids->pdata[i], sbit, ~0); return; } - g_return_if_fail (CAMEL_IS_VTRASH_FOLDER (source)); - /* Moving/Copying from the trash to the original folder = undelete. * Moving/Copying from the trash to a different folder = move/copy. * @@ -179,8 +191,8 @@ vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids, } if (dest == mi->folder) { - /* Just undelete the original message */ - camel_folder_set_message_flags (source, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0); + /* Just unset the flag on the original message */ + camel_folder_set_message_flags (source, uids->pdata[i], sbit, 0); } else { if (batch == NULL) batch = g_hash_table_new(NULL, NULL); |