[evolution] Use icaltime_is_utc() instead of icaltimetype::is_utc



commit 6c1361b40ebe366e26979dd4c9923ee9cee8fe5f
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 4 11:57:56 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.

 src/calendar/gui/comp-util.c                     |    6 +++---
 src/calendar/gui/e-cal-component-preview.c       |    2 +-
 src/calendar/gui/e-comp-editor-event.c           |    8 +++-----
 src/calendar/gui/e-comp-editor-page-recurrence.c |    1 -
 src/calendar/gui/e-comp-editor-property-part.c   |    2 --
 src/calendar/gui/e-comp-editor-task.c            |    2 +-
 src/calendar/gui/e-meeting-store.c               |    4 ++--
 src/calendar/gui/e-to-do-pane.c                  |    2 +-
 src/calendar/gui/itip-utils.c                    |    2 +-
 src/modules/itip-formatter/itip-view.c           |    8 ++++----
 10 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c
index e72e1d2..299364a 100644
--- a/src/calendar/gui/comp-util.c
+++ b/src/calendar/gui/comp-util.c
@@ -123,8 +123,8 @@ cal_comp_util_compare_event_timezones (ECalComponent *comp,
        /* If the event uses UTC for DTSTART & DTEND, return TRUE. Outlook
         * will send single events as UTC, so we don't want to mark all of
         * these. */
-       if ((!start_datetime.value || start_datetime.value->is_utc)
-           && (!end_datetime.value || end_datetime.value->is_utc)) {
+       if ((!start_datetime.value || icaltime_is_utc (*start_datetime.value))
+           && (!end_datetime.value || icaltime_is_utc (*end_datetime.value))) {
                retval = TRUE;
                goto out;
        }
@@ -1328,7 +1328,7 @@ cal_comp_util_update_tzid_parameter (icalproperty *prop,
        if (tt.zone)
                tzid = icaltimezone_get_tzid ((icaltimezone *) tt.zone);
 
-       if (tt.zone && tzid && *tzid && !tt.is_utc && !tt.is_date) {
+       if (tt.zone && tzid && *tzid && !icaltime_is_utc (tt) && !tt.is_date) {
                if (param) {
                        icalparameter_set_tzid (param, (gchar *) tzid);
                } else {
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index 67e5690..5801f71 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -168,7 +168,7 @@ timet_to_str_with_zone (ECalComponentDateTime *dt,
        if (dt->tzid != NULL) {
                e_cal_client_get_timezone_sync (
                        client, dt->tzid, &zone, NULL, NULL);
-       } else if (dt->value->is_utc) {
+       } else if (icaltime_is_utc (*dt->value)) {
                zone = icaltimezone_get_utc_timezone ();
        }
 
diff --git a/src/calendar/gui/e-comp-editor-event.c b/src/calendar/gui/e-comp-editor-event.c
index d56c1c9..40546a9 100644
--- a/src/calendar/gui/e-comp-editor-event.c
+++ b/src/calendar/gui/e-comp-editor-event.c
@@ -286,7 +286,7 @@ ece_event_update_timezone (ECompEditorEvent *event_editor,
        if (icalcomponent_get_first_property (component, ICAL_DTSTART_PROPERTY)) {
                dtstart = icalcomponent_get_dtstart (component);
                if (icaltime_is_valid_time (dtstart)) {
-                       if (dtstart.is_utc)
+                       if (icaltime_is_utc (dtstart))
                                zone = icaltimezone_get_utc_timezone ();
                        else
                                zone = ece_event_get_timezone_from_property (comp_editor,
@@ -297,7 +297,7 @@ ece_event_update_timezone (ECompEditorEvent *event_editor,
        if (icalcomponent_get_first_property (component, ICAL_DTEND_PROPERTY)) {
                dtend = icalcomponent_get_dtend (component);
                if (!zone && icaltime_is_valid_time (dtend)) {
-                       if (dtend.is_utc)
+                       if (icaltime_is_utc (dtend))
                                zone = icaltimezone_get_utc_timezone ();
                        else
                                zone = ece_event_get_timezone_from_property (comp_editor,
@@ -310,7 +310,7 @@ ece_event_update_timezone (ECompEditorEvent *event_editor,
 
                itt = icalcomponent_get_due (component);
                if (icaltime_is_valid_time (itt)) {
-                       if (itt.is_utc)
+                       if (icaltime_is_utc (itt))
                                zone = icaltimezone_get_utc_timezone ();
                        else
                                zone = ece_event_get_timezone_from_property (comp_editor,
@@ -497,10 +497,8 @@ ece_event_fill_component (ECompEditor *comp_editor,
                                dtstart.zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY 
(timezone_entry));
                                if (!dtstart.zone)
                                        dtstart.zone = icaltimezone_get_utc_timezone ();
-                               dtstart.is_utc = dtstart.zone == icaltimezone_get_utc_timezone ();
 
                                dtend.zone = dtstart.zone;
-                               dtend.is_utc = dtstart.is_utc;
 
                                set_dtstart = TRUE;
                                set_dtend = TRUE;
diff --git a/src/calendar/gui/e-comp-editor-page-recurrence.c 
b/src/calendar/gui/e-comp-editor-page-recurrence.c
index 4d0ef50..1fc7515 100644
--- a/src/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/src/calendar/gui/e-comp-editor-page-recurrence.c
@@ -1088,7 +1088,6 @@ ecep_recurrence_fill_ending_date (ECompEditorPageRecurrence *page_recurrence,
                                rrule->until.minute = 0;
                                rrule->until.second = 0;
                                rrule->until.is_date = TRUE;
-                               rrule->until.is_utc = FALSE;
                        }
 
                        page_recurrence->priv->ending_date_tt = rrule->until;
diff --git a/src/calendar/gui/e-comp-editor-property-part.c b/src/calendar/gui/e-comp-editor-property-part.c
index 4eeaf01..42298c2 100644
--- a/src/calendar/gui/e-comp-editor-property-part.c
+++ b/src/calendar/gui/e-comp-editor-property-part.c
@@ -872,8 +872,6 @@ e_comp_editor_property_part_datetime_get_value (ECompEditorPropertyPartDatetime
                        value.zone = e_timezone_entry_get_timezone (timezone_entry);
                if (!value.zone)
                        value.zone = icaltimezone_get_utc_timezone ();
-
-               value.is_utc = value.zone == icaltimezone_get_utc_timezone ();
        }
 
        g_clear_object (&timezone_entry);
diff --git a/src/calendar/gui/e-comp-editor-task.c b/src/calendar/gui/e-comp-editor-task.c
index 16f31d8..86c1dca 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -120,7 +120,7 @@ ece_task_update_timezone (ECompEditorTask *task_editor,
                                if (force_allday && dt.is_date)
                                        *force_allday = TRUE;
 
-                               if (dt.is_utc)
+                               if (icaltime_is_utc (dt))
                                        zone = icaltimezone_get_utc_timezone ();
                                else
                                        zone = ece_task_get_timezone_from_property (comp_editor,
diff --git a/src/calendar/gui/e-meeting-store.c b/src/calendar/gui/e-meeting-store.c
index 13c2e86..ae5b1f5 100644
--- a/src/calendar/gui/e-meeting-store.c
+++ b/src/calendar/gui/e-meeting-store.c
@@ -1347,7 +1347,7 @@ process_free_busy_comp (EMeetingAttendee *attendee,
                icaltimezone *ds_zone;
 
                dtstart = icalproperty_get_dtstart (ip);
-               if (!dtstart.is_utc)
+               if (!icaltime_is_utc (dtstart))
                        ds_zone = find_zone (ip, tz_top_level);
                else
                        ds_zone = icaltimezone_get_utc_timezone ();
@@ -1367,7 +1367,7 @@ process_free_busy_comp (EMeetingAttendee *attendee,
                icaltimezone *de_zone;
 
                dtend = icalproperty_get_dtend (ip);
-               if (!dtend.is_utc)
+               if (!icaltime_is_utc (dtend))
                        de_zone = find_zone (ip, tz_top_level);
                else
                        de_zone = icaltimezone_get_utc_timezone ();
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 236215a..4cfff19 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -188,7 +188,7 @@ etdp_itt_to_zone (struct icaltimetype *itt,
 
        if (itt_tzid) {
                e_cal_client_get_timezone_sync (client, itt_tzid, &zone, NULL, NULL);
-       } else if (itt->is_utc) {
+       } else if (icaltime_is_utc (*itt)) {
                zone = icaltimezone_get_utc_timezone ();
        }
 
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index b053a98..38dea7c 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -1614,7 +1614,7 @@ comp_compliant_one (ESourceRegistry *registry,
                        r->until.is_date = FALSE;
 
                        icaltimezone_convert_time (&r->until, from_zone, to_zone);
-                       r->until.is_utc = TRUE;
+                       r->until.zone = to_zone;
 
                        e_cal_component_free_datetime (&dt);
                        e_cal_component_set_rrule_list (clone, rrule_list);
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 62303b9..5be43ad 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -6167,9 +6167,9 @@ itip_view_init_view (ItipView *view)
 
                 /* If the timezone is not in the component, guess the local time */
                 /* Should we guess if the timezone is an olsen name somehow? */
-               if (datetime.value->is_utc)
+               if (icaltime_is_utc (*datetime.value))
                        from_zone = icaltimezone_get_utc_timezone ();
-               else if (!datetime.value->is_utc && datetime.tzid) {
+               else if (!icaltime_is_utc (*datetime.value) && datetime.tzid) {
                        from_zone = icalcomponent_get_timezone (view->priv->top_level, datetime.tzid);
 
                        if (!from_zone)
@@ -6206,9 +6206,9 @@ itip_view_init_view (ItipView *view)
 
                 /* If the timezone is not in the component, guess the local time */
                 /* Should we guess if the timezone is an olsen name somehow? */
-               if (datetime.value->is_utc)
+               if (icaltime_is_utc (*datetime.value))
                        from_zone = icaltimezone_get_utc_timezone ();
-               else if (!datetime.value->is_utc && datetime.tzid) {
+               else if (!icaltime_is_utc (*datetime.value) && datetime.tzid) {
                        from_zone = icalcomponent_get_timezone (view->priv->top_level, datetime.tzid);
 
                        if (!from_zone)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]