From 0e6d346872289d1ee71cb7b1092b5229b11dab3e Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Wed, 11 Jul 2001 03:56:03 +0000 Subject: more timezone updates. I'm pretty much done with the calendar code now, 2001-07-10 Damon Chaplin * gui/calendar-model.c: * gui/e-calendar-table.c: * gui/e-day-view-main-item.c: * gui/e-day-view-top-item.c: * gui/e-day-view.[hc]: * gui/e-week-view.c: * gui/gnome-cal.c: * gui/print.c: * gui/dialogs/cal-prefs-dialog.c: * gui/dialogs/comp-editor-util.c: * gui/dialogs/event-page.c: * pcs/cal-backend-file.c: * pcs/query.c: * cal-util/cal-component.[hc]: * cal-util/cal-recur.c: * cal-util/timeutil.[hc]: * cal-client/cal-client.[hc]: more timezone updates. I'm pretty much done with the calendar code now, except for alarms and conduits, which Federico and JP know more about. And there are a couple of other minor things to fix. But it is still pretty buggy. svn path=/trunk/; revision=10984 --- calendar/cal-util/cal-component.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'calendar/cal-util/cal-component.c') diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index 1ebc398e63..d340cea60f 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -4933,5 +4933,44 @@ cal_component_event_dates_match (CalComponent *comp1, return TRUE; } +/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */ +static gboolean +cal_component_compare_tzid (const char *tzid1, const char *tzid2) +{ + gboolean retval = TRUE; + + if (tzid1) { + if (!tzid2 || strcmp (tzid1, tzid2)) + retval = FALSE; + } else { + if (tzid2) + retval = FALSE; + } + + return retval; +} +/* Returns TRUE if the component uses the given timezones for both DTSTART + and DTEND. */ +gboolean +cal_component_compare_event_timezone (CalComponent *comp, icaltimezone *zone) +{ + CalComponentDateTime datetime; + const char *tzid; + gboolean match; + tzid = icaltimezone_get_tzid (zone); + + cal_component_get_dtstart (comp, &datetime); + match = cal_component_compare_tzid (tzid, datetime.tzid); + cal_component_free_datetime (&datetime); + if (!match) + return FALSE; + + /* FIXME: DURATION may be used instead. */ + cal_component_get_dtend (comp, &datetime); + match = cal_component_compare_tzid (tzid, datetime.tzid); + cal_component_free_datetime (&datetime); + + return match; +} -- cgit