gnome-todo-eds-libecal-2.0.patch 19 KB

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