1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
/*
*
* Evolution calendar - Data model for ETable
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Rodrigo Moya <rodrigo@ximian.com>
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#ifndef E_CAL_MODEL_H
#define E_CAL_MODEL_H
#include <table/e-table-model.h>
#include <libecal/e-cal.h>
#include "e-cell-date-edit-text.h"
G_BEGIN_DECLS
#define E_TYPE_CAL_MODEL (e_cal_model_get_type ())
#define E_CAL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL, ECalModel))
#define E_CAL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL, ECalModelClass))
#define E_IS_CAL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL))
#define E_IS_CAL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL))
typedef struct _ECalModelPrivate ECalModelPrivate;
typedef enum {
/* If you add new items here or reorder them, you have to update the
.etspec files for the tables using this model */
E_CAL_MODEL_FIELD_CATEGORIES,
E_CAL_MODEL_FIELD_CLASSIFICATION,
E_CAL_MODEL_FIELD_COLOR, /* not a real field */
E_CAL_MODEL_FIELD_COMPONENT, /* not a real field */
E_CAL_MODEL_FIELD_DESCRIPTION,
E_CAL_MODEL_FIELD_DTSTART,
E_CAL_MODEL_FIELD_HAS_ALARMS, /* not a real field */
E_CAL_MODEL_FIELD_ICON, /* not a real field */
E_CAL_MODEL_FIELD_SUMMARY,
E_CAL_MODEL_FIELD_UID,
E_CAL_MODEL_FIELD_LAST
} ECalModelField;
typedef enum {
E_CAL_MODEL_FLAGS_INVALID = -1,
E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES = 0x01
} ECalModelFlags;
#define E_TYPE_CAL_MODEL_COMPONENT (e_cal_model_component_get_type ())
#define E_CAL_MODEL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponent))
#define E_CAL_MODEL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL_COMPONENT, \
ECalComponentClass))
#define E_IS_CAL_MODEL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL_COMPONENT))
#define E_IS_CAL_MODEL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL_COMPONENT))
typedef struct _ECalModelComponent ECalModelComponent;
typedef struct _ECalModelComponentClass ECalModelComponentClass;
typedef struct _ECalModelComponentPrivate ECalModelComponentPrivate;
struct _ECalModelComponent {
GObject object;
ECal *client;
icalcomponent *icalcomp;
time_t instance_start;
time_t instance_end;
/* Private data used by ECalModelCalendar and ECalModelTasks */
/* keep these public to avoid many accessor functions */
ECellDateEditValue *dtstart;
ECellDateEditValue *dtend;
ECellDateEditValue *due;
ECellDateEditValue *completed;
gchar *color;
ECalModelComponentPrivate *priv;
};
struct _ECalModelComponentClass {
GObjectClass parent_class;
};
typedef struct {
ECalModelComponent *comp_data;
gpointer cb_data;
} ECalModelGenerateInstancesData;
typedef struct _ECalModel {
ETableModel model;
ECalModelPrivate *priv;
} ECalModel;
typedef struct {
ETableModelClass parent_class;
/* virtual methods */
const gchar * (* get_color_for_component) (ECalModel *model, ECalModelComponent *comp_data);
void (* fill_component_from_model) (ECalModel *model, ECalModelComponent *comp_data,
ETableModel *source_model, gint row);
/* Signals */
void (* time_range_changed) (ECalModel *model, time_t start, time_t end);
void (* row_appended) (ECalModel *model);
void (* comps_deleted) (ECalModel *model, gpointer list);
void (* cal_view_progress) (ECalModel *model, const char *message, int progress, ECalSourceType type);
void (* cal_view_done) (ECalModel *model, ECalendarStatus status, ECalSourceType type);
} ECalModelClass;
GType e_cal_model_get_type (void);
GType e_cal_model_component_get_type (void);
icalcomponent_kind e_cal_model_get_component_kind (ECalModel *model);
void e_cal_model_set_component_kind (ECalModel *model,
icalcomponent_kind kind);
ECalModelFlags e_cal_model_get_flags (ECalModel *model);
void e_cal_model_set_flags (ECalModel *model,
ECalModelFlags flags);
icaltimezone *e_cal_model_get_timezone (ECalModel *model);
void e_cal_model_set_timezone (ECalModel *model,
icaltimezone *zone);
void e_cal_model_set_default_category (ECalModel *model,
const gchar *default_cat);
gboolean e_cal_model_get_use_24_hour_format (ECalModel *model);
void e_cal_model_set_use_24_hour_format (ECalModel *model,
gboolean use24);
ECal *e_cal_model_get_default_client (ECalModel *model);
void e_cal_model_set_default_client (ECalModel *model,
ECal *client);
GList *e_cal_model_get_client_list (ECalModel *model);
ECal *e_cal_model_get_client_for_uri (ECalModel *model,
const char *uri);
void e_cal_model_add_client (ECalModel *model,
ECal *client);
void e_cal_model_remove_client (ECalModel *model,
ECal *client);
void e_cal_model_remove_all_clients (ECalModel *model);
void e_cal_model_get_time_range (ECalModel *model,
time_t *start,
time_t *end);
void e_cal_model_set_time_range (ECalModel *model,
time_t start,
time_t end);
const char *e_cal_model_get_search_query (ECalModel *model);
void e_cal_model_set_search_query (ECalModel *model,
const gchar *sexp);
icalcomponent *e_cal_model_create_component_with_defaults (ECalModel *model);
const gchar *e_cal_model_get_color_for_component (ECalModel *model,
ECalModelComponent *comp_data);
gboolean e_cal_model_get_rgb_color_for_component (ECalModel *model,
ECalModelComponent *comp_data,
double *red,
double *green,
double *blue);
ECalModelComponent *e_cal_model_get_component_at (ECalModel *model,
gint row);
ECalModelComponent *e_cal_model_get_component_for_uid (ECalModel *model,
const ECalComponentId *id);
gchar *e_cal_model_date_value_to_string (ECalModel *model,
const void *value);
ECalModelComponent *e_cal_model_copy_component_data (ECalModelComponent *comp_data);
void e_cal_model_free_component_data (ECalModelComponent *comp_data);
void e_cal_model_generate_instances (ECalModel *model,
time_t start,
time_t end,
ECalRecurInstanceFn cb,
gpointer cb_data);
GPtrArray * e_cal_model_get_object_array (ECalModel *model);
void e_cal_model_set_instance_times (ECalModelComponent *comp_data, const icaltimezone *zone);
void e_cal_model_set_search_query_with_time_range (ECalModel *model, const char *sexp, time_t start, time_t end);
gboolean e_cal_model_test_row_editable (ECalModel *model, int row);
G_END_DECLS
#endif
|