1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4 * Copyright (C) 2000 Ximian, Inc.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
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.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
20 * Author: Ettore Perazzoli
26 #include <glib-object.h>
32 #endif /* __cplusplus */
34 #define E_TYPE_STORAGE (e_storage_get_type ())
35 #define E_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_STORAGE, EStorage))
36 #define E_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_STORAGE, EStorageClass))
37 #define E_IS_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_STORAGE))
38 #define E_IS_STORAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_STORAGE))
39 #define E_STORAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_STORAGE, EStorageClass))
41 typedef struct EStorage EStorage;
42 typedef struct EStoragePrivate EStoragePrivate;
43 typedef struct EStorageClass EStorageClass;
47 E_STORAGE_GENERICERROR,
49 E_STORAGE_INVALIDTYPE,
54 E_STORAGE_NOTIMPLEMENTED,
55 E_STORAGE_PERMISSIONDENIED,
56 E_STORAGE_UNSUPPORTEDOPERATION,
57 E_STORAGE_UNSUPPORTEDTYPE,
58 E_STORAGE_CANTCHANGESTOCKFOLDER,
59 E_STORAGE_CANTMOVETODESCENDANT,
64 typedef void (* EStorageResultCallback) (EStorage *storage, EStorageResult result, void *data);
65 typedef void (* EStorageDiscoveryCallback) (EStorage *storage, EStorageResult result, const char *path, void *data);
70 EStoragePrivate *priv;
73 struct EStorageClass {
74 GObjectClass parent_class;
78 void (* new_folder) (EStorage *storage, const char *path);
79 void (* updated_folder) (EStorage *storage, const char *path);
80 void (* removed_folder) (EStorage *storage, const char *path);
82 /* Virtual methods. */
84 GList * (* get_subfolder_paths) (EStorage *storage,
86 EFolder * (* get_folder) (EStorage *storage,
88 const char * (* get_name) (EStorage *storage);
90 void (* async_create_folder) (EStorage *storage,
93 EStorageResultCallback callback,
96 void (* async_remove_folder) (EStorage *storage,
98 EStorageResultCallback callback,
101 void (* async_xfer_folder) (EStorage *storage,
102 const char *source_path,
103 const char *destination_path,
104 const gboolean remove_source,
105 EStorageResultCallback callback,
108 void (* async_open_folder) (EStorage *storage,
110 EStorageDiscoveryCallback callback,
113 gboolean (* will_accept_folder) (EStorage *storage,
117 void (* async_discover_shared_folder) (EStorage *storage,
119 const char *folder_name,
120 EStorageDiscoveryCallback callback,
122 void (* cancel_discover_shared_folder) (EStorage *storage,
124 const char *folder_name);
125 void (* async_remove_shared_folder) (EStorage *storage,
127 EStorageResultCallback callback,
131 GType e_storage_get_type (void);
132 void e_storage_construct (EStorage *storage,
134 EFolder *root_folder);
135 EStorage *e_storage_new (const char *name,
136 EFolder *root_folder);
138 gboolean e_storage_path_is_relative (const char *path);
139 gboolean e_storage_path_is_absolute (const char *path);
141 GList *e_storage_get_subfolder_paths (EStorage *storage,
143 EFolder *e_storage_get_folder (EStorage *storage,
146 const char *e_storage_get_name (EStorage *storage);
148 /* Folder operations. */
150 void e_storage_async_create_folder (EStorage *storage,
153 EStorageResultCallback callback,
155 void e_storage_async_remove_folder (EStorage *storage,
157 EStorageResultCallback callback,
159 void e_storage_async_xfer_folder (EStorage *storage,
160 const char *source_path,
161 const char *destination_path,
162 const gboolean remove_source,
163 EStorageResultCallback callback,
165 void e_storage_async_open_folder (EStorage *storage,
167 EStorageDiscoveryCallback callback,
170 const char *e_storage_result_to_string (EStorageResult result);
172 gboolean e_storage_will_accept_folder (EStorage *storage,
176 /* Shared folders. */
177 void e_storage_async_discover_shared_folder (EStorage *storage,
179 const char *folder_name,
180 EStorageDiscoveryCallback callback,
182 void e_storage_cancel_discover_shared_folder (EStorage *storage,
184 const char *folder_name);
185 void e_storage_async_remove_shared_folder (EStorage *storage,
187 EStorageResultCallback callback,
190 /* Utility functions. */
192 char *e_storage_get_path_for_physical_uri (EStorage *storage,
193 const char *physical_uri);
195 /* FIXME: Need to rename these. */
197 gboolean e_storage_new_folder (EStorage *storage,
200 gboolean e_storage_removed_folder (EStorage *storage,
203 gboolean e_storage_declare_has_subfolders (EStorage *storage,
205 const char *message);
206 gboolean e_storage_get_has_subfolders (EStorage *storage,
211 #endif /* __cplusplus */
213 #endif /* _E_STORAGE_H_ */