Update Serbian translation
[evolution.git] / src / calendar / gui / e-cal-model.h
blob720e85996b337ed6d210624aa520687581aa05a4
1 /*
3 * Evolution calendar - Data model for ETable
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * Authors:
19 * Rodrigo Moya <rodrigo@ximian.com>
21 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
25 #ifndef E_CAL_MODEL_H
26 #define E_CAL_MODEL_H
28 #include <libecal/libecal.h>
30 #include <e-util/e-util.h>
31 #include <shell/e-shell.h>
32 #include <calendar/gui/e-cal-data-model.h>
34 #include "e-cell-date-edit-text.h"
36 /* Standard GObject macros */
37 #define E_TYPE_CAL_MODEL \
38 (e_cal_model_get_type ())
39 #define E_CAL_MODEL(obj) \
40 (G_TYPE_CHECK_INSTANCE_CAST \
41 ((obj), E_TYPE_CAL_MODEL, ECalModel))
42 #define E_CAL_MODEL_CLASS(cls) \
43 (G_TYPE_CHECK_CLASS_CAST \
44 ((cls), E_TYPE_CAL_MODEL, ECalModelClass))
45 #define E_IS_CAL_MODEL(obj) \
46 (G_TYPE_CHECK_INSTANCE_TYPE \
47 ((obj), E_TYPE_CAL_MODEL))
48 #define E_IS_CAL_MODEL_CLASS(cls) \
49 (G_TYPE_CHECK_CLASS_TYPE \
50 ((cls), E_TYPE_CAL_MODEL))
51 #define E_CAL_MODEL_GET_CLASS(obj) \
52 (G_TYPE_INSTANCE_GET_CLASS \
53 ((obj), E_TYPE_CAL_MODEL, ECalModelClass))
55 /* Standard GObject macros */
56 #define E_TYPE_CAL_MODEL_COMPONENT \
57 (e_cal_model_component_get_type ())
58 #define E_CAL_MODEL_COMPONENT(obj) \
59 (G_TYPE_CHECK_INSTANCE_CAST \
60 ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponent))
61 #define E_CAL_MODEL_COMPONENT_CLASS(cls) \
62 (G_TYPE_CHECK_CLASS_CAST \
63 ((cls), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentClass))
64 #define E_IS_CAL_MODEL_COMPONENT(obj) \
65 (G_TYPE_CHECK_INSTANCE_TYPE \
66 ((obj), E_TYPE_CAL_MODEL_COMPONENT))
67 #define E_IS_CAL_MODEL_COMPONENT_CLASS(cls) \
68 (G_TYPE_CHECK_CLASS_TYPE \
69 ((cls), E_TYPE_CAL_MODEL_COMPONENT))
70 #define E_CAL_MODEL_COMPONENT_GET_CLASS(obj) \
71 (G_TYPE_INSTANCE_GET_CLASS \
72 ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentClass))
74 G_BEGIN_DECLS
76 typedef enum {
77 /* If you add new items here or reorder them, you have to update the
78 * .etspec files for the tables using this model */
79 E_CAL_MODEL_FIELD_CATEGORIES,
80 E_CAL_MODEL_FIELD_CLASSIFICATION,
81 E_CAL_MODEL_FIELD_COLOR, /* not a real field */
82 E_CAL_MODEL_FIELD_COMPONENT, /* not a real field */
83 E_CAL_MODEL_FIELD_DESCRIPTION,
84 E_CAL_MODEL_FIELD_DTSTART,
85 E_CAL_MODEL_FIELD_HAS_ALARMS, /* not a real field */
86 E_CAL_MODEL_FIELD_ICON, /* not a real field */
87 E_CAL_MODEL_FIELD_SUMMARY,
88 E_CAL_MODEL_FIELD_UID,
89 E_CAL_MODEL_FIELD_CREATED,
90 E_CAL_MODEL_FIELD_LASTMODIFIED,
91 E_CAL_MODEL_FIELD_SOURCE, /* not a real field */
92 E_CAL_MODEL_FIELD_LAST
93 } ECalModelField;
95 typedef struct _ECalModel ECalModel;
96 typedef struct _ECalModelClass ECalModelClass;
97 typedef struct _ECalModelPrivate ECalModelPrivate;
99 typedef struct _ECalModelComponent ECalModelComponent;
100 typedef struct _ECalModelComponentClass ECalModelComponentClass;
101 typedef struct _ECalModelComponentPrivate ECalModelComponentPrivate;
103 struct _ECalModelComponent {
104 GObject object;
106 ECalClient *client;
107 icalcomponent *icalcomp;
108 time_t instance_start;
109 time_t instance_end;
110 gboolean is_new_component;
112 /* Private data used by ECalModelCalendar and ECalModelTasks */
113 /* keep these public to avoid many accessor functions */
114 ECellDateEditValue *dtstart;
115 ECellDateEditValue *dtend;
116 ECellDateEditValue *due;
117 ECellDateEditValue *completed;
118 ECellDateEditValue *created;
119 ECellDateEditValue *lastmodified;
120 gchar *color;
122 ECalModelComponentPrivate *priv;
125 struct _ECalModelComponentClass {
126 GObjectClass parent_class;
129 typedef struct {
130 ECalModelComponent *comp_data;
131 gpointer cb_data;
132 } ECalModelGenerateInstancesData;
134 struct _ECalModel {
135 GObject parent;
136 ECalModelPrivate *priv;
139 struct _ECalModelClass {
140 GObjectClass parent_class;
142 /* virtual methods */
143 const gchar * (*get_color_for_component)
144 (ECalModel *model,
145 ECalModelComponent *comp_data);
146 void (*store_values_from_model)
147 (ECalModel *model,
148 ETableModel *source_model,
149 gint row,
150 GHashTable *values); /* column ID ~> value */
151 void (*fill_component_from_values)
152 (ECalModel *model,
153 ECalModelComponent *comp_data,
154 GHashTable *values); /* column ID ~> value, populated by store_values_from_model() */
156 /* Signals */
157 void (*time_range_changed) (ECalModel *model,
158 gint64 start, /* time_t */
159 gint64 end); /* time_t */
160 void (*row_appended) (ECalModel *model);
161 void (*comps_deleted) (ECalModel *model,
162 gpointer list);
163 void (*timezone_changed) (ECalModel *model,
164 icaltimezone *old_zone,
165 icaltimezone *new_zone);
166 void (*object_created) (ECalModel *model,
167 ECalClient *where);
170 typedef time_t (*ECalModelDefaultTimeFunc) (ECalModel *model, gpointer user_data);
172 GType e_cal_model_get_type (void);
173 GType e_cal_model_component_get_type (void);
174 ECalDataModel * e_cal_model_get_data_model (ECalModel *model);
175 ESourceRegistry *
176 e_cal_model_get_registry (ECalModel *model);
177 EShell * e_cal_model_get_shell (ECalModel *model);
178 EClientCache * e_cal_model_get_client_cache (ECalModel *model);
179 icalcomponent_kind
180 e_cal_model_get_component_kind (ECalModel *model);
181 void e_cal_model_set_component_kind (ECalModel *model,
182 icalcomponent_kind kind);
183 gboolean e_cal_model_get_confirm_delete (ECalModel *model);
184 void e_cal_model_set_confirm_delete (ECalModel *model,
185 gboolean confirm_delete);
186 icaltimezone * e_cal_model_get_timezone (ECalModel *model);
187 void e_cal_model_set_timezone (ECalModel *model,
188 icaltimezone *zone);
189 gboolean e_cal_model_get_compress_weekend
190 (ECalModel *model);
191 void e_cal_model_set_compress_weekend
192 (ECalModel *model,
193 gboolean compress_weekend);
194 void e_cal_model_set_default_category
195 (ECalModel *model,
196 const gchar *default_cat);
197 gint e_cal_model_get_default_reminder_interval
198 (ECalModel *model);
199 void e_cal_model_set_default_reminder_interval
200 (ECalModel *model,
201 gint def_reminder_interval);
202 EDurationType e_cal_model_get_default_reminder_units
203 (ECalModel *model);
204 void e_cal_model_set_default_reminder_units
205 (ECalModel *model,
206 EDurationType def_reminder_units);
207 gboolean e_cal_model_get_use_24_hour_format
208 (ECalModel *model);
209 void e_cal_model_set_use_24_hour_format
210 (ECalModel *model,
211 gboolean use24);
212 gboolean e_cal_model_get_use_default_reminder
213 (ECalModel *model);
214 void e_cal_model_set_use_default_reminder
215 (ECalModel *model,
216 gboolean use_def_reminder);
217 GDateWeekday e_cal_model_get_week_start_day (ECalModel *model);
218 void e_cal_model_set_week_start_day (ECalModel *model,
219 GDateWeekday week_start_day);
220 gboolean e_cal_model_get_work_day (ECalModel *model,
221 GDateWeekday weekday);
222 void e_cal_model_set_work_day (ECalModel *model,
223 GDateWeekday weekday,
224 gboolean work_day);
225 GDateWeekday e_cal_model_get_work_day_first (ECalModel *model);
226 GDateWeekday e_cal_model_get_work_day_last (ECalModel *model);
227 gint e_cal_model_get_work_day_end_hour
228 (ECalModel *model);
229 void e_cal_model_set_work_day_end_hour
230 (ECalModel *model,
231 gint work_day_end_hour);
232 gint e_cal_model_get_work_day_end_minute
233 (ECalModel *model);
234 void e_cal_model_set_work_day_end_minute
235 (ECalModel *model,
236 gint work_day_end_minute);
237 gint e_cal_model_get_work_day_start_hour
238 (ECalModel *model);
239 void e_cal_model_set_work_day_start_hour
240 (ECalModel *model,
241 gint work_day_start_hour);
242 gint e_cal_model_get_work_day_start_minute
243 (ECalModel *model);
244 void e_cal_model_set_work_day_start_minute
245 (ECalModel *model,
246 gint work_day_start_minute);
247 gint e_cal_model_get_work_day_start_mon
248 (ECalModel *model);
249 void e_cal_model_set_work_day_start_mon
250 (ECalModel *model,
251 gint work_day_start);
252 gint e_cal_model_get_work_day_end_mon
253 (ECalModel *model);
254 void e_cal_model_set_work_day_end_mon
255 (ECalModel *model,
256 gint work_day_end);
257 gint e_cal_model_get_work_day_start_tue
258 (ECalModel *model);
259 void e_cal_model_set_work_day_start_tue
260 (ECalModel *model,
261 gint work_day_start);
262 gint e_cal_model_get_work_day_end_tue
263 (ECalModel *model);
264 void e_cal_model_set_work_day_end_tue
265 (ECalModel *model,
266 gint work_day_end);
267 gint e_cal_model_get_work_day_start_wed
268 (ECalModel *model);
269 void e_cal_model_set_work_day_start_wed
270 (ECalModel *model,
271 gint work_day_start);
272 gint e_cal_model_get_work_day_end_wed
273 (ECalModel *model);
274 void e_cal_model_set_work_day_end_wed
275 (ECalModel *model,
276 gint work_day_end);
277 gint e_cal_model_get_work_day_start_thu
278 (ECalModel *model);
279 void e_cal_model_set_work_day_start_thu
280 (ECalModel *model,
281 gint work_day_start);
282 gint e_cal_model_get_work_day_end_thu
283 (ECalModel *model);
284 void e_cal_model_set_work_day_end_thu
285 (ECalModel *model,
286 gint work_day_end);
287 gint e_cal_model_get_work_day_start_fri
288 (ECalModel *model);
289 void e_cal_model_set_work_day_start_fri
290 (ECalModel *model,
291 gint work_day_start);
292 gint e_cal_model_get_work_day_end_fri
293 (ECalModel *model);
294 void e_cal_model_set_work_day_end_fri
295 (ECalModel *model,
296 gint work_day_end);
297 gint e_cal_model_get_work_day_start_sat
298 (ECalModel *model);
299 void e_cal_model_set_work_day_start_sat
300 (ECalModel *model,
301 gint work_day_start);
302 gint e_cal_model_get_work_day_end_sat
303 (ECalModel *model);
304 void e_cal_model_set_work_day_end_sat
305 (ECalModel *model,
306 gint work_day_end);
307 gint e_cal_model_get_work_day_start_sun
308 (ECalModel *model);
309 void e_cal_model_set_work_day_start_sun
310 (ECalModel *model,
311 gint work_day_start);
312 gint e_cal_model_get_work_day_end_sun
313 (ECalModel *model);
314 void e_cal_model_set_work_day_end_sun
315 (ECalModel *model,
316 gint work_day_end);
317 void e_cal_model_get_work_day_range_for
318 (ECalModel *model,
319 GDateWeekday weekday,
320 gint *start_hour,
321 gint *start_minute,
322 gint *end_hour,
323 gint *end_minute);
324 const gchar * e_cal_model_get_default_source_uid
325 (ECalModel *model);
326 void e_cal_model_set_default_source_uid
327 (ECalModel *model,
328 const gchar *source_uid);
329 void e_cal_model_remove_all_objects (ECalModel *model);
330 void e_cal_model_get_time_range (ECalModel *model,
331 time_t *start,
332 time_t *end);
333 void e_cal_model_set_time_range (ECalModel *model,
334 time_t start,
335 time_t end);
336 icalcomponent * e_cal_model_create_component_with_defaults_sync
337 (ECalModel *model,
338 ECalClient *client,
339 gboolean all_day,
340 GCancellable *cancellable,
341 GError **error);
342 gchar * e_cal_model_get_attendees_status_info
343 (ECalModel *model,
344 ECalComponent *comp,
345 ECalClient *cal_client);
346 const gchar * e_cal_model_get_color_for_component
347 (ECalModel *model,
348 ECalModelComponent *comp_data);
349 gboolean e_cal_model_get_rgba_for_component
350 (ECalModel *model,
351 ECalModelComponent *comp_data,
352 GdkRGBA *rgba);
353 gboolean e_cal_model_get_rgb_color_for_component
354 (ECalModel *model,
355 ECalModelComponent *comp_data,
356 gdouble *red,
357 gdouble *green,
358 gdouble *blue);
359 ECalModelComponent *
360 e_cal_model_get_component_at (ECalModel *model,
361 gint row);
362 ECalModelComponent *
363 e_cal_model_get_component_for_client_and_uid
364 (ECalModel *model,
365 ECalClient *client,
366 const ECalComponentId *id);
367 gchar * e_cal_model_date_value_to_string (ECalModel *model,
368 gconstpointer value);
369 void e_cal_model_generate_instances_sync
370 (ECalModel *model,
371 time_t start,
372 time_t end,
373 ECalRecurInstanceFn cb,
374 gpointer cb_data);
375 GPtrArray * e_cal_model_get_object_array (ECalModel *model);
376 void e_cal_model_set_instance_times (ECalModelComponent *comp_data,
377 const icaltimezone *zone);
378 gboolean e_cal_model_test_row_editable (ECalModel *model,
379 gint row);
380 void e_cal_model_set_default_time_func
381 (ECalModel *model,
382 ECalModelDefaultTimeFunc func,
383 gpointer user_data);
385 void e_cal_model_update_comp_time (ECalModel *model,
386 ECalModelComponent *comp_data,
387 gconstpointer time_value,
388 icalproperty_kind kind,
389 void (*set_func) (icalproperty *prop,
390 struct icaltimetype v),
391 icalproperty * (*new_func) (struct icaltimetype v));
393 void e_cal_model_emit_object_created (ECalModel *model,
394 ECalClient *where);
396 void e_cal_model_modify_component (ECalModel *model,
397 ECalModelComponent *comp_data,
398 ECalObjModType mod);
400 void e_cal_model_util_set_value (GHashTable *values,
401 ETableModel *table_model,
402 gint column,
403 gint row);
404 gpointer e_cal_model_util_get_value (GHashTable *values,
405 gint column);
407 ECellDateEditValue *
408 e_cal_model_copy_cell_date_value
409 (const ECellDateEditValue *value);
411 G_END_DECLS
413 #endif /* E_CAL_MODEL_H */