1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
---|
2 | /* e-storage.h |
---|
3 | * |
---|
4 | * Copyright (C) 2000 Ximian, Inc. |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of version 2 of the GNU General Public |
---|
8 | * License as published by the Free Software Foundation. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | * General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU General Public |
---|
16 | * License along with this program; if not, write to the |
---|
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
18 | * Boston, MA 02111-1307, USA. |
---|
19 | * |
---|
20 | * Author: Ettore Perazzoli |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _E_STORAGE_H_ |
---|
24 | #define _E_STORAGE_H_ |
---|
25 | |
---|
26 | #include <gtk/gtkobject.h> |
---|
27 | |
---|
28 | #include "evolution-shell-component-client.h" |
---|
29 | |
---|
30 | #ifdef __cplusplus |
---|
31 | extern "C" { |
---|
32 | #pragma } |
---|
33 | #endif /* __cplusplus */ |
---|
34 | |
---|
35 | #define E_TYPE_STORAGE (e_storage_get_type ()) |
---|
36 | #define E_STORAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_STORAGE, EStorage)) |
---|
37 | #define E_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE, EStorageClass)) |
---|
38 | #define E_IS_STORAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_STORAGE)) |
---|
39 | #define E_IS_STORAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE)) |
---|
40 | |
---|
41 | |
---|
42 | typedef struct _EStorage EStorage; |
---|
43 | typedef struct _EStoragePrivate EStoragePrivate; |
---|
44 | typedef struct _EStorageClass EStorageClass; |
---|
45 | |
---|
46 | enum _EStorageResult { |
---|
47 | E_STORAGE_OK, |
---|
48 | E_STORAGE_GENERICERROR, |
---|
49 | E_STORAGE_EXISTS, |
---|
50 | E_STORAGE_INVALIDTYPE, |
---|
51 | E_STORAGE_IOERROR, |
---|
52 | E_STORAGE_NOSPACE, |
---|
53 | E_STORAGE_NOTEMPTY, |
---|
54 | E_STORAGE_NOTFOUND, |
---|
55 | E_STORAGE_NOTIMPLEMENTED, |
---|
56 | E_STORAGE_PERMISSIONDENIED, |
---|
57 | E_STORAGE_UNSUPPORTEDOPERATION, |
---|
58 | E_STORAGE_UNSUPPORTEDTYPE, |
---|
59 | E_STORAGE_CANTCHANGESTOCKFOLDER, |
---|
60 | E_STORAGE_CANTMOVETODESCENDANT, |
---|
61 | E_STORAGE_NOTONLINE, |
---|
62 | E_STORAGE_INVALIDNAME |
---|
63 | }; |
---|
64 | typedef enum _EStorageResult EStorageResult; |
---|
65 | |
---|
66 | typedef void (* EStorageResultCallback) (EStorage *storage, EStorageResult result, void *data); |
---|
67 | typedef void (* EStorageDiscoveryCallback) (EStorage *storage, EStorageResult result, const char *path, void *data); |
---|
68 | |
---|
69 | #include "e-folder.h" |
---|
70 | |
---|
71 | struct _EStorage { |
---|
72 | GtkObject parent; |
---|
73 | |
---|
74 | EStoragePrivate *priv; |
---|
75 | }; |
---|
76 | |
---|
77 | struct _EStorageClass { |
---|
78 | GtkObjectClass parent_class; |
---|
79 | |
---|
80 | /* Signals. */ |
---|
81 | |
---|
82 | void (* new_folder) (EStorage *storage, const char *path); |
---|
83 | void (* updated_folder) (EStorage *storage, const char *path); |
---|
84 | void (* removed_folder) (EStorage *storage, const char *path); |
---|
85 | void (* close_folder) (EStorage *storage, const char *path); |
---|
86 | |
---|
87 | /* Virtual methods. */ |
---|
88 | |
---|
89 | GList * (* get_subfolder_paths) (EStorage *storage, |
---|
90 | const char *path); |
---|
91 | EFolder * (* get_folder) (EStorage *storage, |
---|
92 | const char *path); |
---|
93 | const char * (* get_name) (EStorage *storage); |
---|
94 | |
---|
95 | void (* async_create_folder) (EStorage *storage, |
---|
96 | const char *path, |
---|
97 | const char *type, |
---|
98 | const char *description, |
---|
99 | EStorageResultCallback callback, |
---|
100 | void *data); |
---|
101 | |
---|
102 | void (* async_remove_folder) (EStorage *storage, |
---|
103 | const char *path, |
---|
104 | EStorageResultCallback callback, |
---|
105 | void *data); |
---|
106 | |
---|
107 | void (* async_xfer_folder) (EStorage *storage, |
---|
108 | const char *source_path, |
---|
109 | const char *destination_path, |
---|
110 | const gboolean remove_source, |
---|
111 | EStorageResultCallback callback, |
---|
112 | void *data); |
---|
113 | |
---|
114 | void (* async_open_folder) (EStorage *storage, |
---|
115 | const char *path); |
---|
116 | |
---|
117 | gboolean (* supports_shared_folders) (EStorage *storage); |
---|
118 | void (* async_discover_shared_folder) (EStorage *storage, |
---|
119 | const char *owner, |
---|
120 | const char *folder_name, |
---|
121 | EStorageDiscoveryCallback callback, |
---|
122 | void *data); |
---|
123 | void (* cancel_discover_shared_folder) (EStorage *storage, |
---|
124 | const char *owner, |
---|
125 | const char *folder_name); |
---|
126 | void (* async_remove_shared_folder) (EStorage *storage, |
---|
127 | const char *path, |
---|
128 | EStorageResultCallback callback, |
---|
129 | void *data); |
---|
130 | }; |
---|
131 | |
---|
132 | |
---|
133 | GtkType e_storage_get_type (void); |
---|
134 | void e_storage_construct (EStorage *storage, |
---|
135 | const char *name, |
---|
136 | EFolder *root_folder); |
---|
137 | EStorage *e_storage_new (const char *name, |
---|
138 | EFolder *root_folder); |
---|
139 | |
---|
140 | gboolean e_storage_path_is_relative (const char *path); |
---|
141 | gboolean e_storage_path_is_absolute (const char *path); |
---|
142 | |
---|
143 | GList *e_storage_get_subfolder_paths (EStorage *storage, |
---|
144 | const char *path); |
---|
145 | EFolder *e_storage_get_folder (EStorage *storage, |
---|
146 | const char *path); |
---|
147 | |
---|
148 | const char *e_storage_get_name (EStorage *storage); |
---|
149 | |
---|
150 | /* Folder operations. */ |
---|
151 | |
---|
152 | void e_storage_async_create_folder (EStorage *storage, |
---|
153 | const char *path, |
---|
154 | const char *type, |
---|
155 | const char *description, |
---|
156 | EStorageResultCallback callback, |
---|
157 | void *data); |
---|
158 | void e_storage_async_remove_folder (EStorage *storage, |
---|
159 | const char *path, |
---|
160 | EStorageResultCallback callback, |
---|
161 | void *data); |
---|
162 | void e_storage_async_xfer_folder (EStorage *storage, |
---|
163 | const char *source_path, |
---|
164 | const char *destination_path, |
---|
165 | const gboolean remove_source, |
---|
166 | EStorageResultCallback callback, |
---|
167 | void *data); |
---|
168 | void e_storage_async_open_folder (EStorage *storage, |
---|
169 | const char *path); |
---|
170 | |
---|
171 | const char *e_storage_result_to_string (EStorageResult result); |
---|
172 | |
---|
173 | /* Shared folders. */ |
---|
174 | gboolean e_storage_supports_shared_folders (EStorage *storage); |
---|
175 | void e_storage_async_discover_shared_folder (EStorage *storage, |
---|
176 | const char *owner, |
---|
177 | const char *folder_name, |
---|
178 | EStorageDiscoveryCallback callback, |
---|
179 | void *data); |
---|
180 | void e_storage_cancel_discover_shared_folder (EStorage *storage, |
---|
181 | const char *owner, |
---|
182 | const char *folder_name); |
---|
183 | void e_storage_async_remove_shared_folder (EStorage *storage, |
---|
184 | const char *path, |
---|
185 | EStorageResultCallback callback, |
---|
186 | void *data); |
---|
187 | |
---|
188 | /* Utility functions. */ |
---|
189 | |
---|
190 | char *e_storage_get_path_for_physical_uri (EStorage *storage, |
---|
191 | const char *physical_uri); |
---|
192 | |
---|
193 | /* Protected. C++ anyone? */ |
---|
194 | gboolean e_storage_new_folder (EStorage *storage, const char *path, EFolder *folder); |
---|
195 | gboolean e_storage_has_subfolders (EStorage *storage, const char *path, const char *message); |
---|
196 | gboolean e_storage_removed_folder (EStorage *storage, const char *path); |
---|
197 | |
---|
198 | #ifdef __cplusplus |
---|
199 | } |
---|
200 | #endif /* __cplusplus */ |
---|
201 | |
---|
202 | #endif /* _E_STORAGE_H_ */ |
---|