[evolution-data-server/gnome-3-26] Use icaltime_is_utc() instead of icaltimetype::is_utc
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-26] Use icaltime_is_utc() instead of icaltimetype::is_utc
- Date: Wed, 4 Oct 2017 09:52:41 +0000 (UTC)
commit f607f8628a28440374579531bc78848dfe0c782e
Author: Milan Crha <mcrha redhat com>
Date: Wed Oct 4 11:48:48 2017 +0200
Use icaltime_is_utc() instead of icaltimetype::is_utc
The structure member is going to be removed from libical in the next release
and the function is available for a long time, thus it's safe to replace
the usage in the code.
.../backends/contacts/e-cal-backend-contacts.c | 1 -
src/calendar/libecal/e-cal-component.c | 8 ++++----
src/calendar/libecal/e-cal-recur.c | 8 ++++----
src/calendar/libecal/e-cal-time-util.c | 3 +--
src/calendar/libedata-cal/e-cal-cache.c | 6 +++---
5 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/src/calendar/backends/contacts/e-cal-backend-contacts.c
b/src/calendar/backends/contacts/e-cal-backend-contacts.c
index dd39695..ef6054f 100644
--- a/src/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/src/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -690,7 +690,6 @@ cdate_to_icaltime (EContactDate *cdate)
ret.month = cdate->month;
ret.day = cdate->day;
ret.is_date = TRUE;
- ret.is_utc = FALSE;
ret.zone = NULL;
ret.is_daylight = FALSE;
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 36a5aec..08f1ebd 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -2494,7 +2494,7 @@ get_datetime (struct datetime *datetime,
* This makes the timezone code simpler. */
if (datetime->tzid_param)
dt->tzid = g_strdup (icalparameter_get_tzid (datetime->tzid_param));
- else if (dt->value && dt->value->is_utc)
+ else if (dt->value && icaltime_is_utc (*dt->value))
dt->tzid = g_strdup ("UTC");
else
dt->tzid = NULL;
@@ -2531,9 +2531,9 @@ set_datetime (ECalComponent *comp,
/* If the TZID is set to "UTC", we set the is_utc flag. */
if (dt->tzid && !strcmp (dt->tzid, "UTC"))
- dt->value->is_utc = 1;
- else
- dt->value->is_utc = 0;
+ dt->value->zone = icaltimezone_get_utc_timezone ();
+ else if (dt->value->zone == icaltimezone_get_utc_timezone ())
+ dt->value->zone = NULL;
if (datetime->prop) {
/* make sure no VALUE property is left if not needed */
diff --git a/src/calendar/libecal/e-cal-recur.c b/src/calendar/libecal/e-cal-recur.c
index 535d56c..cad588c 100644
--- a/src/calendar/libecal/e-cal-recur.c
+++ b/src/calendar/libecal/e-cal-recur.c
@@ -195,7 +195,7 @@ ensure_timezone (icalcomponent *comp,
a different icalcomponent and cause use-after-free. */
tt->zone = NULL;
- if (tt->is_utc)
+ if (icaltime_is_utc (*tt))
return TRUE;
tt->zone = default_timezone;
@@ -435,7 +435,7 @@ e_cal_recur_generate_instances_sync (icalcomponent *comp,
rrule.until.minute = 0;
rrule.until.second = 0;
- if (!rrule.until.zone && !rrule.until.is_utc)
+ if (!rrule.until.zone && !icaltime_is_utc (rrule.until))
rrule.until.zone = dtstart.zone;
}
@@ -542,7 +542,7 @@ e_cal_recur_generate_instances_sync (icalcomponent *comp,
exrule.until.minute = 0;
exrule.until.second = 0;
- if (!exrule.until.zone && !exrule.until.is_utc)
+ if (!exrule.until.zone && !icaltime_is_utc (exrule.until))
exrule.until.zone = dtstart.zone;
}
@@ -586,7 +586,7 @@ e_cal_recur_generate_instances_sync (icalcomponent *comp,
if (!success)
break;
- if (!exdate.zone && !exdate.is_utc)
+ if (!exdate.zone && !icaltime_is_utc (exdate))
exdate.zone = dtstart.zone;
if (intersects_interval (&exdate, NULL, duration_days, duration_seconds,
&interval_start, &interval_end)) {
diff --git a/src/calendar/libecal/e-cal-time-util.c b/src/calendar/libecal/e-cal-time-util.c
index 7bcbc8b..914761c 100644
--- a/src/calendar/libecal/e-cal-time-util.c
+++ b/src/calendar/libecal/e-cal-time-util.c
@@ -763,9 +763,8 @@ tm_to_icaltimetype (struct tm *tm,
itt.day = tm->tm_mday;
itt.month = tm->tm_mon + 1;
- itt.year = tm->tm_year+ 1900;
+ itt.year = tm->tm_year + 1900;
- itt.is_utc = 0;
itt.is_date = is_date;
return itt;
diff --git a/src/calendar/libedata-cal/e-cal-cache.c b/src/calendar/libedata-cal/e-cal-cache.c
index 0f8d198..9a2a40d 100644
--- a/src/calendar/libedata-cal/e-cal-cache.c
+++ b/src/calendar/libedata-cal/e-cal-cache.c
@@ -542,7 +542,7 @@ ecc_encode_time_to_sql (ECalCache *cal_cache,
struct icaltimetype itt;
icaltimezone *zone = NULL;
- if (!dt || !dt->value || (!dt->value->is_utc && (!dt->tzid || !*dt->tzid)))
+ if (!dt || !dt->value || (!icaltime_is_utc (*dt->value) && (!dt->tzid || !*dt->tzid)))
return NULL;
itt = *dt->value;
@@ -845,14 +845,14 @@ ecc_fill_other_columns (ECalCache *cal_cache,
icalcomponent_isa (icalcomp));
e_cal_component_get_dtstart (comp, &dt);
- add_value (ECC_COLUMN_OCCUR_START, dt.value && ((dt.tzid && *dt.tzid) || dt.value->is_utc) ?
ecc_encode_timet_to_sql (cal_cache, occur_start) : NULL);
+ add_value (ECC_COLUMN_OCCUR_START, dt.value && ((dt.tzid && *dt.tzid) || icaltime_is_utc (*dt.value))
? ecc_encode_timet_to_sql (cal_cache, occur_start) : NULL);
has = dt.value != NULL;
add_value (ECC_COLUMN_HAS_START, g_strdup (has ? "1" : "0"));
e_cal_component_free_datetime (&dt);
e_cal_component_get_dtend (comp, &dt);
- add_value (ECC_COLUMN_OCCUR_END, dt.value && ((dt.tzid && *dt.tzid) || dt.value->is_utc) ?
ecc_encode_timet_to_sql (cal_cache, occur_end) : NULL);
+ add_value (ECC_COLUMN_OCCUR_END, dt.value && ((dt.tzid && *dt.tzid) || icaltime_is_utc (*dt.value)) ?
ecc_encode_timet_to_sql (cal_cache, occur_end) : NULL);
e_cal_component_free_datetime (&dt);
e_cal_component_get_due (comp, &dt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]