[evolution-data-server/wip/mcrha/libical-glib] Fix build issues and developer documentation around ECalComponent structures
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/mcrha/libical-glib] Fix build issues and developer documentation around ECalComponent structures
- Date: Fri, 25 Jan 2019 12:40:19 +0000 (UTC)
commit 1341f3859c70a90129980eb97ac3f7e7d1345190
Author: Milan Crha <mcrha redhat com>
Date: Fri Jan 25 13:40:03 2019 +0100
Fix build issues and developer documentation around ECalComponent structures
src/calendar/libecal/CMakeLists.txt | 6 +-
src/calendar/libecal/e-cal-client.c | 2 +-
src/calendar/libecal/e-cal-client.h | 2 +-
.../libecal/e-cal-component-alarm-instance.c | 11 +-
.../libecal/e-cal-component-alarm-instance.h | 2 +-
.../libecal/e-cal-component-alarm-repeat.c | 10 +-
.../libecal/e-cal-component-alarm-repeat.h | 2 +-
.../libecal/e-cal-component-alarm-trigger.c | 31 +--
.../libecal/e-cal-component-alarm-trigger.h | 4 +-
src/calendar/libecal/e-cal-component-alarm.c | 52 ++--
src/calendar/libecal/e-cal-component-alarm.h | 8 +-
src/calendar/libecal/e-cal-component-alarms.c | 26 +-
src/calendar/libecal/e-cal-component-alarms.h | 7 +-
src/calendar/libecal/e-cal-component-attendee.c | 64 ++---
src/calendar/libecal/e-cal-component-attendee.h | 32 +--
src/calendar/libecal/e-cal-component-datetime.c | 8 +-
src/calendar/libecal/e-cal-component-datetime.h | 2 +-
src/calendar/libecal/e-cal-component-id.c | 51 +++-
src/calendar/libecal/e-cal-component-id.h | 5 +-
src/calendar/libecal/e-cal-component-organizer.c | 14 +-
src/calendar/libecal/e-cal-component-organizer.h | 12 +-
src/calendar/libecal/e-cal-component-period.c | 32 +--
src/calendar/libecal/e-cal-component-period.h | 10 +-
src/calendar/libecal/e-cal-component-range.c | 2 +-
src/calendar/libecal/e-cal-component-range.h | 2 +-
src/calendar/libecal/e-cal-component-text.h | 3 +-
src/calendar/libecal/e-cal-component.c | 282 ++++++++++++---------
src/calendar/libecal/e-cal-component.h | 19 +-
src/calendar/libecal/e-cal-util.h | 2 +-
29 files changed, 382 insertions(+), 321 deletions(-)
---
diff --git a/src/calendar/libecal/CMakeLists.txt b/src/calendar/libecal/CMakeLists.txt
index effb1e0e4..d0d5ab3cf 100644
--- a/src/calendar/libecal/CMakeLists.txt
+++ b/src/calendar/libecal/CMakeLists.txt
@@ -1,4 +1,4 @@
-glib_mkenums(e-cal-enumtypes e-cal-enums.h E_CAL_ENUMS_H)
+glib_mkenums(e-cal-enumtypes e-cal-enums.h E_CAL_ENUMTYPES_H)
add_pkgconfig_file(libecal.pc.in libecal-${CAL_API_VERSION}.pc)
@@ -53,7 +53,7 @@ set(HEADERS
e-cal-enums.h
e-cal-recur.h
e-cal-time-util.h
- e-cal-check-timezones.h
+ e-cal-check-timezones.h
e-cal-system-timezone.h
e-cal-util.h
e-reminder-watcher.h
@@ -113,7 +113,7 @@ install(FILES ${HEADERS}
set(gir_sources ${SOURCES} ${HEADERS})
set(gir_identifies_prefixes ECal)
-set(gir_includes GObject-2.0 Gio-2.0 Soup-2.4 libxml2-2.0)
+set(gir_includes GObject-2.0 Gio-2.0 Soup-2.4 libxml2-2.0 ICalGLib-3.0)
set(gir_cflags
-DLIBECAL_COMPILATION
-I${CMAKE_BINARY_DIR}/src/calendar
diff --git a/src/calendar/libecal/e-cal-client.c b/src/calendar/libecal/e-cal-client.c
index 441a93d44..9cedfef5c 100644
--- a/src/calendar/libecal/e-cal-client.c
+++ b/src/calendar/libecal/e-cal-client.c
@@ -42,7 +42,7 @@
#include "e-cal-check-timezones.h"
#include "e-cal-enumtypes.h"
#include "e-cal-time-util.h"
-#include "e-cal-types.h"
+#include "e-cal-enums.h"
#include "e-timezone-cache.h"
#define E_CAL_CLIENT_GET_PRIVATE(obj) \
diff --git a/src/calendar/libecal/e-cal-client.h b/src/calendar/libecal/e-cal-client.h
index a0bcc8782..0913ddd4d 100644
--- a/src/calendar/libecal/e-cal-client.h
+++ b/src/calendar/libecal/e-cal-client.h
@@ -28,7 +28,7 @@
#include <libecal/e-cal-client-view.h>
#include <libecal/e-cal-recur.h>
-#include <libecal/e-cal-types.h>
+#include <libecal/e-cal-enums.h>
#include <libecal/e-cal-util.h>
/* Standard GObject macros */
diff --git a/src/calendar/libecal/e-cal-component-alarm-instance.c
b/src/calendar/libecal/e-cal-component-alarm-instance.c
index a0265a67f..377ed1aa6 100644
--- a/src/calendar/libecal/e-cal-component-alarm-instance.c
+++ b/src/calendar/libecal/e-cal-component-alarm-instance.c
@@ -57,8 +57,7 @@ struct _ECalComponentAlarmInstance {
* Since: 3.36
**/
ECalComponentAlarmInstance *
-e_cal_component_alarm_instance_new (ECalComponentAlarmInstanceKind kind,
- const gchar *uid,
+e_cal_component_alarm_instance_new (const gchar *uid,
time_t instance_time,
time_t occur_start,
time_t occur_end)
@@ -128,7 +127,7 @@ e_cal_component_alarm_instance_free (gpointer instance)
* Since: 3.36
**/
const gchar *
-e_cal_component_alarm_instance_get_uid (ECalComponentAlarmInstance *instance)
+e_cal_component_alarm_instance_get_uid (const ECalComponentAlarmInstance *instance)
{
g_return_val_if_fail (instance != NULL, NULL);
@@ -166,7 +165,7 @@ e_cal_component_alarm_instance_set_uid (ECalComponentAlarmInstance *instance,
* Since: 3.36
**/
time_t
-e_cal_component_alarm_instance_get_ (ECalComponentAlarmInstance *instance)
+e_cal_component_alarm_instance_get_time (const ECalComponentAlarmInstance *instance)
{
g_return_val_if_fail (instance != NULL, (time_t) 0);
@@ -202,7 +201,7 @@ e_cal_component_alarm_instance_set_time (ECalComponentAlarmInstance *instance,
* Since: 3.36
**/
time_t
-e_cal_component_alarm_instance_get_occur_start (ECalComponentAlarmInstance *instance)
+e_cal_component_alarm_instance_get_occur_start (const ECalComponentAlarmInstance *instance)
{
g_return_val_if_fail (instance != NULL, (time_t) 0);
@@ -238,7 +237,7 @@ e_cal_component_alarm_instance_set_occur_start (ECalComponentAlarmInstance *inst
* Since: 3.36
**/
time_t
-e_cal_component_alarm_instance_get_occur_end (ECalComponentAlarmInstance *instance)
+e_cal_component_alarm_instance_get_occur_end (const ECalComponentAlarmInstance *instance)
{
g_return_val_if_fail (instance != NULL, (time_t) 0);
diff --git a/src/calendar/libecal/e-cal-component-alarm-instance.h
b/src/calendar/libecal/e-cal-component-alarm-instance.h
index 5f39d8506..15fa56e8a 100644
--- a/src/calendar/libecal/e-cal-component-alarm-instance.h
+++ b/src/calendar/libecal/e-cal-component-alarm-instance.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ALARM_INSTANCE_H
#define E_CAL_COMPONENT_ALARM_INSTANCE_H
-#include <glib.h>
+#include <glib-object.h>
#include <time.h>
G_BEGIN_DECLS
diff --git a/src/calendar/libecal/e-cal-component-alarm-repeat.c
b/src/calendar/libecal/e-cal-component-alarm-repeat.c
index f8ae7a73a..c62a4a3a0 100644
--- a/src/calendar/libecal/e-cal-component-alarm-repeat.c
+++ b/src/calendar/libecal/e-cal-component-alarm-repeat.c
@@ -32,7 +32,7 @@ G_DEFINE_BOXED_TYPE (ECalComponentAlarmRepeat, e_cal_component_alarm_repeat, e_c
struct _ECalComponentAlarmRepeat {
gint repetitions;
- ICalDurationtype *interval;
+ ICalDurationType *interval;
};
/**
@@ -52,7 +52,7 @@ ECalComponentAlarmRepeat *
e_cal_component_alarm_repeat_new (gint repetitions,
const ICalDurationType *interval)
{
- g_return_val_if_fail (I_CAL_IS_DURATIONTYPE (interval), NULL);
+ g_return_val_if_fail (I_CAL_IS_DURATION_TYPE (interval), NULL);
return e_cal_component_alarm_repeat_new_seconds (repetitions,
i_cal_duration_type_as_int ((ICalDurationType *) interval));
@@ -77,8 +77,6 @@ e_cal_component_alarm_repeat_new_seconds (gint repetitions,
{
ECalComponentAlarmRepeat *repeat;
- g_return_val_if_fail (I_CAL_IS_DURATIONTYPE (interval), NULL);
-
repeat = g_new0 (ECalComponentAlarmRepeat, 1);
repeat->repetitions = repetitions;
repeat->interval = i_cal_duration_type_from_int (interval_seconds);
@@ -210,7 +208,7 @@ e_cal_component_alarm_repeat_set_interval (ECalComponentAlarmRepeat *repeat,
*
* Returns the interval between repetitions of the @repeat in seconds.
*
- * Returns: (transfer none): the interval between repetitions of the @repeat
+ * Returns: the interval between repetitions of the @repeat
*
* Since: 3.36
**/
@@ -239,6 +237,6 @@ e_cal_component_alarm_repeat_set_interval_seconds (ECalComponentAlarmRepeat *rep
if (i_cal_duration_type_as_int (repeat->interval) != interval_seconds) {
g_clear_object (&repeat->interval);
- repeat->interval = i_cal_duration_from_int (interval_seconds);
+ repeat->interval = i_cal_duration_type_from_int (interval_seconds);
}
}
diff --git a/src/calendar/libecal/e-cal-component-alarm-repeat.h
b/src/calendar/libecal/e-cal-component-alarm-repeat.h
index 9b65f7c57..38a2976a0 100644
--- a/src/calendar/libecal/e-cal-component-alarm-repeat.h
+++ b/src/calendar/libecal/e-cal-component-alarm-repeat.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ALARM_REPEAT_H
#define E_CAL_COMPONENT_ALARM_REPEAT_H
-#include <glib.h>
+#include <glib-object.h>
#include <libical-glib/libical-glib.h>
G_BEGIN_DECLS
diff --git a/src/calendar/libecal/e-cal-component-alarm-trigger.c
b/src/calendar/libecal/e-cal-component-alarm-trigger.c
index 9e4f2e069..9172b5f41 100644
--- a/src/calendar/libecal/e-cal-component-alarm-trigger.c
+++ b/src/calendar/libecal/e-cal-component-alarm-trigger.c
@@ -119,7 +119,7 @@ e_cal_component_alarm_trigger_new_from_property (const ICalProperty *property)
if (i_cal_property_isa ((ICalProperty *) property) != I_CAL_TRIGGER_PROPERTY)
return NULL;
- trigger = e_cal_component_alarm_trigger_new ();
+ trigger = g_new0 (ECalComponentAlarmTrigger, 1);
e_cal_component_alarm_trigger_set_from_property (trigger, property);
@@ -186,6 +186,7 @@ e_cal_component_alarm_trigger_set_from_property (ECalComponentAlarmTrigger *trig
const ICalProperty *property)
{
ICalProperty *prop = (ICalProperty *) property;
+ ICalParameter *param;
ICalTriggerType *trgtype;
gboolean relative;
@@ -236,7 +237,7 @@ e_cal_component_alarm_trigger_set_from_property (ECalComponentAlarmTrigger *trig
break;
default:
- kind = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_NONE;
+ kind = E_CAL_COMPONENT_ALARM_TRIGGER_NONE;
break;
}
} else {
@@ -311,22 +312,18 @@ e_cal_component_alarm_trigger_fill_property (const ECalComponentAlarmTrigger *tr
g_return_if_fail (I_CAL_IS_PROPERTY (property));
g_return_if_fail (i_cal_property_isa (property) == I_CAL_TRIGGER_PROPERTY);
- g_return_if_fail (alarm != NULL);
- g_return_if_fail (trigger.type != E_CAL_COMPONENT_ALARM_TRIGGER_NONE);
- g_return_if_fail (alarm->icalcomp != NULL);
-
related = I_CAL_RELATED_START;
trgtype = i_cal_trigger_type_from_int (0);
switch (trigger->kind) {
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START:
- i_cal_trigger_type_set_duration (trgtype, trigger->duration);
+ i_cal_trigger_type_set_duration (trgtype, trigger->rel_duration);
value_type = I_CAL_VALUE_DURATION;
related = I_CAL_RELATED_START;
break;
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END:
- i_cal_trigger_type_set_duration (trgtype, trigger->duration);
+ i_cal_trigger_type_set_duration (trgtype, trigger->rel_duration);
value_type = I_CAL_VALUE_DURATION;
related = I_CAL_RELATED_END;
break;
@@ -340,27 +337,27 @@ e_cal_component_alarm_trigger_fill_property (const ECalComponentAlarmTrigger *tr
g_return_if_reached ();
}
- i_cal_property_set_trigger (prop, trgtype);
+ i_cal_property_set_trigger (property, trgtype);
- param = icalproperty_get_first_parameter (prop, I_CAL_VALUE_PARAMETER);
+ param = i_cal_property_get_first_parameter (property, I_CAL_VALUE_PARAMETER);
if (param) {
i_cal_parameter_set_value (param, value_type);
} else {
param = i_cal_parameter_new_value (value_type);
- i_cal_property_set_parameter (prop, param);
+ i_cal_property_set_parameter (property, param);
}
g_clear_object (¶m);
- param = i_cal_property_get_first_parameter (prop, I_CAL_RELATED_PARAMETER);
+ param = i_cal_property_get_first_parameter (property, I_CAL_RELATED_PARAMETER);
if (trigger->kind != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE) {
if (param) {
i_cal_parameter_set_related (param, related);
} else {
param = i_cal_parameter_new_related (related);
- i_cal_property_add_parameter (prop, param);
+ i_cal_property_add_parameter (property, param);
}
} else if (param) {
- i_cal_property_remove_parameter (prop, param);
+ i_cal_property_remove_parameter_by_kind (property, I_CAL_RELATED_PARAMETER);
}
g_clear_object (¶m);
}
@@ -416,7 +413,7 @@ e_cal_component_alarm_trigger_set_absolute (ECalComponentAlarmTrigger *trigger,
g_clear_object (&trigger->abs_time);
trigger->kind = E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE;
- trigger->absolute_time = i_cal_timetype_new_clone (absolute_time);
+ trigger->abs_time = i_cal_timetype_new_clone (absolute_time);
}
/**
@@ -428,7 +425,7 @@ e_cal_component_alarm_trigger_set_absolute (ECalComponentAlarmTrigger *trigger,
* Since: 3.36
**/
ECalComponentAlarmTriggerKind
-e_cal_component_alarm_trigger_get_kind (ECalComponentAlarmTrigger *trigger)
+e_cal_component_alarm_trigger_get_kind (const ECalComponentAlarmTrigger *trigger)
{
g_return_val_if_fail (trigger != NULL, E_CAL_COMPONENT_ALARM_TRIGGER_NONE);
@@ -557,6 +554,6 @@ e_cal_component_alarm_trigger_set_absolute_time (ECalComponentAlarmTrigger *trig
if (trigger->abs_time != absolute_time) {
g_clear_object (&trigger->abs_time);
- trigger->abs_time = i_cal_timetype_clone (absolute_time);
+ trigger->abs_time = i_cal_timetype_new_clone ((ICalTimetype *) absolute_time);
}
}
diff --git a/src/calendar/libecal/e-cal-component-alarm-trigger.h
b/src/calendar/libecal/e-cal-component-alarm-trigger.h
index 1552006e9..8b9e165ff 100644
--- a/src/calendar/libecal/e-cal-component-alarm-trigger.h
+++ b/src/calendar/libecal/e-cal-component-alarm-trigger.h
@@ -23,8 +23,8 @@
#ifndef E_CAL_COMPONENT_ALARM_TRIGGER_H
#define E_CAL_COMPONENT_ALARM_TRIGGER_H
-#include <glib.h>
-#inlcude <libical-glib/libical-glib.h>
+#include <glib-object.h>
+#include <libical-glib/libical-glib.h>
#include <libecal/e-cal-enums.h>
diff --git a/src/calendar/libecal/e-cal-component-alarm.c b/src/calendar/libecal/e-cal-component-alarm.c
index edf1a5db6..a644ab374 100644
--- a/src/calendar/libecal/e-cal-component-alarm.c
+++ b/src/calendar/libecal/e-cal-component-alarm.c
@@ -168,7 +168,7 @@ e_cal_component_alarm_copy (const ECalComponentAlarm *alarm)
data = i_cal_attach_get_data (src_attach);
if (data)
- attach = i_cal_attach_new_from_data (data, NULL, NULL);
+ attach = i_cal_attach_new_from_data ((gchar *) data, NULL, NULL);
}
if (attach)
@@ -249,7 +249,6 @@ e_cal_component_alarm_set_from_component (ECalComponentAlarm *alarm,
prop;
g_object_unref (prop), prop = i_cal_component_get_next_property (comp, I_CAL_ANY_PROPERTY)) {
ECalComponentAttendee *attendee;
- ECalComponentText *text;
ICalAttach *attach;
const gchar *xname;
@@ -289,12 +288,12 @@ e_cal_component_alarm_set_from_component (ECalComponentAlarm *alarm,
break;
case I_CAL_DESCRIPTION_PROPERTY:
- ICalParameter *param;
-
if (i_cal_property_get_description (prop)) {
+ ICalParameter *param;
+
param = i_cal_property_get_first_parameter (prop, I_CAL_ALTREP_PARAMETER);
alarm->description = e_cal_component_text_new (i_cal_property_get_description
(prop),
- param ? i_cal_property_get_altrep (param) : NULL);
+ param ? i_cal_parameter_get_altrep (param) : NULL);
g_clear_object (¶m);
}
break;
@@ -354,6 +353,7 @@ e_cal_component_alarm_set_from_component (ECalComponentAlarm *alarm,
* @alarm: an #ECalComponentAlarm
*
* Creates a VALARM #ICalComponent filled with data from the @alarm.
+ * In case the @alarm doesn't have set 'uid', a new is assigned.
* Free the returned component with g_object_unref(), when no longer
* needed.
*
@@ -363,7 +363,7 @@ e_cal_component_alarm_set_from_component (ECalComponentAlarm *alarm,
* Since: 3.36
**/
ICalComponent *
-e_cal_component_alarm_get_as_component (const ECalComponentAlarm *alarm)
+e_cal_component_alarm_get_as_component (ECalComponentAlarm *alarm)
{
ICalComponent *valarm;
@@ -383,12 +383,13 @@ e_cal_component_alarm_get_as_component (const ECalComponentAlarm *alarm)
*
* Fills @component with data from @alarm. The @component should
* be of %I_CAL_VALARM_COMPONENT kind - the function does nothing,
- * if it's not.
+ * if it's not. In case the @alarm doesn't have set 'uid', a new
+ * is assigned.
*
* Since: 3.36
**/
void
-e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
+e_cal_component_alarm_fill_component (ECalComponentAlarm *alarm,
ICalComponent *component)
{
ICalPropertyKind remove_props[] = {
@@ -412,7 +413,7 @@ e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
/* Remove used properties first */
for (ii = 0; ii < G_N_ELEMENTS (remove_props); ii++) {
- if (remove_props == I_CAL_ACTION_PROPERTY &&
+ if (remove_props[ii] == I_CAL_ACTION_PROPERTY &&
alarm->action == E_CAL_COMPONENT_ALARM_UNKNOWN)
continue;
@@ -442,7 +443,7 @@ e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
/* Tried all existing and none was the E_CAL_EVOLUTION_ALARM_UID_PROPERTY, thus add it */
if (!prop) {
prop = i_cal_property_new_x (alarm->uid);
- i_cal_property_set_xname (prop, E_CAL_EVOLUTION_ALARM_UID_PROPERTY);
+ i_cal_property_set_x_name (prop, E_CAL_EVOLUTION_ALARM_UID_PROPERTY);
i_cal_component_take_property (component, prop);
}
@@ -468,6 +469,9 @@ e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
case E_CAL_COMPONENT_ALARM_NONE:
prop = i_cal_property_new_action (I_CAL_ACTION_NONE);
break;
+
+ case E_CAL_COMPONENT_ALARM_UNKNOWN:
+ break;
}
if (prop)
@@ -514,7 +518,7 @@ e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
ECalComponentAttendee *attendee = link->data;
if (!attendee)
- continue
+ continue;
prop = e_cal_component_attendee_get_as_property (attendee);
if (prop)
@@ -544,7 +548,7 @@ e_cal_component_alarm_fill_component (const ECalComponentAlarm *alarm,
* Since: 3.36
**/
const gchar *
-e_cal_component_alarm_get_uid (const ECalComponentAlarm *alarm);
+e_cal_component_alarm_get_uid (const ECalComponentAlarm *alarm)
{
g_return_val_if_fail (alarm != NULL, NULL);
@@ -708,9 +712,9 @@ e_cal_component_alarm_set_repeat (ECalComponentAlarm *alarm,
g_return_if_fail (alarm != NULL);
if (repeat != alarm->repeat) {
- e_cal_component_repeat_free (alarm->repeat);
+ e_cal_component_alarm_repeat_free (alarm->repeat);
- alarm->repeat = repeat ? e_cal_component_repeat_copy (repeat) : NULL;
+ alarm->repeat = repeat ? e_cal_component_alarm_repeat_copy (repeat) : NULL;
}
}
@@ -731,7 +735,7 @@ e_cal_component_alarm_take_repeat (ECalComponentAlarm *alarm,
g_return_if_fail (alarm != NULL);
if (repeat != alarm->repeat) {
- e_cal_component_repeat_free (alarm->repeat);
+ e_cal_component_alarm_repeat_free (alarm->repeat);
alarm->repeat = repeat;
}
}
@@ -770,9 +774,9 @@ e_cal_component_alarm_set_trigger (ECalComponentAlarm *alarm,
g_return_if_fail (alarm != NULL);
if (trigger != alarm->trigger) {
- e_cal_component_trigger_free (alarm->trigger);
+ e_cal_component_alarm_trigger_free (alarm->trigger);
- alarm->trigger = trigger ? e_cal_component_trigger_copy (trigger) : NULL;
+ alarm->trigger = trigger ? e_cal_component_alarm_trigger_copy (trigger) : NULL;
}
}
@@ -793,7 +797,7 @@ e_cal_component_alarm_take_trigger (ECalComponentAlarm *alarm,
g_return_if_fail (alarm != NULL);
if (trigger != alarm->trigger) {
- e_cal_component_trigger_free (alarm->trigger);
+ e_cal_component_alarm_trigger_free (alarm->trigger);
alarm->trigger = trigger;
}
}
@@ -856,7 +860,7 @@ e_cal_component_alarm_set_attendees (ECalComponentAlarm *alarm,
if (alarm->attendees == attendees)
return;
- for (link = attendees; link; link = g_slist_next (link)) {
+ for (link = (GSList *) attendees; link; link = g_slist_next (link)) {
ECalComponentAttendee *attendee = link->data;
if (attendee)
@@ -865,7 +869,7 @@ e_cal_component_alarm_set_attendees (ECalComponentAlarm *alarm,
to_take = g_slist_reverse (to_take);
- e_cal_component_alarm_take_attendees (to_take);
+ e_cal_component_alarm_take_attendees (alarm, to_take);
}
/**
@@ -931,7 +935,7 @@ e_cal_component_alarm_get_attachments (const ECalComponentAlarm *alarm)
/**
* e_cal_component_alarm_set_attachments:
* @alarm: an #ECalComponentAlarm
- * @attachemnts: (transfer none) (nullable) (element-type ICalAttach): a #GSList
+ * @attachments: (transfer none) (nullable) (element-type ICalAttach): a #GSList
* of an #ICalAttach objects to set as attachments, or %NULL to unset
*
* Set the list of attachments, as a #GSList of an #ICalAttach.
@@ -949,7 +953,7 @@ e_cal_component_alarm_set_attachments (ECalComponentAlarm *alarm,
if (alarm->attachments == attachments)
return;
- for (link = attachments; link; link = g_slist_next (link)) {
+ for (link = (GSList *) attachments; link; link = g_slist_next (link)) {
ICalAttach *attach = link->data;
if (attach)
@@ -958,13 +962,13 @@ e_cal_component_alarm_set_attachments (ECalComponentAlarm *alarm,
to_take = g_slist_reverse (to_take);
- e_cal_component_alarm_take_attachments (to_take);
+ e_cal_component_alarm_take_attachments (alarm, to_take);
}
/**
* e_cal_component_alarm_take_attachments: (skip)
* @alarm: an #ECalComponentAlarm
- * @attachemnts: (transfer full) (nullable) (element-type ICalAttach): a #GSList
+ * @attachments: (transfer full) (nullable) (element-type ICalAttach): a #GSList
* of an #ICalAttach objects to set as attachments, or %NULL to unset
*
* Sets the list of attachments, as a #GSList of an #ICalAttach and assumes
diff --git a/src/calendar/libecal/e-cal-component-alarm.h b/src/calendar/libecal/e-cal-component-alarm.h
index c0a7ef986..21299d839 100644
--- a/src/calendar/libecal/e-cal-component-alarm.h
+++ b/src/calendar/libecal/e-cal-component-alarm.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ALARM_H
#define E_CAL_COMPONENT_ALARM_H
-#include <glib.h>
+#include <glib-object.h>
#include <libical-glib/libical-glib.h>
#include <libecal/e-cal-component-alarm-repeat.h>
@@ -59,14 +59,14 @@ ECalComponentAlarm *
(const ICalComponent *component);
ECalComponentAlarm *
e_cal_component_alarm_copy (const ECalComponentAlarm *alarm);
-void e_cal_component_alarm_free (ECalComponentAlarm *alarm);
+void e_cal_component_alarm_free (gpointer alarm); /* ECalComponentAlarm * */
void e_cal_component_alarm_set_from_component
(ECalComponentAlarm *alarm,
const ICalComponent *component);
ICalComponent * e_cal_component_alarm_get_as_component
- (const ECalComponentAlarm *alarm);
+ (ECalComponentAlarm *alarm);
void e_cal_component_alarm_fill_component
- (const ECalComponentAlarm *alarm,
+ (ECalComponentAlarm *alarm,
ICalComponent *component);
const gchar * e_cal_component_alarm_get_uid (const ECalComponentAlarm *alarm);
void e_cal_component_alarm_set_uid (ECalComponentAlarm *alarm,
diff --git a/src/calendar/libecal/e-cal-component-alarms.c b/src/calendar/libecal/e-cal-component-alarms.c
index 9a4e8a726..28e895ee8 100644
--- a/src/calendar/libecal/e-cal-component-alarms.c
+++ b/src/calendar/libecal/e-cal-component-alarms.c
@@ -26,24 +26,19 @@
* Contains functions to work with the #ECalComponentAlarms structure.
**/
+#include "e-cal-component.h"
+
#include "e-cal-component-alarms.h"
G_DEFINE_BOXED_TYPE (ECalComponentAlarms, e_cal_component_alarms, e_cal_component_alarms_copy,
e_cal_component_alarms_free)
-/**
- * ECalComponentAlarms:
- * @comp: The actual alarm component
- * @alarms: (element-type ECalComponentAlarms): List of #ECalComponentAlarms structures
- *
- * Alarm trigger instances for a particular component
- **/
-typedef struct {
+struct _ECalComponentAlarms {
/* The actual component */
ECalComponent *comp;
- /* List of ECalComponentAlarms structures */
- GSList *alarms;
-} ECalComponentAlarms;
+ /* List of ECalComponentAlarmInstance structures */
+ GSList *instances;
+};
/**
* e_cal_component_alarms_new_relative:
@@ -61,7 +56,6 @@ e_cal_component_alarms_new (ECalComponent *comp)
{
ECalComponentAlarms *alarms;
- g_return_val_if_fail (uid != NULL, NULL);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
alarms = g_new0 (ECalComponentAlarms, 1);
@@ -110,7 +104,7 @@ e_cal_component_alarms_free (gpointer alarms)
ECalComponentAlarms *alrms = alarms;
if (alrms) {
- g_clear_object (&alrms->uid);
+ g_clear_object (&alrms->comp);
g_slist_free_full (alrms->instances, e_cal_component_alarm_instance_free);
g_free (alrms);
}
@@ -127,7 +121,7 @@ e_cal_component_alarms_free (gpointer alarms)
* Since: 3.36
**/
ECalComponent *
-e_cal_component_alarms_get_component (ECalComponentAlarms *alarms)
+e_cal_component_alarms_get_component (const ECalComponentAlarms *alarms)
{
g_return_val_if_fail (alarms != NULL, NULL);
@@ -148,7 +142,7 @@ e_cal_component_alarms_get_component (ECalComponentAlarms *alarms)
* Since: 3.36
**/
GSList *
-e_cal_component_alarms_get_component (ECalComponentAlarms *alarms)
+e_cal_component_alarms_get_instances (const ECalComponentAlarms *alarms)
{
g_return_val_if_fail (alarms != NULL, NULL);
@@ -172,7 +166,7 @@ e_cal_component_alarms_set_instances (ECalComponentAlarms *alarms,
g_return_if_fail (alarms != NULL);
- copy = g_slist_copy_deep (instances, (GCopyFunc) e_cal_component_alarm_instance_copy, NULL);
+ copy = g_slist_copy_deep ((GSList *) instances, (GCopyFunc) e_cal_component_alarm_instance_copy,
NULL);
g_slist_free_full (alarms->instances, e_cal_component_alarm_instance_free);
alarms->instances = copy;
}
diff --git a/src/calendar/libecal/e-cal-component-alarms.h b/src/calendar/libecal/e-cal-component-alarms.h
index d1ab6cd28..7c98389b0 100644
--- a/src/calendar/libecal/e-cal-component-alarms.h
+++ b/src/calendar/libecal/e-cal-component-alarms.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ALARMS_H
#define E_CAL_COMPONENT_ALARMS_H
-#include <glib.h>
+#include <glib-object.h>
#include <libecal/e-cal-component-alarm-instance.h>
G_BEGIN_DECLS
@@ -41,11 +41,12 @@ typedef struct _ECalComponentAlarms ECalComponentAlarms;
GType e_cal_component_alarms_get_type (void);
ECalComponentAlarms *
- e_cal_component_alarms_new (ECalComponent *comp);
+ e_cal_component_alarms_new (struct _ECalComponent *comp);
ECalComponentAlarms *
e_cal_component_alarms_copy (const ECalComponentAlarms *alarms);
void e_cal_component_alarms_free (gpointer alarms); /* ECalComponentAlarms * */
-ECalComponent * e_cal_component_alarms_get_component
+struct _ECalComponent *
+ e_cal_component_alarms_get_component
(const ECalComponentAlarms *alarms);
GSList * e_cal_component_alarms_get_instances /* ECalComponentAlarmInstance * */
(const ECalComponentAlarms *alarms);
diff --git a/src/calendar/libecal/e-cal-component-attendee.c b/src/calendar/libecal/e-cal-component-attendee.c
index a2f531620..4f89be427 100644
--- a/src/calendar/libecal/e-cal-component-attendee.c
+++ b/src/calendar/libecal/e-cal-component-attendee.c
@@ -30,13 +30,13 @@
G_DEFINE_BOXED_TYPE (ECalComponentAttendee, e_cal_component_attendee, e_cal_component_attendee_copy,
e_cal_component_attendee_free)
-typedef struct {
+struct _ECalComponentAttendee {
gchar *value;
gchar *member;
ICalParameterCutype cutype;
ICalParameterRole role;
- ICalParameterPartstat status;
+ ICalParameterPartstat partstat;
gboolean rsvp;
gchar *delegatedfrom;
@@ -44,7 +44,7 @@ typedef struct {
gchar *sentby;
gchar *cn;
gchar *language;
-} ECalComponentAttendee;
+};
/**
* e_cal_component_attendee_new:
@@ -75,7 +75,7 @@ e_cal_component_attendee_new (void)
* @member: (nullable): member parameter
* @cutype: type of the attendee, an #ICalParameterCutype
* @role: role of the attendee, an #ICalParameterRole
- * @status: current status of the attendee, an #ICalParameterPartstat
+ * @partstat: current status of the attendee, an #ICalParameterPartstat
* @rsvp: whether requires RSVP
* @delegatedfrom: (nullable): delegated from
* @delegatedto: (nullable): delegated to
@@ -97,7 +97,7 @@ e_cal_component_attendee_new_full (const gchar *value,
const gchar *member,
ICalParameterCutype cutype,
ICalParameterRole role,
- ICalParameterPartstat status,
+ ICalParameterPartstat partstat,
gboolean rsvp,
const gchar *delegatedfrom,
const gchar *delegatedto,
@@ -112,10 +112,10 @@ e_cal_component_attendee_new_full (const gchar *value,
attendee->member = member && *member ? g_strdup (member) : NULL;
attendee->cutype = cutype;
attendee->role = role;
- attendee->status = status;
+ attendee->partstat = partstat;
attendee->rsvp = rsvp;
attendee->delegatedfrom = delegatedfrom && *delegatedfrom ? g_strdup (delegatedfrom) : NULL;
- attendee->delegateto = delegatedto && *delegatedto ? g_strdup (delegatedto) : NULL;
+ attendee->delegatedto = delegatedto && *delegatedto ? g_strdup (delegatedto) : NULL;
attendee->sentby = sentby && *sentby ? g_strdup (sentby) : NULL;
attendee->cn = cn && *cn ? g_strdup (cn) : NULL;
attendee->language = language && *language ? g_strdup (language) : NULL;
@@ -173,7 +173,7 @@ e_cal_component_attendee_copy (const ECalComponentAttendee *attendee)
attendee->member,
attendee->cutype,
attendee->role,
- attendee->status,
+ attendee->partstat,
attendee->rsvp,
attendee->delegatedfrom,
attendee->delegatedto,
@@ -231,7 +231,7 @@ e_cal_component_attendee_set_from_property (ECalComponentAttendee *attendee,
g_return_if_fail (I_CAL_IS_PROPERTY (property));
g_return_if_fail (i_cal_property_isa (prop) == I_CAL_ATTENDEE_PROPERTY);
- e_cal_component_attendee_set_value (attendee, i_cal_property_get_attendee (property));
+ e_cal_component_attendee_set_value (attendee, i_cal_property_get_attendee (prop));
param = i_cal_property_get_first_parameter (prop, I_CAL_MEMBER_PARAMETER);
e_cal_component_attendee_set_member (attendee, param ? i_cal_parameter_get_member (param) : NULL);
@@ -325,16 +325,16 @@ e_cal_component_attendee_fill_property (const ECalComponentAttendee *attendee,
i_cal_property_set_attendee (property, attendee->value ? attendee->value : "MAILTO:");
#define fill_param(_param, _val, _filled) \
- param = i_cal_property_get_first_parameter (prop, _param); \
+ param = i_cal_property_get_first_parameter (property, _param); \
if (_filled) { \
if (!param) { \
param = i_cal_parameter_new (_param); \
i_cal_property_add_parameter (property, param); \
} \
- i_cal_parameter_set_ # _val (param, attendee-> _val); \
+ i_cal_parameter_set_ ## _val (param, attendee-> _val); \
g_clear_object (¶m); \
} else if (param) { \
- i_cal_property_remove_parameter (property, param); \
+ i_cal_property_remove_parameter_by_kind (property, _param); \
g_clear_object (¶m); \
}
@@ -343,7 +343,7 @@ e_cal_component_attendee_fill_property (const ECalComponentAttendee *attendee,
fill_param (I_CAL_ROLE_PARAMETER, role, attendee->role != I_CAL_ROLE_NONE);
fill_param (I_CAL_PARTSTAT_PARAMETER, partstat, attendee->partstat != I_CAL_PARTSTAT_NONE);
- param = i_cal_property_get_first_parameter (prop, I_CAL_RSVP_PARAMETER);
+ param = i_cal_property_get_first_parameter (property, I_CAL_RSVP_PARAMETER);
if (param) {
i_cal_parameter_set_rsvp (param, attendee->rsvp ? I_CAL_RSVP_TRUE : I_CAL_RSVP_FALSE);
g_clear_object (¶m);
@@ -371,7 +371,7 @@ e_cal_component_attendee_fill_property (const ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_value (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_value (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -412,7 +412,7 @@ e_cal_component_attendee_set_value (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_member (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_member (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -453,7 +453,7 @@ e_cal_component_attendee_set_member (ECalComponentAttendee *attendee,
* Since: 3.36
**/
ICalParameterCutype
-e_cal_component_attendee_get_cutype (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_cutype (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, I_CAL_CUTYPE_NONE);
@@ -489,7 +489,7 @@ e_cal_component_attendee_set_cutype (ECalComponentAttendee *attendee,
* Since: 3.36
**/
ICalParameterRole
-e_cal_component_attendee_get_role (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_role (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, I_CAL_ROLE_NONE);
@@ -517,7 +517,7 @@ e_cal_component_attendee_set_role (ECalComponentAttendee *attendee,
}
/**
- * e_cal_component_attendee_get_status:
+ * e_cal_component_attendee_get_partstat:
* @attendee: an #ECalComponentAttendee
*
* Returns: the @attendee status, as an #ICalParameterPartstat
@@ -525,30 +525,30 @@ e_cal_component_attendee_set_role (ECalComponentAttendee *attendee,
* Since: 3.36
**/
ICalParameterPartstat
-e_cal_component_attendee_get_status (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_partstat (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, I_CAL_PARTSTAT_NONE);
- return attendee->status;
+ return attendee->partstat;
}
/**
- * e_cal_component_attendee_set_status:
+ * e_cal_component_attendee_set_partstat:
* @attendee: an #ECalComponentAttendee
- * @status: the value to set, as an #ICalParameterPartstat
+ * @partstat: the value to set, as an #ICalParameterPartstat
*
* Set the @attendee status, as an #ICalParameterPartstat.
*
* Since: 3.36
**/
void
-e_cal_component_attendee_set_status (ECalComponentAttendee *attendee,
- ICalParameterPartstat status)
+e_cal_component_attendee_set_partstat (ECalComponentAttendee *attendee,
+ ICalParameterPartstat partstat)
{
g_return_if_fail (attendee != NULL);
- if (attendee->status != status) {
- attendee->status = status;
+ if (attendee->partstat != partstat) {
+ attendee->partstat = partstat;
}
}
@@ -561,7 +561,7 @@ e_cal_component_attendee_set_status (ECalComponentAttendee *attendee,
* Since: 3.36
**/
gboolean
-e_cal_component_attendee_get_rsvp (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_rsvp (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, FALSE);
@@ -597,7 +597,7 @@ e_cal_component_attendee_set_rsvp (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_delegatedfrom (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_delegatedfrom (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -638,7 +638,7 @@ e_cal_component_attendee_set_delegatedfrom (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_delegatedto (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_delegatedto (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -679,7 +679,7 @@ e_cal_component_attendee_set_delegatedto (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_sentby (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_sentby (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -720,7 +720,7 @@ e_cal_component_attendee_set_sentby (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_cn (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_cn (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
@@ -761,7 +761,7 @@ e_cal_component_attendee_set_cn (ECalComponentAttendee *attendee,
* Since: 3.36
**/
const gchar *
-e_cal_component_attendee_get_language (ECalComponentAttendee *attendee)
+e_cal_component_attendee_get_language (const ECalComponentAttendee *attendee)
{
g_return_val_if_fail (attendee != NULL, NULL);
diff --git a/src/calendar/libecal/e-cal-component-attendee.h b/src/calendar/libecal/e-cal-component-attendee.h
index 0a4425355..01f73fe6d 100644
--- a/src/calendar/libecal/e-cal-component-attendee.h
+++ b/src/calendar/libecal/e-cal-component-attendee.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ATTENDEE_H
#define E_CAL_COMPONENT_ATTENDEE_H
-#include <glib.h>
+#include <glib-object.h>
#include <libical-glib/libical-glib.h>
G_BEGIN_DECLS
@@ -45,7 +45,7 @@ ECalComponentAttendee *
const gchar *member,
ICalParameterCutype cutype,
ICalParameterRole role,
- ICalParameterPartstat status,
+ ICalParameterPartstat partstat,
gboolean rsvp,
const gchar *delegatedfrom,
const gchar *delegatedto,
@@ -67,58 +67,58 @@ void e_cal_component_attendee_fill_property
(const ECalComponentAttendee *attendee,
ICalProperty *property);
const gchar * e_cal_component_attendee_get_value
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_value
(ECalComponentAttendee *attendee,
const gchar *value);
const gchar * e_cal_component_attendee_get_member
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_member
(ECalComponentAttendee *attendee,
const gchar *member);
ICalParameterCutype
e_cal_component_attendee_get_cutype
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_cutype
(ECalComponentAttendee *attendee,
ICalParameterCutype cutype);
ICalParameterRole
e_cal_component_attendee_get_role
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_role
(ECalComponentAttendee *attendee,
ICalParameterRole role);
ICalParameterPartstat
- e_cal_component_attendee_get_status
- (ECalComponentAttendee *attendee);
-void e_cal_component_attendee_set_status
+ e_cal_component_attendee_get_partstat
+ (const ECalComponentAttendee *attendee);
+void e_cal_component_attendee_set_partstat
(ECalComponentAttendee *attendee,
- ICalParameterPartstat status);
+ ICalParameterPartstat partstat);
gboolean e_cal_component_attendee_get_rsvp
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_rsvp
(ECalComponentAttendee *attendee,
gboolean rsvp);
const gchar * e_cal_component_attendee_get_delegatedfrom
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_delegatedfrom
(ECalComponentAttendee *attendee,
const gchar *delegatedfrom);
const gchar * e_cal_component_attendee_get_delegatedto
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_delegatedto
(ECalComponentAttendee *attendee,
const gchar *delegatedto);
const gchar * e_cal_component_attendee_get_sentby
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_sentby
(ECalComponentAttendee *attendee,
const gchar *sentby);
-const gchar * e_cal_component_attendee_get_cn (ECalComponentAttendee *attendee);
+const gchar * e_cal_component_attendee_get_cn (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_cn (ECalComponentAttendee *attendee,
const gchar *cn);
const gchar * e_cal_component_attendee_get_language
- (ECalComponentAttendee *attendee);
+ (const ECalComponentAttendee *attendee);
void e_cal_component_attendee_set_language
(ECalComponentAttendee *attendee,
const gchar *language);
diff --git a/src/calendar/libecal/e-cal-component-datetime.c b/src/calendar/libecal/e-cal-component-datetime.c
index 213edce41..708471397 100644
--- a/src/calendar/libecal/e-cal-component-datetime.c
+++ b/src/calendar/libecal/e-cal-component-datetime.c
@@ -35,7 +35,7 @@ struct _ECalComponentDateTime {
ICalTimetype *value;
/* Timezone ID */
- const gchar *tzid;
+ gchar *tzid;
};
/**
@@ -66,7 +66,7 @@ e_cal_component_datetime_new (const ICalTimetype *value,
}
/**
- * e_cal_component_datetime_new:
+ * e_cal_component_datetime_new_take:
* @value: (transfer full) (not nullable): an #ICalTimetype as a value
* @tzid: (transfer full) (nullable): timezone ID for the @value, or %NULL
*
@@ -132,9 +132,9 @@ e_cal_component_datetime_free (gpointer dt)
ECalComponentDateTime *pdt = dt;
if (pdt) {
- g_clear_objct (&pdt->value);
+ g_clear_object (&pdt->value);
g_free (pdt->tzid);
- g_free (pdf);
+ g_free (pdt);
}
}
diff --git a/src/calendar/libecal/e-cal-component-datetime.h b/src/calendar/libecal/e-cal-component-datetime.h
index 39bc6986b..946248771 100644
--- a/src/calendar/libecal/e-cal-component-datetime.h
+++ b/src/calendar/libecal/e-cal-component-datetime.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_DATETIME_H
#define E_CAL_COMPONENT_DATETIME_H
-#include <glib.h>
+#include <glib-object.h>
#include <libical-glib/libical-glib.h>
G_BEGIN_DECLS
diff --git a/src/calendar/libecal/e-cal-component-id.c b/src/calendar/libecal/e-cal-component-id.c
index d985424d4..79e785bfb 100644
--- a/src/calendar/libecal/e-cal-component-id.c
+++ b/src/calendar/libecal/e-cal-component-id.c
@@ -50,18 +50,46 @@ struct _ECalComponentId {
ECalComponentId *
e_cal_component_id_new (const gchar *uid,
const gchar *rid)
+{
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ /* Normalize an empty recurrence ID to NULL. */
+ if (rid && !*rid)
+ rid = NULL;
+
+ return e_cal_component_id_new_take (g_strdup (uid), g_strdup (rid));
+}
+
+/**
+ * e_cal_component_id_new_take:
+ * @uid: (transfer full): a unique ID string
+ * @rid: (transfer full) (nullable): an optional recurrence ID string
+ *
+ * Creates a new #ECalComponentId from @uid and @rid, which should be
+ * freed with e_cal_component_id_free(). The function assumes ownership
+ * of @uid and @rid parameters.
+ *
+ * Returns: (transfer full): an #ECalComponentId
+ *
+ * Since: 3.36
+ **/
+ECalComponentId *
+e_cal_component_id_new_take (gchar *uid,
+ gchar *rid)
{
ECalComponentId *id;
g_return_val_if_fail (uid != NULL, NULL);
/* Normalize an empty recurrence ID to NULL. */
- if (rid != NULL && *rid == '\0')
+ if (rid && !*rid) {
+ g_free (rid);
rid = NULL;
+ }
id = g_new0 (ECalComponentId, 1);
- id->uid = g_strdup (uid);
- id->rid = g_strdup (rid);
+ id->uid = uid;
+ id->rid = rid;
return id;
}
@@ -87,18 +115,21 @@ e_cal_component_id_copy (const ECalComponentId *id)
/**
* e_cal_component_id_free: (skip)
- * @id: (transfer full): an #ECalComponentId
+ * @id: (type ECalComponentId) (transfer full) (nullable): an #ECalComponentId
*
- * Free the @id.
+ * Free the @id, previously created by e_cal_component_id_new(),
+ * e_cal_component_id_new_take() or e_cal_component_id_copy().
**/
void
-e_cal_component_id_free (ECalComponentId *id)
+e_cal_component_id_free (gpointer id)
{
+ ECalComponentId *eid = id;
+
g_return_if_fail (id != NULL);
- g_free (id->uid);
- g_free (id->rid);
- g_free (id);
+ g_free (eid->uid);
+ g_free (eid->rid);
+ g_free (eid);
}
/**
@@ -112,7 +143,7 @@ e_cal_component_id_free (ECalComponentId *id)
* Since: 3.10
**/
guint
-e_cal_component_id_hash (gcontpointer id)
+e_cal_component_id_hash (gconstpointer id)
{
const ECalComponentId *eid = id;
guint uid_hash;
diff --git a/src/calendar/libecal/e-cal-component-id.h b/src/calendar/libecal/e-cal-component-id.h
index 4574dfb29..bf03cd4fd 100644
--- a/src/calendar/libecal/e-cal-component-id.h
+++ b/src/calendar/libecal/e-cal-component-id.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_ID_H
#define E_CAL_COMPONENT_ID_H
-#include <glib.h>
+#include <glib-object.h>
G_BEGIN_DECLS
@@ -40,6 +40,9 @@ GType e_cal_component_id_get_type (void);
ECalComponentId *
e_cal_component_id_new (const gchar *uid,
const gchar *rid);
+ECalComponentId *
+ e_cal_component_id_new_take (gchar *uid,
+ gchar *rid);
ECalComponentId *
e_cal_component_id_copy (const ECalComponentId *id);
void e_cal_component_id_free (gpointer id); /* ECalComponentId * */
diff --git a/src/calendar/libecal/e-cal-component-organizer.c
b/src/calendar/libecal/e-cal-component-organizer.c
index 4754ae83c..6a19d863a 100644
--- a/src/calendar/libecal/e-cal-component-organizer.c
+++ b/src/calendar/libecal/e-cal-component-organizer.c
@@ -254,16 +254,16 @@ e_cal_component_organizer_fill_property (const ECalComponentOrganizer *organizer
i_cal_property_set_organizer (property, organizer->value ? organizer->value : "MAILTO:");
#define fill_param(_param, _val, _filled) \
- param = i_cal_property_get_first_parameter (prop, _param); \
+ param = i_cal_property_get_first_parameter (property, _param); \
if (_filled) { \
if (!param) { \
param = i_cal_parameter_new (_param); \
i_cal_property_add_parameter (property, param); \
} \
- i_cal_parameter_set_ # _val (param, organizer-> _val); \
+ i_cal_parameter_set_ ## _val (param, organizer-> _val); \
g_clear_object (¶m); \
} else if (param) { \
- i_cal_property_remove_parameter (property, param); \
+ i_cal_property_remove_parameter_by_kind (property, _param); \
g_clear_object (¶m); \
}
@@ -283,7 +283,7 @@ e_cal_component_organizer_fill_property (const ECalComponentOrganizer *organizer
* Since: 3.36
**/
const gchar *
-e_cal_component_organizer_get_value (ECalComponentOrganizer *organizer)
+e_cal_component_organizer_get_value (const ECalComponentOrganizer *organizer)
{
g_return_val_if_fail (organizer != NULL, NULL);
@@ -324,7 +324,7 @@ e_cal_component_organizer_set_value (ECalComponentOrganizer *organizer,
* Since: 3.36
**/
const gchar *
-e_cal_component_organizer_get_sentby (ECalComponentOrganizer *organizer)
+e_cal_component_organizer_get_sentby (const ECalComponentOrganizer *organizer)
{
g_return_val_if_fail (organizer != NULL, NULL);
@@ -365,7 +365,7 @@ e_cal_component_organizer_set_sentby (ECalComponentOrganizer *organizer,
* Since: 3.36
**/
const gchar *
-e_cal_component_organizer_get_cn (ECalComponentOrganizer *organizer)
+e_cal_component_organizer_get_cn (const ECalComponentOrganizer *organizer)
{
g_return_val_if_fail (organizer != NULL, NULL);
@@ -406,7 +406,7 @@ e_cal_component_organizer_set_cn (ECalComponentOrganizer *organizer,
* Since: 3.36
**/
const gchar *
-e_cal_component_organizer_get_language (ECalComponentOrganizer *organizer)
+e_cal_component_organizer_get_language (const ECalComponentOrganizer *organizer)
{
g_return_val_if_fail (organizer != NULL, NULL);
diff --git a/src/calendar/libecal/e-cal-component-organizer.h
b/src/calendar/libecal/e-cal-component-organizer.h
index 341e21e60..4bac9945e 100644
--- a/src/calendar/libecal/e-cal-component-organizer.h
+++ b/src/calendar/libecal/e-cal-component-organizer.h
@@ -23,7 +23,8 @@
#ifndef E_CAL_COMPONENT_ORGANIZER_H
#define E_CAL_COMPONENT_ORGANIZER_H
-#include <glib.h>
+#include <glib-object.h>
+#include <libical-glib/libical-glib.h>
G_BEGIN_DECLS
@@ -59,25 +60,24 @@ void e_cal_component_organizer_fill_property
(const ECalComponentOrganizer *organizer,
ICalProperty *property);
const gchar * e_cal_component_organizer_get_value
- (ECalComponentOrganizer *organizer);
+ (const ECalComponentOrganizer *organizer);
void e_cal_component_organizer_set_value
(ECalComponentOrganizer *organizer,
const gchar *value);
const gchar * e_cal_component_organizer_get_sentby
- (ECalComponentOrganizer *organizer);
+ (const ECalComponentOrganizer *organizer);
void e_cal_component_organizer_set_sentby
(ECalComponentOrganizer *organizer,
const gchar *sentby);
-const gchar * e_cal_component_organizer_get_cn(ECalComponentOrganizer *organizer);
+const gchar * e_cal_component_organizer_get_cn(const ECalComponentOrganizer *organizer);
void e_cal_component_organizer_set_cn(ECalComponentOrganizer *organizer,
const gchar *cn);
const gchar * e_cal_component_organizer_get_language
- (ECalComponentOrganizer *organizer);
+ (const ECalComponentOrganizer *organizer);
void e_cal_component_organizer_set_language
(ECalComponentOrganizer *organizer,
const gchar *language);
-
G_END_DECLS
#endif /* E_CAL_COMPONENT_ORGANIZER_H */
diff --git a/src/calendar/libecal/e-cal-component-period.c b/src/calendar/libecal/e-cal-component-period.c
index 6b988094b..81d6018cf 100644
--- a/src/calendar/libecal/e-cal-component-period.c
+++ b/src/calendar/libecal/e-cal-component-period.c
@@ -37,7 +37,7 @@ struct _ECalComponentPeriod {
/* Only one of 'end' and 'duration' can be set, depending on the kind */
ICalTimetype *end;
- ICalDurationtype *duration;
+ ICalDurationType *duration;
};
/**
@@ -73,7 +73,7 @@ e_cal_component_period_new_datetime (const ICalTimetype *start,
/**
* e_cal_component_period_new_duration:
* @start: (not nullable): an #ICalTimetype, the start of the period
- * @duration: (not nullable): an #ICalDurationtype, the duration of the period
+ * @duration: (not nullable): an #ICalDurationType, the duration of the period
*
* Creates a new #ECalComponentPeriod of kind %E_CAL_COMPONENT_PERIOD_DURATION.
* The returned structure should be freed with e_cal_component_period_free(),
@@ -85,12 +85,12 @@ e_cal_component_period_new_datetime (const ICalTimetype *start,
**/
ECalComponentPeriod *
e_cal_component_period_new_duration (const ICalTimetype *start,
- const ICalDurationtype *duration)
+ const ICalDurationType *duration)
{
ECalComponentPeriod *period;
g_return_val_if_fail (I_CAL_IS_TIMETYPE (start), NULL);
- g_return_val_if_fail (I_CAL_IS_TIMETYPE (end), NULL);
+ g_return_val_if_fail (I_CAL_IS_DURATION_TYPE (duration), NULL);
period = g_new0 (ECalComponentPeriod, 1);
period->kind = E_CAL_COMPONENT_PERIOD_DURATION;
@@ -115,7 +115,7 @@ e_cal_component_period_copy (const ECalComponentPeriod *period)
{
ECalComponentPeriod *copy = NULL;
- g_return_if_val_fail (period != NULL, NULL);
+ g_return_val_if_fail (period != NULL, NULL);
switch (e_cal_component_period_get_kind (period)) {
case E_CAL_COMPONENT_PERIOD_DATETIME:
@@ -209,7 +209,7 @@ e_cal_component_period_set_datetime_full (ECalComponentPeriod *period,
* e_cal_component_period_set_duration_full:
* @period: an #ECalComponentPeriod
* @start: (not nullable): an #ICalTimetype, the start of the @period
- * @duration: (not nullable): an #ICalDurationtype, the duration of the @period
+ * @duration: (not nullable): an #ICalDurationType, the duration of the @period
*
* Set the kind of @period to be %E_CAL_COMPONENT_PERIOD_DURATION
* and fills the content with @start and @duration.
@@ -219,11 +219,11 @@ e_cal_component_period_set_datetime_full (ECalComponentPeriod *period,
void
e_cal_component_period_set_duration_full (ECalComponentPeriod *period,
const ICalTimetype *start,
- const ICalDurationtype *duration)
+ const ICalDurationType *duration)
{
g_return_if_fail (period != NULL);
g_return_if_fail (I_CAL_IS_TIMETYPE (start));
- g_return_if_fail (I_CAL_IS_DURATIONTYPE (duration));
+ g_return_if_fail (I_CAL_IS_DURATION_TYPE (duration));
g_clear_object (&period->end);
@@ -327,14 +327,14 @@ e_cal_component_period_set_end (ECalComponentPeriod *period,
*
* Returns the duration of the @period. This can be called only on @period
* objects of kind %E_CAL_COMPONENT_PERIOD_DURATION.
- * The returned #ICalDurationtype object is owned by @period and should not
+ * The returned #ICalDurationType object is owned by @period and should not
* be freed. It's valid until the @period is freed or its duration changed.
*
- * Returns: (transfer none): the duration of the period, as an #ICalDurationtype
+ * Returns: (transfer none): the duration of the period, as an #ICalDurationType
*
* Since: 3.36
**/
-ICalDurationtype *
+ICalDurationType *
e_cal_component_period_get_duration (const ECalComponentPeriod *period)
{
g_return_val_if_fail (period != NULL, NULL);
@@ -344,9 +344,9 @@ e_cal_component_period_get_duration (const ECalComponentPeriod *period)
}
/**
- * e_cal_component_period_set_end:
+ * e_cal_component_period_set_duration:
* @period: an #ECalComponentPeriod
- * @duration: (not nullable): an #ICalDurationtype, the duration of the @period
+ * @duration: (not nullable): an #ICalDurationType, the duration of the @period
*
* Set the duration of the @period. This can be called only on @period
* objects of kind %E_CAL_COMPONENT_PERIOD_DURATION.
@@ -355,14 +355,14 @@ e_cal_component_period_get_duration (const ECalComponentPeriod *period)
**/
void
e_cal_component_period_set_duration (ECalComponentPeriod *period,
- const ICalDurationtype *duration)
+ const ICalDurationType *duration)
{
g_return_if_fail (period != NULL);
g_return_if_fail (period->kind == E_CAL_COMPONENT_PERIOD_DURATION);
- g_return_if_fail (I_CAL_IS_DURATIONTYPE (duration));
+ g_return_if_fail (I_CAL_IS_DURATION_TYPE (duration));
if (period->duration != duration) {
g_clear_object (&period->duration);
- period->duration = i_cal_duration_type_from_int (i_cal_duration_type_as_int
((ICalDurationtype *) duration);
+ period->duration = i_cal_duration_type_from_int (i_cal_duration_type_as_int
((ICalDurationType *) duration));
}
}
diff --git a/src/calendar/libecal/e-cal-component-period.h b/src/calendar/libecal/e-cal-component-period.h
index b47af9766..6ba8683e9 100644
--- a/src/calendar/libecal/e-cal-component-period.h
+++ b/src/calendar/libecal/e-cal-component-period.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_PERIOD_H
#define E_CAL_COMPONENT_PERIOD_H
-#include <glib.h>
+#include <glib-object.h>
#include <libical-glib/libical-glib.h>
#include <libecal/e-cal-enums.h>
@@ -45,7 +45,7 @@ ECalComponentPeriod *
ECalComponentPeriod *
e_cal_component_period_new_duration
(const ICalTimetype *start,
- const ICalDurationtype *duration);
+ const ICalDurationType *duration);
ECalComponentPeriod *
e_cal_component_period_copy (const ECalComponentPeriod *period);
void e_cal_component_period_free (gpointer period); /* ECalComponentPeriod * */
@@ -58,19 +58,19 @@ void e_cal_component_period_set_datetime_full
void e_cal_component_period_set_duration_full
(ECalComponentPeriod *period,
const ICalTimetype *start,
- const ICalDurationtype *duration);
+ const ICalDurationType *duration);
ICalTimetype * e_cal_component_period_get_start(const ECalComponentPeriod *period);
void e_cal_component_period_set_start(ECalComponentPeriod *period,
const ICalTimetype *start);
ICalTimetype * e_cal_component_period_get_end (const ECalComponentPeriod *period);
void e_cal_component_period_set_end (ECalComponentPeriod *period,
const ICalTimetype *end);
-ICalDurationtype *
+ICalDurationType *
e_cal_component_period_get_duration
(const ECalComponentPeriod *period);
void e_cal_component_period_set_duration
(ECalComponentPeriod *period,
- const ICalDurationtype *duration);
+ const ICalDurationType *duration);
G_END_DECLS
diff --git a/src/calendar/libecal/e-cal-component-range.c b/src/calendar/libecal/e-cal-component-range.c
index ba0acaae2..7003b1fa2 100644
--- a/src/calendar/libecal/e-cal-component-range.c
+++ b/src/calendar/libecal/e-cal-component-range.c
@@ -30,7 +30,7 @@
G_DEFINE_BOXED_TYPE (ECalComponentRange, e_cal_component_range, e_cal_component_range_copy,
e_cal_component_range_free)
-typedef struct _ECalComponentRange {
+struct _ECalComponentRange {
ECalComponentRangeKind kind;
ECalComponentDateTime *datetime;
};
diff --git a/src/calendar/libecal/e-cal-component-range.h b/src/calendar/libecal/e-cal-component-range.h
index 5d9bbf554..40a1b9863 100644
--- a/src/calendar/libecal/e-cal-component-range.h
+++ b/src/calendar/libecal/e-cal-component-range.h
@@ -23,7 +23,7 @@
#ifndef E_CAL_COMPONENT_RANGE_H
#define E_CAL_COMPONENT_RANGE_H
-#include <glib.h>
+#include <glib-object.h>
#include <libecal/e-cal-enums.h>
#include <libecal/e-cal-component-datetime.h>
diff --git a/src/calendar/libecal/e-cal-component-text.h b/src/calendar/libecal/e-cal-component-text.h
index 6bf74250f..44044f37e 100644
--- a/src/calendar/libecal/e-cal-component-text.h
+++ b/src/calendar/libecal/e-cal-component-text.h
@@ -23,11 +23,10 @@
#ifndef E_CAL_COMPONENT_TEXT_H
#define E_CAL_COMPONENT_TEXT_H
-#include <glib.h>
+#include <glib-object.h>
G_BEGIN_DECLS
-
/**
* ECalComponentText:
*
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 6a7dc423b..14ff3f809 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -75,7 +75,7 @@ free_icalcomponent (ECalComponent *comp,
}
static gboolean
-ecc_property_exists (ICalCompoennt *icalcomp,
+ecc_property_exists (ICalComponent *icalcomp,
ICalPropertyKind prop_kind)
{
ICalProperty *prop;
@@ -108,7 +108,7 @@ foreach_subcomponent (ICalComponent *icalcomp,
g_return_if_fail (func != NULL);
iter = i_cal_component_begin_component (icalcomp, comp_kind);
- subcomp = i_cal_comp_iter_deref (&iter);
+ subcomp = i_cal_comp_iter_deref (iter);
while (subcomp) {
if (!func (icalcomp, subcomp, user_data)) {
g_object_unref (subcomp);
@@ -131,12 +131,14 @@ foreach_property (ICalComponent *icalcomp,
gpointer user_data),
gpointer user_data)
{
+ ICalProperty *prop;
+
g_return_if_fail (func != NULL);
- for (prop = i_cal_component_get_first_property (icalcomp, kind);
+ for (prop = i_cal_component_get_first_property (icalcomp, prop_kind);
prop;
g_object_unref (prop), prop = i_cal_component_get_next_property (icalcomp, prop_kind)) {
- if (!func (icalcomp, prop, user_data)
+ if (!func (icalcomp, prop, user_data))
break;
}
}
@@ -222,7 +224,7 @@ set_text_altrep_on_prop (ICalProperty *prop,
g_return_if_fail (text != NULL);
altrep = e_cal_component_text_get_altrep (text);
- param = i_cal_property_get_first_param (prop, I_CAL_ALTREP_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_ALTREP_PARAMETER);
if (altrep && *altrep) {
if (param) {
@@ -324,7 +326,7 @@ e_cal_component_new_from_string (const gchar *calobj)
* Since: 3.4
**/
ECalComponent *
-e_cal_component_new_from_icalcomponent (icalcomponent *icalcomp)
+e_cal_component_new_from_icalcomponent (ICalComponent *icalcomp)
{
ECalComponent *comp;
@@ -618,19 +620,18 @@ e_cal_component_get_as_string (ECalComponent *comp)
}
/* Ensures that an alarm subcomponent has the mandatory properties it needs. */
-static gpointer
+static gboolean
ensure_alarm_properties_cb (ICalComponent *icalcomp,
ICalComponent *subcomp,
gpointer user_data)
{
- ECalComponent *comp = user_data;
ICalProperty *prop;
ICalPropertyAction action;
- const gchar *str;
+ const gchar *summary;
prop = i_cal_component_get_first_property (subcomp, I_CAL_ACTION_PROPERTY);
if (!prop)
- return;
+ return TRUE;
action = i_cal_property_get_action (prop);
@@ -638,8 +639,6 @@ ensure_alarm_properties_cb (ICalComponent *icalcomp,
switch (action) {
case I_CAL_ACTION_DISPLAY:
- const gchar *summary;
-
summary = i_cal_component_get_summary (icalcomp);
/* Ensure we have a DESCRIPTION property */
@@ -651,6 +650,8 @@ ensure_alarm_properties_cb (ICalComponent *icalcomp,
for (xprop = i_cal_component_get_first_property (subcomp, I_CAL_X_PROPERTY);
xprop;
g_object_unref (xprop), xprop = i_cal_component_get_next_property
(subcomp, I_CAL_X_PROPERTY)) {
+ const gchar *str;
+
str = i_cal_property_get_x_name (xprop);
if (!g_strcmp0 (str, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
i_cal_property_set_description (prop, summary);
@@ -685,6 +686,8 @@ ensure_alarm_properties_cb (ICalComponent *icalcomp,
default:
break;
}
+
+ return TRUE;
}
/**
@@ -760,16 +763,12 @@ e_cal_component_abort_sequence (ECalComponent *comp)
ECalComponentId *
e_cal_component_get_id (ECalComponent *comp)
{
- ECalComponentId *id;
-
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
- id = g_new0 (ECalComponentId, 1);
- id->uid = g_strdup (i_cal_component_get_uid (comp->priv->icalcomp));
- id->rid = e_cal_component_get_recurid_as_string (comp);
-
- return id;
+ return e_cal_component_id_new_take (
+ g_strdup (i_cal_component_get_uid (comp->priv->icalcomp)),
+ e_cal_component_get_recurid_as_string (comp));
}
/**
@@ -820,7 +819,7 @@ get_attachments_cb (ICalComponent *icalcomp,
attach = i_cal_property_get_attach (prop);
if (attach)
- *attaches = g_slist_prepend (*attaches, attach);
+ *pattaches = g_slist_prepend (*pattaches, attach);
return TRUE;
}
@@ -850,7 +849,7 @@ e_cal_component_get_attachments (ECalComponent *comp)
}
/**
- * e_cal_component_get_attachments:
+ * e_cal_component_set_attachments:
* @comp: A calendar component object
* @attachments: (nullable) (element-type ICalAttach): a #GSList of an #ICalAttach,
* or %NULL to remove any existing
@@ -1070,15 +1069,18 @@ e_cal_component_set_categories_list (ECalComponent *comp,
ECalComponentClassification
e_cal_component_get_classification (ECalComponent *comp)
{
+ ICalProperty *prop;
ECalComponentClassification classif;
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_CAL_COMPONENT_CLASS_UNKNOWN);
g_return_val_if_fail (comp->priv->icalcomp != NULL, E_CAL_COMPONENT_CLASS_UNKNOWN);
- if (!comp->priv->classification)
+ prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_CLASS_PROPERTY);
+
+ if (!prop)
return E_CAL_COMPONENT_CLASS_NONE;
- switch (i_cal_property_get_class (comp->priv->classification)) {
+ switch (i_cal_property_get_class (prop)) {
case I_CAL_CLASS_PUBLIC:
classif = E_CAL_COMPONENT_CLASS_PUBLIC;
break;
@@ -1093,6 +1095,8 @@ e_cal_component_get_classification (ECalComponent *comp)
break;
}
+ g_object_unref (prop);
+
return classif;
}
@@ -1108,16 +1112,19 @@ void
e_cal_component_set_classification (ECalComponent *comp,
ECalComponentClassification classif)
{
- ICalPropertyClass prop_class;
+ ICalProperty_Class prop_class;
+ ICalProperty *prop;
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
g_return_if_fail (classif != E_CAL_COMPONENT_CLASS_UNKNOWN);
g_return_if_fail (comp->priv->icalcomp != NULL);
+ prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_CLASS_PROPERTY);
+
if (classif == E_CAL_COMPONENT_CLASS_NONE) {
- if (comp->priv->classification) {
- i_cal_component_remove_property (comp->priv->icalcomp, comp->priv->classification);
- g_clear_object (&comp->priv->classification);
+ if (prop) {
+ i_cal_component_remove_property (comp->priv->icalcomp, prop);
+ g_object_unref (prop);
}
return;
@@ -1142,11 +1149,12 @@ e_cal_component_set_classification (ECalComponent *comp,
break;
}
- if (comp->priv->classification) {
- i_cal_property_set_class (comp->priv->classification, prop_class);
+ if (prop) {
+ i_cal_property_set_class (prop, prop_class);
+ g_object_unref (prop);
} else {
- comp->priv->classification = i_cal_property_new_class (prop_class);
- i_cal_component_add_property (comp->priv->icalcomp, comp->priv->classification);
+ prop = i_cal_property_new_class (prop_class);
+ i_cal_component_take_property (comp->priv->icalcomp, prop);
}
}
@@ -1253,18 +1261,17 @@ e_cal_component_set_comment_list (ECalComponent *comp,
/**
* e_cal_component_get_contact_list:
* @comp: A calendar component object.
- * @text_list: (out) (transfer full) (element-type ECalComponentText): Return
- * value for the contact properties and their parameters, as a list of
- * #ECalComponentText structures.
*
* Queries the contact of a calendar component object. The contact property can
* appear several times inside a calendar component, and so a list of
* #ECalComponentText is returned. Free the returned #GSList with
* g_slist_free_full (slist, e_cal_component_text_free);, when no longer needed.
+ *
+ * Returns: (transfer full) (element-type ECalComponentText): the contact properties and
+ * their parameters, as a #GSList of #ECalComponentText structures.
**/
-void
-e_cal_component_get_contact_list (ECalComponent *comp,
- GSList **text_list)
+GSList *
+e_cal_component_get_contact_list (ECalComponent *comp)
{
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
@@ -1334,9 +1341,9 @@ set_icaltimetype (ICalComponent *icalcomp,
}
if (prop) {
- prop_set_func (prop, tt);
+ prop_set_func (prop, (ICalTimetype *) tt);
} else {
- prop = prop_new_func (tt);
+ prop = prop_new_func ((ICalTimetype *) tt);
i_cal_component_take_property (icalcomp, prop);
}
}
@@ -1376,7 +1383,7 @@ e_cal_component_set_completed (ECalComponent *comp,
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
g_return_if_fail (comp->priv->icalcomp != NULL);
- if (tt && tt->is_date) {
+ if (tt && i_cal_timetype_get_is_date ((ICalTimetype *) tt)) {
tmp_tt = i_cal_timetype_new_clone (tt);
tt = tmp_tt;
@@ -1500,8 +1507,8 @@ get_datetime (ICalComponent *icalcomp,
/* If the ICalTimetype has is_utc set, we set "UTC" as the TZID.
* This makes the timezone code simpler. */
if (param)
- tzid = i_cal_parameter_get_tzid (param));
- else if (value && i_cal_timetype_is_utc (value))
+ tzid = g_strdup (i_cal_parameter_get_tzid (param));
+ else if (i_cal_timetype_is_utc (value))
tzid = g_strdup ("UTC");
else
tzid = NULL;
@@ -1584,7 +1591,7 @@ e_cal_component_get_start_plus_duration (ECalComponent *comp)
{
ICalDurationType *duration;
ICalTimetype *tt;
- ECalCoponentDateTime *dt;
+ ECalComponentDateTime *dt;
guint dur_days, dur_hours, dur_minutes, dur_seconds;
duration = i_cal_component_get_duration (comp->priv->icalcomp);
@@ -1595,7 +1602,7 @@ e_cal_component_get_start_plus_duration (ECalComponent *comp)
dt = get_datetime (comp->priv->icalcomp, I_CAL_DTSTART_PROPERTY, i_cal_property_get_dtstart);
if (!dt) {
g_object_unref (duration);
- return;
+ return NULL;
}
/* The DURATION shouldn't be negative, but just return DTSTART if it
@@ -1611,7 +1618,7 @@ e_cal_component_get_start_plus_duration (ECalComponent *comp)
dur_days = i_cal_duration_type_get_days (duration) + (7 * i_cal_duration_type_get_weeks (duration));
dur_hours = i_cal_duration_type_get_hours (duration);
dur_minutes = i_cal_duration_type_get_minutes (duration);
- dur_seconds = i_cal_duration_type_get_seconds (duration)
+ dur_seconds = i_cal_duration_type_get_seconds (duration);
tt = e_cal_component_datetime_get_value (dt);
if (i_cal_timetype_get_is_date (tt) && (
@@ -1643,10 +1650,10 @@ e_cal_component_get_dtend (ECalComponent *comp)
{
ECalComponentDateTime *dt;
- g_return_val_if_fail (E_IS_CAL_COMPONENT (comp));
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
- dt = get_datetime (comp->priv->icalcomp, I_CAl_DTEND_PROPERTY, i_cal_property_get_dtend);
+ dt = get_datetime (comp->priv->icalcomp, I_CAL_DTEND_PROPERTY, i_cal_property_get_dtend);
/* If we don't have a DTEND property, then we try to get DTSTART
* + DURATION. */
@@ -1667,8 +1674,6 @@ void
e_cal_component_set_dtend (ECalComponent *comp,
const ECalComponentDateTime *dt)
{
- ICalProperty *prop;
-
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
g_return_if_fail (comp->priv->icalcomp != NULL);
@@ -1721,7 +1726,7 @@ e_cal_component_get_dtstamp (ECalComponent *comp)
/**
* e_cal_component_set_dtstamp:
* @comp: A calendar component object.
- * @t: Date/timestamp value.
+ * @tt: Date/timestamp value.
*
* Sets the date/timestamp of a calendar component object. This should be
* called whenever a calendar user agent makes a change to a component's
@@ -1742,7 +1747,7 @@ e_cal_component_set_dtstamp (ECalComponent *comp,
/* This MUST exist, since we ensured that it did */
g_return_if_fail (prop != NULL);
- i_cal_property_set_dtstamp (prop, tt);
+ i_cal_property_set_dtstamp (prop, (ICalTimetype *) tt);
g_clear_object (&prop);
}
@@ -1785,14 +1790,12 @@ e_cal_component_set_dtstart (ECalComponent *comp,
i_cal_property_set_dtstart,
dt);
- priv->need_sequence_inc = TRUE;
+ comp->priv->need_sequence_inc = TRUE;
}
/**
* e_cal_component_get_due:
* @comp: A calendar component object.
- * @dt: (out): Return value for the due date/time. This should be freed with the
- * e_cal_component_free_datetime() function.
*
* Queries the due date/time of a calendar component object. In case there's no DUE,
* but only DTSTART and DURATION, then the due is computed from the later two.
@@ -1856,8 +1859,7 @@ e_cal_component_set_due (ECalComponent *comp,
static GSList * /* ECalComponentPeriod * */
get_period_list (ICalComponent *icalcomp,
ICalPropertyKind prop_kind,
- ICalDatetimeperiodType (* get_prop_func) (ICalProperty *prop),
- const GSList **list)
+ ICalDatetimeperiodType * (* get_prop_func) (ICalProperty *prop))
{
GSList *props, *link, *periods = NULL;
@@ -1868,7 +1870,7 @@ get_period_list (ICalComponent *icalcomp,
ICalParameter *param;
ICalPeriodType *icalperiod;
ICalDatetimeperiodType *pt;
- ICalDurationtype *duration = NULL;
+ ICalDurationType *duration = NULL;
ICalTimetype *start = NULL, *end = NULL;
ECalComponentPeriod *period;
ECalComponentPeriodKind period_kind;
@@ -1899,8 +1901,8 @@ get_period_list (ICalComponent *icalcomp,
duration = i_cal_period_type_get_duration (icalperiod);
if (!duration ||
- i_cal_durationtype_is_null_duration (duration) ||
- i_cal_durationtype_is_bad_duration (duration))
+ i_cal_duration_type_is_null_duration (duration) ||
+ i_cal_duration_type_is_bad_duration (duration))
period_kind = E_CAL_COMPONENT_PERIOD_DATETIME;
else
period_kind = E_CAL_COMPONENT_PERIOD_DURATION;
@@ -1963,7 +1965,7 @@ set_period_list (ICalComponent *icalcomp,
ICalPeriodType *ic_period;
ICalProperty *prop;
ICalParameter *param;
- ICalParameterValue value_type = I_CAL_VALUE_UNKNOWN;
+ ICalParameterValue value_type = I_CAL_VALUE_NONE;
if (!period)
continue;
@@ -1979,7 +1981,7 @@ set_period_list (ICalComponent *icalcomp,
break;
case E_CAL_COMPONENT_PERIOD_DURATION:
value_type = I_CAL_VALUE_DURATION;
- i_cal_period_type_set_duration (ic_period, e_cal_component_period_get_end (duration));
+ i_cal_period_type_set_duration (ic_period, e_cal_component_period_get_duration
(period));
}
ic_datetimeperiod = i_cal_datetimeperiod_type_new ();
@@ -2102,7 +2104,7 @@ e_cal_component_set_exdate_list (ECalComponent *comp,
i_cal_component_take_property (comp->priv->icalcomp, prop);
}
- priv->need_sequence_inc = TRUE;
+ comp->priv->need_sequence_inc = TRUE;
}
/**
@@ -2138,7 +2140,7 @@ get_recur_list (ICalComponent *icalcomp,
ICalRecurrenceType *rt;
rt = get_prop_func (prop);
- if (rc)
+ if (rt)
recurs = g_slist_prepend (recurs, rt);
}
@@ -2166,11 +2168,11 @@ set_recur_list (ICalComponent *icalcomp,
for (link = (GSList *) rl; link; link = g_slist_next (link)) {
ICalProperty *prop;
- ICalRecurrenceType *recur = l->data;
+ ICalRecurrenceType *recur = link->data;
if (recur) {
prop = (* new_prop_func) (recur);
- i_cal_component_take_property (comp->priv->icalcomp, prop);
+ i_cal_component_take_property (icalcomp, prop);
}
}
}
@@ -2207,8 +2209,7 @@ e_cal_component_get_exrule_list (ECalComponent *comp)
* rule properties
**/
GSList *
-e_cal_component_get_exrule_property_list (ECalComponent *comp,
- GSList **recur_list)
+e_cal_component_get_exrule_property_list (ECalComponent *comp)
{
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
@@ -2219,7 +2220,7 @@ e_cal_component_get_exrule_property_list (ECalComponent *comp,
/**
* e_cal_component_set_exrule_list:
* @comp: A calendar component object.
- * @recur_list: (nullable): (element-type ICalRecurrenceType): a #GSList
+ * @recur_list: (nullable) (element-type ICalRecurrenceType): a #GSList
* of #ICalRecurrenceType structures, or %NULL.
*
* Sets the list of exception rules in a calendar component object.
@@ -2233,7 +2234,7 @@ e_cal_component_set_exrule_list (ECalComponent *comp,
set_recur_list (comp->priv->icalcomp, I_CAL_EXRULE_PROPERTY, i_cal_property_new_exrule, recur_list);
- priv->need_sequence_inc = TRUE;
+ comp->priv->need_sequence_inc = TRUE;
}
/**
@@ -2328,9 +2329,9 @@ e_cal_component_set_geo (ECalComponent *comp,
}
if (prop) {
- i_cal_property_set_geo (prop, geo);
+ i_cal_property_set_geo (prop, (ICalGeoType *) geo);
} else {
- prop = i_cal_property_new_geo (geo);
+ prop = i_cal_property_new_geo ((ICalGeoType *) geo);
i_cal_component_add_property (comp->priv->icalcomp, prop);
}
@@ -2475,8 +2476,8 @@ e_cal_component_get_percent_complete (ECalComponent *comp)
ICalProperty *prop;
gint percent;
- g_return_if_fail (E_IS_CAL_COMPONENT (comp), -1);
- g_return_if_fail (comp->priv->icalcomp != NULL, -1);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), -1);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, -1);
prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY);
if (!prop)
@@ -2535,7 +2536,7 @@ e_cal_component_set_percent_complete (ECalComponent *comp,
*
* Queries the priority property of a calendar component object.
*
- * @priority: the priority property value, or -1 if not found
+ * Returns: the priority property value, or -1, if not found
**/
gint
e_cal_component_get_priority (ECalComponent *comp)
@@ -2543,8 +2544,8 @@ e_cal_component_get_priority (ECalComponent *comp)
ICalProperty *prop;
gint priority;
- g_return_if_fail (E_IS_CAL_COMPONENT (comp), -1);
- g_return_if_fail (comp->priv->icalcomp != NULL, -1);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), -1);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, -1);
prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_PRIORITY_PROPERTY);
if (!prop)
@@ -2609,13 +2610,11 @@ e_cal_component_set_priority (ECalComponent *comp,
ECalComponentRange *
e_cal_component_get_recurid (ECalComponent *comp)
{
- ECalComponentDatetime *dt;
+ ECalComponentDateTime *dt;
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
- recur_id->type = E_CAL_COMPONENT_RANGE_SINGLE;
-
dt = get_datetime (comp->priv->icalcomp, I_CAL_RECURRENCEID_PROPERTY,
i_cal_property_get_recurrenceid);
if (!dt)
@@ -2647,9 +2646,9 @@ e_cal_component_get_recurid_as_string (ECalComponent *comp)
if (range)
dt = e_cal_component_range_get_datetime (range);
if (dt)
- ii = e_cal_component_datetime_get_value (dt);
+ tt = e_cal_component_datetime_get_value (dt);
- if (!range || !dt || !itt) {
+ if (!range || !dt || !tt) {
e_cal_component_range_free (range);
return g_strdup ("0");
}
@@ -2725,7 +2724,7 @@ e_cal_component_set_rdate_list (ECalComponent *comp,
set_period_list (comp->priv->icalcomp, I_CAL_RDATE_PROPERTY, i_cal_property_new_rdate, rdate_list);
- priv->need_sequence_inc = TRUE;
+ comp->priv->need_sequence_inc = TRUE;
}
/**
@@ -2802,7 +2801,7 @@ e_cal_component_set_rrule_list (ECalComponent *comp,
set_recur_list (comp->priv->icalcomp, I_CAL_RRULE_PROPERTY, i_cal_property_new_rrule, recur_list);
- priv->need_sequence_inc = TRUE;
+ comp->priv->need_sequence_inc = TRUE;
}
/**
@@ -2841,21 +2840,21 @@ e_cal_component_has_recurrences (ECalComponent *comp)
/* Counts the elements in the by_xxx fields of an ICalRecurrenceType;
it also frees the 'field' array*/
static gint
-count_by_xxx (GArray *field) /* gshort */
+count_by_xxx_and_free (GArray *field) /* gshort */
{
gint ii;
if (!field)
- return 0
+ return 0;
for (ii = 0; ii < field->len; ii++) {
if (g_array_index (field, gshort, ii) == I_CAL_RECURRENCE_ARRAY_MAX)
break;
}
- g_array_unref (array);
+ g_array_unref (field);
- return i;
+ return ii;
}
/**
@@ -2871,7 +2870,6 @@ gboolean
e_cal_component_has_simple_recurrence (ECalComponent *comp)
{
GSList *rrule_list;
- GArray *array;
ICalRecurrenceType *rt;
gint n_by_second, n_by_minute, n_by_hour;
gint n_by_day, n_by_month_day, n_by_year_day;
@@ -2899,7 +2897,7 @@ e_cal_component_has_simple_recurrence (ECalComponent *comp)
goto cleanup;
/* Any funky BY_* */
-#define N_HAS_BY(field) (count_by_xxx (field, G_N_ELEMENTS (field)))
+#define N_HAS_BY(field) (count_by_xxx_and_free (field))
n_by_second = N_HAS_BY (i_cal_recurrence_type_get_by_second_array (rt));
n_by_minute = N_HAS_BY (i_cal_recurrence_type_get_by_minute_array (rt));
@@ -2937,7 +2935,6 @@ e_cal_component_has_simple_recurrence (ECalComponent *comp)
|| n_by_set_pos != 0)
goto cleanup;
- array = i_cal_recurrence_type_get_by_day (rt);
for (i = 0; i < 8; i++) {
gint pos;
gshort byday = i_cal_recurrence_type_get_by_day (rt, i);
@@ -2947,14 +2944,10 @@ e_cal_component_has_simple_recurrence (ECalComponent *comp)
pos = i_cal_recurrence_type_day_position (byday);
- if (pos != 0) {
- g_array_unref (array);
+ if (pos != 0)
goto cleanup;
- }
}
- g_array_unref (array);
-
simple = TRUE;
break;
@@ -3050,7 +3043,7 @@ e_cal_component_is_instance (ECalComponent *comp)
{
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
- return return ecc_property_exists (comp->priv->icalcomp, I_CAL_RECURRENCEID_PROPERTY);
+ return ecc_property_exists (comp->priv->icalcomp, I_CAL_RECURRENCEID_PROPERTY);
}
/**
@@ -3134,7 +3127,7 @@ e_cal_component_get_status (ECalComponent *comp)
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), I_CAL_STATUS_NONE);
g_return_val_if_fail (comp->priv->icalcomp != NULL, I_CAL_STATUS_NONE);
- prop = i_cal_component_get_fist_property (comp->priv->icalcomp, I_CAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_STATUS_PROPERTY);
if (!prop)
return I_CAL_STATUS_NONE;
@@ -3164,7 +3157,7 @@ e_cal_component_set_status (ECalComponent *comp,
comp->priv->need_sequence_inc = TRUE;
- prop = i_cal_component_get_fist_property (comp->priv->icalcomp, I_CAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_STATUS_PROPERTY);
if (status == I_CAL_STATUS_NONE) {
if (prop) {
@@ -3201,8 +3194,8 @@ e_cal_component_get_summary (ECalComponent *comp)
ECalComponentText *text;
ICalProperty *prop;
- g_return_val_if_fail (E_IS_CAL_COMPONENT (comp));
- g_return_val_if_fail (comp->priv->icalcomp != NULL);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_SUMMARY_PROPERTY);
if (!prop)
@@ -3220,22 +3213,20 @@ typedef struct {
const gchar *new_summary;
} SetAlarmDescriptionData;
-static void
-set_alarm_description_cb (gpointer key,
- gpointer value,
- gpointer user_data)
+static gboolean
+set_alarm_description_cb (ICalComponent *icalcomp,
+ ICalComponent *subcomp,
+ gpointer user_data)
{
- ICalComponent *alarm;
ICalProperty *icalprop, *desc_prop;
- SetAlarmDescriptionData *sadd;
+ SetAlarmDescriptionData *sadd = user_data;
gboolean changed = FALSE;
const gchar *old_summary = NULL;
- alarm = value;
- sadd = user_data;
+ g_return_val_if_fail (sadd != NULL, FALSE);
/* set the new description on the alarm */
- desc_prop = i_cal_component_get_first_property (alarm, I_CAL_DESCRIPTION_PROPERTY);
+ desc_prop = i_cal_component_get_first_property (subcomp, I_CAL_DESCRIPTION_PROPERTY);
if (desc_prop) {
old_summary = i_cal_property_get_description (desc_prop);
} else {
@@ -3243,13 +3234,13 @@ set_alarm_description_cb (gpointer key,
}
/* remove the X-EVOLUTION-NEEDS_DESCRIPTION property */
- icalprop = i_cal_component_get_first_property (alarm, I_CAL_X_PROPERTY);
+ icalprop = i_cal_component_get_first_property (subcomp, I_CAL_X_PROPERTY);
while (icalprop) {
const gchar *x_name;
x_name = i_cal_property_get_x_name (icalprop);
if (!g_strcmp0 (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
- i_cal_component_remove_property (alarm, icalprop);
+ i_cal_component_remove_property (subcomp, icalprop);
g_object_unref (icalprop);
i_cal_property_set_description (desc_prop, sadd->new_summary);
@@ -3258,7 +3249,7 @@ set_alarm_description_cb (gpointer key,
}
g_object_unref (icalprop);
- icalprop = i_cal_component_get_next_property (alarm, I_CAL_X_PROPERTY);
+ icalprop = i_cal_component_get_next_property (subcomp, I_CAL_X_PROPERTY);
}
if (!changed) {
@@ -3268,6 +3259,8 @@ set_alarm_description_cb (gpointer key,
}
g_object_unref (desc_prop);
+
+ return TRUE;
}
/**
@@ -3320,7 +3313,8 @@ e_cal_component_set_summary (ECalComponent *comp,
/* look for alarms that need a description */
sadd.new_summary = e_cal_component_text_get_value (summary);
- g_hash_table_foreach (comp->priv->alarm_uid_hash, set_alarm_description_cb, &sadd);
+
+ foreach_subcomponent (comp->priv->icalcomp, I_CAL_VALARM_COMPONENT, set_alarm_description_cb, &sadd);
g_free (sadd.old_summary);
}
@@ -3340,8 +3334,8 @@ e_cal_component_get_transparency (ECalComponent *comp)
ECalComponentTransparency transp;
ICalProperty *prop;
- g_return_if_fail (E_IS_CAL_COMPONENT (comp), E_CAL_COMPONENT_TRANSP_NONE);
- g_return_if_fail (comp->priv->icalcomp != NULL, E_CAL_COMPONENT_TRANSP_NONE);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_CAL_COMPONENT_TRANSP_NONE);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, E_CAL_COMPONENT_TRANSP_NONE);
prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_TRANSP_PROPERTY);
@@ -3524,11 +3518,10 @@ e_cal_component_get_attendee_list (ECalComponent *comp)
{
GSList *attendees = NULL;
- g_return_val_if_fail (E_IS_CAL_COMPONENT (comp));
- g_return_val_if_fail (comp->priv->icalcomp != NULL);
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
- foreach_property (comp->priv->icalcomp, I_CAL_ATTENDEE_PROPERTY,
- get_attendee_list_cb, &attendees);
+ foreach_property (comp->priv->icalcomp, I_CAL_ATTENDEE_PROPERTY, get_attendee_list_cb, &attendees);
return g_slist_reverse (attendees);
}
@@ -3605,7 +3598,7 @@ e_cal_component_get_location (ECalComponent *comp)
if (!prop)
return NULL;
- location = g_strdup (i_cal_property_get_location (prop);
+ location = g_strdup (i_cal_property_get_location (prop));
g_object_unref (prop);
@@ -3734,7 +3727,7 @@ e_cal_component_add_alarm (ECalComponent *comp,
for (link = existing_uids; link; link = g_slist_next (link)) {
const gchar *existing_auid = link->data;
- if (g_strcmp0 (auid, exisitng_auid) == 0)
+ if (g_strcmp0 (auid, existing_auid) == 0)
break;
}
@@ -3902,7 +3895,7 @@ ECalComponentAlarm *
e_cal_component_get_alarm (ECalComponent *comp,
const gchar *auid)
{
- ECalComponentAlarm *alarm;
+ ECalComponentAlarm *alarm = NULL;
struct GetAlarmData gad;
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
@@ -3916,12 +3909,55 @@ e_cal_component_get_alarm (ECalComponent *comp,
if (gad.valarm) {
alarm = e_cal_component_alarm_new_from_component (gad.valarm);
- g_object_unref (valarm);
+ g_object_unref (gad.valarm);
}
return alarm;
}
+static gboolean
+get_all_alarms_cb (ICalComponent *icalcomp,
+ ICalComponent *subcomp,
+ gpointer user_data)
+{
+ GSList **palarms = user_data;
+ ECalComponentAlarm *alarm;
+
+ g_return_val_if_fail (palarms != NULL, FALSE);
+
+ alarm = e_cal_component_alarm_new_from_component (subcomp);
+ if (alarm)
+ *palarms = g_slist_prepend (*palarms, alarm);
+
+ return TRUE;
+}
+
+/**
+ * e_cal_component_get_all_alarms:
+ * @comp: A calendar component.
+ *
+ * Queries all alarm subcomponents of a calendar component.
+ * Free the returned #GSList with g_slist_free_full (slist, e_cal_component_alarm_free));,
+ * when no longer needed.
+ *
+ * Returns: (transfer full) (nullable) (element-type ECalComponentAlarm): the alarm subcomponents
+ * as a #GSList of #ECalComponentAlarm, or %NULL, if no alarm exists
+ *
+ * Since: 3.36
+ **/
+GSList *
+e_cal_component_get_all_alarms (ECalComponent *comp)
+{
+ GSList *alarms = NULL;
+
+ g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
+ g_return_val_if_fail (comp->priv->icalcomp != NULL, NULL);
+
+ foreach_subcomponent (comp->priv->icalcomp, I_CAL_VALARM_COMPONENT, get_all_alarms_cb, &alarms);
+
+ return g_slist_reverse (alarms);
+}
+
/**
* e_cal_component_event_dates_match:
* @comp1: A calendar component object.
diff --git a/src/calendar/libecal/e-cal-component.h b/src/calendar/libecal/e-cal-component.h
index 60709841f..705f8fe0d 100644
--- a/src/calendar/libecal/e-cal-component.h
+++ b/src/calendar/libecal/e-cal-component.h
@@ -168,13 +168,12 @@ ECalComponentDateTime *
void e_cal_component_set_dtstart (ECalComponent *comp,
const ECalComponentDateTime *dt);
-ECalComponentDateTime *dt
+ECalComponentDateTime *
e_cal_component_get_due (ECalComponent *comp);
void e_cal_component_set_due (ECalComponent *comp,
const ECalComponentDateTime *dt);
-GSList * e_cal_component_get_exdate_list (ECalComponent *comp, /* ECalComponentDateTime * */
- GSList **exdate_list);
+GSList * e_cal_component_get_exdate_list (ECalComponent *comp); /* ECalComponentDateTime * */
void e_cal_component_set_exdate_list (ECalComponent *comp,
const GSList *exdate_list); /* ECalComponentDateTime * */
gboolean e_cal_component_has_exdates (ECalComponent *comp);
@@ -247,10 +246,10 @@ ICalPropertyStatus
void e_cal_component_set_status (ECalComponent *comp,
ICalPropertyStatus status);
-void e_cal_component_get_summary (ECalComponent *comp,
- ECalComponentText *summary);
+ECalComponentText *
+ e_cal_component_get_summary (ECalComponent *comp);
void e_cal_component_set_summary (ECalComponent *comp,
- ECalComponentText *summary);
+ const ECalComponentText *summary);
ECalComponentTransparency
e_cal_component_get_transparency(ECalComponent *comp);
@@ -278,10 +277,6 @@ void e_cal_component_set_attachments (ECalComponent *comp,
const GSList *attachments); /* ICalAttach * */
gboolean e_cal_component_has_attachments (ECalComponent *comp);
-gboolean e_cal_component_event_dates_match
- (ECalComponent *comp1,
- ECalComponent *comp2);
-
/* Alarms */
gboolean e_cal_component_has_alarms (ECalComponent *comp);
void e_cal_component_add_alarm (ECalComponent *comp,
@@ -297,6 +292,10 @@ ECalComponentAlarm *
const gchar *auid);
GSList * e_cal_component_get_all_alarms (ECalComponent *comp);
+gboolean e_cal_component_event_dates_match
+ (ECalComponent *comp1,
+ ECalComponent *comp2);
+
G_END_DECLS
#endif /* E_CAL_COMPONENT_H */
diff --git a/src/calendar/libecal/e-cal-util.h b/src/calendar/libecal/e-cal-util.h
index 6f41853ad..57d842029 100644
--- a/src/calendar/libecal/e-cal-util.h
+++ b/src/calendar/libecal/e-cal-util.h
@@ -28,7 +28,7 @@
#include <time.h>
#include <libecal/e-cal-component.h>
#include <libecal/e-cal-recur.h>
-#include <libecal/e-cal-types.h>
+#include <libecal/e-cal-enums.h>
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]