[evolution-data-server/wip/mcrha/libical-glib] Fix some issues found with tests of ECalComponent API



commit 9d4972b086749b18e3301e07443b20b458dc27b0
Author: Milan Crha <mcrha redhat com>
Date:   Fri Feb 1 14:06:16 2019 +0100

    Fix some issues found with tests of ECalComponent API
    
    And drop one more function, which was inaccurate.

 .../libecal/e-cal-component-alarm-repeat.h         |  3 +-
 .../libecal/e-cal-component-alarm-trigger.c        | 15 +++--
 src/calendar/libecal/e-cal-component-alarms.c      |  2 +-
 src/calendar/libecal/e-cal-component-attendee.c    |  6 +-
 src/calendar/libecal/e-cal-component.c             | 72 ----------------------
 src/calendar/libecal/e-cal-component.h             |  4 --
 6 files changed, 15 insertions(+), 87 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-component-alarm-repeat.h 
b/src/calendar/libecal/e-cal-component-alarm-repeat.h
index 38a2976a0..ada494526 100644
--- a/src/calendar/libecal/e-cal-component-alarm-repeat.h
+++ b/src/calendar/libecal/e-cal-component-alarm-repeat.h
@@ -39,8 +39,7 @@ typedef struct _ECalComponentAlarmRepeat ECalComponentAlarmRepeat;
 GType          e_cal_component_alarm_repeat_get_type
                                                (void);
 ECalComponentAlarmRepeat *
-               e_cal_component_alarm_repeat_new
-                                               (gint repetitions,
+               e_cal_component_alarm_repeat_new(gint repetitions,
                                                 const ICalDurationType *interval);
 ECalComponentAlarmRepeat *
                e_cal_component_alarm_repeat_new_seconds
diff --git a/src/calendar/libecal/e-cal-component-alarm-trigger.c 
b/src/calendar/libecal/e-cal-component-alarm-trigger.c
index 31b1aac9b..0864e2594 100644
--- a/src/calendar/libecal/e-cal-component-alarm-trigger.c
+++ b/src/calendar/libecal/e-cal-component-alarm-trigger.c
@@ -74,7 +74,8 @@ e_cal_component_alarm_trigger_new_relative (ECalComponentAlarmTriggerKind kind,
  *
  * Creates a new #ECalComponentAlarmTrigger structure, set with
  * the %E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE kind and the @absolute_time as
- * the time of the trigger.
+ * the time of the trigger. The @absolute_time should be date/time (not date) in UTC.
+ *
  * To create a relative trigger use e_cal_component_alarm_trigger_new_relative().
  * Free the trigger with e_cal_component_alarm_trigger_free(), when no longer needed.
  *
@@ -399,7 +400,9 @@ e_cal_component_alarm_trigger_set_relative (ECalComponentAlarmTrigger *trigger,
  * @absolute_time: (not nullable): the absolute time when to trigger the alarm, as an #ICalTimetype
  *
  * Set the @trigegr with the %E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE kind and
- * the @absolute_time as the time of the trigger.
+ * the @absolute_time as the time of the trigger. The @absolute_time
+ * should be date/time (not date) in UTC.
+ *
  * To set a relative trigger use e_cal_component_alarm_trigger_set_relative().
  *
  * Since: 3.36
@@ -539,8 +542,10 @@ e_cal_component_alarm_trigger_get_absolute_time (const ECalComponentAlarmTrigger
  * @trigger: an #ECalComponentAlarmTrigger
  * @absolute_time: absolute time for an absolute trigger, as an #ICalTimetype
  *
- * Sets the @trigger absolute time for an absolute trigger. The function does nothing, when
- * the @trigger is a relative trigger.
+ * Sets the @trigger absolute time for an absolute trigger. The @absolute_time
+ * should be date/time (not date) in UTC.
+ *
+ * The function does nothing, when the @trigger is a relative trigger.
  *
  * Since: 3.36
  **/
@@ -551,7 +556,7 @@ e_cal_component_alarm_trigger_set_absolute_time (ECalComponentAlarmTrigger *trig
        g_return_if_fail (trigger != NULL);
        g_return_if_fail (I_CAL_IS_TIMETYPE (absolute_time));
 
-       if (trigger->kind == E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE)
+       if (trigger->kind != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE)
                return;
 
        if (trigger->abs_time != absolute_time) {
diff --git a/src/calendar/libecal/e-cal-component-alarms.c b/src/calendar/libecal/e-cal-component-alarms.c
index 28e895ee8..0a6c25666 100644
--- a/src/calendar/libecal/e-cal-component-alarms.c
+++ b/src/calendar/libecal/e-cal-component-alarms.c
@@ -41,7 +41,7 @@ struct _ECalComponentAlarms {
 };
 
 /**
- * e_cal_component_alarms_new_relative:
+ * e_cal_component_alarms_new:
  * @comp: (not nullable): the actual alarm component, as #ECalComponent
  *
  * Creates a new #ECalComponentAlarms structure, associated with @comp.
diff --git a/src/calendar/libecal/e-cal-component-attendee.c b/src/calendar/libecal/e-cal-component-attendee.c
index 4f89be427..7179e0373 100644
--- a/src/calendar/libecal/e-cal-component-attendee.c
+++ b/src/calendar/libecal/e-cal-component-attendee.c
@@ -63,8 +63,8 @@ e_cal_component_attendee_new (void)
 
        attendee = g_new0 (ECalComponentAttendee, 1);
        attendee->cutype = I_CAL_CUTYPE_NONE;
-       attendee->role = I_CAL_ROLE_NONE;
-       attendee->partstat = I_CAL_PARTSTAT_NONE;
+       attendee->role = I_CAL_ROLE_REQPARTICIPANT;
+       attendee->partstat = I_CAL_PARTSTAT_NEEDSACTION;
 
        return attendee;
 }
@@ -238,7 +238,7 @@ e_cal_component_attendee_set_from_property (ECalComponentAttendee *attendee,
        g_clear_object (&param);
 
        param = i_cal_property_get_first_parameter (prop, I_CAL_CUTYPE_PARAMETER);
-       e_cal_component_attendee_set_cutype (attendee, param ? i_cal_parameter_get_cutype (param) : 
I_CAL_CUTYPE_UNKNOWN);
+       e_cal_component_attendee_set_cutype (attendee, param ? i_cal_parameter_get_cutype (param) : 
I_CAL_CUTYPE_NONE);
        g_clear_object (&param);
 
        param = i_cal_property_get_first_parameter (prop, I_CAL_ROLE_PARAMETER);
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 2780d9d07..ca7569d4c 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -4199,75 +4199,3 @@ e_cal_component_get_all_alarms (ECalComponent *comp)
 
        return g_slist_reverse (alarms);
 }
-
-/**
- * e_cal_component_event_dates_match:
- * @comp1: A calendar component object.
- * @comp2: A calendar component object.
- *
- * Checks if the DTSTART and DTEND properties of the 2 components match.
- * Note that the events may have different recurrence properties which are not
- * taken into account here.
- *
- * Returns: TRUE if the DTSTART and DTEND properties of the 2 components match.
- **/
-gboolean
-e_cal_component_event_dates_match (ECalComponent *comp1,
-                                   ECalComponent *comp2)
-{
-       ECalComponentDateTime *comp1_dtstart, *comp1_dtend;
-       ECalComponentDateTime *comp2_dtstart, *comp2_dtend;
-       gboolean retval = TRUE;
-
-       comp1_dtstart = e_cal_component_get_dtstart (comp1);
-       comp1_dtend = e_cal_component_get_dtend (comp1);
-       comp2_dtstart = e_cal_component_get_dtstart (comp2);
-       comp2_dtend = e_cal_component_get_dtend (comp2);
-
-       /* If either value is NULL they must both be NULL to match. */
-       if (!comp1_dtstart || !comp2_dtstart) {
-               if (comp1_dtstart != comp2_dtstart) {
-                       retval = FALSE;
-                       goto out;
-               }
-       } else {
-               if (i_cal_time_compare (e_cal_component_datetime_get_value (comp1_dtstart),
-                                       e_cal_component_datetime_get_value (comp2_dtstart))) {
-                       retval = FALSE;
-                       goto out;
-               }
-       }
-
-       if (!comp1_dtend || !comp2_dtend) {
-               if (comp1_dtend != comp2_dtend) {
-                       retval = FALSE;
-                       goto out;
-               }
-       } else {
-               if (i_cal_time_compare (e_cal_component_datetime_get_value (comp1_dtend),
-                                       e_cal_component_datetime_get_value (comp2_dtend))) {
-                       retval = FALSE;
-                       goto out;
-               }
-       }
-
-       /* Now check the timezones. */
-       if (g_strcmp0 (comp1_dtstart ? e_cal_component_datetime_get_tzid (comp1_dtstart) : NULL,
-                      comp2_dtstart ? e_cal_component_datetime_get_tzid (comp2_dtstart) : NULL) != 0) {
-               retval = FALSE;
-               goto out;
-       }
-
-       if (g_strcmp0 (comp1_dtend ? e_cal_component_datetime_get_tzid (comp1_dtend) : NULL,
-                      comp2_dtend ? e_cal_component_datetime_get_tzid (comp2_dtend) : NULL) != 0) {
-               retval = FALSE;
-       }
-
- out:
-       e_cal_component_datetime_free (comp1_dtstart);
-       e_cal_component_datetime_free (comp1_dtend);
-       e_cal_component_datetime_free (comp2_dtstart);
-       e_cal_component_datetime_free (comp2_dtend);
-
-       return retval;
-}
diff --git a/src/calendar/libecal/e-cal-component.h b/src/calendar/libecal/e-cal-component.h
index 95d24ca16..b06022ad1 100644
--- a/src/calendar/libecal/e-cal-component.h
+++ b/src/calendar/libecal/e-cal-component.h
@@ -284,10 +284,6 @@ ECalComponentAlarm *
                                                 const gchar *auid);
 GSList *       e_cal_component_get_all_alarms  (ECalComponent *comp); /* ECalComponentAlarm * */
 
-gboolean       e_cal_component_event_dates_match
-                                               (ECalComponent *comp1,
-                                                ECalComponent *comp2);
-
 G_END_DECLS
 
 #endif /* E_CAL_COMPONENT_H */


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