diff options
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/Makefile.am | 2 | ||||
-rw-r--r-- | camel/camel-digest-folder.c | 4 | ||||
-rw-r--r-- | camel/camel-digest-folder.h | 3 | ||||
-rw-r--r-- | camel/camel-digest-store.c | 156 | ||||
-rw-r--r-- | camel/camel-digest-store.h | 60 |
6 files changed, 229 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 08ec723130..46126857e0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,12 @@ 2002-03-11 Jeffrey Stedfast <fejj@ximian.com> + * camel-digest-store.c: A pretty empty store implementation to be + the parent store of a CamelDigestFolder. + + * camel-digest-folder.c: Updated to reference it's parent store. + +2002-03-11 Jeffrey Stedfast <fejj@ximian.com> + * camel-digest-folder.c (camel_digest_folder_new): Allow any leaf part to be a message/rfc822 part. (digest_get_uids): Recurse the mime structure and add all diff --git a/camel/Makefile.am b/camel/Makefile.am index 075ac1077f..5c00f8c0f4 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -25,6 +25,7 @@ libcamel_la_SOURCES = \ camel-data-cache.c \ camel-data-wrapper.c \ camel-digest-folder.c \ + camel-digest-store.c \ camel-disco-diary.c \ camel-disco-folder.c \ camel-disco-store.c \ @@ -116,6 +117,7 @@ libcamelinclude_HEADERS = \ camel-data-cache.h \ camel-data-wrapper.h \ camel-digest-folder.h \ + camel-digest-store.h \ camel-disco-diary.h \ camel-disco-folder.h \ camel-disco-store.h \ diff --git a/camel/camel-digest-folder.c b/camel/camel-digest-folder.c index 03ad633146..41c0fbd4d5 100644 --- a/camel/camel-digest-folder.c +++ b/camel/camel-digest-folder.c @@ -169,7 +169,7 @@ multipart_contains_message_parts (CamelMultipart *multipart) } CamelFolder * -camel_digest_folder_new (CamelMimeMessage *message) +camel_digest_folder_new (CamelStore *parent_store, CamelMimeMessage *message) { CamelDigestFolder *digest_folder; CamelDataWrapper *wrapper; @@ -188,7 +188,7 @@ camel_digest_folder_new (CamelMimeMessage *message) folder = CAMEL_FOLDER (camel_object_new (camel_digest_folder_get_type ())); digest_folder = CAMEL_DIGEST_FOLDER (folder); - camel_folder_construct (folder, NULL, "folder_name", "short_name"); + camel_folder_construct (folder, parent_store, "folder_name", "short_name"); camel_object_ref (CAMEL_OBJECT (message)); digest_folder->priv->message = message; diff --git a/camel/camel-digest-folder.h b/camel/camel-digest-folder.h index b92d178b93..9a0af10836 100644 --- a/camel/camel-digest-folder.h +++ b/camel/camel-digest-folder.h @@ -24,6 +24,7 @@ #define _CAMEL_DIGEST_FOLDER_H #include <glib.h> +#include <camel/camel-store.h> #include <camel/camel-folder.h> #include <camel/camel-mime-message.h> @@ -47,6 +48,6 @@ struct _CamelDigestFolderClass { CamelType camel_digest_folder_get_type (void); -CamelFolder *camel_digest_folder_new (CamelMimeMessage *message); +CamelFolder *camel_digest_folder_new (CamelStore *parent_store, CamelMimeMessage *message); #endif /* ! _CAMEL_DIGEST_FOLDER_H */ diff --git a/camel/camel-digest-store.c b/camel/camel-digest-store.c new file mode 100644 index 0000000000..b082ac0962 --- /dev/null +++ b/camel/camel-digest-store.c @@ -0,0 +1,156 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> + +#include "camel-exception.h" +#include "camel-digest-store.h" +#include "camel-digest-folder.h" + +#include "camel-private.h" + +#define d(x) + +static CamelFolder *digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex); +static void digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex); +static void digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex); +static void digest_init_trash (CamelStore *store); +static CamelFolder *digest_get_trash (CamelStore *store, CamelException *ex); + +static CamelFolderInfo *digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex); + +static void camel_digest_store_class_init (CamelDigestStoreClass *klass); +static void camel_digest_store_init (CamelDigestStore *obj); +static void camel_digest_store_finalise (CamelObject *obj); + +static CamelStoreClass *camel_digest_store_parent = NULL; + + +CamelType +camel_digest_store_get_type (void) +{ + static CamelType type = CAMEL_INVALID_TYPE; + + if (type == CAMEL_INVALID_TYPE) { + type = camel_type_register (camel_store_get_type (), + "CamelDigestStore", + sizeof (CamelDigestStore), + sizeof (CamelDigestStoreClass), + (CamelObjectClassInitFunc) camel_digest_store_class_init, + NULL, + (CamelObjectInitFunc) camel_digest_store_init, + (CamelObjectFinalizeFunc) camel_digest_store_finalise); + } + + return type; +} + +static void +camel_digest_store_class_init (CamelDigestStoreClass *klass) +{ + CamelStoreClass *store_class = (CamelStoreClass *) klass; + + camel_digest_store_parent = CAMEL_STORE_CLASS(camel_type_get_global_classfuncs (camel_store_get_type ())); + + /* virtual method overload */ + store_class->get_folder = digest_get_folder; + store_class->rename_folder = digest_rename_folder; + store_class->delete_folder = digest_delete_folder; + store_class->get_folder_info = digest_get_folder_info; + store_class->free_folder_info = camel_store_free_folder_info_full; + + store_class->init_trash = digest_init_trash; + store_class->get_trash = digest_get_trash; +} + +static void +camel_digest_store_init (CamelDigestStore *obj) +{ + CamelStore *store = (CamelStore *) obj; + + /* we dont want a vtrash on this one */ + store->flags &= ~(CAMEL_STORE_VTRASH); +} + +static void +camel_digest_store_finalise (CamelObject *obj) +{ + +} + + +/** + * camel_digest_store_new: + * + * Create a new CamelDigestStore object. + * + * Return value: A new CamelDigestStore widget. + **/ +CamelStore * +camel_digest_store_new (void) +{ + CamelStore *store = CAMEL_STORE (camel_object_new (camel_digest_store_get_type ())); + + return store; +} + +static CamelFolder * +digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex) +{ + return NULL; +} + +static void +digest_init_trash (CamelStore *store) +{ + /* no-op */ + ; +} + +static CamelFolder * +digest_get_trash (CamelStore *store, CamelException *ex) +{ + return NULL; +} + +static CamelFolderInfo * +digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex) +{ + return NULL; +} + +static void +digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) +{ + +} + +static void +digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex) +{ + +} diff --git a/camel/camel-digest-store.h b/camel/camel-digest-store.h new file mode 100644 index 0000000000..caf33cfdc7 --- /dev/null +++ b/camel/camel-digest-store.h @@ -0,0 +1,60 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast <fejj@ximian.com> + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __CAMEL_DIGEST_STORE_H__ +#define __CAMEL_DIGEST_STORE_H__ + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +#include <glib.h> +#include <camel/camel-store.h> + +#define CAMEL_DIGEST_STORE(obj) CAMEL_CHECK_CAST (obj, camel_digest_store_get_type (), CamelDigestStore) +#define CAMEL_DIGEST_STORE_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_digest_store_get_type (), CamelDigestStoreClass) +#define CAMEL_IS_DIGEST_STORE(obj) CAMEL_CHECK_TYPE (obj, camel_digest_store_get_type ()) + +typedef struct _CamelDigestStore CamelDigestStore; +typedef struct _CamelDigestStoreClass CamelDigestStoreClass; + +struct _CamelDigestStore { + CamelStore parent; + +}; + +struct _CamelDigestStoreClass { + CamelStoreClass parent_class; + +}; + +CamelType camel_digest_store_get_type (void); + +CamelStore *camel_digest_store_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CAMEL_DIGEST_STORE_H__ */ |