mark struct as private
[platform/upstream/evolution-data-server.git] / calendar / libecal / e-cal.h
1 /* Evolution calendar ecal
2  *
3  * Copyright (C) 2001 Ximian, Inc.
4  *
5  * Authors: Federico Mena-Quintero <federico@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 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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef E_CAL_H
22 #define E_CAL_H
23
24 #include <glib-object.h>
25 #include <libecal/e-cal-recur.h>
26 #include <libecal/e-cal-util.h>
27 #include <libecal/e-cal-view.h>
28 #include <libecal/e-cal-types.h>
29
30 G_BEGIN_DECLS
31
32 \f
33
34 #define E_TYPE_CAL            (e_cal_get_type ())
35 #define E_CAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL, ECal))
36 #define E_CAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL, ECalClass))
37 #define E_IS_CAL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL))
38 #define E_IS_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL))
39
40 #define E_CAL_OPEN_STATUS_ENUM_TYPE     (e_cal_open_status_enum_get_type ())
41 #define E_CAL_REMOVE_STATUS_ENUM_TYPE   (e_cal_remove_status_enum_get_type ())
42 #define E_CAL_SET_MODE_STATUS_ENUM_TYPE (e_cal_set_mode_status_enum_get_type ())
43 #define CAL_MODE_ENUM_TYPE                   (cal_mode_enum_get_type ())
44
45 typedef struct _ECal ECal;
46 typedef struct _ECalClass ECalClass;
47 typedef struct _ECalPrivate ECalPrivate;
48
49 /* Open status for the cal_opened signal */
50 typedef enum {
51         E_CAL_OPEN_SUCCESS,
52         E_CAL_OPEN_ERROR,
53         E_CAL_OPEN_NOT_FOUND,
54         E_CAL_OPEN_PERMISSION_DENIED,
55         E_CAL_OPEN_METHOD_NOT_SUPPORTED
56 } ECalOpenStatus;
57
58 /* Set mode status for the e_cal_set_mode function */
59 typedef enum {
60         E_CAL_SET_MODE_SUCCESS,
61         E_CAL_SET_MODE_ERROR,
62         E_CAL_SET_MODE_NOT_SUPPORTED
63 } ECalSetModeStatus;
64
65 /* Get status for the e_cal_get_object() function */
66 typedef enum {
67         E_CAL_GET_SUCCESS,
68         E_CAL_GET_NOT_FOUND,
69         E_CAL_GET_SYNTAX_ERROR
70 } ECalGetStatus;
71
72 /* Status for update_object(s) and remove_object */
73 typedef enum {
74         E_CAL_RESULT_SUCCESS,
75         E_CAL_RESULT_CORBA_ERROR,
76         E_CAL_RESULT_INVALID_OBJECT,
77         E_CAL_RESULT_NOT_FOUND,
78         E_CAL_RESULT_PERMISSION_DENIED
79 } ECalResult;
80
81 /* Whether the ecal is not loaded, is being loaded, or is already loaded */
82 typedef enum {
83         E_CAL_LOAD_NOT_LOADED,
84         E_CAL_LOAD_LOADING,
85         E_CAL_LOAD_LOADED
86 } ECalLoadState;
87
88 struct _ECal {
89         GObject object;
90
91         /*< private >*/
92         ECalPrivate *priv;
93 };
94
95 struct _ECalClass {
96         GObjectClass parent_class;
97
98         /* Notification signals */
99
100         void (* cal_opened) (ECal *ecal, ECalOpenStatus status);
101         void (* cal_set_mode) (ECal *ecal, ECalSetModeStatus status, CalMode mode);     
102
103         void (* backend_error) (ECal *ecal, const char *message);
104
105         void (* categories_changed) (ECal *ecal, GPtrArray *categories);
106
107         void (* forget_password) (ECal *ecal, const char *key);
108
109         void (* backend_died) (ECal *ecal);
110 };
111
112 typedef gchar * (* ECalAuthFunc) (ECal *ecal,
113                                       const gchar *prompt,
114                                       const gchar *key,
115                                       gpointer user_data);
116
117 GType e_cal_get_type (void);
118
119 GType e_cal_open_status_enum_get_type (void);
120 GType e_cal_set_mode_status_enum_get_type (void);
121 GType cal_mode_enum_get_type (void);
122
123 ECal *e_cal_new (const char *uri, CalObjType type);
124
125 void e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data);
126
127 gboolean e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error);
128 void e_cal_open_async (ECal *ecal, gboolean only_if_exists);
129 gboolean e_cal_remove_calendar (ECal *ecal, GError **error);
130
131 GList *e_cal_uri_list (ECal *ecal, CalMode mode);
132
133 ECalLoadState e_cal_get_load_state (ECal *ecal);
134
135 const char *e_cal_get_uri (ECal *ecal);
136
137 gboolean e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error);
138 gboolean e_cal_get_cal_address (ECal *ecal, char **cal_address, GError **error);
139 gboolean e_cal_get_alarm_email_address (ECal *ecal, char **alarm_address, GError **error);
140 gboolean e_cal_get_ldap_attribute (ECal *ecal, char **ldap_attribute, GError **error);
141
142 gboolean e_cal_get_one_alarm_only (ECal *ecal);
143 gboolean e_cal_get_organizer_must_attend (ECal *ecal);
144 gboolean e_cal_get_save_schedules (ECal *ecal);
145 gboolean e_cal_get_static_capability (ECal *ecal, const char *cap);
146
147 gboolean e_cal_set_mode (ECal *ecal, CalMode mode);
148
149 gboolean e_cal_get_default_object (ECal *ecal,
150                                         icalcomponent **icalcomp, GError **error);
151
152 gboolean e_cal_get_object (ECal *ecal,
153                                 const char *uid,
154                                 const char *rid,
155                                 icalcomponent **icalcomp,
156                                 GError **error);
157
158 gboolean e_cal_get_changes (ECal *ecal, const char *change_id, GList **changes, GError **error);
159 void e_cal_free_change_list (GList *list);
160
161 gboolean e_cal_get_object_list (ECal *ecal, const char *query, GList **objects, GError **error);
162 gboolean e_cal_get_object_list_as_comp (ECal *ecal, const char *query, GList **objects, GError **error);
163 void e_cal_free_object_list (GList *objects);
164
165 gboolean e_cal_get_free_busy (ECal *ecal, GList *users, time_t start, time_t end, 
166                                    GList **freebusy, GError **error);
167
168 void e_cal_generate_instances (ECal *ecal, CalObjType type,
169                                     time_t start, time_t end,
170                                     ECalRecurInstanceFn cb, gpointer cb_data);
171
172 GSList *e_cal_get_alarms_in_range (ECal *ecal, time_t start, time_t end);
173
174 void e_cal_free_alarms (GSList *comp_alarms);
175
176 gboolean e_cal_get_alarms_for_object (ECal *ecal, const char *uid,
177                                            time_t start, time_t end,
178                                            ECalComponentAlarms **alarms);
179
180 gboolean e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, char **uid, GError **error);
181 gboolean e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GError **error);
182 gboolean e_cal_remove_object (ECal *ecal, const char *uid, GError **error);
183 gboolean e_cal_remove_object_with_mod (ECal *ecal, const char *uid, const char *rid, CalObjModType mod, GError **error);
184
185 gboolean e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const char *auid, GError **error);
186
187 gboolean e_cal_receive_objects (ECal *ecal, icalcomponent *icalcomp, GError **error);
188 gboolean e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GError **error);
189
190 gboolean e_cal_get_timezone (ECal *ecal, const char *tzid, icaltimezone **zone, GError **error);
191 gboolean e_cal_add_timezone (ECal *ecal, icaltimezone *izone, GError **error);
192 /* Sets the default timezone to use to resolve DATE and floating DATE-TIME
193    values. This will typically be from the user's timezone setting. Call this
194    before using any other functions. It will pass the default timezone on to
195    the server. Returns TRUE on success. */
196 gboolean e_cal_set_default_timezone (ECal *ecal, icaltimezone *zone, GError **error);
197
198 gboolean e_cal_get_query (ECal *ecal, const char *sexp, ECalView **query, GError **error);
199
200 /* Resolves TZIDs for the recurrence generator. */
201 icaltimezone *e_cal_resolve_tzid_cb (const char *tzid, gpointer data);
202
203 /* Returns a complete VCALENDAR for a VEVENT/VTODO including all VTIMEZONEs
204    used by the component. It also includes a 'METHOD:PUBLISH' property. */
205 char* e_cal_get_component_as_string (ECal *ecal, icalcomponent *icalcomp);
206
207 const char * e_cal_get_error_message (ECalendarStatus status);
208
209 G_END_DECLS
210
211 #endif