Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-disco-store.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-disco-store.h: abstruct class for a disconnectable store */
3
4 /* 
5  * Authors: Dan Winship <danw@ximian.com>
6  *
7  * Copyright (C) 2001 Ximian, Inc.
8  *
9  * This program is free software; you can redistribute it and/or 
10  * modify it under the terms of version 2 of the GNU Lesser General Public 
11  * License as published by the Free Software Foundation.
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 Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21  * USA
22  */
23
24
25 #ifndef CAMEL_DISCO_STORE_H
26 #define CAMEL_DISCO_STORE_H 1
27
28 #include <camel/camel-store.h>
29
30 #define CAMEL_DISCO_STORE_TYPE     (camel_disco_store_get_type ())
31 #define CAMEL_DISCO_STORE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_DISCO_STORE_TYPE, CamelDiscoStore))
32 #define CAMEL_DISCO_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_DISCO_STORE_TYPE, CamelDiscoStoreClass))
33 #define CAMEL_IS_DISCO_STORE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_DISCO_STORE_TYPE))
34
35 G_BEGIN_DECLS
36
37 enum {
38         CAMEL_DISCO_STORE_ARG_FIRST  = CAMEL_STORE_ARG_FIRST + 100,
39 };
40
41 typedef enum {
42         CAMEL_DISCO_STORE_ONLINE,
43         CAMEL_DISCO_STORE_OFFLINE,
44         CAMEL_DISCO_STORE_RESYNCING
45 } CamelDiscoStoreStatus;
46
47 struct _CamelDiscoStore {
48         CamelStore parent_object;       
49
50         CamelDiscoStoreStatus status;
51         CamelDiscoDiary *diary;
52 };
53
54
55 typedef struct {
56         CamelStoreClass parent_class;
57
58         void              (*set_status)              (CamelDiscoStore *,
59                                                       CamelDiscoStoreStatus,
60                                                       CamelException *);
61         gboolean          (*can_work_offline)        (CamelDiscoStore *);
62
63
64         gboolean          (*connect_online)          (CamelService *,
65                                                       CamelException *);
66         gboolean          (*connect_offline)         (CamelService *,
67                                                       CamelException *);
68
69         gboolean          (*disconnect_online)       (CamelService *, gboolean,
70                                                       CamelException *);
71         gboolean          (*disconnect_offline)      (CamelService *, gboolean,
72                                                       CamelException *);
73
74         CamelFolder *     (*get_folder_online)       (CamelStore *store,
75                                                       const char *name,
76                                                       guint32 flags,
77                                                       CamelException *ex);
78         CamelFolder *     (*get_folder_offline)      (CamelStore *store,
79                                                       const char *name,
80                                                       guint32 flags,
81                                                       CamelException *ex);
82         CamelFolder *     (*get_folder_resyncing)    (CamelStore *store,
83                                                       const char *name,
84                                                       guint32 flags,
85                                                       CamelException *ex);
86
87         CamelFolderInfo * (*get_folder_info_online)    (CamelStore *store,
88                                                         const char *top,
89                                                         guint32 flags,
90                                                         CamelException *ex);
91         CamelFolderInfo * (*get_folder_info_offline)   (CamelStore *store,
92                                                         const char *top,
93                                                         guint32 flags,
94                                                         CamelException *ex);
95         CamelFolderInfo * (*get_folder_info_resyncing) (CamelStore *store,
96                                                         const char *top,
97                                                         guint32 flags,
98                                                         CamelException *ex);
99
100 } CamelDiscoStoreClass;
101
102
103 /* Standard Camel function */
104 CamelType camel_disco_store_get_type (void);
105
106 /* Public methods */
107 CamelDiscoStoreStatus camel_disco_store_status           (CamelDiscoStore *);
108 void                  camel_disco_store_set_status       (CamelDiscoStore *,
109                                                           CamelDiscoStoreStatus,
110                                                           CamelException *);
111 gboolean              camel_disco_store_can_work_offline (CamelDiscoStore *);
112
113
114 /* Convenience functions */
115 gboolean camel_disco_store_check_online (CamelDiscoStore *store, CamelException *ex);
116 void camel_disco_store_prepare_for_offline(CamelDiscoStore *store, CamelException *ex);
117
118 G_END_DECLS
119
120 #endif /* CAMEL_DISCO_STORE_H */