From 094deb7bca96f1dcf97952b93a7c4745cd799ebc Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Thu, 29 Jul 1999 00:26:11 +0000 Subject: Lots of more work on the sync stuff. It works pretty well now. Lots of more work on the sync stuff. It works pretty well now. I dont know why my pilot is not accepting the events I send to it though Miguel. svn path=/trunk/; revision=1040 --- calendar/gui/corba-cal.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'calendar/gui/corba-cal.c') diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c index d78685bf90..8f92057d42 100644 --- a/calendar/gui/corba-cal.c +++ b/calendar/gui/corba-cal.c @@ -81,6 +81,7 @@ cal_repo_get_object_by_pilot_id (PortableServer_Servant servant, CORBA_char *ret; obj = calendar_object_find_by_pilot (gcal->cal, pilot_id); + printf ("Looking for [%d]\n", pilot_id); if (obj == NULL){ CORBA_exception_set (ev, CORBA_USER_EXCEPTION, @@ -148,12 +149,67 @@ cal_repo_update_object (PortableServer_Servant servant, obj = calendar_object_find_event (gcal->cal, uid); if (obj != NULL){ + printf ("ELIMINATING: %s -> %s\n", obj->uid, new_object->uid); calendar_remove_object (gcal->cal, obj); } calendar_add_object (gcal->cal, new_object); } +static void +cal_repo_update_pilot_id (PortableServer_Servant servant, + CORBA_char *uid, + CORBA_long pilot_id, + CORBA_long pilot_status, + CORBA_Environment *ev) +{ + GnomeCalendar *gcal = gnomecal_from_servant (servant); + iCalObject *obj; + + obj = calendar_object_find_event (gcal->cal, uid); + if (obj == NULL){ + CORBA_exception_set ( + ev, + CORBA_USER_EXCEPTION, + ex_GNOME_Calendar_Repository_NotFound, + ""); + return; + } + + obj->pilot_id = pilot_id; + obj->pilot_status = pilot_status; +} + +static CORBA_char * +cal_repo_get_updated_objects (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + GnomeCalendar *gcal = gnomecal_from_servant (servant); + Calendar *dirty_cal; + GList *l; + CORBA_char *res; + char *str; + + dirty_cal = calendar_new ("Temporal"); + + for (l = gcal->cal->events; l; l = l->next){ + iCalObject *obj = l->data; + + if (obj->pilot_status != ICAL_PILOT_SYNC_MOD) + continue; + + obj = ical_object_duplicate (l->data); + + calendar_add_object (dirty_cal, obj); + } + str = calendar_get_as_vcal_string (dirty_cal); + res = CORBA_string_dup (str); + g_free (str); + calendar_destroy (dirty_cal); + + return res; +} + static void cal_repo_done (PortableServer_Servant servant, CORBA_Environment *ev) @@ -171,6 +227,9 @@ init_calendar_repo_class (void) calendar_repository_epv.get_id_from_pilot_id = cal_repo_get_id_from_pilot_id; calendar_repository_epv.delete_object = cal_repo_delete_object; calendar_repository_epv.update_object = cal_repo_update_object; + calendar_repository_epv.get_updated_objects = cal_repo_get_updated_objects; + calendar_repository_epv.update_pilot_id = cal_repo_update_pilot_id; + calendar_repository_epv.done = cal_repo_done; calendar_repository_vepv.GNOME_Calendar_Repository_epv = -- cgit v1.2.3