1 diff --git a/plugins/eds/gtd-eds-autoptr.h b/plugins/eds/gtd-eds-autoptr.h
2 index eb9b011..78bd944 100644
3 --- a/plugins/eds/gtd-eds-autoptr.h
4 +++ b/plugins/eds/gtd-eds-autoptr.h
6 #include <libecal/libecal.h>
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);
13 diff --git a/plugins/eds/gtd-provider-eds.c b/plugins/eds/gtd-provider-eds.c
14 index 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,
19 e_cal_client_create_object (client,
20 e_cal_component_get_icalcomponent (component),
21 + E_CAL_OPERATION_FLAG_NONE,
23 (GAsyncReadyCallback) on_task_created_cb,
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),
29 + E_CAL_OPERATION_FLAG_NONE,
31 (GAsyncReadyCallback) on_task_modified_cb,
33 @@ -616,9 +618,10 @@ gtd_provider_eds_remove_task (GtdProvider *provider,
34 gtd_object_push_loading (GTD_OBJECT (provider));
36 e_cal_client_remove_object (client,
39 + e_cal_component_id_get_uid (id),
40 + e_cal_component_id_get_rid (id),
42 + E_CAL_OPERATION_FLAG_NONE,
44 (GAsyncReadyCallback) on_task_removed_cb,
46 diff --git a/plugins/eds/gtd-task-eds.c b/plugins/eds/gtd-task-eds.c
47 index 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];
54 -convert_icaltime (const icaltimetype *date)
55 +convert_icaltime (const ICalTime *date)
62 - dt = g_date_time_new_utc (date->year,
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));
77 @@ -67,19 +67,20 @@ static void
78 set_description (GtdTaskEds *self,
79 const gchar *description)
81 - ECalComponentText text;
82 + ECalComponentText *text;
85 - text.value = description && *description ? description : "";
87 + text = e_cal_component_text_new (description ? description : "", NULL);
93 g_clear_pointer (&self->description, g_free);
94 self->description = g_strdup (description);
96 - e_cal_component_set_description_list (self->component, ¬e);
97 + e_cal_component_set_descriptions (self->component, (description && *description) ? ¬e : NULL);
99 + e_cal_component_text_free (text);
103 @@ -90,7 +91,7 @@ setup_description (GtdTaskEds *self)
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);
110 for (l = text_list; l != NULL; l = l->next)
112 @@ -105,21 +106,21 @@ setup_description (GtdTaskEds *self)
114 carrier = g_strconcat (desc,
117 + e_cal_component_text_get_value (text),
124 - desc = g_strdup (text->value);
125 + desc = g_strdup (e_cal_component_text_get_value (text));
130 set_description (self, desc);
132 - e_cal_component_free_text_list (text_list);
133 + g_slist_free_full (text_list, e_cal_component_text_free);
137 @@ -138,7 +139,7 @@ gtd_task_eds_get_uid (GtdObject *object)
138 self = GTD_TASK_EDS (object);
141 - e_cal_component_get_uid (self->component, &uid);
142 + uid = e_cal_component_get_uid (self->component);
146 @@ -159,7 +160,7 @@ gtd_task_eds_set_uid (GtdObject *object,
147 if (!self->component)
150 - e_cal_component_get_uid (self->component, ¤t_uid);
151 + current_uid = e_cal_component_get_uid (self->component);
153 if (g_strcmp0 (current_uid, uid) != 0)
155 @@ -177,7 +178,7 @@ gtd_task_eds_set_uid (GtdObject *object,
157 gtd_task_eds_get_complete (GtdTask *task)
159 - icalproperty_status status;
160 + ICalPropertyStatus status;
164 @@ -185,8 +186,8 @@ gtd_task_eds_get_complete (GtdTask *task)
166 self = GTD_TASK_EDS (task);
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;
175 @@ -195,8 +196,8 @@ static void
176 gtd_task_eds_set_complete (GtdTask *task,
179 - icalproperty_status status;
181 + ICalPropertyStatus status;
186 @@ -209,54 +210,54 @@ gtd_task_eds_set_complete (GtdTask *task,
188 status = ICAL_STATUS_COMPLETED;
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 ());
211 * FIXME: This does not do anything until we have an ical
212 * timezone associated with the task
214 - icaltimezone_convert_time (dt, NULL, icaltimezone_get_utc_timezone ());
215 + i_cal_time_convert_timezone (dt, NULL, i_cal_timezone_get_utc_timezone ());
221 - status = ICAL_STATUS_NEEDSACTION;
222 + status = I_CAL_STATUS_NEEDSACTION;
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);
231 - e_cal_component_free_icaltimetype (dt);
232 + g_clear_object (&dt);
236 gtd_task_eds_get_creation_date (GtdTask *task)
243 self = GTD_TASK_EDS (task);
247 - e_cal_component_get_created (self->component, &idt);
248 + idt = e_cal_component_get_created (self->component);
251 dt = convert_icaltime (idt);
253 - g_clear_pointer (&idt, e_cal_component_free_icaltimetype);
254 + g_clear_object (&idt);
258 @@ -286,7 +287,7 @@ gtd_task_eds_set_description (GtdTask *task,
260 gtd_task_eds_get_due_date (GtdTask *task)
262 - ECalComponentDateTime comp_dt;
263 + ECalComponentDateTime *comp_dt;
267 @@ -294,10 +295,12 @@ gtd_task_eds_get_due_date (GtdTask *task)
269 self = GTD_TASK_EDS (task);
271 - e_cal_component_get_due (self->component, &comp_dt);
272 + comp_dt = e_cal_component_get_due (self->component);
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);
283 @@ -317,11 +320,10 @@ gtd_task_eds_set_due_date (GtdTask *task,
285 if (dt != current_dt)
287 - ECalComponentDateTime comp_dt;
289 + ECalComponentDateTime *comp_dt;
292 - comp_dt.value = NULL;
293 - comp_dt.tzid = NULL;
298 @@ -329,36 +331,34 @@ gtd_task_eds_set_due_date (GtdTask *task,
300 g_date_time_compare (current_dt, dt) != 0))
302 - idt = g_new0 (icaltimetype, 1);
303 + idt = i_cal_time_new_null_time ();
305 g_date_time_ref (dt);
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 &&
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);
332 - comp_dt.value = idt;
333 + comp_dt = e_cal_component_datetime_new_take (idt, g_strdup ("UTC"));
335 - e_cal_component_set_due (self->component, &comp_dt);
336 + e_cal_component_set_due (self->component, comp_dt);
338 - e_cal_component_free_datetime (&comp_dt);
339 + e_cal_component_datetime_free (comp_dt);
341 g_date_time_unref (dt);
346 - comp_dt.tzid = NULL;
348 e_cal_component_set_due (self->component, NULL);
351 @@ -369,19 +369,13 @@ gtd_task_eds_set_due_date (GtdTask *task,
353 gtd_task_eds_get_priority (GtdTask *task)
355 - g_autofree gint *priority = NULL;
358 g_assert (GTD_IS_TASK_EDS (task));
360 self = GTD_TASK_EDS (task);
362 - e_cal_component_get_priority (self->component, &priority);
368 + return e_cal_component_get_priority (self->component);
372 @@ -394,29 +388,26 @@ gtd_task_eds_set_priority (GtdTask *task,
374 self = GTD_TASK_EDS (task);
376 - e_cal_component_set_priority (self->component, &priority);
377 + e_cal_component_set_priority (self->component, priority);
381 gtd_task_eds_get_title (GtdTask *task)
383 - ECalComponentText summary;
386 g_return_val_if_fail (GTD_IS_TASK_EDS (task), NULL);
388 self = GTD_TASK_EDS (task);
390 - e_cal_component_get_summary (self->component, &summary);
392 - return summary.value;
393 + return i_cal_component_get_summary (e_cal_component_get_icalcomponent (self->component));
397 gtd_task_eds_set_title (GtdTask *task,
400 - ECalComponentText new_summary;
401 + ECalComponentText *new_summary;
404 g_return_if_fail (GTD_IS_TASK_EDS (task));
405 @@ -424,10 +415,11 @@ gtd_task_eds_set_title (GtdTask *task,
407 self = GTD_TASK_EDS (task);
409 - new_summary.value = title;
410 - new_summary.altrep = NULL;
411 + new_summary = e_cal_component_text_new (title, NULL);
413 - e_cal_component_set_summary (self->component, &new_summary);
414 + e_cal_component_set_summary (self->component, new_summary);
416 + e_cal_component_text_free (new_summary);
420 @@ -436,10 +428,10 @@ gtd_task_eds_subtask_added (GtdTask *task,
423 g_autoptr (GList) subtasks = NULL;
424 - ECalComponentId *id;
427 - icalcomponent *ical_comp;
428 - icalproperty *property;
429 + ICalComponent *ical_comp;
430 + ICalProperty *property;
431 GtdTaskEds *subtask_self;
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);
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);
446 - icalproperty_set_relatedto (property, id->uid);
447 + i_cal_property_set_relatedto (property, uid);
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));
452 - e_cal_component_free_id (id);
453 + g_clear_object (&property);
457 @@ -468,8 +460,8 @@ gtd_task_eds_subtask_removed (GtdTask *task,
460 g_autoptr (GList) subtasks = NULL;
461 - icalcomponent *ical_comp;
462 - icalproperty *property;
463 + ICalComponent *ical_comp;
464 + ICalProperty *property;
465 GtdTaskEds *subtask_self;
467 subtask_self = GTD_TASK_EDS (subtask);
468 @@ -480,12 +472,13 @@ gtd_task_eds_subtask_removed (GtdTask *task,
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);
478 - icalcomponent_remove_property (ical_comp, property);
479 + i_cal_component_remove_property (ical_comp, property);
480 + g_object_unref (property);
484 diff --git a/plugins/eds/gtd-task-list-eds.c b/plugins/eds/gtd-task-list-eds.c
485 index 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,
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;
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);
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);
512 @@ -112,6 +112,8 @@ setup_parent_task (GtdTaskListEds *self,
514 g_ptr_array_add (self->pending_subtasks, data);
517 + g_object_unref (property);
521 @@ -161,8 +163,8 @@ on_view_objects_added_cb (ECalClientView *view,
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);
530 task = gtd_task_list_get_task_by_id (self, uid);
532 @@ -211,8 +213,8 @@ on_view_objects_modified_cb (ECalClientView *view,
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);
541 task = gtd_task_list_get_task_by_id (self, uid);
543 @@ -244,7 +246,7 @@ on_view_objects_removed_cb (ECalClientView *view,
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));
552 diff --git a/plugins/eds/meson.build b/plugins/eds/meson.build
553 index 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']
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'),
567 eds_plugin_deps += gnome_todo_deps