@@ -176,18 +176,16 @@ public class Services.Tasks.Store : Object {
176176 destroy_task_list_client (task_list, client);
177177 }
178178
179- public void add_task (E .Source list , ECal .Component task , Widgets .NewItem new_task ) {
179+ public void add_task (E .Source list , ECal .Component task , Widgets .TaskRow new_task ) {
180180 add_task_async. begin (list, task, new_task);
181181 }
182182
183- private async void add_task_async (E .Source list , ECal .Component task , Widgets .NewItem new_task ) {
183+ private async void add_task_async (E .Source list , ECal .Component task , Widgets .TaskRow new_task ) {
184184 ECal . Client client;
185185 try {
186186 client = get_client (list);
187187 } catch (Error e) {
188188 new_task. loading = false ;
189-
190- // Send Notification Error
191189 critical (e. message);
192190 return ;
193191 }
@@ -197,24 +195,14 @@ public class Services.Tasks.Store : Object {
197195
198196 try {
199197 string ? uid;
200- #if E_CAL_2_0
201198 yield client. create_object (comp, ECal . OperationFlags . NONE , null , out uid);
202- #else
203- yield client. create_object (comp, null , out uid);
204- #endif
205199 if (uid != null ) {
206200 comp. set_uid (uid);
207201 }
208-
209- // var row = new Widgets.NewItem.for_source (new_task.source, new_task.listbox);
210- // new_task.listbox.add (row);
211- // new_task.listbox.show_all ();
212202
213203 new_task. hide_destroy ();
214204 } catch (GLib . Error error) {
215205 new_task. loading = false ;
216-
217- // Send Notification Error
218206 critical (error. message);
219207 }
220208 }
@@ -237,27 +225,15 @@ public class Services.Tasks.Store : Object {
237225 comp. set_status (ICal . PropertyStatus . NONE );
238226 task. set_percent_complete (0 );
239227
240- #if E_CAL_2_0
241228 task. set_completed (new ICal .Time .null_time ());
242- #else
243- var null_time = ICal . Time . null_time ();
244- task. set_completed (ref null_time);
245- #endif
246229
247230 update_icalcomponent (client, comp, ECal . ObjModType . ONLY_THIS );
248-
249231 } else {
250232 debug (@" Completing $(task.is_instance() ? " instance" : " task" ) '$(comp.get_uid())'" );
251233
252234 comp. set_status (ICal . PropertyStatus . COMPLETED );
253235 task. set_percent_complete (100 );
254-
255- #if E_CAL_2_0
256236 task. set_completed (new ICal .Time .today ());
257- #else
258- var today_time = ICal . Time . today ();
259- task. set_completed (ref today_time);
260- #endif
261237
262238 update_icalcomponent (client, comp, ECal . ObjModType . THIS_AND_PRIOR );
263239 }
@@ -348,44 +324,13 @@ public class Services.Tasks.Store : Object {
348324 }
349325
350326 private void update_icalcomponent (ECal .Client client , ICal .Component comp , ECal .ObjModType mod_type ) {
351- client. modify_object. begin (comp, mod_type, null , (obj, res) = > {
327+ client. modify_object. begin (comp, mod_type, ECal . OperationFlags . NONE , null , (obj, res) = > {
352328 try {
353329 client. modify_object. end (res);
354330 } catch (Error e) {
355331 warning (e. message);
356332 }
357333 });
358- // try {
359- // #if E_CAL_2_0
360- // client.modify_object_sync (comp, mod_type, ECal.OperationFlags.NONE, null);
361- // #else
362- // client.modify_object_sync (comp, mod_type, null);
363- // #endif
364- // } catch (Error e) {
365- // warning (e.message);
366- // return;
367- // }
368-
369- // if (comp.get_uid () == null) {
370- // return;
371- // }
372-
373- // try {
374- // SList<ECal.Component> ecal_tasks;
375- // client.get_objects_for_uid_sync (comp.get_uid (), out ecal_tasks, null);
376-
377- // #if E_CAL_2_0
378- // var ical_tasks = new SList<ICal.Component> ();
379- // #else
380- // var ical_tasks = new SList<unowned ICal.Component> ();
381- // #endif
382- // foreach (unowned ECal.Component ecal_task in ecal_tasks) {
383- // ical_tasks.append (ecal_task.get_icalcomponent ());
384- // }
385-
386- // } catch (Error e) {
387- // warning (e.message);
388- // }
389334 }
390335
391336 public void remove_task (E .Source list , ECal .Component task , ECal .ObjModType mod_type ) {
@@ -402,11 +347,7 @@ public class Services.Tasks.Store : Object {
402347 string ? rid = task. has_recurrences () ? null : task. get_recurid_as_string ();
403348 debug (@" Removing task '$uid '" );
404349
405- #if E_CAL_2_0
406350 client. remove_object. begin (uid, rid, mod_type, ECal . OperationFlags . NONE , null , (obj, results) = > {
407- #else
408- client. remove_object. begin (uid, rid, mod_type, null , (obj, results) = > {
409- #endif
410351 try {
411352 client. remove_object. end (results);
412353 } catch (Error e) {
@@ -475,11 +416,7 @@ public class Services.Tasks.Store : Object {
475416 }
476417 }
477418
478- #if E_CAL_2_0
479419 private void on_objects_added (E .Source task_list , ECal .Client client , SList<ICal . Component > objects , TasksAddedFunc on_tasks_added ) { // vala-lint=line-length
480- #else
481- private void on_objects_added (E . Source task_list, ECal . Client client, SList<weak ICal . Component > objects, TasksAddedFunc on_tasks_added) { // vala-lint=line-length
482- #endif
483420 debug (@" Received $(objects.length()) added task(s) for task list '%s '" , task_list. dup_display_name ());
484421 var added_tasks = new Gee .ArrayList<ECal . Component > ((Gee . EqualDataFunc<ECal . Component > ? ) Util . calcomponent_equal_func); // vala-lint=line-length
485422 objects. foreach ((ical_comp) = > {
@@ -503,11 +440,7 @@ public class Services.Tasks.Store : Object {
503440 on_tasks_added (added_tasks. read_only_view, task_list);
504441 }
505442
506- #if E_CAL_2_0
507443 private void on_objects_modified (E .Source task_list , ECal .Client client , SList<ICal . Component > objects , TasksModifiedFunc on_tasks_modified ) { // vala-lint=line-length
508- #else
509- private void on_objects_modified (E . Source task_list, ECal . Client client, SList<weak ICal . Component > objects, TasksModifiedFunc on_tasks_modified) { // vala-lint=line-length
510- #endif
511444 debug (@" Received $(objects.length()) modified task(s) for task list '%s '" , task_list. dup_display_name ());
512445 var updated_tasks = new Gee .ArrayList<ECal . Component > ((Gee . EqualDataFunc<ECal . Component > ? ) Util . calcomponent_equal_func); // vala-lint=line-length
513446 objects. foreach ((comp) = > {
@@ -530,13 +463,8 @@ public class Services.Tasks.Store : Object {
530463 on_tasks_modified (updated_tasks. read_only_view);
531464 }
532465
533- #if E_CAL_2_0
534466 private void on_objects_removed (E .Source task_list , ECal .Client client , SList<ECal . ComponentId ?> cids , TasksRemovedFunc on_tasks_removed ) { // vala-lint=line-length
535- #else
536- private void on_objects_removed (E . Source task_list, ECal . Client client, SList<weak ECal . ComponentId ? > cids, TasksRemovedFunc on_tasks_removed) { // vala-lint=line-length
537- #endif
538467 debug (@" Received $(cids.length()) removed task(s) for task list '%s '" , task_list. dup_display_name ());
539-
540468 on_tasks_removed (cids);
541469 }
542470}
0 commit comments