[evolution/wip/mcrha/eds-libical-glib] More changes in src/calendar/ and related code
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/eds-libical-glib] More changes in src/calendar/ and related code
- Date: Wed, 20 Mar 2019 11:47:04 +0000 (UTC)
commit 4770f96f97ba12f72c666b6ba4e4cbd12c9c3753
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 20 12:47:35 2019 +0100
More changes in src/calendar/ and related code
src/calendar/gui/calendar-config.c | 23 +-
src/calendar/gui/calendar-config.h | 2 +-
src/calendar/gui/comp-util.c | 749 +++++++++++-----------
src/calendar/gui/comp-util.h | 70 +-
src/calendar/gui/e-cal-component-preview.h | 2 +-
src/calendar/gui/e-cal-data-model.h | 4 +-
src/calendar/gui/e-cal-dialogs.h | 4 +-
src/calendar/gui/e-cal-model.c | 4 +-
src/calendar/gui/e-cal-model.h | 4 +-
src/calendar/gui/e-cal-ops.h | 16 +-
src/calendar/gui/e-calendar-view.c | 101 ++-
src/calendar/gui/e-calendar-view.h | 23 +-
src/calendar/gui/e-cell-date-edit-text.h | 4 +-
src/calendar/gui/e-comp-editor-page-attachments.c | 2 +-
src/calendar/gui/e-comp-editor-page-general.c | 4 +-
src/calendar/gui/e-comp-editor-page-recurrence.c | 20 +-
src/calendar/gui/e-comp-editor-page.h | 8 +-
src/calendar/gui/e-comp-editor-property-part.h | 70 +-
src/calendar/gui/e-comp-editor.h | 16 +-
src/calendar/gui/e-date-time-list.h | 12 +-
src/calendar/gui/e-day-view-time-item.h | 2 +-
src/calendar/gui/e-day-view.c | 8 +-
src/calendar/gui/e-meeting-attendee.h | 12 +-
src/calendar/gui/e-meeting-store.h | 4 +-
src/calendar/gui/e-memo-table.c | 21 +-
src/calendar/gui/e-memo-table.h | 6 +-
src/calendar/gui/e-send-options-utils.h | 2 +-
src/calendar/gui/e-task-table.c | 20 +-
src/calendar/gui/e-task-table.h | 2 +-
src/calendar/gui/e-week-view.c | 45 +-
src/calendar/gui/itip-utils.c | 48 +-
src/calendar/gui/itip-utils.h | 10 +-
src/calendar/gui/print.h | 2 +-
src/calendar/gui/tag-calendar.c | 8 +-
src/calendar/gui/tag-calendar.h | 2 +-
src/calendar/importers/icalendar-importer.c | 508 ++++++++-------
src/modules/calendar/e-cal-shell-view-actions.c | 2 +-
src/modules/calendar/e-cal-shell-view-memopad.c | 2 +-
src/modules/calendar/e-cal-shell-view-taskpad.c | 2 +-
src/modules/calendar/e-memo-shell-view-actions.c | 2 +-
src/modules/calendar/e-task-shell-view-actions.c | 2 +-
src/modules/itip-formatter/itip-view.c | 12 +-
src/plugins/publish-calendar/publish-format-fb.c | 2 +-
src/plugins/save-calendar/csv-format.c | 2 +-
src/plugins/save-calendar/rdf-format.c | 2 +-
45 files changed, 970 insertions(+), 896 deletions(-)
---
diff --git a/src/calendar/gui/calendar-config.c b/src/calendar/gui/calendar-config.c
index 84811a25bf..40d94384de 100644
--- a/src/calendar/gui/calendar-config.c
+++ b/src/calendar/gui/calendar-config.c
@@ -113,17 +113,17 @@ calendar_config_get_timezone (void)
return calendar_config_get_timezone_stored ();
}
-icaltimezone *
+ICalTimezone *
calendar_config_get_icaltimezone (void)
{
gchar *location;
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
calendar_config_init ();
location = calendar_config_get_timezone ();
if (location) {
- zone = icaltimezone_get_builtin_timezone (location);
+ zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location);
}
@@ -228,30 +228,33 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
sexp = g_strdup ("(is-completed?)");
} else {
gchar *isodate;
- icaltimezone *zone;
- struct icaltimetype tt;
+ ICalTimezone *zone;
+ ICalTimetype *tt;
time_t t;
/* Get the current time, and subtract the appropriate
* number of days/hours/minutes. */
zone = calendar_config_get_icaltimezone ();
- tt = icaltime_current_time_with_zone (zone);
+ tt = i_cal_time_current_time_with_zone (zone);
switch (units) {
case E_DURATION_DAYS:
- icaltime_adjust (&tt, -value, 0, 0, 0);
+ i_cal_time_adjust (tt, -value, 0, 0, 0);
break;
case E_DURATION_HOURS:
- icaltime_adjust (&tt, 0, -value, 0, 0);
+ i_cal_time_adjust (tt, 0, -value, 0, 0);
break;
case E_DURATION_MINUTES:
- icaltime_adjust (&tt, 0, 0, -value, 0);
+ i_cal_time_adjust (tt, 0, 0, -value, 0);
break;
default:
+ g_clear_object (&tt);
g_return_val_if_reached (NULL);
}
- t = icaltime_as_timet_with_zone (tt, zone);
+ t = i_cal_time_as_timet_with_zone (tt, zone);
+
+ g_clear_object (&tt);
/* Convert the time to an ISO date string, and build
* the query sub-expression. */
diff --git a/src/calendar/gui/calendar-config.h b/src/calendar/gui/calendar-config.h
index b71aa92fa0..2df088c538 100644
--- a/src/calendar/gui/calendar-config.h
+++ b/src/calendar/gui/calendar-config.h
@@ -47,7 +47,7 @@ void calendar_config_remove_notification (CalendarConfigChangedFunc func, gpoint
*/
/* The current timezone, e.g. "Europe/London". */
-icaltimezone *calendar_config_get_icaltimezone (void);
+ICalTimezone *calendar_config_get_icaltimezone (void);
/* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean calendar_config_get_24_hour_format (void);
diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c
index e66eaf37c2..09487e5b60 100644
--- a/src/calendar/gui/comp-util.c
+++ b/src/calendar/gui/comp-util.c
@@ -39,38 +39,38 @@
/**
* cal_comp_util_add_exdate:
* @comp: A calendar component object.
- * @itt: Time for the exception.
+ * @t: Time for the exception.
+ * @zone: an #ICalTimezone
*
* Adds an exception date to the current list of EXDATE properties in a calendar
* component object.
**/
void
cal_comp_util_add_exdate (ECalComponent *comp,
- time_t t,
- icaltimezone *zone)
+ time_t t,
+ ICalTimezone *zone)
{
- GSList *list;
+ GSList *exdates;
ECalComponentDateTime *cdt;
g_return_if_fail (comp != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- e_cal_component_get_exdate_list (comp, &list);
+ exdates = e_cal_component_get_exdates (comp);
+
+ cdt = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone (t, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
- cdt = g_new (ECalComponentDateTime, 1);
- cdt->value = g_new (struct icaltimetype, 1);
- *cdt->value = icaltime_from_timet_with_zone (t, FALSE, zone);
- cdt->tzid = g_strdup (icaltimezone_get_tzid (zone));
+ exdates = g_slist_append (exdates, cdt);
+ e_cal_component_set_exdates (comp, exdates);
- list = g_slist_append (list, cdt);
- e_cal_component_set_exdate_list (comp, list);
- e_cal_component_free_exdate_list (list);
+ g_slist_free_full (exdates, e_cal_component_datetime_free);
}
/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */
static gboolean
-e_cal_component_compare_tzid (const gchar *tzid1,
- const gchar *tzid2)
+cal_comp_util_tzid_equal (const gchar *tzid1,
+ const gchar *tzid2)
{
gboolean retval = TRUE;
@@ -99,35 +99,40 @@ e_cal_component_compare_tzid (const gchar *tzid1,
**/
gboolean
cal_comp_util_compare_event_timezones (ECalComponent *comp,
- ECalClient *client,
- icaltimezone *zone)
+ ECalClient *client,
+ ICalTimezone *zone)
{
- ECalComponentDateTime start_datetime, end_datetime;
+ ECalComponentDateTime *start_datetime, *end_datetime;
const gchar *tzid;
gboolean retval = FALSE;
- icaltimezone *start_zone = NULL;
- icaltimezone *end_zone = NULL;
+ ICalTimezone *start_zone = NULL;
+ ICalTimezone *end_zone = NULL;
gint offset1, offset2;
- tzid = icaltimezone_get_tzid (zone);
+ tzid = i_cal_timezone_get_tzid (zone);
- e_cal_component_get_dtstart (comp, &start_datetime);
- e_cal_component_get_dtend (comp, &end_datetime);
+ start_datetime = e_cal_component_get_dtstart (comp);
+ end_datetime = e_cal_component_get_dtend (comp);
/* If either the DTSTART or the DTEND is a DATE value, we return TRUE.
* Maybe if one was a DATE-TIME we should check that, but that should
* not happen often. */
- if ((start_datetime.value && start_datetime.value->is_date)
- || (end_datetime.value && end_datetime.value->is_date)) {
+ if ((start_datetime && i_cal_time_is_date (e_cal_component_datetime_get_value (start_datetime))) ||
+ (end_datetime && i_cal_time_is_date (e_cal_component_datetime_get_value (end_datetime)))) {
retval = TRUE;
goto out;
}
+ if (!start_datetime || !end_datetime) {
+ retval = FALSE;
+ goto out;
+ }
+
/* If the event uses UTC for DTSTART & DTEND, return TRUE. Outlook
* will send single events as UTC, so we don't want to mark all of
* these. */
- if ((!start_datetime.value || icaltime_is_utc (*start_datetime.value))
- && (!end_datetime.value || icaltime_is_utc (*end_datetime.value))) {
+ if (i_cal_time_is_utc (e_cal_component_datetime_get_value (start_datetime)) &&
+ i_cal_time_is_utc (e_cal_component_datetime_get_value (end_datetime))) {
retval = TRUE;
goto out;
}
@@ -135,14 +140,15 @@ cal_comp_util_compare_event_timezones (ECalComponent *comp,
/* If the event uses floating time for DTSTART & DTEND, return TRUE.
* Imported vCalendar files will use floating times, so we don't want
* to mark all of these. */
- if (!start_datetime.tzid && !end_datetime.tzid) {
+ if (!e_cal_component_datetime_get_tzid (start_datetime) &&
+ !e_cal_component_datetime_get_tzid (end_datetime)) {
retval = TRUE;
goto out;
}
/* FIXME: DURATION may be used instead. */
- if (e_cal_component_compare_tzid (tzid, start_datetime.tzid)
- && e_cal_component_compare_tzid (tzid, end_datetime.tzid)) {
+ if (cal_comp_util_tzid_equal (tzid, e_cal_component_datetime_get_tzid (start_datetime)) &&
+ cal_comp_util_tzid_equal (tzid, e_cal_component_datetime_get_tzid (end_datetime))) {
/* If both TZIDs are the same as the given zone's TZID, then
* we know the timezones are the same so we return TRUE. */
retval = TRUE;
@@ -150,43 +156,41 @@ cal_comp_util_compare_event_timezones (ECalComponent *comp,
/* If the TZIDs differ, we have to compare the UTC offsets
* of the start and end times, using their own timezones and
* the given timezone. */
- if (start_datetime.tzid)
- e_cal_client_get_timezone_sync (client, start_datetime.tzid, &start_zone, NULL, NULL);
- else
+ if (!e_cal_component_datetime_get_tzid (start_datetime) ||
+ !e_cal_client_get_timezone_sync (client, e_cal_component_datetime_get_tzid
(start_datetime), &start_zone, NULL, NULL))
start_zone = NULL;
if (start_zone == NULL)
goto out;
- if (start_datetime.value) {
- offset1 = icaltimezone_get_utc_offset (
+ if (e_cal_component_datetime_get_value (start_datetime)) {
+ offset1 = i_cal_timezone_get_utc_offset (
start_zone,
- start_datetime.value,
+ e_cal_component_datetime_get_value (start_datetime),
NULL);
- offset2 = icaltimezone_get_utc_offset (
+ offset2 = i_cal_timezone_get_utc_offset (
zone,
- start_datetime.value,
+ e_cal_component_datetime_get_value (start_datetime),
NULL);
if (offset1 != offset2)
goto out;
}
- if (end_datetime.tzid)
- e_cal_client_get_timezone_sync (client, end_datetime.tzid, &end_zone, NULL, NULL);
- else
+ if (!e_cal_component_datetime_get_tzid (end_datetime) ||
+ !e_cal_client_get_timezone_sync (client, e_cal_component_datetime_get_tzid
(end_datetime), &end_zone, NULL, NULL))
end_zone = NULL;
if (end_zone == NULL)
goto out;
- if (end_datetime.value) {
- offset1 = icaltimezone_get_utc_offset (
+ if (e_cal_component_datetime_get_value (end_datetime)) {
+ offset1 = i_cal_timezone_get_utc_offset (
end_zone,
- end_datetime.value,
+ e_cal_component_datetime_get_value (end_datetime),
NULL);
- offset2 = icaltimezone_get_utc_offset (
+ offset2 = i_cal_timezone_get_utc_offset (
zone,
- end_datetime.value,
+ e_cal_component_datetime_get_value (end_datetime),
NULL);
if (offset1 != offset2)
goto out;
@@ -197,8 +201,8 @@ cal_comp_util_compare_event_timezones (ECalComponent *comp,
out:
- e_cal_component_free_datetime (&start_datetime);
- e_cal_component_free_datetime (&end_datetime);
+ e_cal_component_datetime_free (start_datetime);
+ e_cal_component_datetime_free (end_datetime);
return retval;
}
@@ -224,7 +228,7 @@ cal_comp_is_on_server_sync (ECalComponent *comp,
{
const gchar *uid;
gchar *rid = NULL;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *local_error = NULL;
g_return_val_if_fail (comp != NULL, FALSE);
@@ -238,7 +242,7 @@ cal_comp_is_on_server_sync (ECalComponent *comp,
* confirm and we can just delete the event. Otherwise, we ask
* the user.
*/
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
/* TODO We should not be checking for this here. But since
* e_cal_util_construct_instance does not create the instances
@@ -247,9 +251,9 @@ cal_comp_is_on_server_sync (ECalComponent *comp,
rid = e_cal_component_get_recurid_as_string (comp);
}
- if (e_cal_client_get_object_sync (client, uid, rid, &icalcomp, cancellable, &local_error) &&
- icalcomp != NULL) {
- icalcomponent_free (icalcomp);
+ if (e_cal_client_get_object_sync (client, uid, rid, &icomp, cancellable, &local_error) &&
+ icomp != NULL) {
+ g_object_unref (icomp);
g_free (rid);
return TRUE;
@@ -271,7 +275,7 @@ cal_comp_is_on_server_sync (ECalComponent *comp,
* icalcomponent, not the ECalComponent.
**/
gboolean
-cal_comp_is_icalcomp_on_server_sync (icalcomponent *icalcomp,
+cal_comp_is_icalcomp_on_server_sync (ICalComponent *icomp,
ECalClient *client,
GCancellable *cancellable,
GError **error)
@@ -279,10 +283,10 @@ cal_comp_is_icalcomp_on_server_sync (icalcomponent *icalcomp,
gboolean on_server;
ECalComponent *comp;
- if (!icalcomp || !client || !icalcomponent_get_uid (icalcomp))
+ if (!icomp || !client || !i_cal_component_get_uid (icomp))
return FALSE;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
if (!comp)
return FALSE;
@@ -310,21 +314,22 @@ cal_comp_event_new_with_defaults_sync (ECalClient *client,
GCancellable *cancellable,
GError **error)
{
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
ECalComponent *comp;
ECalComponentAlarm *alarm;
- icalproperty *icalprop;
- ECalComponentAlarmTrigger trigger;
+ ICalProperty *prop;
+ ICalDurationType *duration;
+ ECalComponentAlarmTrigger *trigger;
- if (client && !e_cal_client_get_default_object_sync (client, &icalcomp, cancellable, error))
+ if (client && !e_cal_client_get_default_object_sync (client, &icomp, cancellable, error))
return NULL;
- if (icalcomp == NULL)
- icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+ if (!icomp)
+ icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icomp)) {
+ g_clear_object (&icomp);
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
}
@@ -338,37 +343,36 @@ cal_comp_event_new_with_defaults_sync (ECalClient *client,
* summary when it gets committed to the server. For that, we add a
* X-EVOLUTION-NEEDS-DESCRIPTION property to the alarm's component.
*/
- icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
- icalprop = icalproperty_new_x ("1");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION");
- icalcomponent_add_property (icalcomp, icalprop);
+ prop = i_cal_property_new_x ("1");
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-NEEDS-DESCRIPTION");
+ e_cal_component_property_bag_take (e_cal_component_alarm_get_property_bag (alarm), prop);
e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
- trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
-
- memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
-
- trigger.u.rel_duration.is_neg = TRUE;
+ duration = i_cal_duration_type_null_duration ();
+ i_cal_duration_type_set_is_neg (duration, TRUE);
switch (default_reminder_units) {
case E_DURATION_MINUTES:
- trigger.u.rel_duration.minutes = default_reminder_interval;
+ i_cal_duration_type_set_minutes (duration, default_reminder_interval);
break;
case E_DURATION_HOURS:
- trigger.u.rel_duration.hours = default_reminder_interval;
+ i_cal_duration_type_set_hours (duration, default_reminder_interval);
break;
case E_DURATION_DAYS:
- trigger.u.rel_duration.days = default_reminder_interval;
+ i_cal_duration_type_set_days (duration, default_reminder_interval);
break;
default:
g_warning ("wrong units %d\n", default_reminder_units);
}
- e_cal_component_alarm_set_trigger (alarm, trigger);
+ trigger = e_cal_component_alarm_trigger_new_relative (E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START,
duration);
+ g_clear_object (&duration);
+
+ e_cal_component_alarm_take_trigger (alarm, trigger);
e_cal_component_add_alarm (comp, alarm);
e_cal_component_alarm_free (alarm);
@@ -386,9 +390,9 @@ cal_comp_event_new_with_current_time_sync (ECalClient *client,
GError **error)
{
ECalComponent *comp;
- struct icaltimetype itt;
- ECalComponentDateTime dt;
- icaltimezone *zone;
+ ICalTimetype *itt;
+ ECalComponentDateTime *dt;
+ ICalTimezone *zone;
comp = cal_comp_event_new_with_defaults_sync (
client, all_day, use_default_reminder,
@@ -400,23 +404,22 @@ cal_comp_event_new_with_current_time_sync (ECalClient *client,
zone = calendar_config_get_icaltimezone ();
if (all_day) {
- itt = icaltime_from_timet_with_zone (time (NULL), 1, zone);
+ itt = i_cal_time_from_timet_with_zone (time (NULL), 1, zone);
- dt.value = &itt;
- dt.tzid = icaltimezone_get_tzid (zone);
+ dt = e_cal_component_datetime_new_take (itt, zone ? g_strdup (i_cal_timezone_get_tzid (zone))
: NULL);
- e_cal_component_set_dtstart (comp, &dt);
- e_cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_dtstart (comp, dt);
+ e_cal_component_set_dtend (comp, dt);
} else {
- itt = icaltime_current_time_with_zone (zone);
- icaltime_adjust (&itt, 0, 1, -itt.minute, -itt.second);
+ itt = i_cal_time_current_time_with_zone (zone);
+ i_cal_time_adjust (itt, 0, 1, -i_cal_timetype_get_minute (itt), -i_cal_timetype_get_second
(itt));
+
+ dt = e_cal_component_datetime_new_take (itt, zone ? g_strdup (i_cal_timezone_get_tzid (zone))
: NULL);
- dt.value = &itt;
- dt.tzid = icaltimezone_get_tzid (zone);
+ e_cal_component_set_dtstart (comp, dt);
- e_cal_component_set_dtstart (comp, &dt);
- icaltime_adjust (&itt, 0, 1, 0, 0);
- e_cal_component_set_dtend (comp, &dt);
+ i_cal_time_adjust (e_cal_component_datetime_get_value (dt), 0, 1, 0, 0);
+ e_cal_component_set_dtend (comp, dt);
}
return comp;
@@ -428,17 +431,17 @@ cal_comp_task_new_with_defaults_sync (ECalClient *client,
GError **error)
{
ECalComponent *comp;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
- if (client && !e_cal_client_get_default_object_sync (client, &icalcomp, cancellable, error))
+ if (client && !e_cal_client_get_default_object_sync (client, &icomp, cancellable, error))
return NULL;
- if (icalcomp == NULL)
- icalcomp = icalcomponent_new (ICAL_VTODO_COMPONENT);
+ if (!icomp)
+ icomp = i_cal_component_new (I_CAL_VTODO_COMPONENT);
comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icomp)) {
+ g_object_unref (icomp);
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
}
@@ -452,17 +455,17 @@ cal_comp_memo_new_with_defaults_sync (ECalClient *client,
GError **error)
{
ECalComponent *comp;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
- if (client && !e_cal_client_get_default_object_sync (client, &icalcomp, cancellable, error))
+ if (client && !e_cal_client_get_default_object_sync (client, &icomp, cancellable, error))
return NULL;
- if (icalcomp == NULL)
- icalcomp = icalcomponent_new (ICAL_VJOURNAL_COMPONENT);
+ if (!icomp)
+ icomp = i_cal_component_new (I_CAL_VJOURNAL_COMPONENT);
comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- icalcomponent_free (icalcomp);
+ if (!e_cal_component_set_icalcomponent (comp, icomp)) {
+ g_object_unref (icomp);
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_JOURNAL);
}
@@ -493,10 +496,10 @@ cal_comp_update_time_by_active_window (ECalComponent *comp,
EShellView *shell_view;
ECalendarView *cal_view;
time_t start = 0, end = 0;
- icaltimezone *zone;
- struct icaltimetype itt;
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ICalTimezone *zone;
+ ICalTimetype *itt;
+ ICalComponent *icomp;
+ ICalProperty *prop;
shell_view = e_shell_window_peek_shell_view (shell_window, "calendar");
g_return_if_fail (shell_view != NULL);
@@ -508,20 +511,20 @@ cal_comp_update_time_by_active_window (ECalComponent *comp,
g_return_if_fail (e_calendar_view_get_visible_time_range (cal_view, &start, &end));
zone = e_cal_model_get_timezone (e_calendar_view_get_model (cal_view));
- itt = icaltime_from_timet_with_zone (start, FALSE, zone);
+ itt = i_cal_time_from_timet_with_zone (start, FALSE, zone);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- prop = icalcomponent_get_first_property (icalcomp, ICAL_DTSTART_PROPERTY);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_DTSTART_PROPERTY);
if (prop) {
- icalproperty_set_dtstart (prop, itt);
+ i_cal_property_set_dtstart (prop, itt);
+ g_object_unref (prop);
} else {
- prop = icalproperty_new_dtstart (itt);
- icalcomponent_add_property (icalcomp, prop);
+ prop = i_cal_property_new_dtstart (itt);
+ i_cal_component_take_property (icomp, prop);
}
- e_cal_component_rescan (comp);
-
g_clear_object (&cal_view);
+ g_object_unref (itt);
}
}
}
@@ -547,7 +550,7 @@ cal_comp_util_get_n_icons (ECalComponent *comp,
g_return_val_if_fail (comp != NULL, 0);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), 0);
- e_cal_component_get_categories_list (comp, &categories_list);
+ categories_list = e_cal_component_get_categories_list (comp);
for (elem = categories_list; elem; elem = elem->next) {
const gchar *category;
GdkPixbuf *pixbuf = NULL;
@@ -566,7 +569,7 @@ cal_comp_util_get_n_icons (ECalComponent *comp,
}
}
}
- e_cal_component_free_categories_list (categories_list);
+ g_slist_free_full (categories_list, g_free);
return num_icons;
}
@@ -654,38 +657,39 @@ datetime_to_zone (ECalClient *client,
ECalComponentDateTime *date,
const gchar *tzid)
{
- icaltimezone *from, *to;
+ ICalTimezone *from, *to;
g_return_if_fail (date != NULL);
- if (date->tzid == NULL || tzid == NULL ||
- date->tzid == tzid || g_str_equal (date->tzid, tzid))
+ if (!e_cal_component_datetime_get_tzid (date) || !tzid ||
+ e_cal_component_datetime_get_tzid (date) == tzid ||
+ g_str_equal (e_cal_component_datetime_get_tzid (date), tzid))
return;
- from = icaltimezone_get_builtin_timezone_from_tzid (date->tzid);
+ from = i_cal_timezone_get_builtin_timezone_from_tzid (e_cal_component_datetime_get_tzid (date));
if (!from) {
GError *error = NULL;
e_cal_client_get_timezone_sync (
- client, date->tzid, &from, NULL, &error);
+ client, e_cal_component_datetime_get_tzid (date), &from, NULL, &error);
if (error != NULL) {
g_warning (
"%s: Could not get timezone '%s' from server: %s",
- G_STRFUNC, date->tzid ? date->tzid : "",
+ G_STRFUNC, e_cal_component_datetime_get_tzid (date) ?
e_cal_component_datetime_get_tzid (date) : "",
error->message);
g_error_free (error);
}
}
- to = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ to = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!to) {
/* do not check failure here, maybe the zone is not available there */
e_cal_client_get_timezone_sync (client, tzid, &to, NULL, NULL);
}
- icaltimezone_convert_time (date->value, from, to);
- date->tzid = tzid;
+ i_cal_timezone_convert_time (e_cal_component_datetime_get_value (date), from, to);
+ e_cal_component_datetime_set_tzid (date, tzid);
}
/**
@@ -701,19 +705,19 @@ cal_comp_set_dtstart_with_oldzone (ECalClient *client,
ECalComponent *comp,
const ECalComponentDateTime *pdate)
{
- ECalComponentDateTime olddate, date;
+ ECalComponentDateTime *olddate, *date;
g_return_if_fail (comp != NULL);
g_return_if_fail (pdate != NULL);
- e_cal_component_get_dtstart (comp, &olddate);
+ olddate = e_cal_component_get_dtstart (comp);
+ date = e_cal_component_datetime_copy (pdate);
- date = *pdate;
+ datetime_to_zone (client, date, e_cal_component_datetime_get_tzid (olddate));
+ e_cal_component_set_dtstart (comp, date);
- datetime_to_zone (client, &date, olddate.tzid);
- e_cal_component_set_dtstart (comp, &date);
-
- e_cal_component_free_datetime (&olddate);
+ e_cal_component_datetime_free (olddate);
+ e_cal_component_datetime_free (date);
}
/**
@@ -729,19 +733,19 @@ cal_comp_set_dtend_with_oldzone (ECalClient *client,
ECalComponent *comp,
const ECalComponentDateTime *pdate)
{
- ECalComponentDateTime olddate, date;
+ ECalComponentDateTime *olddate, *date;
g_return_if_fail (comp != NULL);
g_return_if_fail (pdate != NULL);
- e_cal_component_get_dtend (comp, &olddate);
-
- date = *pdate;
+ olddate = e_cal_component_get_dtend (comp);
+ date = e_cal_component_datetime_copy (pdate);
- datetime_to_zone (client, &date, olddate.tzid);
- e_cal_component_set_dtend (comp, &date);
+ datetime_to_zone (client, date, e_cal_component_datetime_get_tzid (olddate));
+ e_cal_component_set_dtend (comp, date);
- e_cal_component_free_datetime (&olddate);
+ e_cal_component_datetime_free (olddate);
+ e_cal_component_datetime_free (date);
}
gboolean
@@ -751,183 +755,204 @@ comp_util_sanitize_recurrence_master_sync (ECalComponent *comp,
GError **error)
{
ECalComponent *master = NULL;
- icalcomponent *icalcomp = NULL;
- ECalComponentRange rid;
- ECalComponentDateTime sdt;
+ ICalComponent *icomp = NULL;
+ ECalComponentRange *rid;
+ ECalComponentDateTime *sdt, *rdt;
const gchar *uid;
/* Get the master component */
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
- if (!e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, cancellable, error))
+ if (!e_cal_client_get_object_sync (client, uid, NULL, &icomp, cancellable, error))
return FALSE;
- master = e_cal_component_new_from_icalcomponent (icalcomp);
+ master = e_cal_component_new_from_icalcomponent (icomp);
if (!master) {
g_warn_if_reached ();
return FALSE;
}
/* Compare recur id and start date */
- e_cal_component_get_recurid (comp, &rid);
- e_cal_component_get_dtstart (comp, &sdt);
+ rid = e_cal_component_get_recurid (comp);
+ sdt = e_cal_component_get_dtstart (comp);
+ rdt = rid ? e_cal_component_range_get_datetime (rid) : NULL;
- if (rid.datetime.value && sdt.value &&
- icaltime_compare_date_only (
- *rid.datetime.value, *sdt.value) == 0) {
- ECalComponentDateTime msdt, medt, edt;
- gint *sequence;
+ if (rdt && sdt &&
+ i_cal_time_compare_date_only (e_cal_component_datetime_get_value (rdt),
e_cal_component_datetime_get_value (sdt)) == 0) {
+ ECalComponentDateTime *msdt, *medt, *edt;
+ gint sequence, yy = 0, mm = 0, dd = 0;
- e_cal_component_get_dtstart (master, &msdt);
- e_cal_component_get_dtend (master, &medt);
+ msdt = e_cal_component_get_dtstart (master);
+ medt = e_cal_component_get_dtend (master);
- e_cal_component_get_dtend (comp, &edt);
+ edt = e_cal_component_get_dtend (comp);
- if (!msdt.value || !medt.value || !edt.value) {
+ if (!msdt || !medt || !edt) {
g_warn_if_reached ();
- e_cal_component_free_datetime (&msdt);
- e_cal_component_free_datetime (&medt);
- e_cal_component_free_datetime (&edt);
- e_cal_component_free_datetime (&sdt);
- e_cal_component_free_range (&rid);
+ e_cal_component_datetime_free (msdt);
+ e_cal_component_datetime_free (medt);
+ e_cal_component_datetime_free (edt);
+ e_cal_component_datetime_free (sdt);
+ e_cal_component_range_free (rid);
g_object_unref (master);
return FALSE;
}
- sdt.value->year = msdt.value->year;
- sdt.value->month = msdt.value->month;
- sdt.value->day = msdt.value->day;
+ i_cal_timetype_get_date (e_cal_component_datetime_get_value (msdt), &yy, &mm, &dd);
+ i_cal_timetype_set_date (e_cal_component_datetime_get_value (sdt), yy, mm, dd);
- edt.value->year = medt.value->year;
- edt.value->month = medt.value->month;
- edt.value->day = medt.value->day;
+ i_cal_timetype_get_date (e_cal_component_datetime_get_value (medt), &yy, &mm, &dd);
+ i_cal_timetype_set_date (e_cal_component_datetime_get_value (edt), yy, mm, dd);
- e_cal_component_set_dtstart (comp, &sdt);
- e_cal_component_set_dtend (comp, &edt);
+ e_cal_component_set_dtstart (comp, sdt);
+ e_cal_component_set_dtend (comp, edt);
- e_cal_component_get_sequence (master, &sequence);
+ sequence = e_cal_component_get_sequence (master);
e_cal_component_set_sequence (comp, sequence);
- e_cal_component_free_datetime (&msdt);
- e_cal_component_free_datetime (&medt);
- e_cal_component_free_datetime (&edt);
+ e_cal_component_datetime_free (msdt);
+ e_cal_component_datetime_free (medt);
+ e_cal_component_datetime_free (edt);
}
- e_cal_component_free_datetime (&sdt);
- e_cal_component_free_range (&rid);
e_cal_component_set_recurid (comp, NULL);
+ e_cal_component_datetime_free (sdt);
+ e_cal_component_range_free (rid);
g_object_unref (master);
return TRUE;
}
gchar *
-icalcomp_suggest_filename (icalcomponent *icalcomp,
- const gchar *default_name)
+comp_util_suggest_filename (ICalComponent *icomp,
+ const gchar *default_name)
{
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *summary = NULL;
+ gchar *filename;
- if (!icalcomp)
+ if (!icomp)
return g_strconcat (default_name, ".ics", NULL);
- prop = icalcomponent_get_first_property (icalcomp, ICAL_SUMMARY_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_SUMMARY_PROPERTY);
if (prop)
- summary = icalproperty_get_summary (prop);
+ summary = i_cal_property_get_summary (prop);
if (!summary || !*summary)
summary = default_name;
- return g_strconcat (summary, ".ics", NULL);
+ filename = g_strconcat (summary, ".ics", NULL);
+
+ g_clear_object (&prop);
+
+ return filename;
}
void
cal_comp_get_instance_times (ECalClient *client,
- icalcomponent *icalcomp,
- const icaltimezone *default_zone,
+ ICalComponent *icomp,
+ const ICalTimezone *default_zone,
time_t *instance_start,
gboolean *start_is_date,
time_t *instance_end,
gboolean *end_is_date,
GCancellable *cancellable)
{
- struct icaltimetype start_time, end_time;
- const icaltimezone *zone = default_zone;
+ ICalTimetype *start_time, *end_time;
+ const ICalTimezone *zone = default_zone;
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (icomp != NULL);
g_return_if_fail (instance_start != NULL);
g_return_if_fail (instance_end != NULL);
- start_time = icalcomponent_get_dtstart (icalcomp);
- end_time = icalcomponent_get_dtend (icalcomp);
+ start_time = i_cal_component_get_dtstart (icomp);
+ end_time = i_cal_component_get_dtend (icomp);
/* Some event can have missing DTEND, then use the start_time for them */
- if (icaltime_is_null_time (end_time))
- end_time = start_time;
+ if (!end_time || i_cal_time_is_null_time (end_time)) {
+ g_clear_object (&end_time);
+
+ end_time = i_cal_timetype_new_clone (start_time);
+ }
- if (start_time.zone) {
- zone = start_time.zone;
+ if (i_cal_timetype_get_zone (start_time)) {
+ zone = i_cal_timetype_get_zone (start_time);
} else {
- icalparameter *param = NULL;
- icalproperty *prop = icalcomponent_get_first_property (icalcomp, ICAL_DTSTART_PROPERTY);
+ ICalParameter *param = NULL;
+ ICalProperty *prop = i_cal_component_get_first_property (icomp, I_CAL_DTSTART_PROPERTY);
if (prop) {
- param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
if (param) {
const gchar *tzid = NULL;
- icaltimezone *st_zone = NULL;
+ ICalTimezone *st_zone = NULL;
- tzid = icalparameter_get_tzid (param);
- if (tzid)
- e_cal_client_get_timezone_sync (client, tzid, &st_zone, cancellable,
NULL);
+ tzid = i_cal_parameter_get_tzid (param);
+ if (tzid && !e_cal_client_get_timezone_sync (client, tzid, &st_zone,
cancellable, NULL))
+ st_zone = NULL;
if (st_zone)
zone = st_zone;
+
+ g_object_unref (param);
}
+
+ g_object_unref (prop);
}
}
- *instance_start = icaltime_as_timet_with_zone (start_time, zone);
+ *instance_start = i_cal_time_as_timet_with_zone (start_time, (ICalTimezone *) zone);
if (start_is_date)
- *start_is_date = start_time.is_date;
+ *start_is_date = i_cal_time_is_date (start_time);
- if (end_time.zone) {
- zone = end_time.zone;
+ if (i_cal_timetype_get_zone (end_time)) {
+ zone = i_cal_timetype_get_zone (end_time);
} else {
- icalparameter *param = NULL;
- icalproperty *prop = icalcomponent_get_first_property (icalcomp, ICAL_DTSTART_PROPERTY);
+ ICalParameter *param = NULL;
+ ICalProperty *prop = i_cal_component_get_first_property (icomp, I_CAL_DTEND_PROPERTY);
+
+ if (!prop)
+ prop = i_cal_component_get_first_property (icomp, I_CAL_DTSTART_PROPERTY);
if (prop) {
- param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
if (param) {
const gchar *tzid = NULL;
- icaltimezone *end_zone = NULL;
+ ICalTimezone *end_zone = NULL;
- tzid = icalparameter_get_tzid (param);
- if (tzid)
- e_cal_client_get_timezone_sync (client, tzid, &end_zone, cancellable,
NULL);
+ tzid = i_cal_parameter_get_tzid (param);
+ if (tzid && !e_cal_client_get_timezone_sync (client, tzid, &end_zone,
cancellable, NULL))
+ end_zone = NULL;
if (end_zone)
zone = end_zone;
+
+ g_object_unref (param);
}
+
+ g_object_unref (prop);
}
}
- *instance_end = icaltime_as_timet_with_zone (end_time, zone);
+ *instance_end = i_cal_time_as_timet_with_zone (end_time, (ICalTimezone *) zone);
if (end_is_date)
- *end_is_date = end_time.is_date;
+ *end_is_date = i_cal_time_is_date (end_time);
+
+ g_clear_object (&start_time);
+ g_clear_object (&end_time);
}
time_t
cal_comp_gdate_to_timet (const GDate *date,
- const icaltimezone *with_zone)
+ const ICalTimezone *with_zone)
{
struct tm tm;
- struct icaltimetype tt;
+ ICalTimetype *tt;
+ time_t res;
g_return_val_if_fail (date != NULL, (time_t) -1);
g_return_val_if_fail (g_date_valid (date), (time_t) -1);
@@ -936,14 +961,18 @@ cal_comp_gdate_to_timet (const GDate *date,
tt = tm_to_icaltimetype (&tm, TRUE);
if (with_zone)
- return icaltime_as_timet_with_zone (tt, with_zone);
+ res = i_cal_time_as_timet_with_zone (tt, (ICalTimezone *) with_zone);
+ else
+ res = i_cal_time_as_timet (tt);
+
+ g_clear_object (&tt);
- return icaltime_as_timet (tt);
+ return res;
}
typedef struct _AsyncContext {
ECalClient *src_client;
- icalcomponent *icalcomp_clone;
+ ICalComponent *icomp_clone;
gboolean do_copy;
} AsyncContext;
@@ -959,21 +988,17 @@ struct ForeachTzidData
static void
async_context_free (AsyncContext *async_context)
{
- if (async_context->src_client)
- g_object_unref (async_context->src_client);
-
- if (async_context->icalcomp_clone)
- icalcomponent_free (async_context->icalcomp_clone);
-
+ g_clear_object (&async_context->src_client);
+ g_clear_object (&async_context->icomp_clone);
g_slice_free (AsyncContext, async_context);
}
static void
-add_timezone_to_cal_cb (icalparameter *param,
+add_timezone_to_cal_cb (ICalParameter *param,
gpointer data)
{
struct ForeachTzidData *ftd = data;
- icaltimezone *tz = NULL;
+ ICalTimezone *tz = NULL;
const gchar *tzid;
g_return_if_fail (ftd != NULL);
@@ -988,7 +1013,7 @@ add_timezone_to_cal_cb (icalparameter *param,
return;
}
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (!tzid || !*tzid)
return;
@@ -1011,7 +1036,7 @@ cal_comp_transfer_item_to_thread (GSimpleAsyncResult *simple,
cal_comp_transfer_item_to_sync (
async_context->src_client,
E_CAL_CLIENT (source_object),
- async_context->icalcomp_clone,
+ async_context->icomp_clone,
async_context->do_copy,
cancellable, &local_error);
@@ -1021,23 +1046,23 @@ cal_comp_transfer_item_to_thread (GSimpleAsyncResult *simple,
void
cal_comp_transfer_item_to (ECalClient *src_client,
- ECalClient *dest_client,
- icalcomponent *icalcomp_vcal,
- gboolean do_copy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ ECalClient *dest_client,
+ ICalComponent *icomp_vcal,
+ gboolean do_copy,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
AsyncContext *async_context;
g_return_if_fail (E_IS_CAL_CLIENT (src_client));
g_return_if_fail (E_IS_CAL_CLIENT (dest_client));
- g_return_if_fail (icalcomp_vcal != NULL);
+ g_return_if_fail (icomp_vcal != NULL);
async_context = g_slice_new0 (AsyncContext);
async_context->src_client = g_object_ref (src_client);
- async_context->icalcomp_clone = icalcomponent_new_clone (icalcomp_vcal);
+ async_context->icomp_clone = i_cal_component_new_clone (icomp_vcal);
async_context->do_copy = do_copy;
simple = g_simple_async_result_new (
@@ -1077,15 +1102,15 @@ cal_comp_transfer_item_to_finish (ECalClient *client,
gboolean
cal_comp_transfer_item_to_sync (ECalClient *src_client,
- ECalClient *dest_client,
- icalcomponent *icalcomp_vcal,
- gboolean do_copy,
- GCancellable *cancellable,
- GError **error)
+ ECalClient *dest_client,
+ ICalComponent *icomp_vcal,
+ gboolean do_copy,
+ GCancellable *cancellable,
+ GError **error)
{
- icalcomponent *icalcomp;
- icalcomponent *icalcomp_event, *subcomp;
- icalcomponent_kind icalcomp_kind;
+ ICalComponent *icomp;
+ ICalComponent *icomp_event, *subcomp;
+ ICalComponentKind icomp_kind;
const gchar *uid;
gchar *new_uid = NULL;
struct ForeachTzidData ftd;
@@ -1096,21 +1121,21 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
g_return_val_if_fail (E_IS_CAL_CLIENT (src_client), FALSE);
g_return_val_if_fail (E_IS_CAL_CLIENT (dest_client), FALSE);
- g_return_val_if_fail (icalcomp_vcal != NULL, FALSE);
+ g_return_val_if_fail (icomp_vcal != NULL, FALSE);
- icalcomp_event = icalcomponent_get_inner (icalcomp_vcal);
- g_return_val_if_fail (icalcomp_event != NULL, FALSE);
+ icomp_event = i_cal_component_get_inner (icomp_vcal);
+ g_return_val_if_fail (icomp_event != NULL, FALSE);
source_type = e_cal_client_get_source_type (src_client);
switch (source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
- icalcomp_kind = ICAL_VEVENT_COMPONENT;
+ icomp_kind = I_CAL_VEVENT_COMPONENT;
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
- icalcomp_kind = ICAL_VTODO_COMPONENT;
+ icomp_kind = I_CAL_VTODO_COMPONENT;
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
- icalcomp_kind = ICAL_VJOURNAL_COMPONENT;
+ icomp_kind = I_CAL_VJOURNAL_COMPONENT;
break;
default:
g_return_val_if_reached (FALSE);
@@ -1120,20 +1145,20 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
e_client_get_source (E_CLIENT (src_client)), e_client_get_source (E_CLIENT (dest_client)));
processed_uids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- icalcomp_event = icalcomponent_get_first_component (icalcomp_vcal, icalcomp_kind);
+ icomp_event = i_cal_component_get_first_component (icomp_vcal, icomp_kind);
/*
* This check should be removed in the near future.
* We should be able to work properly with multiselection, which means that we always
* will receive a component with subcomponents.
*/
- if (icalcomp_event == NULL)
- icalcomp_event = icalcomp_vcal;
+ if (icomp_event == NULL)
+ icomp_event = icomp_vcal;
for (;
- icalcomp_event;
- icalcomp_event = icalcomponent_get_next_component (icalcomp_vcal, icalcomp_kind)) {
+ icomp_event;
+ g_object_unref (icomp_event), icomp_event = i_cal_component_get_next_component (icomp_vcal,
icomp_kind)) {
GError *local_error = NULL;
- uid = icalcomponent_get_uid (icalcomp_event);
+ uid = i_cal_component_get_uid (icomp_event);
if (g_hash_table_lookup (processed_uids, uid))
continue;
@@ -1141,12 +1166,12 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
if (do_copy && same_client)
success = FALSE;
else
- success = e_cal_client_get_object_sync (dest_client, uid, NULL, &icalcomp,
cancellable, &local_error);
+ success = e_cal_client_get_object_sync (dest_client, uid, NULL, &icomp, cancellable,
&local_error);
if (success) {
success = e_cal_client_modify_object_sync (
- dest_client, icalcomp_event, E_CAL_OBJ_MOD_ALL, cancellable, error);
+ dest_client, icomp_event, E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE,
cancellable, error);
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
if (!success)
goto exit;
@@ -1154,12 +1179,12 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
ECalObjModType mod_type = E_CAL_OBJ_MOD_THIS;
/* Remove the item from the source calendar. */
- if (e_cal_util_component_is_instance (icalcomp_event) ||
- e_cal_util_component_has_recurrences (icalcomp_event))
+ if (e_cal_util_component_is_instance (icomp_event) ||
+ e_cal_util_component_has_recurrences (icomp_event))
mod_type = E_CAL_OBJ_MOD_ALL;
success = e_cal_client_remove_object_sync (
- src_client, uid, NULL, mod_type, cancellable, error);
+ src_client, uid, NULL, mod_type, E_CAL_OPERATION_FLAG_NONE,
cancellable, error);
if (!success)
goto exit;
}
@@ -1173,7 +1198,7 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
g_clear_error (&local_error);
}
- if (e_cal_util_component_is_instance (icalcomp_event)) {
+ if (e_cal_util_component_is_instance (icomp_event)) {
GSList *ecalcomps = NULL, *eiter;
ECalComponent *comp;
@@ -1184,36 +1209,36 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
if (ecalcomps && !ecalcomps->next) {
/* only one component, no need for a vCalendar list */
comp = ecalcomps->data;
- icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+ icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
} else {
- icalcomp = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
+ icomp = i_cal_component_new (I_CAL_VCALENDAR_COMPONENT);
for (eiter = ecalcomps; eiter; eiter = g_slist_next (eiter)) {
comp = eiter->data;
- icalcomponent_add_component (
- icalcomp,
- icalcomponent_new_clone (e_cal_component_get_icalcomponent
(comp)));
+ i_cal_component_take_component (
+ icomp,
+ i_cal_component_new_clone (e_cal_component_get_icalcomponent
(comp)));
}
}
- e_cal_client_free_ecalcomp_slist (ecalcomps);
+ e_util_free_nullable_object_slist (ecalcomps);
} else {
- icalcomp = icalcomponent_new_clone (icalcomp_event);
+ icomp = i_cal_component_new_clone (icomp_event);
}
if (do_copy) {
/* Change the UID to avoid problems with duplicated UID */
new_uid = e_util_generate_uid ();
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT) {
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT) {
/* in case of a vCalendar, the component might have detached instances,
* thus change the UID on all of the subcomponents of it */
- for (subcomp = icalcomponent_get_first_component (icalcomp, icalcomp_kind);
+ for (subcomp = i_cal_component_get_first_component (icomp, icomp_kind);
subcomp;
- subcomp = icalcomponent_get_next_component (icalcomp, icalcomp_kind)) {
- icalcomponent_set_uid (subcomp, new_uid);
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component
(icomp, icomp_kind)) {
+ i_cal_component_set_uid (subcomp, new_uid);
}
} else {
- icalcomponent_set_uid (icalcomp, new_uid);
+ i_cal_component_set_uid (icomp, new_uid);
}
g_free (new_uid);
new_uid = NULL;
@@ -1225,16 +1250,18 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
ftd.error = error;
ftd.success = TRUE;
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT) {
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT) {
/* in case of a vCalendar, the component might have detached instances,
* thus check timezones on all of the subcomponents of it */
- for (subcomp = icalcomponent_get_first_component (icalcomp, icalcomp_kind);
+ for (subcomp = i_cal_component_get_first_component (icomp, icomp_kind);
subcomp && ftd.success;
- subcomp = icalcomponent_get_next_component (icalcomp, icalcomp_kind)) {
- icalcomponent_foreach_tzid (subcomp, add_timezone_to_cal_cb, &ftd);
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
icomp_kind)) {
+ i_cal_component_foreach_tzid (subcomp, add_timezone_to_cal_cb, &ftd);
}
+
+ g_clear_object (&subcomp);
} else {
- icalcomponent_foreach_tzid (icalcomp, add_timezone_to_cal_cb, &ftd);
+ i_cal_component_foreach_tzid (icomp, add_timezone_to_cal_cb, &ftd);
}
if (!ftd.success) {
@@ -1242,53 +1269,57 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
goto exit;
}
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT) {
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT) {
gboolean did_add = FALSE;
/* in case of a vCalendar, the component might have detached instances,
* thus add the master object first, and then all of the subcomponents of it */
- for (subcomp = icalcomponent_get_first_component (icalcomp, icalcomp_kind);
+ for (subcomp = i_cal_component_get_first_component (icomp, icomp_kind);
subcomp && !did_add;
- subcomp = icalcomponent_get_next_component (icalcomp, icalcomp_kind)) {
- if (icaltime_is_null_time (icalcomponent_get_recurrenceid (subcomp))) {
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
icomp_kind)) {
+ if (!e_cal_util_component_has_property (subcomp,
I_CAL_RECURRENCEID_PROPERTY)) {
did_add = TRUE;
success = e_cal_client_create_object_sync (
- dest_client, subcomp,
+ dest_client, subcomp, E_CAL_OPERATION_FLAG_NONE,
&new_uid, cancellable, error);
g_free (new_uid);
}
}
+ g_clear_object (&subcomp);
+
if (!success) {
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
goto exit;
}
/* deal with detached instances */
- for (subcomp = icalcomponent_get_first_component (icalcomp, icalcomp_kind);
+ for (subcomp = i_cal_component_get_first_component (icomp, icomp_kind);
subcomp && success;
- subcomp = icalcomponent_get_next_component (icalcomp, icalcomp_kind)) {
- if (!icaltime_is_null_time (icalcomponent_get_recurrenceid (subcomp))) {
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
icomp_kind)) {
+ if (e_cal_util_component_has_property (subcomp, I_CAL_RECURRENCEID_PROPERTY))
{
if (did_add) {
success = e_cal_client_modify_object_sync (
dest_client, subcomp,
- E_CAL_OBJ_MOD_THIS, cancellable, error);
+ E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
cancellable, error);
} else {
/* just in case there are only detached instances and no
master object */
did_add = TRUE;
success = e_cal_client_create_object_sync (
- dest_client, subcomp,
+ dest_client, subcomp, E_CAL_OPERATION_FLAG_NONE,
&new_uid, cancellable, error);
g_free (new_uid);
}
}
}
+
+ g_clear_object (&subcomp);
} else {
- success = e_cal_client_create_object_sync (dest_client, icalcomp, &new_uid,
cancellable, error);
+ success = e_cal_client_create_object_sync (dest_client, icomp,
E_CAL_OPERATION_FLAG_NONE, &new_uid, cancellable, error);
g_free (new_uid);
}
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
if (!success)
goto exit;
@@ -1296,11 +1327,11 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
ECalObjModType mod_type = E_CAL_OBJ_MOD_THIS;
/* Remove the item from the source calendar. */
- if (e_cal_util_component_is_instance (icalcomp_event) ||
- e_cal_util_component_has_recurrences (icalcomp_event))
+ if (e_cal_util_component_is_instance (icomp_event) ||
+ e_cal_util_component_has_recurrences (icomp_event))
mod_type = E_CAL_OBJ_MOD_ALL;
- success = e_cal_client_remove_object_sync (src_client, uid, NULL, mod_type,
cancellable, error);
+ success = e_cal_client_remove_object_sync (src_client, uid, NULL, mod_type,
E_CAL_OPERATION_FLAG_NONE, cancellable, error);
if (!success)
goto exit;
}
@@ -1315,72 +1346,60 @@ cal_comp_transfer_item_to_sync (ECalClient *src_client,
}
void
-cal_comp_util_update_tzid_parameter (icalproperty *prop,
- const struct icaltimetype tt)
+cal_comp_util_update_tzid_parameter (ICalProperty *prop,
+ const ICalTimetype *tt)
{
- icalparameter *param;
+ ICalParameter *param;
const gchar *tzid = NULL;
g_return_if_fail (prop != NULL);
- if (!icaltime_is_valid_time (tt) ||
- icaltime_is_null_time (tt))
+ if (!tt || !i_cal_time_is_valid_time ((ICalTimetype *) tt) ||
+ i_cal_time_is_null_time ((ICalTimetype *) tt))
return;
- param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
- if (tt.zone)
- tzid = icaltimezone_get_tzid ((icaltimezone *) tt.zone);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
+ if (i_cal_timetype_get_zone ((ICalTimetype *) tt))
+ tzid = i_cal_timezone_get_tzid (i_cal_timetype_get_zone ((ICalTimetype *) tt));
- if (tt.zone && tzid && *tzid && !icaltime_is_utc (tt) && !tt.is_date) {
+ if (i_cal_timetype_get_zone ((ICalTimetype *) tt) && tzid && *tzid &&
+ !i_cal_time_is_utc ((ICalTimetype *) tt) &&
+ !i_cal_time_is_date ((ICalTimetype *) tt)) {
if (param) {
- icalparameter_set_tzid (param, (gchar *) tzid);
+ i_cal_parameter_set_tzid (param, (gchar *) tzid);
+ g_object_unref (param);
} else {
- param = icalparameter_new_tzid ((gchar *) tzid);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_tzid ((gchar *) tzid);
+ i_cal_property_take_parameter (prop, param);
}
} else if (param) {
- icalproperty_remove_parameter_by_kind (prop, ICAL_TZID_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_TZID_PARAMETER);
+ g_object_unref (param);
}
}
/* Returns <0 for time before today, 0 for today, >0 for after today (future) */
gint
-cal_comp_util_compare_time_with_today (const struct icaltimetype time_tt)
+cal_comp_util_compare_time_with_today (const ICalTimetype *time_tt)
{
- struct icaltimetype now_tt;
+ ICalTimetype *now_tt, *tt = (ICalTimetype *) time_tt;
+ gint res;
- if (icaltime_is_null_time (time_tt))
+ if (!tt || i_cal_time_is_null_time (tt))
return 0;
- if (time_tt.is_date) {
- now_tt = icaltime_today ();
- return icaltime_compare_date_only (time_tt, now_tt);
+ if (i_cal_time_is_date (tt)) {
+ now_tt = i_cal_time_today ();
+ res = i_cal_time_compare_date_only (tt, now_tt);
} else {
- now_tt = icaltime_current_time_with_zone (time_tt.zone);
- now_tt.zone = time_tt.zone;
+ now_tt = i_cal_time_current_time_with_zone (i_cal_timetype_get_zone (tt));
+ i_cal_timetype_set_zone (now_tt, i_cal_timetype_get_zone (tt));
+ res = i_cal_time_compare (tt, now_tt);
}
- return icaltime_compare (time_tt, now_tt);
-}
-
-/* Returns whether removed any */
-gboolean
-cal_comp_util_remove_all_properties (icalcomponent *component,
- icalproperty_kind kind)
-{
- icalproperty *prop;
- gboolean removed_any = FALSE;
-
- g_return_val_if_fail (component != NULL, FALSE);
-
- while (prop = icalcomponent_get_first_property (component, kind), prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
-
- removed_any = TRUE;
- }
+ g_clear_object (&now_tt);
- return removed_any;
+ return res;
}
gboolean
@@ -1444,59 +1463,66 @@ cal_comp_util_set_added_attendees_mails (ECalComponent *comp,
g_object_set_data_full (G_OBJECT (comp), "new-attendees", emails, free_slist_strs);
}
-const gchar *
-cal_comp_util_find_parameter_xvalue (icalproperty *prop,
- const gchar *name)
+gchar *
+cal_comp_util_dup_parameter_xvalue (ICalProperty *prop,
+ const gchar *name)
{
- icalparameter *param;
+ ICalParameter *param;
if (!prop || !name || !*name)
return NULL;
- for (param = icalproperty_get_first_parameter (prop, ICAL_X_PARAMETER);
+ for (param = i_cal_property_get_first_parameter (prop, I_CAL_X_PARAMETER);
param;
- param = icalproperty_get_next_parameter (prop, ICAL_X_PARAMETER)) {
- const gchar *xname = icalparameter_get_xname (param);
+ g_object_unref (param), param = i_cal_property_get_next_parameter (prop, I_CAL_X_PARAMETER)) {
+ const gchar *xname = i_cal_parameter_get_xname (param);
+
+ if (xname && g_ascii_strcasecmp (xname, name) == 0) {
+ gchar *value;
+
+ value = g_strdup (i_cal_parameter_get_xvalue (param));
+ g_object_unref (param);
- if (xname && g_ascii_strcasecmp (xname, name) == 0)
- return icalparameter_get_xvalue (param);
+ return value;
+ }
}
return NULL;
}
gchar *
-cal_comp_util_get_attendee_comments (icalcomponent *icalcomp)
+cal_comp_util_get_attendee_comments (ICalComponent *icomp)
{
GString *comments = NULL;
- icalproperty *prop;
+ ICalProperty *prop;
- g_return_val_if_fail (icalcomp != NULL, NULL);
+ g_return_val_if_fail (icomp != NULL, NULL);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_ATTENDEE_PROPERTY)) {
gchar *guests_str = NULL;
guint32 num_guests = 0;
- const gchar *value;
+ gchar *value;
- value = cal_comp_util_find_parameter_xvalue (prop, "X-NUM-GUESTS");
+ value = cal_comp_util_dup_parameter_xvalue (prop, "X-NUM-GUESTS");
if (value && *value)
num_guests = atoi (value);
+ g_free (value);
- value = cal_comp_util_find_parameter_xvalue (prop, "X-RESPONSE-COMMENT");
+ value = cal_comp_util_dup_parameter_xvalue (prop, "X-RESPONSE-COMMENT");
if (num_guests)
guests_str = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "with one guest", "with
%d guests", num_guests), num_guests);
if (guests_str || (value && *value)) {
- const gchar *email = icalproperty_get_attendee (prop);
+ const gchar *email = i_cal_property_get_attendee (prop);
const gchar *cn = NULL;
- icalparameter *cnparam;
+ ICalParameter *cnparam;
- cnparam = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
+ cnparam = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
if (cnparam) {
- cn = icalparameter_get_cn (cnparam);
+ cn = i_cal_parameter_get_cn (cnparam);
if (!cn || !*cn)
cn = NULL;
}
@@ -1535,9 +1561,12 @@ cal_comp_util_get_attendee_comments (icalcomponent *icalcomp)
if (value && *value)
g_string_append (comments, value);
}
+
+ g_clear_object (&cnparam);
}
g_free (guests_str);
+ g_free (value);
}
if (comments) {
diff --git a/src/calendar/gui/comp-util.h b/src/calendar/gui/comp-util.h
index a0cac726e3..107a1a1f32 100644
--- a/src/calendar/gui/comp-util.h
+++ b/src/calendar/gui/comp-util.h
@@ -32,24 +32,28 @@
struct _EShell;
-void cal_comp_util_add_exdate (ECalComponent *comp, time_t t, icaltimezone *zone);
+void cal_comp_util_add_exdate (ECalComponent *comp,
+ time_t t,
+ ICalTimezone *zone);
/* Returns TRUE if the component uses the given timezone for both DTSTART
* and DTEND, or if the UTC offsets of the start and end times are the same
* as in the given zone. */
-gboolean cal_comp_util_compare_event_timezones (ECalComponent *comp,
- ECalClient *client,
- icaltimezone *zone);
+gboolean cal_comp_util_compare_event_timezones
+ (ECalComponent *comp,
+ ECalClient *client,
+ ICalTimezone *zone);
/* Returns the number of icons owned by the ECalComponent */
-gint cal_comp_util_get_n_icons (ECalComponent *comp, GSList **pixbufs);
+gint cal_comp_util_get_n_icons (ECalComponent *comp,
+ GSList **pixbufs);
gboolean cal_comp_is_on_server_sync (ECalComponent *comp,
ECalClient *client,
GCancellable *cancellable,
GError **error);
gboolean cal_comp_is_icalcomp_on_server_sync
- (icalcomponent *icalcomp,
+ (ICalComponent *icomp,
ECalClient *client,
GCancellable *cancellable,
GError **error);
@@ -79,13 +83,23 @@ ECalComponent * cal_comp_memo_new_with_defaults_sync
GCancellable *cancellable,
GError **error);
-void cal_comp_update_time_by_active_window (ECalComponent *comp, struct _EShell *shell);
+void cal_comp_update_time_by_active_window
+ (ECalComponent *comp,
+ struct _EShell *shell);
-void cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list);
-GSList *cal_comp_selection_get_string_list (GtkSelectionData *data);
+void cal_comp_selection_set_string_list
+ (GtkSelectionData *data,
+ GSList *str_list);
+GSList * cal_comp_selection_get_string_list
+ (GtkSelectionData *data);
-void cal_comp_set_dtstart_with_oldzone (ECalClient *client, ECalComponent *comp, const ECalComponentDateTime
*pdate);
-void cal_comp_set_dtend_with_oldzone (ECalClient *client, ECalComponent *comp, const ECalComponentDateTime
*pdate);
+void cal_comp_set_dtstart_with_oldzone
+ (ECalClient *client,
+ ECalComponent *comp,
+ const ECalComponentDateTime *pdate);
+void cal_comp_set_dtend_with_oldzone (ECalClient *client,
+ ECalComponent *comp,
+ const ECalComponentDateTime *pdate);
gboolean comp_util_sanitize_recurrence_master_sync
(ECalComponent *comp,
@@ -93,43 +107,41 @@ gboolean comp_util_sanitize_recurrence_master_sync
GCancellable *cancellable,
GError **error);
-gchar *icalcomp_suggest_filename (icalcomponent *icalcomp, const gchar *default_name);
+gchar * comp_util_suggest_filename (ICalComponent *icomp,
+ const gchar *default_name);
void cal_comp_get_instance_times (ECalClient *client,
- icalcomponent *icalcomp,
- const icaltimezone *default_zone,
+ ICalComponent *icomp,
+ const ICalTimezone *default_zone,
time_t *instance_start,
gboolean *start_is_date,
time_t *instance_end,
gboolean *end_is_date,
GCancellable *cancellable);
time_t cal_comp_gdate_to_timet (const GDate *date,
- const icaltimezone *with_zone);
+ const ICalTimezone *with_zone);
-void cal_comp_transfer_item_to (ECalClient *src_client,
+void cal_comp_transfer_item_to (ECalClient *src_client,
ECalClient *dest_client,
- icalcomponent *icalcomp_vcal,
+ ICalComponent *icomp_vcal,
gboolean do_copy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean cal_comp_transfer_item_to_finish (ECalClient *client,
+gboolean cal_comp_transfer_item_to_finish(ECalClient *client,
GAsyncResult *result,
GError **error);
-gboolean cal_comp_transfer_item_to_sync (ECalClient *src_client,
+gboolean cal_comp_transfer_item_to_sync (ECalClient *src_client,
ECalClient *dest_client,
- icalcomponent *icalcomp_event,
+ ICalComponent *icomp_event,
gboolean do_copy,
GCancellable *cancellable,
GError **error);
void cal_comp_util_update_tzid_parameter
- (icalproperty *prop,
- const struct icaltimetype tt);
+ (ICalProperty *prop,
+ const ICalTimetype *tt);
gint cal_comp_util_compare_time_with_today
- (const struct icaltimetype time_tt);
-gboolean cal_comp_util_remove_all_properties
- (icalcomponent *component,
- icalproperty_kind kind);
+ (const ICalTimetype *time_tt);
gboolean cal_comp_util_have_in_new_attendees
(const GSList *new_attendees_mails,
const gchar *eml);
@@ -139,9 +151,9 @@ void cal_comp_util_copy_new_attendees
void cal_comp_util_set_added_attendees_mails
(ECalComponent *comp,
GSList *emails);
-const gchar * cal_comp_util_find_parameter_xvalue
- (icalproperty *prop,
+gchar * cal_comp_util_dup_parameter_xvalue
+ (ICalProperty *prop,
const gchar *name);
gchar * cal_comp_util_get_attendee_comments
- (icalcomponent *icalcomp);
+ (ICalComponent *icomp);
#endif
diff --git a/src/calendar/gui/e-cal-component-preview.h b/src/calendar/gui/e-cal-component-preview.h
index 9b0b376618..a8685e235c 100644
--- a/src/calendar/gui/e-cal-component-preview.h
+++ b/src/calendar/gui/e-cal-component-preview.h
@@ -71,7 +71,7 @@ GtkWidget * e_cal_component_preview_new (void);
void e_cal_component_preview_display (ECalComponentPreview *preview,
ECalClient *client,
ECalComponent *comp,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format);
void e_cal_component_preview_clear (ECalComponentPreview *preview);
diff --git a/src/calendar/gui/e-cal-data-model.h b/src/calendar/gui/e-cal-data-model.h
index ff0b05c581..15ce5e708a 100644
--- a/src/calendar/gui/e-cal-data-model.h
+++ b/src/calendar/gui/e-cal-data-model.h
@@ -107,9 +107,9 @@ gboolean e_cal_data_model_get_skip_cancelled
void e_cal_data_model_set_skip_cancelled
(ECalDataModel *data_model,
gboolean expand_recurrences);
-icaltimezone * e_cal_data_model_get_timezone (ECalDataModel *data_model);
+ICalTimezone * e_cal_data_model_get_timezone (ECalDataModel *data_model);
void e_cal_data_model_set_timezone (ECalDataModel *data_model,
- icaltimezone *zone);
+ ICalTimezone *zone);
void e_cal_data_model_set_filter (ECalDataModel *data_model,
const gchar *sexp);
gchar * e_cal_data_model_dup_filter (ECalDataModel *data_model);
diff --git a/src/calendar/gui/e-cal-dialogs.h b/src/calendar/gui/e-cal-dialogs.h
index 10bf44929b..348d1e6a45 100644
--- a/src/calendar/gui/e-cal-dialogs.h
+++ b/src/calendar/gui/e-cal-dialogs.h
@@ -49,7 +49,7 @@ gboolean e_cal_dialogs_recur_component (ECalClient *client,
GtkWindow *parent,
gboolean delegated);
gboolean e_cal_dialogs_recur_icalcomp (ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalObjModType *mod,
GtkWindow *parent,
gboolean delegated);
@@ -71,6 +71,6 @@ GtkResponseType e_cal_dialogs_send_dragged_or_resized_component
gboolean *only_new_attendees);
gboolean e_cal_dialogs_send_component_prompt_subject
(GtkWindow *parent,
- icalcomponent *component);
+ ICalComponent *icomp);
#endif /* E_CAL_DIALOGS_H */
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index 8bdee39d93..c482c3ae62 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -4010,7 +4010,7 @@ e_cal_model_date_value_to_string (ECalModel *model,
typedef struct _GenerateInstacesData {
ECalModelGenerateInstancesData mdata;
- ECalRecurInstanceFn cb;
+ ECalRecurInstanceCb cb;
ECalClient *client;
ICalTimezone *zone;
} GenerateInstancesData;
@@ -4041,7 +4041,7 @@ void
e_cal_model_generate_instances_sync (ECalModel *model,
time_t start,
time_t end,
- ECalRecurInstanceFn cb,
+ ECalRecurInstanceCb cb,
gpointer cb_data)
{
GenerateInstancesData gid;
diff --git a/src/calendar/gui/e-cal-model.h b/src/calendar/gui/e-cal-model.h
index 0efcc7ac0e..dbbdc76fdb 100644
--- a/src/calendar/gui/e-cal-model.h
+++ b/src/calendar/gui/e-cal-model.h
@@ -180,7 +180,7 @@ EClientCache * e_cal_model_get_client_cache (ECalModel *model);
ICalComponentKind
e_cal_model_get_component_kind (ECalModel *model);
void e_cal_model_set_component_kind (ECalModel *model,
- ICalcomponentKind kind);
+ ICalComponentKind kind);
gboolean e_cal_model_get_confirm_delete (ECalModel *model);
void e_cal_model_set_confirm_delete (ECalModel *model,
gboolean confirm_delete);
@@ -371,7 +371,7 @@ void e_cal_model_generate_instances_sync
(ECalModel *model,
time_t start,
time_t end,
- ECalRecurInstanceFn cb,
+ ECalRecurInstanceCb cb,
gpointer cb_data);
GPtrArray * e_cal_model_get_object_array (ECalModel *model);
void e_cal_model_set_instance_times (ECalModelComponent *comp_data,
diff --git a/src/calendar/gui/e-cal-ops.h b/src/calendar/gui/e-cal-ops.h
index f465a8dd9e..aa6be2fcac 100644
--- a/src/calendar/gui/e-cal-ops.h
+++ b/src/calendar/gui/e-cal-ops.h
@@ -26,12 +26,12 @@
typedef void (* ECalOpsCreateComponentFunc) (ECalModel *model,
ECalClient *client,
- icalcomponent *original_icalcomp,
+ ICalComponent *original_icomp,
const gchar *new_uid,
gpointer user_data);
typedef void (* ECalOpsGetDefaultComponentFunc) (ECalModel *model,
ECalClient *client,
- icalcomponent *default_component,
+ ICalComponent *default_component,
gpointer user_data);
typedef enum {
@@ -45,13 +45,13 @@ typedef enum {
void e_cal_ops_create_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalOpsCreateComponentFunc callback,
gpointer user_data,
GDestroyNotify user_data_free);
void e_cal_ops_modify_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalObjModType mod,
ECalOpsSendFlags send_flags);
void e_cal_ops_remove_component (ECalModel *model,
@@ -63,10 +63,10 @@ void e_cal_ops_remove_component (ECalModel *model,
void e_cal_ops_delete_ecalmodel_components (ECalModel *model,
const GSList *objects); /* data is 'ECalModelComponent *' */
void e_cal_ops_paste_components (ECalModel *model,
- const gchar *icalcompstr);
+ const gchar *icompstr);
void e_cal_ops_send_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp);
+ ICalComponent *icomp);
void e_cal_ops_purge_components (ECalModel *model,
time_t older_than);
void e_cal_ops_delete_completed_tasks (ECalModel *model);
@@ -99,13 +99,13 @@ void e_cal_ops_new_component_editor_from_model
gboolean all_day);
void e_cal_ops_open_component_in_editor_sync (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
gboolean force_attendees);
void e_cal_ops_transfer_components (EShellView *shell_view,
ECalModel *model,
ECalClientSourceType source_type,
- GHashTable *icalcomps_by_source, /* ESource ~>
GSList{icalcomponent} */
+ GHashTable *icomps_by_source, /* ESource ~>
GSList{ICalComponent} */
ESource *destination,
gboolean is_move);
diff --git a/src/calendar/gui/e-calendar-view.c b/src/calendar/gui/e-calendar-view.c
index 5ba5e4a8f6..b609dd64ff 100644
--- a/src/calendar/gui/e-calendar-view.c
+++ b/src/calendar/gui/e-calendar-view.c
@@ -1782,7 +1782,6 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
ECalModel *model;
ECalClient *client = NULL;
GList *list, *link;
- gboolean free_text = FALSE;
/* This function is a timeout callback. */
@@ -1814,24 +1813,23 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- str = e_calendar_view_get_icalcomponent_summary (pevent->comp_data->client,
pevent->comp_data->icalcomp, &free_text);
+ tmp1 = e_calendar_view_dup_component_summary (pevent->comp_data->client, pevent->comp_data->icalcomp);
- if (!(str && *str)) {
+ if (!(tmp1 && *tmp1)) {
g_object_unref (newcomp);
gtk_widget_destroy (box);
+ g_free (tmp1);
return FALSE;
}
- tmp = g_markup_printf_escaped ("<b>%s</b>", str);
+ tmp = g_markup_printf_escaped ("<b>%s</b>", tmp1);
label = gtk_label_new (NULL);
gtk_label_set_line_wrap ((GtkLabel *) label, TRUE);
gtk_label_set_markup ((GtkLabel *) label, tmp);
- if (free_text) {
- g_free ((gchar *) str);
- str = NULL;
- }
+ g_free (tmp1);
+ tmp1 = NULL;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start ((GtkBox *) hbox, label, FALSE, FALSE, 0);
@@ -2034,78 +2032,73 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
}
static gboolean
-icalcomp_contains_category (icalcomponent *icalcomp,
- const gchar *category)
+icomp_contains_category (ICalComponent *icomp,
+ const gchar *category)
{
- icalproperty *property;
+ ICalProperty *prop;
- g_return_val_if_fail (icalcomp != NULL && category != NULL, FALSE);
+ g_return_val_if_fail (icomp != NULL && category != NULL, FALSE);
- for (property = icalcomponent_get_first_property (icalcomp, ICAL_CATEGORIES_PROPERTY);
- property != NULL;
- property = icalcomponent_get_next_property (icalcomp, ICAL_CATEGORIES_PROPERTY)) {
- gchar *value = icalproperty_get_value_as_string_r (property);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_CATEGORIES_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_CATEGORIES_PROPERTY)) {
+ const gchar *value = i_cal_property_get_categories (prop);
- if (value && strcmp (category, value) == 0) {
- g_free (value);
+ if (g_strcmp0 (category, value) == 0) {
+ g_object_unref (prop);
return TRUE;
}
- g_free (value);
}
return FALSE;
}
-/* e_calendar_view_get_icalcomponent_summary returns summary of calcomp,
- * and for type of birthday or anniversary it append number of years since
- * beginning. In this case, the free_text is set to TRUE and caller need
- * to g_free returned string, otherwise free_text is set to FALSE and
- * returned value is owned by calcomp.
+/* e_calendar_view_dup_component_summary returns summary of icomp,
+ * and for type of birthday or anniversary it appends number of years since
+ * beginning. Free the returned string with g_free(), when no longer needed.
*/
-
-const gchar *
-e_calendar_view_get_icalcomponent_summary (ECalClient *client,
- icalcomponent *icalcomp,
- gboolean *free_text)
+gchar *
+e_calendar_view_dup_component_summary (ECalClient *client,
+ ICalComponent *icomp)
{
const gchar *summary;
- g_return_val_if_fail (icalcomp != NULL && free_text != NULL, NULL);
+ g_return_val_if_fail (icomp != NULL, NULL);
- *free_text = FALSE;
- summary = icalcomponent_get_summary (icalcomp);
+ summary = i_cal_component_get_summary (icomp);
- if (icalcomp_contains_category (icalcomp, _("Birthday")) ||
- icalcomp_contains_category (icalcomp, _("Anniversary"))) {
- icalproperty *xprop;
+ if (icomp_contains_category (icomp, _("Birthday")) ||
+ icomp_contains_category (icomp, _("Anniversary"))) {
+ gchar *since_year_str;
- for (xprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- xprop;
- xprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
- const gchar *xname = icalproperty_get_x_name (xprop);
+ since_year_str = e_cal_util_component_dup_x_property (icomp, "X-EVOLUTION-SINCE-YEAR");
- if (xname && g_ascii_strcasecmp (xname, "X-EVOLUTION-SINCE-YEAR") == 0) {
- struct icaltimetype dtnow;
- gint since_year;
- gchar *str;
+ if (since_year_str) {
+ ICalTimetype *dtstart;
+ gint since_year;
+ gchar *res = NULL;
- str = icalproperty_get_value_as_string_r (xprop);
- since_year = str ? atoi (str) : 0;
- g_free (str);
+ since_year = atoi (since_year_str) : 0;
- dtnow = icalcomponent_get_dtstart (icalcomp);
+ dtstart = i_cal_component_get_dtstart (icomp);
- if (since_year > 0 && dtnow.year - since_year > 0) {
- summary = g_strdup_printf ("%s (%d)", summary ? summary : "",
dtnow.year - since_year);
- *free_text = summary != NULL;
- }
-
- break;
+ if (since_year > 0 && dtstart && i_cal_time_is_valid_time (dtstart) &&
+ i_cal_timetype_get_year (dtstart) - since_year > 0) {
+ /* Translators: the '%s' stands for a component summary, the '%d' for the
years.
+ The string is used for Birthday & Anniversary events where the first year
is
+ know, constructing a summary which also shows how many years the birthday
or
+ anniversary is for. Example: "Birthday: John Doe (13)" */
+ summary = g_strdup_printf (C_("BirthdaySummary", "%s (%d)"), summary ?
summary : "", i_cal_timetype_get_year (dtstart) - since_year);
}
+
+ g_clear_object (&dtstart);
+ g_free (since_year_str);
+
+ return res ? res : g_strdup (summary);
}
}
- return summary;
+ return g_strdup (summary);
}
/* A callback for e_cal_ops_create_component(), whose @user_data is an ECalendarView instance */
diff --git a/src/calendar/gui/e-calendar-view.h b/src/calendar/gui/e-calendar-view.h
index f114e76c43..cade88cbe5 100644
--- a/src/calendar/gui/e-calendar-view.h
+++ b/src/calendar/gui/e-calendar-view.h
@@ -142,8 +142,8 @@ struct _ECalendarViewClass {
void (*selection_changed) (ECalendarView *cal_view);
void (*selected_time_changed)(ECalendarView *cal_view);
void (*timezone_changed) (ECalendarView *cal_view,
- icaltimezone *old_zone,
- icaltimezone *new_zone);
+ ICalTimezone *old_zone,
+ ICalTimezone *new_zone);
void (*event_changed) (ECalendarView *day_view,
ECalendarViewEvent *event);
void (*event_added) (ECalendarView *day_view,
@@ -179,9 +179,9 @@ struct _ECalendarViewClass {
GType e_calendar_view_get_type (void);
ECalModel * e_calendar_view_get_model (ECalendarView *cal_view);
-icaltimezone * e_calendar_view_get_timezone (ECalendarView *cal_view);
+ICalTimezone * e_calendar_view_get_timezone (ECalendarView *cal_view);
void e_calendar_view_set_timezone (ECalendarView *cal_view,
- icaltimezone *zone);
+ ICalTimezone *zone);
gint e_calendar_view_get_time_divisions
(ECalendarView *cal_view);
void e_calendar_view_set_time_divisions
@@ -219,7 +219,7 @@ void e_calendar_view_delete_selected_occurrence
ECompEditor * e_calendar_view_open_event_with_flags
(ECalendarView *cal_view,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
guint32 flags);
void e_calendar_view_popup_event (ECalendarView *cal_view,
@@ -228,8 +228,8 @@ void e_calendar_view_popup_event (ECalendarView *cal_view,
void e_calendar_view_add_event (ECalendarView *cal_view,
ECalClient *client,
time_t dtstart,
- icaltimezone *default_zone,
- icalcomponent *icalcomp,
+ ICalTimezone *default_zone,
+ ICalComponent *icomp,
gboolean in_top_canvas);
void e_calendar_view_new_appointment_full
(ECalendarView *cal_view,
@@ -240,7 +240,7 @@ void e_calendar_view_new_appointment (ECalendarView *cal_view);
void e_calendar_view_edit_appointment
(ECalendarView *cal_view,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
EEditEventMode mode);
void e_calendar_view_open_event (ECalendarView *cal_view);
gchar * e_calendar_view_get_description_text
@@ -254,15 +254,14 @@ void e_calendar_view_move_tip (GtkWidget *widget,
gint x,
gint y);
-const gchar * e_calendar_view_get_icalcomponent_summary
+gchar * e_calendar_view_dup_component_summary
(ECalClient *ecal,
- icalcomponent *icalcomp,
- gboolean *free_text);
+ ICalComponent *icomp);
void e_calendar_view_component_created_cb
(ECalModel *model,
ECalClient *client,
- icalcomponent *original_icalcomp,
+ ICalComponent *original_icomp,
const gchar *new_uid,
gpointer user_data);
diff --git a/src/calendar/gui/e-cell-date-edit-text.h b/src/calendar/gui/e-cell-date-edit-text.h
index 2d48580907..cb1d68704d 100644
--- a/src/calendar/gui/e-cell-date-edit-text.h
+++ b/src/calendar/gui/e-cell-date-edit-text.h
@@ -85,11 +85,11 @@ struct _ECellDateEditTextClass {
GType e_cell_date_edit_text_get_type (void);
ECell * e_cell_date_edit_text_new (const gchar *fontname,
GtkJustification justify);
-icaltimezone * e_cell_date_edit_text_get_timezone
+ICalTimezone * e_cell_date_edit_text_get_timezone
(ECellDateEditText *ecd);
void e_cell_date_edit_text_set_timezone
(ECellDateEditText *ecd,
- icaltimezone *timezone);
+ ICalTimezone *timezone);
gboolean e_cell_date_edit_text_get_use_24_hour_format
(ECellDateEditText *ecd);
void e_cell_date_edit_text_set_use_24_hour_format
diff --git a/src/calendar/gui/e-comp-editor-page-attachments.c
b/src/calendar/gui/e-comp-editor-page-attachments.c
index 4f28c57f70..def5ccbfc5 100644
--- a/src/calendar/gui/e-comp-editor-page-attachments.c
+++ b/src/calendar/gui/e-comp-editor-page-attachments.c
@@ -422,7 +422,7 @@ ecep_attachments_fill_component (ECompEditorPage *page,
return FALSE;
}
- cal_comp_util_remove_all_properties (component, ICAL_ATTACH_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_ATTACH_PROPERTY, TRUE);
attachments = e_attachment_store_get_attachments (E_ATTACHMENT_STORE (page_attachments->priv->store));
for (link = attachments; link; link = g_list_next (link)) {
diff --git a/src/calendar/gui/e-comp-editor-page-general.c b/src/calendar/gui/e-comp-editor-page-general.c
index 61b9ddcd9c..ee4bbdf080 100644
--- a/src/calendar/gui/e-comp-editor-page-general.c
+++ b/src/calendar/gui/e-comp-editor-page-general.c
@@ -1053,7 +1053,7 @@ ecep_general_fill_component (ECompEditorPage *page,
if (page_general->priv->comp_color)
e_comp_editor_property_part_fill_component (page_general->priv->comp_color, component);
- cal_comp_util_remove_all_properties (component, ICAL_ATTENDEE_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_ATTENDEE_PROPERTY, TRUE);
if (e_comp_editor_page_general_get_show_attendees (page_general)) {
const GPtrArray *attendees;
@@ -1221,7 +1221,7 @@ ecep_general_fill_component (ECompEditorPage *page,
g_clear_object (&comp_editor);
} else {
- cal_comp_util_remove_all_properties (component, ICAL_ORGANIZER_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_ORGANIZER_PROPERTY, TRUE);
}
return E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_general_parent_class)->fill_component (page,
component);
diff --git a/src/calendar/gui/e-comp-editor-page-recurrence.c
b/src/calendar/gui/e-comp-editor-page-recurrence.c
index c6111cf625..e72aff0749 100644
--- a/src/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/src/calendar/gui/e-comp-editor-page-recurrence.c
@@ -1403,7 +1403,7 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
g_return_if_reached ();
}
- cal_comp_util_remove_all_properties (component, ICAL_RRULE_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RRULE_PROPERTY, TRUE);
/* Set the recurrence */
prop = icalproperty_new_rrule (r);
@@ -1822,21 +1822,21 @@ ecep_recurrence_fill_component (ECompEditorPage *page,
/* We just keep whatever the component has currently */
return TRUE;
} else if (recurs) {
- cal_comp_util_remove_all_properties (component, ICAL_RRULE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_RDATE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_EXRULE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_EXDATE_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RRULE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RDATE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_EXRULE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_EXDATE_PROPERTY, TRUE);
ecep_recurrence_simple_recur_to_comp (page_recurrence, component);
} else {
gboolean had_recurrences = e_cal_util_component_has_recurrences (component);
- cal_comp_util_remove_all_properties (component, ICAL_RRULE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_RDATE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_EXRULE_PROPERTY);
- cal_comp_util_remove_all_properties (component, ICAL_EXDATE_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RRULE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RDATE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_EXRULE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_EXDATE_PROPERTY, TRUE);
if (had_recurrences)
- cal_comp_util_remove_all_properties (component, ICAL_RECURRENCEID_PROPERTY);
+ e_cal_util_component_remove_property_by_kind (component, I_CAL_RECURRENCEID_PROPERTY,
TRUE);
return TRUE;
}
diff --git a/src/calendar/gui/e-comp-editor-page.h b/src/calendar/gui/e-comp-editor-page.h
index 114cbdf3d7..b104efb025 100644
--- a/src/calendar/gui/e-comp-editor-page.h
+++ b/src/calendar/gui/e-comp-editor-page.h
@@ -64,9 +64,9 @@ struct _ECompEditorPageClass {
void (* sensitize_widgets) (ECompEditorPage *page,
gboolean force_insensitive);
void (* fill_widgets) (ECompEditorPage *page,
- icalcomponent *component);
+ ICalComponent *component);
gboolean (* fill_component) (ECompEditorPage *page,
- icalcomponent *component);
+ ICalComponent *component);
/* Signals */
void (* changed) (ECompEditorPage *page);
@@ -85,9 +85,9 @@ void e_comp_editor_page_add_property_part (ECompEditorPage *page,
void e_comp_editor_page_sensitize_widgets (ECompEditorPage *page,
gboolean force_insensitive);
void e_comp_editor_page_fill_widgets (ECompEditorPage *page,
- icalcomponent *component);
+ ICalComponent *component);
gboolean e_comp_editor_page_fill_component (ECompEditorPage *page,
- icalcomponent *component);
+ ICalComponent *component);
void e_comp_editor_page_emit_changed (ECompEditorPage *page);
gboolean e_comp_editor_page_get_updating (ECompEditorPage *page);
void e_comp_editor_page_set_updating (ECompEditorPage *page,
diff --git a/src/calendar/gui/e-comp-editor-property-part.h b/src/calendar/gui/e-comp-editor-property-part.h
index b504e3becd..6df0c132b9 100644
--- a/src/calendar/gui/e-comp-editor-property-part.h
+++ b/src/calendar/gui/e-comp-editor-property-part.h
@@ -165,9 +165,9 @@ struct _ECompEditorPropertyPartClass {
GtkWidget **out_label_widget,
GtkWidget **out_edit_widget);
void (* fill_widget) (ECompEditorPropertyPart *property_part,
- icalcomponent *component);
+ ICalComponent *component);
void (* fill_component) (ECompEditorPropertyPart *property_part,
- icalcomponent *component);
+ ICalComponent *component);
/* Signals */
void (* changed) (ECompEditorPropertyPart *property_part);
@@ -188,9 +188,9 @@ void e_comp_editor_property_part_create_widgets
(ECompEditorPropertyPart *prope
GtkWidget * e_comp_editor_property_part_get_label_widget (ECompEditorPropertyPart *property_part);
GtkWidget * e_comp_editor_property_part_get_edit_widget (ECompEditorPropertyPart *property_part);
void e_comp_editor_property_part_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component);
+ ICalComponent *component);
void e_comp_editor_property_part_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component);
+ ICalComponent *component);
void e_comp_editor_property_part_emit_changed (ECompEditorPropertyPart *property_part);
/* ************************************************************************* */
@@ -212,12 +212,12 @@ struct _ECompEditorPropertyPartStringClass {
the default is the GtkEntry */
GType entry_type;
- /* ical property kind and its manipulation functions */
- icalproperty_kind ical_prop_kind;
- icalproperty * (* ical_new_func) (const gchar *value);
- void (* ical_set_func) (icalproperty *prop,
+ /* ICal property kind and its manipulation functions */
+ ICalPropertyKind prop_kind;
+ ICalProperty * (* i_cal_new_func) (const gchar *value);
+ void (* i_cal_set_func) (ICalProperty *prop,
const gchar *value);
- const gchar * (* ical_get_func) (const icalproperty *prop);
+ const gchar * (* i_cal_get_func) (const ICalProperty *prop);
};
GType e_comp_editor_property_part_string_get_type (void) G_GNUC_CONST;
@@ -245,13 +245,12 @@ struct _ECompEditorPropertyPartDatetime {
struct _ECompEditorPropertyPartDatetimeClass {
ECompEditorPropertyPartClass parent_class;
- /* ical property kind and its manipulation functions */
- icalproperty_kind ical_prop_kind;
- icalproperty * (* ical_new_func) (struct icaltimetype value);
- void (* ical_set_func) (icalproperty *prop,
- struct icaltimetype value);
- struct icaltimetype
- (* ical_get_func) (const icalproperty *prop);
+ /* ICal property kind and its manipulation functions */
+ ICalPropertyKind prop_kind;
+ ICalProperty * (* i_cal_new_func) (ICalTimetype *value);
+ void (* i_cal_set_func) (ICalProperty *prop,
+ ICalTimetype *value);
+ ICalTimetype * (* i_cal_get_func) (const ICalProperty *prop);
};
GType e_comp_editor_property_part_datetime_get_type (void) G_GNUC_CONST;
@@ -269,9 +268,8 @@ void e_comp_editor_property_part_datetime_set_allow_no_date_set
gboolean e_comp_editor_property_part_datetime_get_allow_no_date_set
(ECompEditorPropertyPartDatetime
*part_datetime);
void e_comp_editor_property_part_datetime_set_value (ECompEditorPropertyPartDatetime
*part_datetime,
- struct icaltimetype value);
-struct icaltimetype
- e_comp_editor_property_part_datetime_get_value (ECompEditorPropertyPartDatetime
*part_datetime);
+ const ICalTimetype *value);
+ICalTimetype * e_comp_editor_property_part_datetime_get_value (ECompEditorPropertyPartDatetime
*part_datetime);
gboolean e_comp_editor_property_part_datetime_check_validity
(ECompEditorPropertyPartDatetime
*part_datetime,
gboolean *out_date_is_valid,
@@ -292,12 +290,12 @@ struct _ECompEditorPropertyPartSpin {
struct _ECompEditorPropertyPartSpinClass {
ECompEditorPropertyPartClass parent_class;
- /* ical property kind and its manipulation functions */
- icalproperty_kind ical_prop_kind;
- icalproperty * (* ical_new_func) (gint value);
- void (* ical_set_func) (icalproperty *prop,
+ /* ICal property kind and its manipulation functions */
+ ICalPropertyKind prop_kind;
+ ICalProperty * (* i_cal_new_func) (gint value);
+ void (* i_cal_set_func) (ICalProperty *prop,
gint value);
- gint (* ical_get_func) (const icalproperty *prop);
+ gint (* i_cal_get_func) (const ICalProperty *prop);
};
GType e_comp_editor_property_part_spin_get_type (void) G_GNUC_CONST;
@@ -327,11 +325,11 @@ struct _ECompEditorPropertyPartPickerClass {
GSList **out_ids,
GSList **out_display_names);
gboolean (* get_from_component) (ECompEditorPropertyPartPicker *part_picker,
- icalcomponent *component,
+ ICalComponent *component,
gchar **out_id);
void (* set_to_component) (ECompEditorPropertyPartPicker *part_picker,
const gchar *id,
- icalcomponent *component);
+ ICalComponent *component);
};
GType e_comp_editor_property_part_picker_get_type (void) G_GNUC_CONST;
@@ -340,12 +338,12 @@ void e_comp_editor_property_part_picker_get_values
(ECompEditorPropertyPartPick
GSList **out_display_names);
gboolean e_comp_editor_property_part_picker_get_from_component
(ECompEditorPropertyPartPicker *part_picker,
- icalcomponent *component,
+ ICalComponent *component,
gchar **out_id);
void e_comp_editor_property_part_picker_set_to_component
(ECompEditorPropertyPartPicker *part_picker,
const gchar *id,
- icalcomponent *component);
+ ICalComponent *component);
const gchar * e_comp_editor_property_part_picker_get_selected_id
(ECompEditorPropertyPartPicker *part_picker);
void e_comp_editor_property_part_picker_set_selected_id
@@ -359,16 +357,16 @@ typedef struct _ECompEditorPropertyPartPickerWithMapClass ECompEditorPropertyPar
typedef struct _ECompEditorPropertyPartPickerWithMapPrivate ECompEditorPropertyPartPickerWithMapPrivate;
typedef struct _ECompEditorPropertyPartPickerMap {
- gint value; /* libical enum value */
+ gint value; /* ICal enum value */
const gchar *description; /* user visible description of the value */
gboolean delete_prop; /* whether to delete property from the component when this one is selected
*/
gboolean (*matches_func) (gint map_value, gint component_value); /* can be NULL, then 'equal' compare
is done */
} ECompEditorPropertyPartPickerMap;
-typedef icalproperty * (* ECompEditorPropertyPartPickerMapICalNewFunc) (gint value);
-typedef void (* ECompEditorPropertyPartPickerMapICalSetFunc) (icalproperty *prop,
+typedef ICalProperty * (* ECompEditorPropertyPartPickerMapICalNewFunc) (gint value);
+typedef void (* ECompEditorPropertyPartPickerMapICalSetFunc) (ICalProperty *prop,
gint value);
-typedef gint (* ECompEditorPropertyPartPickerMapICalGetFunc) (const icalproperty *prop);
+typedef gint (* ECompEditorPropertyPartPickerMapICalGetFunc) (const ICalProperty *prop);
struct _ECompEditorPropertyPartPickerWithMap {
ECompEditorPropertyPartPicker parent;
@@ -386,10 +384,10 @@ ECompEditorPropertyPart *
e_comp_editor_property_part_picker_with_map_new (const ECompEditorPropertyPartPickerMap map[],
gint n_map_elements,
const gchar *label,
- icalproperty_kind ical_prop_kind,
- ECompEditorPropertyPartPickerMapICalNewFunc
ical_new_func,
- ECompEditorPropertyPartPickerMapICalSetFunc
ical_set_func,
- ECompEditorPropertyPartPickerMapICalGetFunc
ical_get_func);
+ ICalPropertyKind prop_kind,
+ ECompEditorPropertyPartPickerMapICalNewFunc
i_cal_new_func,
+ ECompEditorPropertyPartPickerMapICalSetFunc
i_cal_set_func,
+ ECompEditorPropertyPartPickerMapICalGetFunc
i_cal_get_func);
gint e_comp_editor_property_part_picker_with_map_get_selected
(ECompEditorPropertyPartPickerWithMap
*part_picker_with_map);
void e_comp_editor_property_part_picker_with_map_set_selected
diff --git a/src/calendar/gui/e-comp-editor.h b/src/calendar/gui/e-comp-editor.h
index 76a06405a2..06939208ec 100644
--- a/src/calendar/gui/e-comp-editor.h
+++ b/src/calendar/gui/e-comp-editor.h
@@ -79,9 +79,9 @@ struct _ECompEditorClass {
void (* sensitize_widgets) (ECompEditor *comp_editor,
gboolean force_insensitive);
void (* fill_widgets) (ECompEditor *comp_editor,
- icalcomponent *component);
+ ICalComponent *component);
gboolean (* fill_component) (ECompEditor *comp_editor,
- icalcomponent *component);
+ ICalComponent *component);
/* Signals */
void (* times_changed) (ECompEditor *comp_editor);
@@ -93,9 +93,9 @@ struct _ECompEditorClass {
GType e_comp_editor_get_type (void) G_GNUC_CONST;
void e_comp_editor_sensitize_widgets (ECompEditor *comp_editor);
void e_comp_editor_fill_widgets (ECompEditor *comp_editor,
- icalcomponent *component);
+ ICalComponent *component);
gboolean e_comp_editor_fill_component (ECompEditor *comp_editor,
- icalcomponent *component);
+ ICalComponent *component);
void e_comp_editor_set_validation_error
(ECompEditor *comp_editor,
ECompEditorPage *error_page,
@@ -104,7 +104,7 @@ void e_comp_editor_set_validation_error
EShell * e_comp_editor_get_shell (ECompEditor *comp_editor);
GSettings * e_comp_editor_get_settings (ECompEditor *comp_editor);
ESource * e_comp_editor_get_origin_source (ECompEditor *comp_editor);
-icalcomponent * e_comp_editor_get_component (ECompEditor *comp_editor);
+ICalComponent * e_comp_editor_get_component (ECompEditor *comp_editor);
guint32 e_comp_editor_get_flags (ECompEditor *comp_editor);
void e_comp_editor_set_flags (ECompEditor *comp_editor,
guint32 flags);
@@ -176,11 +176,11 @@ ECompEditor * e_comp_editor_open_for_component
(GtkWindow *parent,
EShell *shell,
ESource *origin_source,
- const icalcomponent *component,
+ const ICalComponent *component,
guint32 flags /* bit-or of ECompEditorFlags */);
ECompEditor * e_comp_editor_find_existing_for (ESource *origin_source,
- const icalcomponent *component);
-icaltimezone * e_comp_editor_lookup_timezone (ECompEditor *comp_editor,
+ const ICalComponent *component);
+ICalTimezone * e_comp_editor_lookup_timezone (ECompEditor *comp_editor,
const gchar *tzid);
G_END_DECLS
diff --git a/src/calendar/gui/e-date-time-list.h b/src/calendar/gui/e-date-time-list.h
index d9178cdf9b..1ac7490844 100644
--- a/src/calendar/gui/e-date-time-list.h
+++ b/src/calendar/gui/e-date-time-list.h
@@ -70,24 +70,22 @@ struct _EDateTimeListClass {
GType e_date_time_list_get_type (void);
EDateTimeList * e_date_time_list_new (void);
-struct icaltimetype *
- e_date_time_list_get_date_time
- (EDateTimeList *date_time_list,
+ICalTimetype * e_date_time_list_get_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter);
void e_date_time_list_set_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const struct icaltimetype itt);
+ const ICalTimetype *itt);
gboolean e_date_time_list_get_use_24_hour_format
(EDateTimeList *date_time_list);
void e_date_time_list_set_use_24_hour_format
(EDateTimeList *date_time_list,
gboolean use_24_hour_format);
-icaltimezone * e_date_time_list_get_timezone (EDateTimeList *date_time_list);
+ICalTimezone * e_date_time_list_get_timezone (EDateTimeList *date_time_list);
void e_date_time_list_set_timezone (EDateTimeList *date_time_list,
- icaltimezone *zone);
+ const ICalTimezone *zone);
void e_date_time_list_append (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const struct icaltimetype itt);
+ const ICalTimetype *itt);
void e_date_time_list_remove (EDateTimeList *date_time_list,
GtkTreeIter *iter);
void e_date_time_list_clear (EDateTimeList *date_time_list);
diff --git a/src/calendar/gui/e-day-view-time-item.h b/src/calendar/gui/e-day-view-time-item.h
index 880aa4c470..5a8e909340 100644
--- a/src/calendar/gui/e-day-view-time-item.h
+++ b/src/calendar/gui/e-day-view-time-item.h
@@ -72,7 +72,7 @@ void e_day_view_time_item_set_day_view
EDayView *day_view);
gint e_day_view_time_item_get_column_width
(EDayViewTimeItem *time_item);
-icaltimezone * e_day_view_time_item_get_second_zone
+ICalTimezone * e_day_view_time_item_get_second_zone
(EDayViewTimeItem *time_item);
G_END_DECLS
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index aaedadd79c..57b5441b7e 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -3444,8 +3444,7 @@ e_day_view_update_long_event_label (EDayView *day_view,
ECalendarView *cal_view;
ECalModel *model;
ESourceRegistry *registry;
- const gchar *summary;
- gboolean free_text = FALSE;
+ gchar *summary;
cal_view = E_CALENDAR_VIEW (day_view);
model = e_calendar_view_get_model (cal_view);
@@ -3462,15 +3461,14 @@ e_day_view_update_long_event_label (EDayView *day_view,
if (!event->canvas_item || !is_comp_data_valid (event))
return;
- summary = e_calendar_view_get_icalcomponent_summary (event->comp_data->client,
event->comp_data->icalcomp, &free_text);
+ summary = e_calendar_view_dup_component_summary (event->comp_data->client,
event->comp_data->icalcomp);
gnome_canvas_item_set (
event->canvas_item,
"text", summary ? summary : "",
NULL);
- if (free_text)
- g_free ((gchar *) summary);
+ g_free (summary);
if (e_cal_util_component_has_attendee (event->comp_data->icalcomp))
set_style_from_attendee (event, registry);
diff --git a/src/calendar/gui/e-meeting-attendee.h b/src/calendar/gui/e-meeting-attendee.h
index a345ff6b42..d19f5f5033 100644
--- a/src/calendar/gui/e-meeting-attendee.h
+++ b/src/calendar/gui/e-meeting-attendee.h
@@ -85,11 +85,11 @@ const gchar *e_meeting_attendee_get_member (EMeetingAttendee *ia);
void e_meeting_attendee_set_member (EMeetingAttendee *ia, gchar *member);
gboolean e_meeting_attendee_is_set_member (EMeetingAttendee *ia);
-icalparameter_cutype e_meeting_attendee_get_cutype (EMeetingAttendee *ia);
-void e_meeting_attendee_set_cutype (EMeetingAttendee *ia, icalparameter_cutype cutype);
+ICalParameterCutype e_meeting_attendee_get_cutype (EMeetingAttendee *ia);
+void e_meeting_attendee_set_cutype (EMeetingAttendee *ia, ICalParameterCutype cutype);
-icalparameter_role e_meeting_attendee_get_role (EMeetingAttendee *ia);
-void e_meeting_attendee_set_role (EMeetingAttendee *ia, icalparameter_role role);
+ICalParameterRole e_meeting_attendee_get_role (EMeetingAttendee *ia);
+void e_meeting_attendee_set_role (EMeetingAttendee *ia, ICalParameterRole role);
gboolean e_meeting_attendee_get_rsvp (EMeetingAttendee *ia);
void e_meeting_attendee_set_rsvp (EMeetingAttendee *ia, gboolean rsvp);
@@ -102,8 +102,8 @@ const gchar *e_meeting_attendee_get_delfrom (EMeetingAttendee *ia);
void e_meeting_attendee_set_delfrom (EMeetingAttendee *ia, gchar *delfrom);
gboolean e_meeting_attendee_is_set_delfrom (EMeetingAttendee *ia);
-icalparameter_partstat e_meeting_attendee_get_status (EMeetingAttendee *ia);
-void e_meeting_attendee_set_status (EMeetingAttendee *ia, icalparameter_partstat status);
+ICalParameterPartstat e_meeting_attendee_get_status (EMeetingAttendee *ia);
+void e_meeting_attendee_set_status (EMeetingAttendee *ia, ICalParameterPartstat status);
const gchar *e_meeting_attendee_get_sentby (EMeetingAttendee *ia);
void e_meeting_attendee_set_sentby (EMeetingAttendee *ia, gchar *sentby);
diff --git a/src/calendar/gui/e-meeting-store.h b/src/calendar/gui/e-meeting-store.h
index c587d78e96..c6539a68a2 100644
--- a/src/calendar/gui/e-meeting-store.h
+++ b/src/calendar/gui/e-meeting-store.h
@@ -105,9 +105,9 @@ const gchar * e_meeting_store_get_free_busy_template
void e_meeting_store_set_free_busy_template
(EMeetingStore *meeting_store,
const gchar *free_busy_template);
-icaltimezone * e_meeting_store_get_timezone (EMeetingStore *meeting_store);
+ICalTimezone * e_meeting_store_get_timezone (EMeetingStore *meeting_store);
void e_meeting_store_set_timezone (EMeetingStore *meeting_store,
- icaltimezone *timezone);
+ const ICalTimezone *timezone);
gboolean e_meeting_store_get_show_address(EMeetingStore *store);
void e_meeting_store_set_show_address(EMeetingStore *store,
gboolean show_address);
diff --git a/src/calendar/gui/e-memo-table.c b/src/calendar/gui/e-memo-table.c
index 2415ffff55..9e43a67d7c 100644
--- a/src/calendar/gui/e-memo-table.c
+++ b/src/calendar/gui/e-memo-table.c
@@ -401,10 +401,8 @@ memo_table_query_tooltip (GtkWidget *widget,
gint row = -1, col = -1, row_y = -1, row_height = -1;
GtkWidget *box, *l, *w;
GdkRGBA sel_bg, sel_fg, norm_bg, norm_text;
- gchar *tmp;
- const gchar *str;
+ gchar *tmp, *summary;
GString *tmp2;
- gboolean free_text = FALSE;
ECalComponent *new_comp;
ECalComponentOrganizer organizer;
ECalComponentDateTime dtstart, dtdue;
@@ -452,17 +450,14 @@ memo_table_query_tooltip (GtkWidget *widget,
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- str = e_calendar_view_get_icalcomponent_summary (
- comp_data->client, comp_data->icalcomp, &free_text);
- if (!(str && *str)) {
- if (free_text)
- g_free ((gchar *) str);
- free_text = FALSE;
- str = _("* No Summary *");
+ summary = e_calendar_view_dup_component_summary (comp_data->client, comp_data->icalcomp);
+ if (!(summary && *summary)) {
+ g_free (summary);
+ summary = g_Strdup (_("* No Summary *"));
}
l = gtk_label_new (NULL);
- tmp = g_markup_printf_escaped ("<b>%s</b>", str);
+ tmp = g_markup_printf_escaped ("<b>%s</b>", summary);
gtk_label_set_line_wrap (GTK_LABEL (l), TRUE);
gtk_label_set_markup (GTK_LABEL (l), tmp);
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
@@ -474,9 +469,7 @@ memo_table_query_tooltip (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
g_free (tmp);
- if (free_text)
- g_free ((gchar *) str);
- free_text = FALSE;
+ g_free (summary);
w = gtk_event_box_new ();
gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &norm_bg);
diff --git a/src/calendar/gui/e-memo-table.h b/src/calendar/gui/e-memo-table.h
index 8bbdf363b0..d01f0a8b45 100644
--- a/src/calendar/gui/e-memo-table.h
+++ b/src/calendar/gui/e-memo-table.h
@@ -68,7 +68,7 @@ struct _EMemoTable {
ECellDateEdit *dates_cell;
/* Fields used for cut/copy/paste */
- icalcomponent *tmp_vcal;
+ ICalComponent *tmp_vcal;
EMemoTablePrivate *priv;
};
@@ -88,9 +88,9 @@ GtkWidget * e_memo_table_new (EShellView *shell_view,
ECalModel *model);
ECalModel * e_memo_table_get_model (EMemoTable *memo_table);
EShellView * e_memo_table_get_shell_view (EMemoTable *memo_table);
-icaltimezone * e_memo_table_get_timezone (EMemoTable *memo_table);
+ICalTimezone * e_memo_table_get_timezone (EMemoTable *memo_table);
void e_memo_table_set_timezone (EMemoTable *memo_table,
- icaltimezone *timezone);
+ const ICalTimezone *timezone);
gboolean e_memo_table_get_use_24_hour_format
(EMemoTable *memo_table);
void e_memo_table_set_use_24_hour_format
diff --git a/src/calendar/gui/e-send-options-utils.h b/src/calendar/gui/e-send-options-utils.h
index 5a49250ba5..592b26ff45 100644
--- a/src/calendar/gui/e-send-options-utils.h
+++ b/src/calendar/gui/e-send-options-utils.h
@@ -35,6 +35,6 @@ void e_send_options_utils_set_default_data
void e_send_options_utils_fill_component
(ESendOptionsDialog *sod,
ECalComponent *comp,
- icaltimezone *zone);
+ ICalTimezone *zone);
#endif
diff --git a/src/calendar/gui/e-task-table.c b/src/calendar/gui/e-task-table.c
index f23c69f7db..17fb1daa6d 100644
--- a/src/calendar/gui/e-task-table.c
+++ b/src/calendar/gui/e-task-table.c
@@ -724,10 +724,9 @@ task_table_query_tooltip (GtkWidget *widget,
gint row = -1, col = -1, row_y = -1, row_height = -1;
GtkWidget *box, *l, *w;
GdkRGBA sel_bg, sel_fg, norm_bg, norm_text;
- gchar *tmp;
+ gchar *tmp, *summary;
const gchar *str;
GString *tmp2;
- gboolean free_text = FALSE;
ECalComponent *new_comp;
ECalComponentOrganizer organizer;
ECalComponentDateTime dtstart, dtdue;
@@ -773,17 +772,14 @@ task_table_query_tooltip (GtkWidget *widget,
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- str = e_calendar_view_get_icalcomponent_summary (
- comp_data->client, comp_data->icalcomp, &free_text);
- if (!(str && *str)) {
- if (free_text)
- g_free ((gchar *) str);
- free_text = FALSE;
- str = _("* No Summary *");
+ summary = e_calendar_view_dup_component_summary (comp_data->client, comp_data->icalcomp);
+ if (!(summary && *summary)) {
+ g_free (summary);
+ summary = g_strdup (_("* No Summary *"));
}
l = gtk_label_new (NULL);
- tmp = g_markup_printf_escaped ("<b>%s</b>", str);
+ tmp = g_markup_printf_escaped ("<b>%s</b>", summary);
gtk_label_set_line_wrap (GTK_LABEL (l), TRUE);
gtk_label_set_markup (GTK_LABEL (l), tmp);
gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
@@ -795,9 +791,7 @@ task_table_query_tooltip (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
g_free (tmp);
- if (free_text)
- g_free ((gchar *) str);
- free_text = FALSE;
+ g_free (summary);
w = gtk_event_box_new ();
gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &norm_bg);
diff --git a/src/calendar/gui/e-task-table.h b/src/calendar/gui/e-task-table.h
index 09e68c1ec6..72995878e8 100644
--- a/src/calendar/gui/e-task-table.h
+++ b/src/calendar/gui/e-task-table.h
@@ -66,7 +66,7 @@ struct _ETaskTable {
ECellDateEdit *dates_cell;
/* Fields used for cut/copy/paste */
- icalcomponent *tmp_vcal;
+ ICalComponent *tmp_vcal;
ETaskTablePrivate *priv;
};
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index 40fad7aade..f270eaa84a 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -3685,28 +3685,27 @@ tooltip_event_cb (GnomeCanvasItem *item,
}
}
-static const gchar *
-get_comp_summary (ECalClient *client,
- icalcomponent *icalcomp,
- gboolean *free_text)
+static gchar *
+dup_comp_summary (ECalClient *client,
+ ICalComponent *icomp)
{
- const gchar *my_summary, *location;
- const gchar *summary;
- gboolean my_free_text = FALSE;
+ const gchar *location;
+ gchar *summary, *my_summary;
+
+ g_return_val_if_fail (icomp != NULL, NULL);
- g_return_val_if_fail (icalcomp != NULL && free_text != NULL, NULL);
+ my_summary = e_calendar_view_dup_component_summary (client, icomp);
- my_summary = e_calendar_view_get_icalcomponent_summary (client, icalcomp, &my_free_text);
+ location = i_cal_component_get_location (icomp);
- location = icalcomponent_get_location (icalcomp);
if (location && *location) {
- *free_text = TRUE;
- summary = g_strdup_printf ("%s (%s)", my_summary ? my_summary : "", location);
+ /* Translators: the first '%s' is replaced with a component summary;
+ the second '%s' is replaced with an event location.
+ Example: "Meet John Doe (Central Park)" */
+ summary = g_strdup_printf (C_("SummaryWithLocation", "%s (%s)"), my_summary ? my_summary :
"", location);
- if (my_free_text)
- g_free ((gchar *) my_summary);
+ g_free (my_summary);
} else {
- *free_text = my_free_text;
summary = my_summary;
}
@@ -3844,12 +3843,11 @@ e_week_view_reshape_event_span (EWeekView *week_view,
/* Create the text item if necessary. */
if (!span->text_item) {
- const gchar *summary;
+ gchar *summary;
GdkColor color;
- gboolean free_text = FALSE;
color = e_week_view_get_text_color (week_view, event);
- summary = get_comp_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text);
+ summary = dup_comp_summary (event->comp_data->client, event->comp_data->icalcomp);
span->text_item =
gnome_canvas_item_new (
@@ -3864,8 +3862,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
"im_context", E_CANVAS (week_view->main_canvas)->im_context,
NULL);
- if (free_text)
- g_free ((gchar *) summary);
+ g_free (summary);
if (e_cal_util_component_has_attendee (event->comp_data->icalcomp))
set_style_from_attendee (event, span, registry);
@@ -4753,14 +4750,12 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
/* Only update the summary if necessary. */
e_cal_component_get_summary (comp, &summary);
if (summary.value && !strcmp (text, summary.value)) {
- gboolean free_text = FALSE;
- const gchar *summary;
+ gchar *summary;
- summary = get_comp_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text);
+ summary = dup_comp_summary (event->comp_data->client, event->comp_data->icalcomp);
g_object_set (span->text_item, "text", summary ? summary : "", NULL);
- if (free_text)
- g_free ((gchar *) summary);
+ g_free (summary);
if (!e_week_view_is_one_day_event (week_view, event_num))
e_week_view_reshape_event_span (week_view, event_num, span_num);
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index 114bb2b8c2..1d6c005178 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -2589,38 +2589,46 @@ itip_publish_begin (ECalComponent *pub_comp,
}
static gboolean
-check_time (const struct icaltimetype tmval,
+check_time (ICalTimetype *tmval,
gboolean can_null_time)
{
- if (icaltime_is_null_time (tmval))
+ gboolean valid;
+
+ if (!tmpval || i_cal_time_is_null_time (tmval)) {
+ g_clear_object (&tmval);
return can_null_time;
+ }
+
+ valid = i_cal_time_is_valid_time (tmval) &&
+ i_cal_time_type_get_month (tmval) >= 1 && i_cal_time_type_get_month (tmval) <= 12 &&
+ i_cal_time_type_get_day (tmval) >= 1 && i_cal_time_type_get_day (tmval) <= 31 &&
+ i_cal_time_type_get_hour (tmval) >= 0 && i_cal_time_type_get_hour (tmval) < 24 &&
+ i_cal_time_type_get_minute (tmval) >= 0 && i_cal_time_type_get_minute (tmval) < 60 &&
+ i_cal_time_type_get_second (tmval) >= 0 && i_cal_time_type_get_second (tmval) < 60;
+
+ g_clear_object (&tmval);
- return icaltime_is_valid_time (tmval) &&
- tmval.month >= 1 && tmval.month <= 12 &&
- tmval.day >= 1 && tmval.day <= 31 &&
- tmval.hour >= 0 && tmval.hour < 24 &&
- tmval.minute >= 0 && tmval.minute < 60 &&
- tmval.second >= 0 && tmval.second < 60;
+ return valid;
}
/* Returns whether the passed-in icalcomponent is valid or not.
* It does some sanity checks on values too. */
gboolean
-is_icalcomp_valid (icalcomponent *icalcomp)
+itip_is_component_valid (ICalComponent *icomp)
{
- if (!icalcomp || !icalcomponent_is_valid (icalcomp))
+ if (!icomp || !i_cal_component_is_valid (icomp))
return FALSE;
- switch (icalcomponent_isa (icalcomp)) {
- case ICAL_VEVENT_COMPONENT:
- return check_time (icalcomponent_get_dtstart (icalcomp), FALSE) &&
- check_time (icalcomponent_get_dtend (icalcomp), TRUE);
- case ICAL_VTODO_COMPONENT:
- return check_time (icalcomponent_get_dtstart (icalcomp), TRUE) &&
- check_time (icalcomponent_get_due (icalcomp), TRUE);
- case ICAL_VJOURNAL_COMPONENT:
- return check_time (icalcomponent_get_dtstart (icalcomp), TRUE) &&
- check_time (icalcomponent_get_dtend (icalcomp), TRUE);
+ switch (i_cal_component_isa (icomp)) {
+ case I_CAL_VEVENT_COMPONENT:
+ return check_time (i_cal_component_get_dtstart (icomp), FALSE) &&
+ check_time (i_cal_component_get_dtend (icomp), TRUE);
+ case I_CAL_VTODO_COMPONENT:
+ return check_time (i_cal_component_get_dtstart (icomp), TRUE) &&
+ check_time (i_cal_component_get_due (icomp), TRUE);
+ case I_CAL_VJOURNAL_COMPONENT:
+ return check_time (i_cal_component_get_dtstart (icomp), TRUE) &&
+ check_time (i_cal_component_get_dtend (icomp), TRUE);
default:
break;
}
diff --git a/src/calendar/gui/itip-utils.h b/src/calendar/gui/itip-utils.h
index 86845762c8..b6b89664ac 100644
--- a/src/calendar/gui/itip-utils.h
+++ b/src/calendar/gui/itip-utils.h
@@ -76,7 +76,7 @@ gboolean itip_send_comp_sync (ESourceRegistry *registry,
ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList *attachments_list,
GSList *users,
gboolean strip_alarms,
@@ -87,7 +87,7 @@ void itip_send_component_with_model (ECalModel *model,
ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList *attachments_list,
GSList *users,
gboolean strip_alarms,
@@ -97,7 +97,7 @@ void itip_send_component (ESourceRegistry *registry,
ECalComponentItipMethod method,
ECalComponent *send_comp,
ECalClient *cal_client,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList *attachments_list,
GSList *users,
gboolean strip_alarms,
@@ -117,9 +117,9 @@ gboolean reply_to_calendar_comp (ESourceRegistry *registry,
ECalComponent *send_comp,
ECalClient *cal_client,
gboolean reply_all,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList *attachments_list);
-gboolean is_icalcomp_valid (icalcomponent *icalcomp);
+gboolean itip_is_component_valid (ICalComponent *icomp);
gboolean itip_component_has_recipients (ECalComponent *comp);
G_END_DECLS
diff --git a/src/calendar/gui/print.h b/src/calendar/gui/print.h
index 75b835bfd4..fd9d90953d 100644
--- a/src/calendar/gui/print.h
+++ b/src/calendar/gui/print.h
@@ -43,7 +43,7 @@ void print_calendar (ECalendarView *cal_view,
time_t start);
void print_comp (ECalComponent *comp,
ECalClient *cal_client,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format,
GtkPrintOperationAction action);
void print_table (ETable *table,
diff --git a/src/calendar/gui/tag-calendar.c b/src/calendar/gui/tag-calendar.c
index 1227c38d9c..bd8d1a2411 100644
--- a/src/calendar/gui/tag-calendar.c
+++ b/src/calendar/gui/tag-calendar.c
@@ -1042,13 +1042,11 @@ tag_calendar_by_comp (ECalendar *ecal,
e_cal_client_generate_instances_for_object (
client, e_cal_component_get_icalcomponent (comp),
closure.start_time, closure.end_time, cancellable,
- (ECalRecurInstanceFn) tag_calendar_cb,
+ tag_calendar_cb,
alloced_closure, (GDestroyNotify) g_free);
} else
e_cal_recur_generate_instances (
comp, closure.start_time, closure.end_time,
- (ECalRecurInstanceFn) tag_calendar_cb,
- &closure,
- (ECalRecurResolveTimezoneFn) resolve_tzid_cb,
- client, closure.zone);
+ tag_calendar_cb, &closure,
+ resolve_tzid_cb, client, closure.zone);
}
diff --git a/src/calendar/gui/tag-calendar.h b/src/calendar/gui/tag-calendar.h
index 8b8a88976f..e565927314 100644
--- a/src/calendar/gui/tag-calendar.h
+++ b/src/calendar/gui/tag-calendar.h
@@ -82,7 +82,7 @@ void e_tag_calendar_unsubscribe (ETagCalendar *tag_calendar,
void tag_calendar_by_comp (ECalendar *ecal,
ECalComponent *comp,
ECalClient *client,
- icaltimezone *display_zone,
+ ICalTimezone *display_zone,
gboolean clear_first,
gboolean comp_is_on_server,
gboolean can_recur_events_italic,
diff --git a/src/calendar/importers/icalendar-importer.c b/src/calendar/importers/icalendar-importer.c
index b4fd16130c..a6be631009 100644
--- a/src/calendar/importers/icalendar-importer.c
+++ b/src/calendar/importers/icalendar-importer.c
@@ -53,7 +53,7 @@ typedef struct {
ECalClient *cal_client;
ECalClientSourceType source_type;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GCancellable *cancellable;
} ICalImporter;
@@ -62,7 +62,7 @@ typedef struct {
EImport *ei;
EImportTarget *target;
GList *tasks;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GCancellable *cancellable;
} ICalIntelligentImporter;
@@ -82,23 +82,34 @@ static const gchar *import_type_strings[] = {
* Functions shared by iCalendar & vCalendar importer.
*/
-static GtkWidget *ical_get_preview (icalcomponent *icalcomp);
+static GtkWidget *ical_get_preview (ICalComponent *icomp);
static gboolean
-is_icalcomp_usable (icalcomponent *icalcomp)
+is_icomp_usable (ICalComponent *icomp)
{
- return icalcomp && icalcomponent_is_valid (icalcomp) && (
- icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT) != NULL ||
- icalcomponent_get_first_component (icalcomp, ICAL_VTODO_COMPONENT) != NULL);
+ ICalComponent *vevent, *vtodo;
+ gboolean usable;
+
+ if (!icomp || !i_cal_component_is_valid (icomp))
+ return FALSE;
+
+ vevent = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
+ vtodo = i_cal_component_get_first_component (icomp, I_CAL_VTODO_COMPONENT);
+
+ usable = vevent || vtodo;
+
+ g_clear_object (&vevent);
+ g_clear_object (&vtodo);
+
+ return usable;
}
static void
ivcal_import_done (ICalImporter *ici,
const GError *error)
{
- if (ici->cal_client)
- g_object_unref (ici->cal_client);
- icalcomponent_free (ici->icalcomp);
+ g_clear_object (&ici->cal_client);
+ g_clear_object (&ici->icomp);
e_import_complete (ici->import, ici->target, error);
g_object_unref (ici->import);
@@ -108,61 +119,71 @@ ivcal_import_done (ICalImporter *ici,
/* This removes all components except VEVENTs and VTIMEZONEs from the toplevel */
static void
-prepare_events (icalcomponent *icalcomp,
- GList **vtodos)
+prepare_events (ICalComponent *icomp,
+ GList **vtodos) /* ICalComponent * */
{
- icalcomponent *subcomp;
- icalcompiter iter;
+ ICalComponent *subcomp;
+ ICalCompIter *iter;
if (vtodos)
*vtodos = NULL;
- iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT);
- while ((subcomp = icalcompiter_deref (&iter)) != NULL) {
- icalcomponent_kind child_kind = icalcomponent_isa (subcomp);
- if (child_kind != ICAL_VEVENT_COMPONENT
- && child_kind != ICAL_VTIMEZONE_COMPONENT) {
+ iter = i_cal_component_begin_component (icomp, I_CAL_ANY_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
+ ICalComponentKind child_kind = i_cal_component_isa (subcomp);
- icalcompiter_next (&iter);
+ next_subcomp = i_cal_comp_iter_next (iter);
- icalcomponent_remove_component (icalcomp, subcomp);
- if (child_kind == ICAL_VTODO_COMPONENT && vtodos)
- *vtodos = g_list_prepend (*vtodos, subcomp);
- else
- icalcomponent_free (subcomp);
- } else {
- icalcompiter_next (&iter);
+ if (child_kind != I_CAL_VEVENT_COMPONENT &&
+ child_kind != I_CAL_VTIMEZONE_COMPONENT) {
+ i_cal_component_remove_component (icomp, subcomp);
+ if (child_kind == I_CAL_VTODO_COMPONENT && vtodos)
+ *vtodos = g_list_prepend (*vtodos, g_object_ref (subcomp));
}
+
+ g_clear_object (&subcomp);
+ subcomp = next_subcomp;
}
+
+ g_clear_object (&iter);
}
/* This removes all components except VTODOs and VTIMEZONEs from the toplevel
- * icalcomponent, and adds the given list of VTODO components. The list is
+ * ICalComponent, and adds the given list of VTODO components. The list is
* freed afterwards. */
static void
-prepare_tasks (icalcomponent *icalcomp,
- GList *vtodos)
+prepare_tasks (ICalComponent *icomp,
+ GList *vtodos)
{
- icalcomponent *subcomp;
+ ICalComponent *subcomp;
+ ICalCompIter *iter;
GList *elem;
- icalcompiter iter;
-
- iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT);
- while ((subcomp = icalcompiter_deref (&iter)) != NULL) {
- icalcomponent_kind child_kind = icalcomponent_isa (subcomp);
- if (child_kind != ICAL_VTODO_COMPONENT
- && child_kind != ICAL_VTIMEZONE_COMPONENT) {
- icalcompiter_next (&iter);
- icalcomponent_remove_component (icalcomp, subcomp);
- icalcomponent_free (subcomp);
- } else {
- icalcompiter_next (&iter);
+
+ iter = i_cal_component_begin_component (icomp, I_CAL_ANY_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
+ ICalComponentKind child_kind = i_cal_component_isa (subcomp);
+
+ next_subcomp = i_cal_comp_iter_next (iter);
+
+ if (child_kind != I_CAL_VTODO_COMPONENT &&
+ child_kind != I_CAL_VTIMEZONE_COMPONENT) {
+ i_cal_component_remove_component (icomp, subcomp);
}
+
+ g_clear_object (&subcomp);
+ subcomp = next_subcomp;
}
+ g_clear_object (&iter);
+
for (elem = vtodos; elem; elem = elem->next) {
- icalcomponent_add_component (icalcomp, elem->data);
+ i_cal_component_take_component (icomp, elem->data);
}
+
g_list_free (vtodos);
}
@@ -194,27 +215,27 @@ receive_objects_ready_cb (GObject *source_object,
static void
update_objects (ECalClient *cal_client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
GCancellable *cancellable,
void (*done_cb) (gpointer user_data, const GError *error),
gpointer user_data)
{
- icalcomponent_kind kind;
- icalcomponent *vcal;
+ ICalComponentKind kind;
+ ICalComponent *vcal;
struct UpdateObjectsData *uod;
- kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) {
+ kind = i_cal_component_isa (icomp);
+ if (kind == I_CAL_VTODO_COMPONENT || kind == I_CAL_VEVENT_COMPONENT) {
vcal = e_cal_util_new_top_level ();
- if (icalcomponent_get_method (icalcomp) == ICAL_METHOD_CANCEL)
- icalcomponent_set_method (vcal, ICAL_METHOD_CANCEL);
+ if (i_cal_component_get_method (icomp) == I_CAL_METHOD_CANCEL)
+ i_cal_component_set_method (vcal, I_CAL_METHOD_CANCEL);
else
- icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH);
- icalcomponent_add_component (vcal, icalcomponent_new_clone (icalcomp));
- } else if (kind == ICAL_VCALENDAR_COMPONENT) {
- vcal = icalcomponent_new_clone (icalcomp);
- if (!icalcomponent_get_first_property (vcal, ICAL_METHOD_PROPERTY))
- icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH);
+ i_cal_component_set_method (vcal, I_CAL_METHOD_PUBLISH);
+ i_cal_component_take_component (vcal, i_cal_component_new_clone (icomp));
+ } else if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ vcal = i_cal_component_new_clone (icomp);
+ if (!e_cal_util_component_has_property (vcal, I_CAL_METHOD_PROPERTY))
+ i_cal_component_set_method (vcal, I_CAL_METHOD_PUBLISH);
} else {
if (done_cb)
done_cb (user_data, NULL);
@@ -225,9 +246,9 @@ update_objects (ECalClient *cal_client,
uod->done_cb = done_cb;
uod->user_data = user_data;
- e_cal_client_receive_objects (cal_client, vcal, cancellable, receive_objects_ready_cb, uod);
+ e_cal_client_receive_objects (cal_client, vcal, E_CAL_OPERATION_FLAG_NONE, cancellable,
receive_objects_ready_cb, uod);
- icalcomponent_free (vcal);
+ g_object_unref (vcal);
return;
}
@@ -337,7 +358,7 @@ ivcal_getwidget (EImport *ei,
gtk_notebook_set_show_border (GTK_NOTEBOOK (nb), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), nb, TRUE, TRUE, 6);
- /* Type of icalendar items */
+ /* Type of iCalendar items */
for (i = 0; import_type_map[i] != -1; i++) {
GtkWidget *selector, *rb, *create_button, *vbox;
GtkWidget *scrolled;
@@ -432,12 +453,12 @@ ivcal_import_items (gpointer d)
switch (ici->source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
- prepare_events (ici->icalcomp, NULL);
- update_objects (ici->cal_client, ici->icalcomp, ici->cancellable, ivcal_call_import_done,
ici);
+ prepare_events (ici->icomp, NULL);
+ update_objects (ici->cal_client, ici->icomp, ici->cancellable, ivcal_call_import_done, ici);
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
- prepare_tasks (ici->icalcomp, NULL);
- update_objects (ici->cal_client, ici->icalcomp, ici->cancellable, ivcal_call_import_done,
ici);
+ prepare_tasks (ici->icomp, NULL);
+ update_objects (ici->cal_client, ici->icomp, ici->cancellable, ivcal_call_import_done, ici);
break;
default:
g_warn_if_reached ();
@@ -482,7 +503,7 @@ ivcal_connect_cb (GObject *source_object,
static void
ivcal_import (EImport *ei,
EImportTarget *target,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
ECalClientSourceType type;
ICalImporter *ici = g_malloc0 (sizeof (*ici));
@@ -493,7 +514,7 @@ ivcal_import (EImport *ei,
g_datalist_set_data (&target->data, "ivcal-data", ici);
g_object_ref (ei);
ici->target = target;
- ici->icalcomp = icalcomp;
+ ici->icomp = icomp;
ici->cal_client = NULL;
ici->source_type = type;
ici->cancellable = g_cancellable_new ();
@@ -545,14 +566,14 @@ ical_supported (EImport *ei,
return FALSE;
if (g_file_get_contents (filename, &contents, NULL, NULL)) {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
- icalcomp = e_cal_util_parse_ics_string (contents);
+ icomp = e_cal_util_parse_ics_string (contents);
g_free (contents);
- if (icalcomp) {
- ret = is_icalcomp_usable (icalcomp);
- icalcomponent_free (icalcomp);
+ if (icomp) {
+ ret = is_icomp_usable (icomp);
+ g_object_unref (icomp);
}
}
g_free (filename);
@@ -567,7 +588,7 @@ ical_import (EImport *ei,
{
gchar *filename;
gchar *contents;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GError *error = NULL;
EImportTargetURI *s = (EImportTargetURI *) target;
@@ -586,11 +607,11 @@ ical_import (EImport *ei,
}
g_free (filename);
- icalcomp = e_cal_util_parse_ics_string (contents);
+ icomp = e_cal_util_parse_ics_string (contents);
g_free (contents);
- if (icalcomp)
- ivcal_import (ei, target, icalcomp);
+ if (icomp)
+ ivcal_import (ei, target, icomp);
else
e_import_complete (ei, target, error);
}
@@ -603,7 +624,7 @@ ivcal_get_preview (EImport *ei,
GtkWidget *preview;
EImportTargetURI *s = (EImportTargetURI *) target;
gchar *filename;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
gchar *contents;
filename = g_filename_from_uri (s->uri_src, NULL, NULL);
@@ -618,15 +639,15 @@ ivcal_get_preview (EImport *ei,
}
g_free (filename);
- icalcomp = e_cal_util_parse_ics_string (contents);
+ icomp = e_cal_util_parse_ics_string (contents);
g_free (contents);
- if (!icalcomp)
+ if (!icomp)
return NULL;
- preview = ical_get_preview (icalcomp);
+ preview = ical_get_preview (icomp);
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
return preview;
}
@@ -683,25 +704,28 @@ vcal_supported (EImport *ei,
if (g_file_get_contents (filename, &contents, NULL, NULL)) {
VObject *vcal;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
- icalcomp = e_cal_util_parse_ics_string (contents);
+ icomp = e_cal_util_parse_ics_string (contents);
- if (icalcomp && is_icalcomp_usable (icalcomp)) {
+ if (icomp && is_icomp_usable (icomp)) {
/* If we can create proper iCalendar from the file, then
* rather use ics importer, because it knows to read more
* information than older version, the vCalendar. */
ret = FALSE;
+
g_free (contents);
+ g_clear_object (&icomp);
} else {
- if (icalcomp)
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
/* parse the file */
vcal = Parse_MIME (contents, strlen (contents));
g_free (contents);
if (vcal) {
+ icalcomponent *icalcomp;
+
icalcomp = icalvcal_convert (vcal);
if (icalcomp) {
@@ -718,9 +742,9 @@ vcal_supported (EImport *ei,
return ret;
}
-/* This tries to load in a vCalendar file and convert it to an icalcomponent.
+/* This tries to load in a vCalendar file and convert it to an ICalComponent.
* It returns NULL on failure. */
-static icalcomponent *
+static ICalComponent *
load_vcalendar_file (const gchar *filename)
{
icalvcal_defaults defaults = { NULL };
@@ -753,7 +777,17 @@ load_vcalendar_file (const gchar *filename)
}
}
- return icalcomp;
+ if (icalcomp) {
+ ICalComponent *icomp;
+
+ icomp = i_cal_object_construct (I_CAL_TYPE_COMPONENT, icalcomp,
+ (GDestroyNotify) icalcomponent_free,
+ FALSE, NULL);
+
+ return icomp;
+ }
+
+ return NULL;
}
static void
@@ -762,7 +796,7 @@ vcal_import (EImport *ei,
EImportImporter *im)
{
gchar *filename;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
EImportTargetURI *s = (EImportTargetURI *) target;
GError *error = NULL;
@@ -772,10 +806,10 @@ vcal_import (EImport *ei,
return;
}
- icalcomp = load_vcalendar_file (filename);
+ icomp = load_vcalendar_file (filename);
g_free (filename);
- if (icalcomp)
- ivcal_import (ei, target, icalcomp);
+ if (icomp)
+ ivcal_import (ei, target, icomp);
else
e_import_complete (ei, target, error);
}
@@ -788,7 +822,7 @@ vcal_get_preview (EImport *ei,
GtkWidget *preview;
EImportTargetURI *s = (EImportTargetURI *) target;
gchar *filename;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
filename = g_filename_from_uri (s->uri_src, NULL, NULL);
if (filename == NULL) {
@@ -796,15 +830,15 @@ vcal_get_preview (EImport *ei,
return NULL;
}
- icalcomp = load_vcalendar_file (filename);
+ icomp = load_vcalendar_file (filename);
g_free (filename);
- if (!icalcomp)
+ if (!icomp)
return NULL;
- preview = ical_get_preview (icalcomp);
+ preview = ical_get_preview (icomp);
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
return preview;
}
@@ -856,9 +890,7 @@ free_ici (gpointer ptr)
if (!ici)
return;
- if (ici->icalcomp)
- icalcomponent_free (ici->icalcomp);
-
+ g_clear_object (&ici->icomp);
g_object_unref (ici->cancellable);
g_free (ici);
}
@@ -970,10 +1002,10 @@ gc_import_tasks (ECalClient *cal_client,
e_import_status (ici->ei, ici->target, _("Importing..."), 0);
- prepare_tasks (ici->icalcomp, ici->tasks);
+ prepare_tasks (ici->icomp, ici->tasks);
update_objects (
- cal_client, ici->icalcomp,
+ cal_client, ici->icomp,
ici->cancellable, continue_done_cb, ici);
}
@@ -1011,7 +1043,7 @@ gc_import_events (ECalClient *cal_client,
e_import_status (ici->ei, ici->target, _("Importing..."), 0);
update_objects (
- cal_client, ici->icalcomp, ici->cancellable,
+ cal_client, ici->icomp, ici->cancellable,
ici->tasks ? continue_tasks_cb : continue_done_cb, ici);
}
@@ -1020,7 +1052,7 @@ gnome_calendar_import (EImport *ei,
EImportTarget *target,
EImportImporter *im)
{
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
gchar *filename;
gint do_calendar, do_tasks;
ICalIntelligentImporter *ici;
@@ -1037,26 +1069,26 @@ gnome_calendar_import (EImport *ei,
/* Load the Gnome Calendar file and convert to iCalendar. */
filename = g_build_filename (g_get_home_dir (), "user-cal.vcf", NULL);
- icalcomp = load_vcalendar_file (filename);
+ icomp = load_vcalendar_file (filename);
g_free (filename);
/* If we couldn't load the file, just return. FIXME: Error message? */
- if (icalcomp) {
+ if (icomp) {
ici = g_malloc0 (sizeof (*ici));
ici->ei = ei;
ici->target = target;
ici->cancellable = g_cancellable_new ();
- ici->icalcomp = icalcomp;
+ ici->icomp = icomp;
g_datalist_set_data_full (&target->data, "gnomecal-data", ici, free_ici);
- prepare_events (ici->icalcomp, &ici->tasks);
+ prepare_events (ici->icomp, &ici->tasks);
if (do_calendar) {
open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, gc_import_events);
return;
}
- prepare_tasks (ici->icalcomp, ici->tasks);
+ prepare_tasks (ici->icomp, ici->tasks);
if (do_tasks) {
open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_TASKS, gc_import_tasks);
return;
@@ -1153,32 +1185,37 @@ gnome_calendar_importer_peek (void)
static gchar *
format_dt (const ECalComponentDateTime *dt,
GHashTable *timezones,
- icaltimezone *users_zone)
+ ICalTimezone *users_zone)
{
+ ICalTimetype *tt;
struct tm tm;
- g_return_val_if_fail (dt != NULL, NULL);
g_return_val_if_fail (timezones != NULL, NULL);
- if (!dt->value)
+ if (!dt || !e_cal_component_datetime_get_value (dt))
return NULL;
- dt->value->zone = NULL;
- if (dt->tzid) {
- dt->value->zone = g_hash_table_lookup (timezones, dt->tzid);
- if (!dt->value->zone)
- dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (dt->tzid);
+ tt = e_cal_component_datetime_get_value (dt);
+
+ i_cal_timetype_set_zone (tt, NULL);
+ if (e_cal_component_datetime_get_tzid (dt)) {
+ const gchar *tzid = e_cal_component_datetime_get_tzid (dt);
+
+ i_cal_timetype_set_zone (tt, g_hash_table_lookup (timezones, tzid));
- if (!dt->value->zone && g_ascii_strcasecmp (dt->tzid, "UTC") == 0)
- dt->value->zone = icaltimezone_get_utc_timezone ();
+ if (!i_cal_timetype_get_zone (tt))
+ i_cal_timetype_set_zone (tt, i_cal_timezone_get_builtin_timezone_from_tzid (tzid));
+
+ if (!i_cal_timetype_get_zone (tt) && g_ascii_strcasecmp (tzid, "UTC") == 0)
+ i_cal_timetype_set_zone (tt, i_cal_timezone_get_utc_timezone ());
}
- if (dt->value->zone)
- tm = icaltimetype_to_tm_with_zone (dt->value, (icaltimezone *) dt->value->zone, users_zone);
+ if (i_cal_timetype_get_zone (tt))
+ tm = icaltimetype_to_tm_with_zone (tt, i_cal_timetype_get_zone (tt), users_zone);
else
- tm = icaltimetype_to_tm (dt->value);
+ tm = icaltimetype_to_tm (tt);
- return e_datetime_format_format_tm ("calendar", "table", dt->value->is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
+ return e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (tt) ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
}
static const gchar *
@@ -1194,15 +1231,15 @@ static void
preview_comp (EWebViewPreview *preview,
ECalComponent *comp)
{
- ECalComponentText text = { 0 };
- ECalComponentDateTime dt;
+ ECalComponentText *text;
+ ECalComponentDateTime *dt;
ECalComponentClassification classif;
const gchar *str;
gchar *tmp;
gint percent;
gboolean have;
GHashTable *timezones;
- icaltimezone *users_zone;
+ ICalTimezone *users_zone;
GSList *slist, *l;
g_return_if_fail (preview != NULL);
@@ -1253,8 +1290,7 @@ preview_comp (EWebViewPreview *preview,
}
str = NULL;
- classif = E_CAL_COMPONENT_CLASS_NONE;
- e_cal_component_get_classification (comp, &classif);
+ classif = e_cal_component_get_classification (comp);
if (classif == E_CAL_COMPONENT_CLASS_PUBLIC) {
/* Translators: Appointment's classification */
str = C_("iCalImp", "Public");
@@ -1269,43 +1305,42 @@ preview_comp (EWebViewPreview *preview,
/* Translators: Appointment's classification section name */
e_web_view_preview_add_section (preview, C_("iCalImp", "Classification"), str);
- e_cal_component_get_summary (comp, &text);
- if ((text.value && *text.value) || (text.altrep && *text.altrep))
+ text = e_cal_component_get_summary (comp);
+ if (text && (e_cal_component_text_get_value (text) || e_cal_component_text_get_altrep (text)))
/* Translators: Appointment's summary */
- e_web_view_preview_add_section (preview, C_("iCalImp", "Summary"), (text.value &&
*text.value) ? text.value : text.altrep);
+ e_web_view_preview_add_section (preview, C_("iCalImp", "Summary"),
+ e_cal_component_text_get_value (text) ? e_cal_component_text_get_value (text) :
e_cal_component_text_get_altrep (text));
+ e_cal_component_text_free (text);
- str = NULL;
- e_cal_component_get_location (comp, &str);
- if (str && *str)
+ tmp = e_cal_component_get_location (comp);
+ if (tmp && *tmp)
/* Translators: Appointment's location */
- e_web_view_preview_add_section (preview, C_("iCalImp", "Location"), str);
+ e_web_view_preview_add_section (preview, C_("iCalImp", "Location"), tmp);
+ g_free (tmp);
- dt.value = NULL;
- e_cal_component_get_dtstart (comp, &dt);
- if (dt.value) {
- tmp = format_dt (&dt, timezones, users_zone);
+ dt = e_cal_component_get_dtstart (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ tmp = format_dt (dt, timezones, users_zone);
if (tmp)
/* Translators: Appointment's start time */
e_web_view_preview_add_section (preview, C_("iCalImp", "Start"), tmp);
g_free (tmp);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- dt.value = NULL;
- e_cal_component_get_due (comp, &dt);
- if (dt.value) {
- tmp = format_dt (&dt, timezones, users_zone);
+ dt = e_cal_component_get_due (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ tmp = format_dt (dt, timezones, users_zone);
if (tmp)
/* Translators: 'Due' like the time due a task should be finished */
e_web_view_preview_add_section (preview, C_("iCalImp", "Due"), tmp);
g_free (tmp);
} else {
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- dt.value = NULL;
- e_cal_component_get_dtend (comp, &dt);
- if (dt.value) {
- tmp = format_dt (&dt, timezones, users_zone);
+ dt = e_cal_component_get_dtend (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ tmp = format_dt (dt, timezones, users_zone);
if (tmp)
/* Translators: Appointment's end time */
@@ -1313,29 +1348,29 @@ preview_comp (EWebViewPreview *preview,
g_free (tmp);
}
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- str = NULL;
- e_cal_component_get_categories (comp, &str);
- if (str && *str)
+ tmp = e_cal_component_get_categories (comp);
+ if (tmp && *tmp)
/* Translators: Appointment's categories */
- e_web_view_preview_add_section (preview, C_("iCalImp", "Categories"), str);
+ e_web_view_preview_add_section (preview, C_("iCalImp", "Categories"), tmp);
+ g_free (tmp);
- percent = e_cal_component_get_percent_as_int (comp);
+ percent = e_cal_component_get_percent_complete (comp);
if (percent >= 0) {
tmp = NULL;
if (percent == 100) {
- icaltimetype *completed = NULL;
+ ICalTimetype *completed;
- e_cal_component_get_completed (comp, &completed);
+ completed = e_cal_component_get_completed (comp);
if (completed) {
- dt.tzid = "UTC";
- dt.value = completed;
+ dt = e_cal_component_datetime_new (completed, "UTC");
- tmp = format_dt (&dt, timezones, users_zone);
+ tmp = format_dt (dt, timezones, users_zone);
- e_cal_component_free_icaltimetype (completed);
+ e_cal_component_datetime_free (dt);
+ g_object_unref (completed);
}
}
@@ -1347,65 +1382,81 @@ preview_comp (EWebViewPreview *preview,
g_free (tmp);
}
- str = NULL;
- e_cal_component_get_url (comp, &str);
- if (str && *str)
+ tmp = e_cal_component_get_url (comp);
+ if (tmp && *tmp)
/* Translators: Appointment's URL */
- e_web_view_preview_add_section (preview, C_("iCalImp", "URL"), str);
+ e_web_view_preview_add_section (preview, C_("iCalImp", "URL"), tmp);
+ g_free (tmp);
if (e_cal_component_has_organizer (comp)) {
- ECalComponentOrganizer organizer = { 0 };
+ ECalComponentOrganizer *organizer;
+
+ organizer = e_cal_component_get_organizer (comp);
+
+ if (organizer && e_cal_component_organizer_get_value (organizer)) {
+ const gchar *value, *cn;
- e_cal_component_get_organizer (comp, &organizer);
+ value = e_cal_component_organizer_get_value (organizer);
+ cn = e_cal_component_organizer_get_cn (organizer);
- if (organizer.value && *organizer.value) {
- if (organizer.cn && *organizer.cn) {
- tmp = g_strconcat (organizer.cn, " <", strip_mailto (organizer.value), ">",
NULL);
+ if (cn && *cn) {
+ tmp = g_strconcat (cn, " <", strip_mailto (value), ">", NULL);
/* Translators: Appointment's organizer */
e_web_view_preview_add_section (preview, C_("iCalImp", "Organizer"), tmp);
g_free (tmp);
} else {
- e_web_view_preview_add_section (preview, C_("iCalImp", "Organizer"),
strip_mailto (organizer.value));
+ e_web_view_preview_add_section (preview, C_("iCalImp", "Organizer"),
strip_mailto (value));
}
}
+
+ e_cal_component_organizer_free (organizer);
}
if (e_cal_component_has_attendees (comp)) {
- GSList *attendees = NULL, *a;
+ GSList *attendees, *link;
have = FALSE;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
+
+ for (link = attendees; link; link = g_slist_next (link)) {
+ ECalComponentAttendee *attnd = link->data;
+ const gchar *value, *cn;
- for (a = attendees; a; a = a->next) {
- ECalComponentAttendee *attnd = a->data;
+ if (!attnd)
+ continue;
- if (!attnd || !attnd->value || !*attnd->value)
+ value = e_cal_component_attendee_get_value (attnd);
+ if (!value || !*value)
continue;
- if (attnd->cn && *attnd->cn) {
- tmp = g_strconcat (attnd->cn, " <", strip_mailto (attnd->value), ">", NULL);
+ cn = e_cal_component_attendee_get_cn (attnd);
+
+ if (cn && *cn) {
+ tmp = g_strconcat (cn, " <", strip_mailto (value), ">", NULL);
/* Translators: Appointment's attendees */
e_web_view_preview_add_section (preview, have ? NULL : C_("iCalImp",
"Attendees"), tmp);
g_free (tmp);
} else {
- e_web_view_preview_add_section (preview, have ? NULL : C_("iCalImp",
"Attendees"), strip_mailto (attnd->value));
+ e_web_view_preview_add_section (preview, have ? NULL : C_("iCalImp",
"Attendees"), strip_mailto (value));
}
have = TRUE;
}
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
- slist = NULL;
- e_cal_component_get_description_list (comp, &slist);
+ slist = e_cal_component_get_descriptions (comp);
for (l = slist; l; l = l->next) {
ECalComponentText *txt = l->data;
+ const gchar *value;
+
+ value = txt ? e_cal_component_text_get_value (txt) : NULL;
- e_web_view_preview_add_section (preview, l != slist ? NULL : C_("iCalImp", "Description"),
(txt && txt->value) ? txt->value : "");
+ e_web_view_preview_add_section (preview, l != slist ? NULL : C_("iCalImp", "Description"),
value ? value : "");
}
- e_cal_component_free_text_list (slist);
+ g_slist_free_full (slist, e_cal_component_text_free);
}
static void
@@ -1434,12 +1485,12 @@ preview_selection_changed_cb (GtkTreeSelection *selection,
e_web_view_preview_end_update (preview);
}
-static icaltimezone *
+static ICalTimezone *
get_users_timezone (void)
{
/* more or less copy&paste of calendar_config_get_icaltimezone */
GSettings *settings;
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
gchar *location;
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
@@ -1453,7 +1504,7 @@ get_users_timezone (void)
g_object_unref (settings);
if (location) {
- zone = icaltimezone_get_builtin_timezone (location);
+ zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location);
}
@@ -1461,17 +1512,8 @@ get_users_timezone (void)
return zone;
}
-static void
-free_zone_cb (gpointer ptr)
-{
- icaltimezone *zone = ptr;
-
- if (zone)
- icaltimezone_free (zone, 1);
-}
-
static GtkWidget *
-ical_get_preview (icalcomponent *icalcomp)
+ical_get_preview (ICalComponent *icomp)
{
GtkWidget *preview;
GtkTreeView *tree_view;
@@ -1479,66 +1521,76 @@ ical_get_preview (icalcomponent *icalcomp)
GtkListStore *store;
GtkTreeIter iter;
GHashTable *timezones;
- icalcomponent *subcomp;
- icaltimezone *users_zone;
+ ICalComponent *subcomp;
+ ICalTimezone *users_zone;
- if (!icalcomp || !is_icalcomp_usable (icalcomp))
+ if (!icomp || !is_icomp_usable (icomp))
return NULL;
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, E_TYPE_CAL_COMPONENT);
- timezones = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, free_zone_cb);
+ timezones = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
users_zone = get_users_timezone ();
/* get timezones first */
- for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
subcomp;
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
- icaltimezone *zone = icaltimezone_new ();
- if (!icaltimezone_set_component (zone, icalcomponent_new_clone (subcomp)) ||
!icaltimezone_get_tzid (zone)) {
- icaltimezone_free (zone, 1);
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
I_CAL_VTIMEZONE_COMPONENT)) {
+ ICalTimezone *zone = i_cal_timezone_new ();
+ if (!i_cal_timezone_set_component (zone, i_cal_component_new_clone (subcomp)) ||
!i_cal_timezone_get_tzid (zone)) {
+ g_object_unref (zone);
} else {
- g_hash_table_insert (timezones, (gchar *) icaltimezone_get_tzid (zone), zone);
+ g_hash_table_insert (timezones, (gchar *) i_cal_timezone_get_tzid (zone), zone);
}
}
/* then each component */
- for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (icomp, I_CAL_ANY_COMPONENT);
subcomp;
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT)) {
- icalcomponent_kind kind = icalcomponent_isa (subcomp);
-
- if (kind == ICAL_VEVENT_COMPONENT ||
- kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VJOURNAL_COMPONENT) {
- ECalComponent *comp = e_cal_component_new ();
- ECalComponentText summary = { 0 };
- ECalComponentDateTime dt = { 0 };
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
I_CAL_ANY_COMPONENT)) {
+ ICalComponentKind kind = i_cal_component_isa (subcomp);
+
+ if (kind == I_CAL_VEVENT_COMPONENT ||
+ kind == I_CAL_VTODO_COMPONENT ||
+ kind == I_CAL_VJOURNAL_COMPONENT) {
+ ECalComponent *comp;
+ ECalComponentText *summary;
+ ECalComponentDateTime *dt;
gchar *formatted_dt;
+ const gchar *summary_txt = NULL;
- if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp))) {
- g_object_unref (comp);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (subcomp));
+ if (!comp)
continue;
+
+ summary = e_cal_component_get_summary (comp);
+ if (summary) {
+ const gchar *value, *altrep;
+
+ value = e_cal_component_text_get_value (summary);
+ altrep = e_cal_component_text_get_altrep (summary);
+
+ summary_txt = (value && *value) ? value : (altrep && *altrep) ? altrep : NULL;
}
- e_cal_component_get_summary (comp, &summary);
- e_cal_component_get_dtstart (comp, &dt);
- formatted_dt = format_dt (&dt, timezones, users_zone);
+ dt = e_cal_component_get_dtstart (comp);
+ formatted_dt = format_dt (dt, timezones, users_zone);
gtk_list_store_append (store, &iter);
gtk_list_store_set (
store, &iter,
- 0, kind == ICAL_VEVENT_COMPONENT ? (e_cal_component_has_attendees (comp) ?
C_("iCalImp", "Meeting") : C_("iCalImp", "Event")) :
- kind == ICAL_VTODO_COMPONENT ? C_("iCalImp", "Task") :
- kind == ICAL_VJOURNAL_COMPONENT ? C_("iCalImp", "Memo") : "??? Other ???",
+ 0, kind == I_CAL_VEVENT_COMPONENT ? (e_cal_component_has_attendees (comp) ?
C_("iCalImp", "Meeting") : C_("iCalImp", "Event")) :
+ kind == I_CAL_VTODO_COMPONENT ? C_("iCalImp", "Task") :
+ kind == I_CAL_VJOURNAL_COMPONENT ? C_("iCalImp", "Memo") : "??? Other ???",
1, formatted_dt ? formatted_dt : "",
- 2, summary.value && *summary.value ? summary.value : summary.altrep &&
*summary.altrep ? summary.altrep : "",
+ 2, summary_txt ? summary_txt : "",
3, comp,
-1);
- g_free (formatted_dt);
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
+ e_cal_component_text_free (summary);
g_object_unref (comp);
+ g_free (formatted_dt);
}
}
diff --git a/src/modules/calendar/e-cal-shell-view-actions.c b/src/modules/calendar/e-cal-shell-view-actions.c
index 91f6831116..453aee2743 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.c
+++ b/src/modules/calendar/e-cal-shell-view-actions.c
@@ -1137,7 +1137,7 @@ action_event_save_as_cb (GtkAction *action,
/* Translators: Default filename part saving an event to a file when
* no summary is filed, the '.ics' extension is concatenated to it. */
- string = icalcomp_suggest_filename (icalcomp, _("event"));
+ string = comp_util_suggest_filename (icalcomp, _("event"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
diff --git a/src/modules/calendar/e-cal-shell-view-memopad.c b/src/modules/calendar/e-cal-shell-view-memopad.c
index 198d4925b0..c74fe5fc86 100644
--- a/src/modules/calendar/e-cal-shell-view-memopad.c
+++ b/src/modules/calendar/e-cal-shell-view-memopad.c
@@ -202,7 +202,7 @@ action_calendar_memopad_save_as_cb (GtkAction *action,
/* Translators: Default filename part saving a memo to a file when
* no summary is filed, the '.ics' extension is concatenated to it. */
- string = icalcomp_suggest_filename (comp_data->icalcomp, _("memo"));
+ string = comp_util_suggest_filename (comp_data->icalcomp, _("memo"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
diff --git a/src/modules/calendar/e-cal-shell-view-taskpad.c b/src/modules/calendar/e-cal-shell-view-taskpad.c
index 891bbb1917..c16678f1f4 100644
--- a/src/modules/calendar/e-cal-shell-view-taskpad.c
+++ b/src/modules/calendar/e-cal-shell-view-taskpad.c
@@ -270,7 +270,7 @@ action_calendar_taskpad_save_as_cb (GtkAction *action,
/* Translators: Default filename part saving a task to a file when
* no summary is filed, the '.ics' extension is concatenated to it. */
- string = icalcomp_suggest_filename (comp_data->icalcomp, _("task"));
+ string = comp_util_suggest_filename (comp_data->icalcomp, _("task"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
diff --git a/src/modules/calendar/e-memo-shell-view-actions.c
b/src/modules/calendar/e-memo-shell-view-actions.c
index d2d3fc6ec3..93170d6cfb 100644
--- a/src/modules/calendar/e-memo-shell-view-actions.c
+++ b/src/modules/calendar/e-memo-shell-view-actions.c
@@ -507,7 +507,7 @@ action_memo_save_as_cb (GtkAction *action,
/* Translators: Default filename part saving a memo to a file when
* no summary is filed, the '.ics' extension is concatenated to it. */
- string = icalcomp_suggest_filename (comp_data->icalcomp, _("memo"));
+ string = comp_util_suggest_filename (comp_data->icalcomp, _("memo"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
diff --git a/src/modules/calendar/e-task-shell-view-actions.c
b/src/modules/calendar/e-task-shell-view-actions.c
index 857cad866f..8713e74dbc 100644
--- a/src/modules/calendar/e-task-shell-view-actions.c
+++ b/src/modules/calendar/e-task-shell-view-actions.c
@@ -626,7 +626,7 @@ action_task_save_as_cb (GtkAction *action,
/* Translators: Default filename part saving a task to a file when
* no summary is filed, the '.ics' extension is concatenated to it */
- string = icalcomp_suggest_filename (comp_data->icalcomp, _("task"));
+ string = comp_util_suggest_filename (comp_data->icalcomp, _("task"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 578e124876..46178fc2d0 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -2378,12 +2378,15 @@ itip_view_extract_attendee_info (ItipView *view)
gchar *guests_str = NULL;
guint32 num_guests = 0;
const gchar *value;
+ gchar *prop_value;
- value = cal_comp_util_find_parameter_xvalue (prop, "X-NUM-GUESTS");
- if (value && *value)
- num_guests = atoi (value);
+ prop_value = cal_comp_util_dup_parameter_xvalue (prop, "X-NUM-GUESTS");
+ if (prop_value && *prop_value)
+ num_guests = atoi (prop_value);
+ g_free (prop_value);
- value = cal_comp_util_find_parameter_xvalue (prop, "X-RESPONSE-COMMENT");
+ prop_value = cal_comp_util_dup_parameter_xvalue (prop, "X-RESPONSE-COMMENT");
+ value = prop_value;
if (value && *value && num_attendees == 1 &&
g_strcmp0 (value, top_comment) == 0)
@@ -2467,6 +2470,7 @@ itip_view_extract_attendee_info (ItipView *view)
}
}
+ g_free (prop_value);
g_free (guests_str);
}
diff --git a/src/plugins/publish-calendar/publish-format-fb.c
b/src/plugins/publish-calendar/publish-format-fb.c
index 2640e92cae..b67d705bd9 100644
--- a/src/plugins/publish-calendar/publish-format-fb.c
+++ b/src/plugins/publish-calendar/publish-format-fb.c
@@ -128,7 +128,7 @@ write_calendar (const gchar *uid,
strlen (ical_string),
NULL, NULL, error);
- e_cal_client_free_ecalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
g_free (ical_string);
}
diff --git a/src/plugins/save-calendar/csv-format.c b/src/plugins/save-calendar/csv-format.c
index 9e7d29ca9c..a79ab459df 100644
--- a/src/plugins/save-calendar/csv-format.c
+++ b/src/plugins/save-calendar/csv-format.c
@@ -532,7 +532,7 @@ do_save_calendar_csv (FormatHandler *handler,
g_output_stream_close (stream, NULL, NULL);
- e_cal_client_free_ecalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
}
if (stream)
diff --git a/src/plugins/save-calendar/rdf-format.c b/src/plugins/save-calendar/rdf-format.c
index ee6760ae83..ef4e4a1415 100644
--- a/src/plugins/save-calendar/rdf-format.c
+++ b/src/plugins/save-calendar/rdf-format.c
@@ -355,7 +355,7 @@ do_save_calendar_rdf (FormatHandler *handler,
g_output_stream_write_all (stream, xmlBufferContent (buffer), xmlBufferLength (buffer), NULL,
NULL, &error);
g_output_stream_close (stream, NULL, NULL);
- e_cal_client_free_ecalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
xmlBufferFree (buffer);
xmlFreeDoc (doc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]