1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camelStore.c : Abstract class for an email store */
6 * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
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.
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.
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
24 #include "camel-store.h"
26 static GtkObjectClass *parent_class=NULL;
28 /* Returns the class for a CamelStore */
29 #define CS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
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);
39 camel_store_class_init (CamelStoreClass *camel_store_class)
41 parent_class = gtk_type_class (camel_service_get_type ());
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 */
60 camel_store_get_type (void)
62 static GtkType camel_store_type = 0;
64 if (!camel_store_type) {
65 GtkTypeInfo camel_store_info =
69 sizeof (CamelStoreClass),
70 (GtkClassInitFunc) camel_store_class_init,
71 (GtkObjectInitFunc) NULL,
72 /* reserved_1 */ NULL,
73 /* reserved_2 */ NULL,
74 (GtkClassInitFunc) NULL,
77 camel_store_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_store_info);
80 return camel_store_type;
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
93 * This routine is called by the session object from which this
94 * store is created. It must not be called directly.
98 camel_store_init(CamelStore *store, CamelSession *session, GString *url_name)
101 CS_CLASS(store)->init(store, session, url_name);
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
112 * This routine is called by the session object from which this
117 _init(CamelStore *store, CamelSession *session, GString *url_name)
124 store->session = session;
125 store->url_name = url_name;
131 * camel_store_set_separator: set the character which separates this folder
132 * path from the folders names in a lower level of hierarchy.
139 _set_separator(CamelStore *store, gchar sep)
141 store->separator = sep;
147 * camel_store_get_separator: return the character which separates this folder
148 * path from the folders names in a lower level of hierarchy.
154 camel_store_get_separator(CamelStore *store)
157 return store->separator;
164 * camel_store_get_folder: return the folder corresponding to a path.
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
176 * @folder_name: name of the folder to get
178 * Return value: the folder
181 camel_store_get_folder(CamelStore *store, GString *folder_name)
184 #warning fill this part in.
190 * camel_store_get_root_folder : return the toplevel folder
192 * Returns the folder which is at the top of the folder
193 * hierarchy. This folder is generally different from
194 * the default folder.
196 * @Return value: the tolevel folder.
199 _get_root_folder(CamelStore *store)
205 * camel_store_get_default_folder : return the store default folder
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.
211 * @Return value: the default folder.
214 _get_default_folder(CamelStore *store)