Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:pchenthill
evolution-data-server
bnc-215636-duplicate-instances.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc-215636-duplicate-instances.diff of Package evolution-data-server
Index: calendar/libecal/e-cal.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v retrieving revision 1.129 diff -u -p -r1.129 e-cal.c --- calendar/libecal/e-cal.c 31 Jul 2006 10:01:14 -0000 1.129 +++ calendar/libecal/e-cal.c 2 Nov 2006 07:01:41 -0000 @@ -3466,37 +3466,65 @@ struct comp_instance { time_t end; }; +struct instances_info { + GList **instances; + icaltimezone *start_zone; +}; + /* Called from cal_recur_generate_instances(); adds an instance to the list */ static gboolean add_instance (ECalComponent *comp, time_t start, time_t end, gpointer data) { GList **list; struct comp_instance *ci; - struct icaltimetype itt, itt_start; + struct icaltimetype itt; icalcomponent *icalcomp; + struct instances_info *instances_hold; + ECalComponentDateTime datetime; - list = data; + instances_hold = data; + list = instances_hold->instances; ci = g_new (struct comp_instance, 1); icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp)); - itt_start = icalcomponent_get_dtstart (icalcomp); + e_cal_component_get_dtstart (comp, &datetime); + + /* add the instance to the list */ + ci->comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (ci->comp, icalcomp); /* set the RECUR-ID for the instance */ if (e_cal_util_component_has_recurrences (icalcomp)) { if (!(icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))) { - if (itt_start.zone) - itt = icaltime_from_timet_with_zone (start, itt_start.is_date, itt_start.zone); - else - itt = icaltime_from_timet (start, itt_start.is_date); - icalcomponent_set_recurrenceid (icalcomp, itt); + ECalComponentRange *range; + + if (instances_hold->start_zone) + itt = icaltime_from_timet_with_zone (start, datetime.value->is_date, instances_hold->start_zone); + else { + itt = icaltime_from_timet (start, datetime.value->is_date); + + if (datetime.tzid) { + g_free ((char *) datetime.tzid); + datetime.tzid = NULL; + } + } + + g_free (datetime.value); + datetime.value = &itt; + + range = g_new0 (ECalComponentRange, 1); + range->type = E_CAL_COMPONENT_RANGE_SINGLE; + range->datetime = datetime; + + e_cal_component_set_recurid (ci->comp, range); + + if (datetime.tzid) + g_free ((char *) datetime.tzid); + g_free (range); } } - /* add the instance to the list */ - ci->comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (ci->comp, icalcomp); - ci->start = start; ci->end = end; @@ -3693,10 +3721,24 @@ generate_instances (ECal *ecal, time_t s detached_instances = g_list_prepend (detached_instances, ci); } else { - e_cal_recur_generate_instances (comp, start, end, add_instance, &instances, + ECalComponentDateTime datetime; + icaltimezone *start_zone; + struct instances_info *instances_hold; + + /* Get the start timezone */ + e_cal_component_get_dtstart (comp, &datetime); + e_cal_get_timezone (ecal, datetime.tzid, &start_zone, NULL); + e_cal_component_free_datetime (&datetime); + + instances_hold = g_new0 (struct instances_info, 1); + instances_hold->instances = &instances; + instances_hold->start_zone = start_zone; + + e_cal_recur_generate_instances (comp, start, end, add_instance, instances_hold, e_cal_resolve_tzid_cb, ecal, default_zone); - + + g_free (instances_hold); g_object_unref (comp); } } @@ -3805,6 +3847,9 @@ e_cal_generate_instances_for_object (ECa const char *uid, *rid; gboolean result; GList *instances = NULL; + ECalComponentDateTime datetime; + icaltimezone *start_zone; + struct instances_info *instances_hold; g_return_if_fail (E_IS_CAL (ecal)); g_return_if_fail (start >= 0); @@ -3830,9 +3875,19 @@ e_cal_generate_instances_for_object (ECa e_cal_component_get_uid (comp, &uid); rid = e_cal_component_get_recurid_as_string (comp); + /* Get the start timezone */ + e_cal_component_get_dtstart (comp, &datetime); + e_cal_get_timezone (ecal, datetime.tzid, &start_zone, NULL); + e_cal_component_free_datetime (&datetime); + + instances_hold = g_new0 (struct instances_info, 1); + instances_hold->instances = &instances; + instances_hold->start_zone = start_zone; + /* generate all instances in the given time range */ - generate_instances (ecal, start, end, uid, add_instance, &instances); + generate_instances (ecal, start, end, uid, add_instance, instances_hold); + instances = *(instances_hold->instances); /* now only return back the instances for the given object */ result = TRUE; while (instances != NULL) { @@ -3859,6 +3914,7 @@ e_cal_generate_instances_for_object (ECa /* clean up */ g_object_unref (comp); + g_free (instances_hold); } /* Builds a list of ECalComponentAlarms structures */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor