typo fix.
[platform/upstream/evolution-data-server.git] / camel / camel-store.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camelStore.c : Abstract class for an email store */
3
4 /* 
5  *
6  * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
7  *
8  * This program is free software; you can redistribute it and/or 
9  * modify it under the terms of the GNU General Public License as 
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  * USA
22  */
23
24 #include "camel-store.h"
25
26 static GtkObjectClass *parent_class=NULL;
27
28 /* Returns the class for a CamelStore */
29 #define CS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
30
31 static void _set_separator(CamelStore *store, gchar sep);
32 static CamelFolder *_get_root_folder(CamelStore *store);
33 static CamelFolder *_get_default_folder(CamelStore *store);
34 static void _init(CamelStore *store, CamelSession *session, GString *url_name);
35
36
37
38 static void
39 camel_store_class_init (CamelStoreClass *camel_store_class)
40 {
41         parent_class = gtk_type_class (camel_service_get_type ());
42         
43         /* virtual method definition */
44         camel_store_class->init = _init;
45         camel_store_class->set_separator = _set_separator;
46         camel_store_class->get_separator = camel_store_get_separator;
47         camel_store_class->get_folder = camel_store_get_folder;
48         camel_store_class->get_root_folder = _get_root_folder;
49         camel_store_class->get_default_folder = _get_default_folder;
50         /* virtual method overload */
51 }
52
53
54
55
56
57
58
59 GtkType
60 camel_store_get_type (void)
61 {
62         static GtkType camel_store_type = 0;
63         
64         if (!camel_store_type)  {
65                 GtkTypeInfo camel_store_info =  
66                 {
67                         "CamelStore",
68                         sizeof (CamelStore),
69                         sizeof (CamelStoreClass),
70                         (GtkClassInitFunc) camel_store_class_init,
71                         (GtkObjectInitFunc) NULL,
72                                 /* reserved_1 */ NULL,
73                                 /* reserved_2 */ NULL,
74                         (GtkClassInitFunc) NULL,
75                 };
76                 
77                 camel_store_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_store_info);
78         }
79         
80         return camel_store_type;
81 }
82
83
84
85
86
87 /**
88  * camel_store_init: call store's init method
89  * @store: the store to initialize
90  * @session: session which instantiates the store
91  * @url_name: URL defining the store
92  *
93  * This routine is called by the session object from which this 
94  * store is created. It must not be called directly.
95  * 
96  **/
97 void 
98 camel_store_init(CamelStore *store, CamelSession *session, GString *url_name)
99 {
100         g_assert(store);
101         CS_CLASS(store)->init(store, session, url_name);
102 }
103
104
105 /**
106  * init: method called by a session object to 
107  * initialize a store object
108  * @store: the store to initialize
109  * @session: session which instantiates the store
110  * @url_name: URL defining the store
111  * 
112  * This routine is called by the session object from which this 
113  * store is created. 
114  * 
115  **/
116 static void 
117 _init(CamelStore *store, CamelSession *session, GString *url_name)
118 {
119         
120         
121         g_assert(session);
122         g_assert(url_name);
123
124         store->session = session;
125         store->url_name = url_name;
126 }
127
128
129
130 /** 
131  * camel_store_set_separator: set the character which separates this folder 
132  * path from the folders names in a lower level of hierarchy.
133  *
134  * @store:
135  * @sep:
136  *
137  **/
138 static void
139 _set_separator(CamelStore *store, gchar sep)
140 {
141     store->separator = sep;
142 }
143
144
145
146 /** 
147  * camel_store_get_separator: return the character which separates this folder 
148  * path from the folders names in a lower level of hierarchy.
149  *
150  * @store: store
151  *
152  **/
153 gchar
154 camel_store_get_separator(CamelStore *store)
155 {
156         g_assert(store);
157         return store->separator;
158 }
159
160
161
162
163 /** 
164  * camel_store_get_folder: return the folder corresponding to a path.
165  * 
166  * Returns the folder corresponding to the path "name". 
167  * If the path begins with the separator caracter, it 
168  * is relative to the root folder. Otherwise, it is
169  * relative to the default folder.
170  * The folder does not necessarily exist on the store.
171  * To make sure it already exists, use its "exists" method.
172  * If it does not exist, you can create it with its 
173  * "create" method.
174  *
175  * @store: store
176  * @folder_name: name of the folder to get
177  *
178  * Return value: the folder
179  **/
180 CamelFolder *
181 camel_store_get_folder(CamelStore *store, GString *folder_name)
182 {
183
184 #warning fill this part in.
185         return NULL;
186 }
187
188
189 /**
190  * camel_store_get_root_folder : return the toplevel folder
191  * 
192  * Returns the folder which is at the top of the folder
193  * hierarchy. This folder is generally different from
194  * the default folder. 
195  * 
196  * @Return value: the tolevel folder.
197  **/
198 static CamelFolder *
199 _get_root_folder(CamelStore *store)
200 {
201     return NULL;
202 }
203
204 /** 
205  * camel_store_get_default_folder : return the store default folder
206  *
207  * The default folder is the folder which is presented 
208  * to the user in the default configuration. The default
209  * is often the root folder.
210  *
211  *  @Return value: the default folder.
212  **/
213 static CamelFolder *
214 _get_default_folder(CamelStore *store)
215 {
216     return NULL;
217 }
218
219
220