]> git.pld-linux.org Git - packages/gnome-todo.git/blame - gnome-todo-ecal2.patch
Release 4 (by relup.sh)
[packages/gnome-todo.git] / gnome-todo-ecal2.patch
CommitLineData
d8ab2ab8
JB
1diff --git a/plugins/eds/gtd-eds-autoptr.h b/plugins/eds/gtd-eds-autoptr.h
2index eb9b011..78bd944 100644
3--- a/plugins/eds/gtd-eds-autoptr.h
4+++ b/plugins/eds/gtd-eds-autoptr.h
5@@ -23,6 +23,5 @@
6 #include <libecal/libecal.h>
7
8 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalComponent, g_object_unref);
9-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalComponentId, e_cal_component_free_id);
10+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalComponentId, e_cal_component_id_free);
11 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalClient, g_object_unref);
12-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ESource, g_object_unref);
13diff --git a/plugins/eds/gtd-provider-eds.c b/plugins/eds/gtd-provider-eds.c
14index a403226..def4235 100644
15--- a/plugins/eds/gtd-provider-eds.c
16+++ b/plugins/eds/gtd-provider-eds.c
17@@ -554,6 +554,7 @@ gtd_provider_eds_create_task (GtdProvider *provider,
18
19 e_cal_client_create_object (client,
20 e_cal_component_get_icalcomponent (component),
21+ E_CAL_OPERATION_FLAG_NONE,
22 NULL,
23 (GAsyncReadyCallback) on_task_created_cb,
24 new_task);
25@@ -587,6 +588,7 @@ gtd_provider_eds_update_task (GtdProvider *provider,
26 e_cal_client_modify_object (client,
27 e_cal_component_get_icalcomponent (component),
28 E_CAL_OBJ_MOD_THIS,
29+ E_CAL_OPERATION_FLAG_NONE,
30 NULL,
31 (GAsyncReadyCallback) on_task_modified_cb,
32 task);
33@@ -616,9 +618,10 @@ gtd_provider_eds_remove_task (GtdProvider *provider,
34 gtd_object_push_loading (GTD_OBJECT (provider));
35
36 e_cal_client_remove_object (client,
37- id->uid,
38- id->rid,
39+ e_cal_component_id_get_uid (id),
40+ e_cal_component_id_get_rid (id),
41 E_CAL_OBJ_MOD_THIS,
42+ E_CAL_OPERATION_FLAG_NONE,
43 NULL,
44 (GAsyncReadyCallback) on_task_removed_cb,
45 provider);
46diff --git a/plugins/eds/gtd-task-eds.c b/plugins/eds/gtd-task-eds.c
47index 2c8cd8e..bd8f7ac 100644
48--- a/plugins/eds/gtd-task-eds.c
49+++ b/plugins/eds/gtd-task-eds.c
50@@ -46,19 +46,19 @@ static GParamSpec *properties [N_PROPS];
51 */
52
53 static GDateTime*
54-convert_icaltime (const icaltimetype *date)
55+convert_icaltime (const ICalTime *date)
56 {
57 GDateTime *dt;
58
59 if (!date)
60 return NULL;
61
62- dt = g_date_time_new_utc (date->year,
63- date->month,
64- date->day,
65- date->is_date ? 0 : date->hour,
66- date->is_date ? 0 : date->minute,
67- date->is_date ? 0 : date->second);
68+ dt = g_date_time_new_utc (i_cal_time_get_year (date),
69+ i_cal_time_get_month (date),
70+ i_cal_time_get_day (date),
71+ i_cal_time_is_date (date) ? 0 : i_cal_time_get_hour (date),
72+ i_cal_time_is_date (date) ? 0 : i_cal_time_get_minute (date),
73+ i_cal_time_is_date (date) ? 0 : i_cal_time_get_second (date));
74
75 return dt;
76 }
77@@ -67,19 +67,20 @@ static void
78 set_description (GtdTaskEds *self,
79 const gchar *description)
80 {
81- ECalComponentText text;
82+ ECalComponentText *text;
83 GSList note;
84
85- text.value = description && *description ? description : "";
86- text.altrep = NULL;
87+ text = e_cal_component_text_new (description ? description : "", NULL);
88
89- note.data = &text;
90+ note.data = text;
91 note.next = NULL;
92
93 g_clear_pointer (&self->description, g_free);
94 self->description = g_strdup (description);
95
96- e_cal_component_set_description_list (self->component, &note);
97+ e_cal_component_set_descriptions (self->component, (description && *description) ? &note : NULL);
98+
99+ e_cal_component_text_free (text);
100 }
101
102 static void
103@@ -90,7 +91,7 @@ setup_description (GtdTaskEds *self)
104 GSList *l;
105
106 /* concatenates the multiple descriptions a task may have */
107- e_cal_component_get_description_list (self->component, &text_list);
108+ text_list = e_cal_component_get_descriptions (self->component);
109
110 for (l = text_list; l != NULL; l = l->next)
111 {
112@@ -105,21 +106,21 @@ setup_description (GtdTaskEds *self)
113 {
114 carrier = g_strconcat (desc,
115 "\n",
116- text->value,
117+ e_cal_component_text_get_value (text),
118 NULL);
119 g_free (desc);
120 desc = carrier;
121 }
122 else
123 {
124- desc = g_strdup (text->value);
125+ desc = g_strdup (e_cal_component_text_get_value (text));
126 }
127 }
128 }
129
130 set_description (self, desc);
131
132- e_cal_component_free_text_list (text_list);
133+ g_slist_free_full (text_list, e_cal_component_text_free);
134 }
135
136
137@@ -138,7 +139,7 @@ gtd_task_eds_get_uid (GtdObject *object)
138 self = GTD_TASK_EDS (object);
139
140 if (self->component)
141- e_cal_component_get_uid (self->component, &uid);
142+ uid = e_cal_component_get_uid (self->component);
143 else
144 uid = NULL;
145
146@@ -159,7 +160,7 @@ gtd_task_eds_set_uid (GtdObject *object,
147 if (!self->component)
148 return;
149
150- e_cal_component_get_uid (self->component, &current_uid);
151+ current_uid = e_cal_component_get_uid (self->component);
152
153 if (g_strcmp0 (current_uid, uid) != 0)
154 {
155@@ -177,7 +178,7 @@ gtd_task_eds_set_uid (GtdObject *object,
156 static gboolean
157 gtd_task_eds_get_complete (GtdTask *task)
158 {
159- icalproperty_status status;
160+ ICalPropertyStatus status;
161 GtdTaskEds *self;
162 gboolean completed;
163
164@@ -185,8 +186,8 @@ gtd_task_eds_get_complete (GtdTask *task)
165
166 self = GTD_TASK_EDS (task);
167
168- e_cal_component_get_status (self->component, &status);
169- completed = status == ICAL_STATUS_COMPLETED;
170+ status = e_cal_component_get_status (self->component);
171+ completed = status == I_CAL_STATUS_COMPLETED;
172
173 return completed;
174 }
175@@ -195,8 +196,8 @@ static void
176 gtd_task_eds_set_complete (GtdTask *task,
177 gboolean complete)
178 {
179- icalproperty_status status;
180- icaltimetype *dt;
181+ ICalPropertyStatus status;
182+ ICalTime *dt;
183 GtdTaskEds *self;
184 gint percent;
185
186@@ -209,54 +210,54 @@ gtd_task_eds_set_complete (GtdTask *task,
187 percent = 100;
188 status = ICAL_STATUS_COMPLETED;
189
190- dt = g_new0 (icaltimetype, 1);
191- dt->year = g_date_time_get_year (now);
192- dt->month = g_date_time_get_month (now);
193- dt->day = g_date_time_get_day_of_month (now);
194- dt->hour = g_date_time_get_hour (now);
195- dt->minute = g_date_time_get_minute (now);
196- dt->second = g_date_time_get_seconds (now);
197- dt->zone = icaltimezone_get_utc_timezone ();
198+ dt = i_cal_time_new_null_time ();
199+ i_cal_time_set_date (dt,
200+ g_date_time_get_year (now),
201+ g_date_time_get_month (now),
202+ g_date_time_get_day_of_month (now));
203+ i_cal_time_set_time (dt,
204+ g_date_time_get_hour (now),
205+ g_date_time_get_minute (now),
206+ g_date_time_get_seconds (now));
207+ i_cal_time_set_timezone (dt, i_cal_timezone_get_utc_timezone ());
208
209 /* convert timezone
210 *
211 * FIXME: This does not do anything until we have an ical
212 * timezone associated with the task
213 */
214- icaltimezone_convert_time (dt, NULL, icaltimezone_get_utc_timezone ());
215+ i_cal_time_convert_timezone (dt, NULL, i_cal_timezone_get_utc_timezone ());
216 }
217 else
218 {
219 dt = NULL;
220 percent = 0;
221- status = ICAL_STATUS_NEEDSACTION;
222+ status = I_CAL_STATUS_NEEDSACTION;
223 }
224
225- e_cal_component_set_percent_as_int (self->component, percent);
226+ e_cal_component_set_percent_complete (self->component, percent);
227 e_cal_component_set_status (self->component, status);
228 e_cal_component_set_completed (self->component, dt);
229
230- if (dt)
231- e_cal_component_free_icaltimetype (dt);
232+ g_clear_object (&dt);
233 }
234
235 static GDateTime*
236 gtd_task_eds_get_creation_date (GtdTask *task)
237 {
238- icaltimetype *idt;
239+ ICalTime *idt;
240 GtdTaskEds *self;
241 GDateTime *dt;
242
243 self = GTD_TASK_EDS (task);
244- idt = NULL;
245 dt = NULL;
246
247- e_cal_component_get_created (self->component, &idt);
248+ idt = e_cal_component_get_created (self->component);
249
250 if (idt)
251 dt = convert_icaltime (idt);
252
253- g_clear_pointer (&idt, e_cal_component_free_icaltimetype);
254+ g_clear_object (&idt);
255
256 return dt;
257 }
258@@ -286,7 +287,7 @@ gtd_task_eds_set_description (GtdTask *task,
259 static GDateTime*
260 gtd_task_eds_get_due_date (GtdTask *task)
261 {
262- ECalComponentDateTime comp_dt;
263+ ECalComponentDateTime *comp_dt;
264 GtdTaskEds *self;
265 GDateTime *date;
266
267@@ -294,10 +295,12 @@ gtd_task_eds_get_due_date (GtdTask *task)
268
269 self = GTD_TASK_EDS (task);
270
271- e_cal_component_get_due (self->component, &comp_dt);
272+ comp_dt = e_cal_component_get_due (self->component);
273+ if (!comp_dt)
274+ return NULL;
275
276- date = convert_icaltime (comp_dt.value);
277- e_cal_component_free_datetime (&comp_dt);
278+ date = convert_icaltime (e_cal_component_datetime_get_value (comp_dt));
279+ e_cal_component_datetime_free (comp_dt);
280
281 return date;
282 }
283@@ -317,11 +320,10 @@ gtd_task_eds_set_due_date (GtdTask *task,
284
285 if (dt != current_dt)
286 {
287- ECalComponentDateTime comp_dt;
288- icaltimetype *idt;
289+ ECalComponentDateTime *comp_dt;
290+ ICalTime *idt;
291
292- comp_dt.value = NULL;
293- comp_dt.tzid = NULL;
294+ comp_dt = NULL;
295 idt = NULL;
296
297 if (!current_dt ||
298@@ -329,36 +331,34 @@ gtd_task_eds_set_due_date (GtdTask *task,
299 dt &&
300 g_date_time_compare (current_dt, dt) != 0))
301 {
302- idt = g_new0 (icaltimetype, 1);
303+ idt = i_cal_time_new_null_time ();
304
305 g_date_time_ref (dt);
306
307 /* Copy the given dt */
308- idt->year = g_date_time_get_year (dt);
309- idt->month = g_date_time_get_month (dt);
310- idt->day = g_date_time_get_day_of_month (dt);
311- idt->hour = g_date_time_get_hour (dt);
312- idt->minute = g_date_time_get_minute (dt);
313- idt->second = g_date_time_get_seconds (dt);
314- idt->is_date = (idt->hour == 0 &&
315- idt->minute == 0 &&
316- idt->second == 0);
317-
318- comp_dt.tzid = g_strdup ("UTC");
319+ i_cal_time_set_date (idt,
320+ g_date_time_get_year (dt),
321+ g_date_time_get_month (dt),
322+ g_date_time_get_day_of_month (dt));
323+ i_cal_time_set_time (idt,
324+ g_date_time_get_hour (dt),
325+ g_date_time_get_minute (dt),
326+ g_date_time_get_seconds (dt));
327+ i_cal_time_set_is_date (idt,
328+ i_cal_time_get_hour (idt) == 0 &&
329+ i_cal_time_get_minute (idt) == 0 &&
330+ i_cal_time_get_second (idt) == 0);
331
332- comp_dt.value = idt;
333+ comp_dt = e_cal_component_datetime_new_take (idt, g_strdup ("UTC"));
334
335- e_cal_component_set_due (self->component, &comp_dt);
336+ e_cal_component_set_due (self->component, comp_dt);
337
338- e_cal_component_free_datetime (&comp_dt);
339+ e_cal_component_datetime_free (comp_dt);
340
341 g_date_time_unref (dt);
342 }
343 else if (!dt)
344 {
345- idt = NULL;
346- comp_dt.tzid = NULL;
347-
348 e_cal_component_set_due (self->component, NULL);
349 }
350 }
351@@ -369,19 +369,13 @@ gtd_task_eds_set_due_date (GtdTask *task,
352 static gint32
353 gtd_task_eds_get_priority (GtdTask *task)
354 {
355- g_autofree gint *priority = NULL;
356 GtdTaskEds *self;
357
358 g_assert (GTD_IS_TASK_EDS (task));
359
360 self = GTD_TASK_EDS (task);
361
362- e_cal_component_get_priority (self->component, &priority);
363-
364- if (!priority)
365- return -1;
366-
367- return *priority;
368+ return e_cal_component_get_priority (self->component);
369 }
370
371 static void
372@@ -394,29 +388,26 @@ gtd_task_eds_set_priority (GtdTask *task,
373
374 self = GTD_TASK_EDS (task);
375
376- e_cal_component_set_priority (self->component, &priority);
377+ e_cal_component_set_priority (self->component, priority);
378 }
379
380 static const gchar*
381 gtd_task_eds_get_title (GtdTask *task)
382 {
383- ECalComponentText summary;
384 GtdTaskEds *self;
385
386 g_return_val_if_fail (GTD_IS_TASK_EDS (task), NULL);
387
388 self = GTD_TASK_EDS (task);
389
390- e_cal_component_get_summary (self->component, &summary);
391-
392- return summary.value;
393+ return i_cal_component_get_summary (e_cal_component_get_icalcomponent (self->component));
394 }
395
396 static void
397 gtd_task_eds_set_title (GtdTask *task,
398 const gchar *title)
399 {
400- ECalComponentText new_summary;
401+ ECalComponentText *new_summary;
402 GtdTaskEds *self;
403
404 g_return_if_fail (GTD_IS_TASK_EDS (task));
405@@ -424,10 +415,11 @@ gtd_task_eds_set_title (GtdTask *task,
406
407 self = GTD_TASK_EDS (task);
408
409- new_summary.value = title;
410- new_summary.altrep = NULL;
411+ new_summary = e_cal_component_text_new (title, NULL);
412
413- e_cal_component_set_summary (self->component, &new_summary);
414+ e_cal_component_set_summary (self->component, new_summary);
415+
416+ e_cal_component_text_free (new_summary);
417 }
418
419
420@@ -436,10 +428,10 @@ gtd_task_eds_subtask_added (GtdTask *task,
421 GtdTask *subtask)
422 {
423 g_autoptr (GList) subtasks = NULL;
424- ECalComponentId *id;
425+ const gchar *uid;
426 ECalComponent *comp;
427- icalcomponent *ical_comp;
428- icalproperty *property;
429+ ICalComponent *ical_comp;
430+ ICalProperty *property;
431 GtdTaskEds *subtask_self;
432 GtdTaskEds *self;
433
434@@ -450,17 +442,17 @@ gtd_task_eds_subtask_added (GtdTask *task,
435 /* Hook with parent's :subtask_added */
436 GTD_TASK_CLASS (gtd_task_eds_parent_class)->subtask_added (task, subtask);
437
438- id = e_cal_component_get_id (self->component);
439+ uid = e_cal_component_get_uid (self->component);
440 comp = subtask_self->component;
441 ical_comp = e_cal_component_get_icalcomponent (comp);
442- property = icalcomponent_get_first_property (ical_comp, ICAL_RELATEDTO_PROPERTY);
443+ property = i_cal_component_get_first_property (ical_comp, I_CAL_RELATEDTO_PROPERTY);
444
445 if (property)
446- icalproperty_set_relatedto (property, id->uid);
447+ i_cal_property_set_relatedto (property, uid);
448 else
449- icalcomponent_add_property (ical_comp, icalproperty_new_relatedto (id->uid));
450+ i_cal_component_take_property (ical_comp, i_cal_property_new_relatedto (uid));
451
452- e_cal_component_free_id (id);
453+ g_clear_object (&property);
454 }
455
456 static void
457@@ -468,8 +460,8 @@ gtd_task_eds_subtask_removed (GtdTask *task,
458 GtdTask *subtask)
459 {
460 g_autoptr (GList) subtasks = NULL;
461- icalcomponent *ical_comp;
462- icalproperty *property;
463+ ICalComponent *ical_comp;
464+ ICalProperty *property;
465 GtdTaskEds *subtask_self;
466
467 subtask_self = GTD_TASK_EDS (subtask);
468@@ -480,12 +472,13 @@ gtd_task_eds_subtask_removed (GtdTask *task,
469
470 /* Remove the parent link from the subtask's component */
471 ical_comp = e_cal_component_get_icalcomponent (subtask_self->component);
472- property = icalcomponent_get_first_property (ical_comp, ICAL_RELATEDTO_PROPERTY);
473+ property = i_cal_component_get_first_property (ical_comp, I_CAL_RELATEDTO_PROPERTY);
474
475 if (!property)
476 return;
477
478- icalcomponent_remove_property (ical_comp, property);
479+ i_cal_component_remove_property (ical_comp, property);
480+ g_object_unref (property);
481 }
482
483
484diff --git a/plugins/eds/gtd-task-list-eds.c b/plugins/eds/gtd-task-list-eds.c
485index eb48a73..5b71718 100644
486--- a/plugins/eds/gtd-task-list-eds.c
487+++ b/plugins/eds/gtd-task-list-eds.c
488@@ -85,19 +85,19 @@ setup_parent_task (GtdTaskListEds *self,
489 GtdTask *task)
490 {
491 ECalComponent *component;
492- icalcomponent *ical_comp;
493- icalproperty *property;
494+ ICalComponent *ical_comp;
495+ ICalProperty *property;
496 GtdTask *parent_task;
497 const gchar *parent_uid;
498
499 component = gtd_task_eds_get_component (GTD_TASK_EDS (task));
500 ical_comp = e_cal_component_get_icalcomponent (component);
501- property = icalcomponent_get_first_property (ical_comp, ICAL_RELATEDTO_PROPERTY);
502+ property = i_cal_component_get_first_property (ical_comp, I_CAL_RELATEDTO_PROPERTY);
503
504 if (!property)
505 return;
506
507- parent_uid = icalproperty_get_relatedto (property);
508+ parent_uid = i_cal_property_get_relatedto (property);
509 parent_task = gtd_task_list_get_task_by_id (GTD_TASK_LIST (self), parent_uid);
510
511 if (parent_task)
512@@ -112,6 +112,8 @@ setup_parent_task (GtdTaskListEds *self,
513
514 g_ptr_array_add (self->pending_subtasks, data);
515 }
516+
517+ g_object_unref (property);
518 }
519
520 static void
521@@ -161,8 +163,8 @@ on_view_objects_added_cb (ECalClientView *view,
522 GtdTask *task;
523 const gchar *uid;
524
525- component = e_cal_component_new_from_string (icalcomponent_as_ical_string (l->data));
526- e_cal_component_get_uid (component, &uid);
527+ component = e_cal_component_new_from_icalcomponent (i_cal_component_clone (l->data));
528+ uid = e_cal_component_get_uid (component);
529
530 task = gtd_task_list_get_task_by_id (self, uid);
531
532@@ -211,8 +213,8 @@ on_view_objects_modified_cb (ECalClientView *view,
533 GtdTask *task;
534 const gchar *uid;
535
536- component = e_cal_component_new_from_string (icalcomponent_as_ical_string (l->data));
537- e_cal_component_get_uid (component, &uid);
538+ component = e_cal_component_new_from_icalcomponent (i_cal_component_clone (l->data));
539+ uid = e_cal_component_get_uid (component);
540
541 task = gtd_task_list_get_task_by_id (self, uid);
542
543@@ -244,7 +246,7 @@ on_view_objects_removed_cb (ECalClientView *view,
544 GtdTask *task;
545
546 id = l->data;
547- task = gtd_task_list_get_task_by_id (self, id->uid);
548+ task = gtd_task_list_get_task_by_id (self, e_cal_component_id_get_uid (id));
549
550 if (!task)
551 continue;
552diff --git a/plugins/eds/meson.build b/plugins/eds/meson.build
553index ea84426..b37f0c6 100644
554--- a/plugins/eds/meson.build
555+++ b/plugins/eds/meson.build
556@@ -8,10 +8,9 @@ plugins_ldflags += ['-Wl,--undefined=gtd_plugin_eds_register_types']
557 ################
558
559 eds_plugin_deps = [
560- dependency('libecal-1.2', version: '>= 3.13.90'),
561+ dependency('libecal-2.0', version: '>= 3.33.1'),
562 dependency('libedataserver-1.2', version: '>= 3.17.1'),
563 dependency('libedataserverui-1.2', version: '>= 3.17.1'),
564- dependency('libical', version: '>= 0.43'),
565 ]
566
567 eds_plugin_deps += gnome_todo_deps
This page took 0.148225 seconds and 4 git commands to generate.