Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / providers / local / camel-local-folder.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  * Author: Michael Zucchi <notzed@ximian.com>
4  *
5  * Copyright (C) 1999 Ximian (www.ximian.com/).
6  *
7  * This program is free software; you can redistribute it and/or 
8  * modify it under the terms of version 2 of the GNU Lesser General Public 
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19  * USA
20  */
21
22 #ifndef CAMEL_LOCAL_FOLDER_H
23 #define CAMEL_LOCAL_FOLDER_H 1
24
25 #include <camel/camel-folder.h>
26 #include <camel/camel-folder-search.h>
27 #include <camel/camel-index.h>
28 #include "camel-local-summary.h"
29 #include "camel-lock.h"
30
31 /*  #include "camel-store.h" */
32
33 #define CAMEL_LOCAL_FOLDER_TYPE     (camel_local_folder_get_type ())
34 #define CAMEL_LOCAL_FOLDER(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolder))
35 #define CAMEL_LOCAL_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_LOCAL_FOLDER_TYPE, CamelLocalFolderClass))
36 #define CAMEL_IS_LOCAL_FOLDER(o)    (CAMEL_CHECK_TYPE((o), CAMEL_LOCAL_FOLDER_TYPE))
37
38 G_BEGIN_DECLS
39
40 enum {
41         CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY = CAMEL_FOLDER_ARG_LAST,
42
43         CAMEL_LOCAL_FOLDER_ARG_LAST = CAMEL_FOLDER_ARG_LAST + 0x100
44 };
45
46 enum {
47         CAMEL_LOCAL_FOLDER_INDEX_BODY = CAMEL_LOCAL_FOLDER_ARG_INDEX_BODY | CAMEL_ARG_BOO,
48 };
49
50 typedef struct {
51         CamelFolder parent_object;
52         struct _CamelLocalFolderPrivate *priv;
53
54         guint32 flags;          /* open mode flags */
55
56         int locked;             /* lock counter */
57         CamelLockType locktype; /* what type of lock we have */
58
59         char *base_path;        /* base path of the local folder */
60         char *folder_path;      /* the path to the folder itself */
61         char *summary_path;     /* where the summary lives */
62         char *index_path;       /* where the index file lives */
63
64         CamelIndex *index;         /* index for this folder */
65         CamelFolderSearch *search; /* used to run searches, we just use the real thing (tm) */
66         CamelFolderChangeInfo *changes; /* used to store changes to the folder during processing */
67 } CamelLocalFolder;
68
69 typedef struct {
70         CamelFolderClass parent_class;
71
72         /* Virtual methods */   
73         
74         /* summary factory, only used at init */
75         CamelLocalSummary *(*create_summary)(CamelLocalFolder *lf, const char *path, const char *folder, CamelIndex *index);
76
77         /* Lock the folder for my operations */
78         int (*lock)(CamelLocalFolder *, CamelLockType type, CamelException *ex);
79
80         /* Unlock the folder for my operations */
81         void (*unlock)(CamelLocalFolder *);
82 } CamelLocalFolderClass;
83
84
85 /* public methods */
86 /* flags are taken from CAMEL_STORE_FOLDER_* flags */
87 CamelLocalFolder *camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store,
88                                                const char *full_name, guint32 flags, CamelException *ex);
89
90 /* Standard Camel function */
91 CamelType camel_local_folder_get_type(void);
92
93 /* Lock the folder for internal use.  May be called repeatedly */
94 /* UNIMPLEMENTED */
95 int camel_local_folder_lock(CamelLocalFolder *lf, CamelLockType type, CamelException *ex);
96 int camel_local_folder_unlock(CamelLocalFolder *lf);
97
98 G_END_DECLS
99
100 #endif /* CAMEL_LOCAL_FOLDER_H */