changed order around, first try to delete and only remove from the object
[platform/upstream/evolution-data-server.git] / camel / camel-digest-store.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  *  Authors: Jeffrey Stedfast <fejj@ximian.com>
4  *
5  *  Copyright 2002 Ximian, Inc. (www.ximian.com)
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
20  *
21  */
22
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <string.h>
29
30 #include "camel-exception.h"
31 #include "camel-digest-store.h"
32 #include "camel-digest-folder.h"
33
34 #include "camel-private.h"
35
36 #define d(x)
37
38 static CamelFolder *digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
39 static void digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex);
40 static void digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex);
41 static CamelFolder *digest_get_trash  (CamelStore *store, CamelException *ex);
42 static CamelFolder *digest_get_junk  (CamelStore *store, CamelException *ex);
43
44 static CamelFolderInfo *digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex);
45
46 static void camel_digest_store_class_init (CamelDigestStoreClass *klass);
47 static void camel_digest_store_init       (CamelDigestStore *obj);
48 static void camel_digest_store_finalise   (CamelObject *obj);
49
50 static int digest_setv (CamelObject *object, CamelException *ex, CamelArgV *args);
51 static int digest_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args);
52
53 static CamelStoreClass *parent_class = NULL;
54
55
56 CamelType
57 camel_digest_store_get_type (void)
58 {
59         static CamelType type = CAMEL_INVALID_TYPE;
60         
61         if (type == CAMEL_INVALID_TYPE) {
62                 type = camel_type_register (camel_store_get_type (),
63                                             "CamelDigestStore",
64                                             sizeof (CamelDigestStore),
65                                             sizeof (CamelDigestStoreClass),
66                                             (CamelObjectClassInitFunc) camel_digest_store_class_init,
67                                             NULL,
68                                             (CamelObjectInitFunc) camel_digest_store_init,
69                                             (CamelObjectFinalizeFunc) camel_digest_store_finalise);
70         }
71         
72         return type;
73 }
74
75 static void
76 camel_digest_store_class_init (CamelDigestStoreClass *klass)
77 {
78         CamelObjectClass *object_class = (CamelObjectClass *) klass;
79         CamelStoreClass *store_class = (CamelStoreClass *) klass;
80         
81         parent_class = CAMEL_STORE_CLASS(camel_type_get_global_classfuncs (camel_store_get_type ()));
82         
83         /* virtual method overload */
84         object_class->setv = digest_setv;
85         object_class->getv = digest_getv;
86         
87         store_class->get_folder = digest_get_folder;
88         store_class->rename_folder = digest_rename_folder;
89         store_class->delete_folder = digest_delete_folder;
90         store_class->get_folder_info = digest_get_folder_info;
91         store_class->free_folder_info = camel_store_free_folder_info_full;
92         
93         store_class->get_trash = digest_get_trash;
94         store_class->get_junk = digest_get_junk;
95 }
96
97 static void
98 camel_digest_store_init (CamelDigestStore *obj)
99 {
100         CamelStore *store = (CamelStore *) obj;
101         
102         /* we dont want a vtrash and vjunk on this one */
103         store->flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);      
104 }
105
106 static void
107 camel_digest_store_finalise (CamelObject *obj)
108 {
109         
110 }
111
112 static int
113 digest_setv (CamelObject *object, CamelException *ex, CamelArgV *args)
114 {
115         /* CamelDigestStore doesn't currently have anything to set */
116         return CAMEL_OBJECT_CLASS (parent_class)->setv (object, ex, args);
117 }
118
119 static int
120 digest_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
121 {
122         /* CamelDigestStore doesn't currently have anything to get */
123         return CAMEL_OBJECT_CLASS (parent_class)->getv (object, ex, args);
124 }
125
126
127 /**
128  * camel_digest_store_new:
129  * @url:
130  *
131  * Create a new CamelDigestStore object.
132  * 
133  * Return value: A new CamelDigestStore widget.
134  **/
135 CamelStore *
136 camel_digest_store_new (const char *url)
137 {
138         CamelStore *store;
139         CamelURL *uri;
140         
141         uri = camel_url_new (url, NULL);
142         if (!uri)
143                 return NULL;
144         
145         store = CAMEL_STORE (camel_object_new (camel_digest_store_get_type ()));
146         CAMEL_SERVICE (store)->url = uri;
147         
148         return store;
149 }
150
151 static CamelFolder *
152 digest_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
153 {
154         return NULL;
155 }
156
157 static CamelFolder *
158 digest_get_trash (CamelStore *store, CamelException *ex)
159 {
160         return NULL;
161 }
162
163 static CamelFolder *
164 digest_get_junk (CamelStore *store, CamelException *ex)
165 {
166         return NULL;
167 }
168
169 static CamelFolderInfo *
170 digest_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelException *ex)
171 {
172         return NULL;
173 }
174
175 static void
176 digest_delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
177 {
178         
179 }
180
181 static void
182 digest_rename_folder (CamelStore *store, const char *old, const char *new, CamelException *ex)
183 {
184         
185 }