[evolution/wip/mcrha/eds-libical-glib] Rebase to master branch
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/eds-libical-glib] Rebase to master branch
- Date: Mon, 25 Mar 2019 17:47:44 +0000 (UTC)
commit 6f65966097ea3a358a83e6759beee474f2bc36db
Author: Milan Crha <mcrha redhat com>
Date: Mon Mar 25 18:47:49 2019 +0100
Rebase to master branch
Initial changes with merged several src/calendar/gui changes
CMakeLists.txt | 45 +-
config.h.in | 12 -
src/calendar/gui/calendar-config.c | 31 +-
src/calendar/gui/calendar-config.h | 2 +-
src/calendar/gui/comp-util.c | 763 ++++++++-------
src/calendar/gui/comp-util.h | 76 +-
src/calendar/gui/e-alarm-list.c | 69 +-
src/calendar/gui/e-cal-component-preview.c | 185 ++--
src/calendar/gui/e-cal-component-preview.h | 2 +-
src/calendar/gui/e-cal-data-model-subscriber.c | 2 +-
src/calendar/gui/e-cal-data-model.c | 221 +++--
src/calendar/gui/e-cal-data-model.h | 4 +-
src/calendar/gui/e-cal-dialogs.c | 141 ++-
src/calendar/gui/e-cal-dialogs.h | 4 +-
src/calendar/gui/e-cal-list-view.c | 148 +--
src/calendar/gui/e-cal-list-view.h | 20 +-
src/calendar/gui/e-cal-model-calendar.c | 169 ++--
src/calendar/gui/e-cal-model-memos.c | 14 +-
src/calendar/gui/e-cal-model-tasks.c | 492 +++++-----
src/calendar/gui/e-cal-model.c | 635 ++++++-------
src/calendar/gui/e-cal-model.h | 32 +-
src/calendar/gui/e-cal-ops.c | 2 +-
src/calendar/gui/e-cal-ops.h | 16 +-
src/calendar/gui/e-calendar-view.c | 584 ++++++------
src/calendar/gui/e-calendar-view.h | 24 +-
src/calendar/gui/e-cell-date-edit-text.c | 204 +++-
src/calendar/gui/e-cell-date-edit-text.h | 34 +-
src/calendar/gui/e-comp-editor-event.c | 2 +-
src/calendar/gui/e-comp-editor-memo.c | 2 +-
src/calendar/gui/e-comp-editor-page-attachments.c | 8 +-
src/calendar/gui/e-comp-editor-page-general.c | 44 +-
src/calendar/gui/e-comp-editor-page-recurrence.c | 22 +-
src/calendar/gui/e-comp-editor-page-reminders.c | 22 +-
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-property-parts.c | 8 -
src/calendar/gui/e-comp-editor-task.c | 6 +-
src/calendar/gui/e-comp-editor.c | 14 +-
src/calendar/gui/e-comp-editor.h | 16 +-
src/calendar/gui/e-date-time-list.c | 120 ++-
src/calendar/gui/e-date-time-list.h | 12 +-
src/calendar/gui/e-day-view-main-item.c | 71 +-
src/calendar/gui/e-day-view-time-item.c | 66 +-
src/calendar/gui/e-day-view-time-item.h | 2 +-
src/calendar/gui/e-day-view-top-item.c | 29 +-
src/calendar/gui/e-day-view.c | 764 ++++++++-------
src/calendar/gui/e-meeting-attendee.h | 12 +-
src/calendar/gui/e-meeting-store.h | 4 +-
src/calendar/gui/e-memo-table.c | 152 ++-
src/calendar/gui/e-memo-table.h | 10 +-
src/calendar/gui/e-send-options-utils.c | 103 +-
src/calendar/gui/e-send-options-utils.h | 2 +-
src/calendar/gui/e-task-table.c | 215 ++---
src/calendar/gui/e-task-table.h | 6 -
src/calendar/gui/e-timezone-entry.c | 56 +-
src/calendar/gui/e-timezone-entry.h | 11 +-
src/calendar/gui/e-to-do-pane.c | 376 ++++----
src/calendar/gui/e-week-view-event-item.c | 6 +-
src/calendar/gui/e-week-view-main-item.c | 14 +-
src/calendar/gui/e-week-view.c | 406 ++++----
src/calendar/gui/ea-cal-view-event.c | 2 +-
src/calendar/gui/itip-utils.c | 1004 +++++++++++---------
src/calendar/gui/itip-utils.h | 11 +-
src/calendar/gui/print.h | 2 +-
src/calendar/gui/tag-calendar.c | 188 ++--
src/calendar/gui/tag-calendar.h | 2 +-
src/calendar/importers/icalendar-importer.c | 508 +++++-----
src/e-util/e-timezone-dialog.c | 144 +--
src/e-util/e-timezone-dialog.h | 9 +-
src/e-util/test-source-selector.c | 6 +-
src/modules/alarm-notify/alarm-notify.c | 2 +-
src/modules/calendar/e-cal-attachment-handler.c | 1 -
src/modules/calendar/e-cal-shell-content.c | 4 +-
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-private.c | 6 +-
src/modules/calendar/e-cal-shell-view-taskpad.c | 6 +-
src/modules/calendar/e-memo-shell-view-actions.c | 2 +-
src/modules/calendar/e-task-shell-content.c | 4 +-
src/modules/calendar/e-task-shell-view-actions.c | 2 +-
src/modules/itip-formatter/itip-view.c | 35 +-
src/plugins/mail-to-task/mail-to-task.c | 6 +-
src/plugins/publish-calendar/publish-format-fb.c | 4 +-
src/plugins/publish-calendar/publish-format-ical.c | 2 +-
src/plugins/save-calendar/csv-format.c | 4 +-
src/plugins/save-calendar/ical-format.c | 2 +-
src/plugins/save-calendar/rdf-format.c | 4 +-
src/shell/main.c | 8 +-
88 files changed, 4535 insertions(+), 4027 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5e24687b5..65b7f4175a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,7 +286,7 @@ pkg_check_modules(GNOME_PLATFORM REQUIRED
pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
camel-1.2>=${eds_minimum_version}
libebook-1.2>=${eds_minimum_version}
- libecal-1.2>=${eds_minimum_version}
+ libecal-2.0>=${eds_minimum_version}
libedataserver-1.2>=${eds_minimum_version}
libedataserverui-1.2>=${eds_minimum_version}
libebackend-1.2>=${eds_minimum_version}
@@ -589,49 +589,6 @@ set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
pkg_check_modules(LIBUNITY unity>=${libunity_minimum_version})
set(HAVE_LIBUNITY ${LIBUNITY_FOUND})
-# ******************************
-# libical tweaks
-# ******************************
-
-set(CMAKE_REQUIRED_DEFINITIONS ${EVOLUTION_DATA_SERVER_CFLAGS_OTHER})
-set(CMAKE_REQUIRED_INCLUDES ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS})
-set(CMAKE_REQUIRED_LIBRARIES ${EVOLUTION_DATA_SERVER_LDFLAGS})
-
-CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
- int main(void) {
- ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
- return 0;
- }" HAVE_ICAL_UNKNOWN_TOKEN_HANDLING)
-
-CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
- int main(void) {
- icaltzutil_set_exact_vtimezones_support (0);
- return 0;
- }" HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT)
-
-CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
- int main(void) {
- icalparameter *param;
- param = icalproperty_get_first_parameter (NULL, ICAL_FILENAME_PARAMETER);
- icalparameter_get_filename (param);
- icalparameter_new_filename (NULL);
- return 0;
- }" HAVE_ICAL_FILENAME_PARAMETER)
-
-CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
- int main(void) {
- icalproperty *prop;
- prop = icalcomponent_get_first_property (NULL, ICAL_COLOR_PROPERTY);
- icalproperty_get_color (prop);
- icalproperty_set_color (prop, \"white\");
- prop = icalproperty_new_color (NULL);
- return 0;
- }" HAVE_ICAL_COLOR_PROPERTY)
-
-unset(CMAKE_REQUIRED_DEFINITIONS)
-unset(CMAKE_REQUIRED_INCLUDES)
-unset(CMAKE_REQUIRED_LIBRARIES)
-
# ******************************
# gspell
# ******************************
diff --git a/config.h.in b/config.h.in
index 4a134f6b66..19bfc49cc9 100644
--- a/config.h.in
+++ b/config.h.in
@@ -99,18 +99,6 @@
/* Define if you have libunity */
#cmakedefine HAVE_LIBUNITY 1
-/* libical provides ical_set_unknown_token_handling_setting function */
-#cmakedefine HAVE_ICAL_UNKNOWN_TOKEN_HANDLING 1
-
-/* libical provides icaltzutil_set_exact_vtimezones_support function */
-#cmakedefine HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT 1
-
-/* libical provides ICAL_FILENAME_PARAMETER */
-#cmakedefine HAVE_ICAL_FILENAME_PARAMETER 1
-
-/* libical provides ICAL_COLOR_PROPERTY */
-#cmakedefine HAVE_ICAL_COLOR_PROPERTY 1
-
/* When defined GSpell usage is enabled */
#cmakedefine HAVE_GSPELL 1
diff --git a/src/calendar/gui/calendar-config.c b/src/calendar/gui/calendar-config.c
index 4be9405875..d523d5f846 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;
+ ICalTime *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. */
@@ -399,14 +402,14 @@ calendar_config_get_day_second_zone (void)
void
calendar_config_select_day_second_zone (GtkWidget *parent)
{
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
ETimezoneDialog *tzdlg;
GtkWidget *dialog;
gchar *second_location;
second_location = calendar_config_get_day_second_zone ();
if (second_location && *second_location)
- zone = icaltimezone_get_builtin_timezone (second_location);
+ zone = i_cal_timezone_get_builtin_timezone (second_location);
g_free (second_location);
if (!zone)
@@ -424,10 +427,10 @@ calendar_config_select_day_second_zone (GtkWidget *parent)
const gchar *location = NULL;
zone = e_timezone_dialog_get_timezone (tzdlg);
- if (zone == icaltimezone_get_utc_timezone ()) {
+ if (zone == i_cal_timezone_get_utc_timezone ()) {
location = "UTC";
} else if (zone) {
- location = icaltimezone_get_location (zone);
+ location = i_cal_timezone_get_location (zone);
}
calendar_config_set_day_second_zone (location);
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..75676b929d 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;
+ ICalDuration *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_null_duration ();
+ i_cal_duration_set_is_neg (duration, TRUE);
switch (default_reminder_units) {
case E_DURATION_MINUTES:
- trigger.u.rel_duration.minutes = default_reminder_interval;
+ i_cal_duration_set_minutes (duration, default_reminder_interval);
break;
case E_DURATION_HOURS:
- trigger.u.rel_duration.hours = default_reminder_interval;
+ i_cal_duration_set_hours (duration, default_reminder_interval);
break;
case E_DURATION_DAYS:
- trigger.u.rel_duration.days = default_reminder_interval;
+ i_cal_duration_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;
+ ICalTime *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_time_get_minute (itt), -i_cal_time_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;
+ ICalTime *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,199 +755,220 @@ 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_time_get_date (e_cal_component_datetime_get_value (msdt), &yy, &mm, &dd);
+ i_cal_time_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_time_get_date (e_cal_component_datetime_get_value (medt), &yy, &mm, &dd);
+ i_cal_time_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,
- time_t *instance_start,
- gboolean *start_is_date,
- time_t *instance_end,
- gboolean *end_is_date,
+ ICalComponent *icomp,
+ const ICalTimezone *default_zone,
+ ICalTime **out_instance_start,
+ ICalTime **out_instance_end,
GCancellable *cancellable)
{
- struct icaltimetype start_time, end_time;
- const icaltimezone *zone = default_zone;
+ ICalTime *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 (instance_start != NULL);
- g_return_if_fail (instance_end != NULL);
+ g_return_if_fail (icomp != NULL);
+ g_return_if_fail (out_instance_start != NULL);
+ g_return_if_fail (out_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_time_new_clone (start_time);
+ }
- if (start_time.zone) {
- zone = start_time.zone;
+ if (i_cal_time_get_timezone (start_time)) {
+ zone = i_cal_time_get_timezone (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);
- if (start_is_date)
- *start_is_date = start_time.is_date;
+ *out_instance_start = i_cal_time_new_clone (start_time);
+ i_cal_time_set_timezone (*out_instance_start, zone);
- if (end_time.zone) {
- zone = end_time.zone;
+ if (i_cal_time_get_timezone (end_time)) {
+ zone = i_cal_time_get_timezone (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);
- if (end_is_date)
- *end_is_date = end_time.is_date;
+ *out_instance_end = i_cal_time_new_clone (end_time);
+ i_cal_time_set_timezone (*out_instance_end, zone);
+
+ 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;
+ ICalTime *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);
g_date_to_struct_tm (date, &tm);
- tt = tm_to_icaltimetype (&tm, TRUE);
+ tt = e_cal_util_tm_to_icaltime (&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 +984,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 +1009,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 +1032,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 +1042,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 +1098,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 +1117,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 +1141,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 +1162,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 +1175,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 +1194,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 +1205,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 +1246,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 +1265,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 +1323,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 +1342,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 ICalTime *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 ((ICalTime *) tt) ||
+ i_cal_time_is_null_time ((ICalTime *) 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_time_get_timezone ((ICalTime *) tt))
+ tzid = i_cal_timezone_get_tzid (i_cal_time_get_timezone ((ICalTime *) tt));
- if (tt.zone && tzid && *tzid && !icaltime_is_utc (tt) && !tt.is_date) {
+ if (i_cal_time_get_timezone ((ICalTime *) tt) && tzid && *tzid &&
+ !i_cal_time_is_utc ((ICalTime *) tt) &&
+ !i_cal_time_is_date ((ICalTime *) 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 ICalTime *time_tt)
{
- struct icaltimetype now_tt;
+ ICalTime *now_tt, *tt = (ICalTime *) 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_time_get_timezone (tt));
+ i_cal_time_set_timezone (now_tt, i_cal_time_get_timezone (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 +1459,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 +1557,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..b6ae7dc617 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,39 @@ 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,
- time_t *instance_start,
- gboolean *start_is_date,
- time_t *instance_end,
- gboolean *end_is_date,
+ ICalComponent *icomp,
+ const ICalTimezone *default_zone,
+ ICalTime **out_instance_start,
+ ICalTime **out_instance_end,
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 ICalTime *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 ICalTime *time_tt);
gboolean cal_comp_util_have_in_new_attendees
(const GSList *new_attendees_mails,
const gchar *eml);
@@ -139,9 +149,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-alarm-list.c b/src/calendar/gui/e-alarm-list.c
index 15f60733ac..3b0d47c988 100644
--- a/src/calendar/gui/e-alarm-list.c
+++ b/src/calendar/gui/e-alarm-list.c
@@ -246,7 +246,7 @@ free_alarm (ECalComponentAlarm *alarm)
static ECalComponentAlarm *
copy_alarm (const ECalComponentAlarm *alarm)
{
- return e_cal_component_alarm_clone ((ECalComponentAlarm *) alarm);
+ return e_cal_component_alarm_copy ((ECalComponentAlarm *) alarm);
}
void
@@ -355,64 +355,63 @@ e_alarm_list_get_path (GtkTreeModel *tree_model,
/* Builds a string for the duration of the alarm. If the duration is zero, returns NULL. */
static gchar *
-get_alarm_duration_string (struct icaldurationtype *duration)
+get_alarm_duration_string (ICalDuration *duration)
{
GString *string = g_string_new (NULL);
- gchar *ret;
gboolean have_something;
+ guint value;
have_something = FALSE;
- if (duration->days >= 1) {
+ value = i_cal_duration_get_days (duration);
+ if (value >= 1) {
/* Translator: Entire string is like "Pop up an alert %d days before start" */
- g_string_printf (string, ngettext ("%d day", "%d days", duration->days), duration->days);
+ g_string_printf (string, ngettext ("%d day", "%d days", value), value);
have_something = TRUE;
}
- if (duration->weeks >= 1) {
+ value = i_cal_duration_get_weeks (duration);
+ if (value >= 1) {
/* Translator: Entire string is like "Pop up an alert %d weeks before start" */
- g_string_printf (string, ngettext ("%d week","%d weeks", duration->weeks), duration->weeks);
+ g_string_printf (string, ngettext ("%d week","%d weeks", value), value);
have_something = TRUE;
}
- if (duration->hours >= 1) {
+ value = i_cal_duration_get_hours (duration);
+ if (value >= 1) {
/* Translator: Entire string is like "Pop up an alert %d hours before start" */
- g_string_printf (string, ngettext ("%d hour", "%d hours", duration->hours), duration->hours);
+ g_string_printf (string, ngettext ("%d hour", "%d hours", value), value);
have_something = TRUE;
}
- if (duration->minutes >= 1) {
+ value = i_cal_duration_get_minutes (duration);
+ if (value >= 1) {
/* Translator: Entire string is like "Pop up an alert %d minutes before start" */
- g_string_printf (string, ngettext ("%d minute", "%d minutes", duration->minutes),
duration->minutes);
+ g_string_printf (string, ngettext ("%d minute", "%d minutes", value), value);
have_something = TRUE;
}
- if (duration->seconds >= 1) {
+ value = i_cal_duration_get_seconds (duration);
+ if (value >= 1) {
/* Translator: Entire string is like "Pop up an alert %d seconds before start" */
- g_string_printf (string, ngettext ("%d second", "%d seconds", duration->seconds),
duration->seconds);
+ g_string_printf (string, ngettext ("%d second", "%d seconds", value), value);
have_something = TRUE;
}
- if (have_something) {
- ret = string->str;
- g_string_free (string, FALSE);
- return ret;
- } else {
- g_string_free (string, TRUE);
- return NULL;
- }
+ return g_string_free (string, !have_something);
}
static gchar *
get_alarm_string (ECalComponentAlarm *alarm)
{
ECalComponentAlarmAction action;
- ECalComponentAlarmTrigger trigger;
+ ECalComponentAlarmTrigger *trigger;
+ ICalDuration *duration;
const gchar *base;
gchar *str = NULL, *dur;
- e_cal_component_alarm_get_action (alarm, &action);
- e_cal_component_alarm_get_trigger (alarm, &trigger);
+ action = e_cal_component_alarm_get_action (alarm);
+ trigger = e_cal_component_alarm_get_trigger (alarm);
switch (action) {
case E_CAL_COMPONENT_ALARM_AUDIO:
@@ -440,12 +439,13 @@ get_alarm_string (ECalComponentAlarm *alarm)
/* FIXME: This does not look like it will localize correctly. */
- switch (trigger.type) {
+ switch (trigger ? e_cal_component_alarm_trigger_get_kind (trigger) :
E_CAL_COMPONENT_ALARM_TRIGGER_NONE) {
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START:
- dur = get_alarm_duration_string (&trigger.u.rel_duration);
+ duration = e_cal_component_alarm_trigger_get_duration (trigger);
+ dur = get_alarm_duration_string (duration);
if (dur) {
- if (trigger.u.rel_duration.is_neg)
+ if (i_cal_duration_is_neg (duration))
str = g_strdup_printf (
/*Translator: The first %s refers to the base, which would be actions
like
* "Play a Sound". Second %s refers to the duration string e.g:"15
minutes"*/
@@ -467,10 +467,11 @@ get_alarm_string (ECalComponentAlarm *alarm)
break;
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END:
- dur = get_alarm_duration_string (&trigger.u.rel_duration);
+ duration = e_cal_component_alarm_trigger_get_duration (trigger);
+ dur = get_alarm_duration_string (duration);
if (dur) {
- if (trigger.u.rel_duration.is_neg)
+ if (i_cal_duration_is_neg (duration))
str = g_strdup_printf (
/* Translator: The first %s refers to the base, which would be
actions like
* "Play a Sound". Second %s refers to the duration string e.g:"15
minutes" */
@@ -492,19 +493,19 @@ get_alarm_string (ECalComponentAlarm *alarm)
break;
case E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE: {
- struct icaltimetype itt;
- icaltimezone *utc_zone, *current_zone;
+ ICalTime *itt;
+ ICalTimezone *utc_zone, *current_zone;
struct tm tm;
gchar buf[256];
/* Absolute triggers come in UTC, so convert them to the local timezone */
- itt = trigger.u.abs_time;
+ itt = e_cal_component_alarm_trigger_get_absolute_time (trigger);
- utc_zone = icaltimezone_get_utc_timezone ();
+ utc_zone = i_cal_timezone_get_utc_timezone ();
current_zone = calendar_config_get_icaltimezone ();
- tm = icaltimetype_to_tm_with_zone (&itt, utc_zone, current_zone);
+ tm = e_cal_util_icaltime_to_tm_with_zone (itt, utc_zone, current_zone);
e_time_format_date_and_time (&tm, calendar_config_get_24_hour_format (),
FALSE, FALSE, buf, sizeof (buf));
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index c751817b87..eee4ae3e33 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -48,12 +48,12 @@ struct _ECalComponentPreviewPrivate {
* if it didn't change then the preview is not updated */
gchar *cal_uid;
gchar *comp_uid;
- struct icaltimetype comp_last_modified;
+ ICalTime *comp_last_modified;
gint comp_sequence;
ECalClient *client;
ECalComponent *comp;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
gboolean use_24_hour_format;
};
@@ -78,25 +78,22 @@ clear_comp_info (ECalComponentPreview *preview)
priv->cal_uid = NULL;
g_free (priv->comp_uid);
priv->comp_uid = NULL;
- priv->comp_last_modified = icaltime_null_time ();
priv->comp_sequence = -1;
+ g_clear_object (&priv->comp_last_modified);
g_clear_object (&priv->client);
g_clear_object (&priv->comp);
- if (priv->timezone) {
- icaltimezone_free (priv->timezone, 1);
- priv->timezone = NULL;
- }
+ g_clear_object (&priv->timezone);
}
/* Stores information about actually shown component and
* returns whether component in the preview changed */
static gboolean
update_comp_info (ECalComponentPreview *preview,
- ECalClient *client,
- ECalComponent *comp,
- icaltimezone *zone,
- gboolean use_24_hour_format)
+ ECalClient *client,
+ ECalComponent *comp,
+ ICalTimezone *zone,
+ gboolean use_24_hour_format)
{
ECalComponentPreviewPrivate *priv;
gboolean changed;
@@ -114,32 +111,27 @@ update_comp_info (ECalComponentPreview *preview,
const gchar *uid;
gchar *cal_uid;
gchar *comp_uid;
- struct icaltimetype comp_last_modified, *itm = NULL;
- gint *sequence = NULL;
+ ICalTime *comp_last_modified;
gint comp_sequence;
source = e_client_get_source (E_CLIENT (client));
cal_uid = g_strdup (e_source_get_uid (source));
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
comp_uid = g_strdup (uid);
- e_cal_component_get_last_modified (comp, &itm);
- if (itm) {
- comp_last_modified = *itm;
- e_cal_component_free_icaltimetype (itm);
- } else
- comp_last_modified = icaltime_null_time ();
- e_cal_component_get_sequence (comp, &sequence);
- if (sequence) {
- comp_sequence = *sequence;
- e_cal_component_free_sequence (sequence);
- } else
+ comp_last_modified = e_cal_component_get_last_modified (comp);
+ comp_sequence = e_cal_component_get_sequence (comp);
+ if (comp_sequence < 0)
comp_sequence = 0;
changed = !priv->cal_uid || !priv->comp_uid || !cal_uid || !comp_uid ||
!g_str_equal (priv->cal_uid, cal_uid) ||
!g_str_equal (priv->comp_uid, comp_uid) ||
- priv->comp_sequence != comp_sequence ||
- icaltime_compare (priv->comp_last_modified, comp_last_modified) != 0;
+ priv->comp_sequence != comp_sequence;
+
+ if (comp_last_modified && priv->comp_last_modified)
+ changed = changed || i_cal_time_compare (priv->comp_last_modified,
comp_last_modified) != 0;
+ else
+ changed = changed || comp_last_modified != priv->comp_last_modified;
clear_comp_info (preview);
@@ -150,7 +142,7 @@ update_comp_info (ECalComponentPreview *preview,
priv->comp = g_object_ref (comp);
priv->client = g_object_ref (client);
- priv->timezone = icaltimezone_copy (zone);
+ priv->timezone = i_cal_timezone_copy (zone);
priv->use_24_hour_format = use_24_hour_format;
}
@@ -160,26 +152,29 @@ update_comp_info (ECalComponentPreview *preview,
/* Converts a time_t to a string, relative to the specified timezone */
static gchar *
timet_to_str_with_zone (ECalComponentDateTime *dt,
- ECalClient *client,
- icaltimezone *default_zone)
+ ECalClient *client,
+ ICalTimezone *default_zone)
{
- struct icaltimetype itt;
- icaltimezone *zone = NULL;
+ ICalTime *itt;
+ ICalTimezone *zone = NULL;
struct tm tm;
- if (dt->tzid != NULL) {
- e_cal_client_get_timezone_sync (
- client, dt->tzid, &zone, NULL, NULL);
- } else if (icaltime_is_utc (*dt->value)) {
- zone = icaltimezone_get_utc_timezone ();
+ if (!dt)
+ return NULL;
+
+ itt = e_cal_component_datetime_get_value (dt);
+
+ if (e_cal_component_datetime_get_tzid (dt)) {
+ e_cal_client_get_timezone_sync (client, e_cal_component_datetime_get_tzid (dt), &zone, NULL,
NULL);
+ } else if (i_cal_time_is_utc (itt)) {
+ zone = i_cal_timezone_get_utc_timezone ();
}
- itt = *dt->value;
if (zone != NULL)
- icaltimezone_convert_time (&itt, zone, default_zone);
- tm = icaltimetype_to_tm (&itt);
+ i_cal_timezone_convert_time (itt, zone, default_zone);
+ tm = e_cal_util_icaltime_to_tm (itt);
- return e_datetime_format_format_tm ("calendar", "table", itt.is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
+ return e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (itt) ? DTFormatKindDate
: DTFormatKindDateTime, &tm);
}
static void
@@ -188,38 +183,39 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
{
ECalClient *client;
ECalComponent *comp;
- icaltimezone *default_zone;
- ECalComponentText text;
- ECalComponentDateTime dt;
+ ICalTimezone *default_zone;
+ ECalComponentText *text;
+ ECalComponentDateTime *dt;
gchar *str;
GString *string;
GSList *list, *iter;
- icalcomponent *icalcomp;
- icalproperty *icalprop;
- icalproperty_status status;
- const gchar *location, *url;
- gint *priority_value;
+ ICalComponent *icomp;
+ ICalProperty *prop;
+ ICalPropertyStatus status;
+ gchar *location, *url;
+ gint priority;
client = preview->priv->client;
comp = preview->priv->comp;
default_zone = preview->priv->timezone;
/* write document header */
- e_cal_component_get_summary (comp, &text);
+ text = e_cal_component_get_summary (comp);
g_string_append (buffer, HTML_HEADER);
g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color\">");
- if (text.value)
- g_string_append_printf (buffer, "<h2>%s</h2>", text.value);
+ if (text && e_cal_component_text_get_value (text))
+ g_string_append_printf (buffer, "<h2>%s</h2>", e_cal_component_text_get_value (text));
else
g_string_append_printf (buffer, "<h2><i>%s</i></h2>",_("Untitled"));
+ e_cal_component_text_free (text);
g_string_append (buffer, "<table border=\"0\" cellspacing=\"5\">");
/* write icons for the categories */
string = g_string_new (NULL);
- e_cal_component_get_categories_list (comp, &list);
+ list = e_cal_component_get_categories_list (comp);
if (list != NULL)
g_string_append_printf (buffer, "<tr><th>%s</th><td>", _("Categories:"));
for (iter = list; iter != NULL; iter = iter->next) {
@@ -247,52 +243,56 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append_printf (buffer, "%s", string->str);
if (list != NULL)
g_string_append (buffer, "</td></tr>");
- e_cal_component_free_categories_list (list);
+ g_slist_free_full (list, g_free);
g_string_free (string, TRUE);
/* write location */
- e_cal_component_get_location (comp, &location);
+ location = e_cal_component_get_location (comp);
if (location && *location)
g_string_append_printf (
buffer, "<tr><th>%s</th><td>%s</td></tr>",
_("Location:"), location);
+ g_free (location);
/* write start date */
- e_cal_component_get_dtstart (comp, &dt);
- if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, client, default_zone);
+ dt = e_cal_component_get_dtstart (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ str = timet_to_str_with_zone (dt, client, default_zone);
g_string_append_printf (
buffer, "<tr><th>%s</th><td>%s</td></tr>",
_("Start Date:"), str);
g_free (str);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
/* write end date */
- e_cal_component_get_dtend (comp, &dt);
- if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, client, default_zone);
+ dt = e_cal_component_get_dtend (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ str = timet_to_str_with_zone (dt, client, default_zone);
g_string_append_printf (
buffer,"<tr><th>%s</th><td>%s</td></tr>",
_("End Date:"), str);
g_free (str);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
/* write Due Date */
- e_cal_component_get_due (comp, &dt);
- if (dt.value != NULL) {
- str = timet_to_str_with_zone (&dt, client, default_zone);
+ dt = e_cal_component_get_due (comp);
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ str = timet_to_str_with_zone (dt, client, default_zone);
g_string_append_printf (
buffer, "<tr><th>%s</th><td>%s</td></tr>",
_("Due Date:"), str);
g_free (str);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- if (e_cal_util_component_has_recurrences (e_cal_component_get_icalcomponent (comp))) {
- str = e_cal_recur_describe_recurrence (e_cal_component_get_icalcomponent (comp),
- calendar_config_get_week_start_day (), E_CAL_RECUR_DESCRIBE_RECURRENCE_FLAG_NONE);
+ icomp = e_cal_component_get_icalcomponent (comp);
+
+ if (e_cal_util_component_has_recurrences (icomp)) {
+ str = e_cal_recur_describe_recurrence (icomp,
+ calendar_config_get_week_start_day (),
+ E_CAL_RECUR_DESCRIBE_RECURRENCE_FLAG_NONE);
if (str) {
g_string_append_printf (
@@ -303,25 +303,23 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
}
/* write status */
- icalcomp = e_cal_component_get_icalcomponent (comp);
- icalprop = icalcomponent_get_first_property (
- icalcomp, ICAL_STATUS_PROPERTY);
- if (icalprop != NULL) {
+ prop = i_cal_component_get_first_property (icomp, I_CAL_STATUS_PROPERTY);
+ if (prop) {
g_string_append_printf (
buffer, "<tr><th>%s</th>",
_("Status:"));
- e_cal_component_get_status (comp, &status);
+ status = e_cal_component_get_status (comp);
switch (status) {
- case ICAL_STATUS_INPROCESS :
+ case I_CAL_STATUS_INPROCESS :
str = g_strdup (_("In Progress"));
break;
- case ICAL_STATUS_COMPLETED :
+ case I_CAL_STATUS_COMPLETED :
str = g_strdup (_("Completed"));
break;
- case ICAL_STATUS_CANCELLED :
+ case I_CAL_STATUS_CANCELLED :
str = g_strdup (_("Cancelled"));
break;
- case ICAL_STATUS_NONE :
+ case I_CAL_STATUS_NONE :
default :
str = g_strdup (_("Not Started"));
break;
@@ -329,17 +327,19 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append_printf (buffer, "<td>%s</td></tr>", str);
g_free (str);
+
+ g_object_unref (prop);
}
/* write priority */
- e_cal_component_get_priority (comp, &priority_value);
- if (priority_value && *priority_value != 0) {
+ priority = e_cal_component_get_priority (comp);
+ if (priority > 0) {
g_string_append_printf (
buffer, "<tr><th>%s</th>",
_("Priority:"));
- if (*priority_value <= 4)
+ if (priority <= 4)
str = g_strdup (_("High"));
- else if (*priority_value == 5)
+ else if (priority == 5)
str = g_strdup (_("Normal"));
else
str = g_strdup (_("Low"));
@@ -349,13 +349,10 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (str);
}
- if (priority_value)
- e_cal_component_free_priority (priority_value);
-
/* write description and URL */
g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>");
- e_cal_component_get_description_list (comp, &list);
+ list = e_cal_component_get_descriptions (comp);
if (list) {
GSList *node;
@@ -368,9 +365,12 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
for (node = list; node != NULL; node = node->next) {
gchar *html;
- text = * (ECalComponentText *) node->data;
+ text = node->data;
+ if (!text || !e_cal_component_text_get_value (text))
+ continue;
+
html = camel_text_to_html (
- text.value ? text.value : "",
+ e_cal_component_text_get_value (text),
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
@@ -384,11 +384,11 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append (buffer, "</td></tr>");
- e_cal_component_free_text_list (list);
+ g_slist_free_full (list, e_cal_component_text_free);
}
/* URL */
- e_cal_component_get_url (comp, &url);
+ url = e_cal_component_get_url (comp);
if (url) {
gchar *scheme;
const gchar *href = url;
@@ -408,6 +408,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
_("Web Page:"), href, url);
g_free (str);
+ g_free (url);
}
g_string_append (buffer, "</table>");
@@ -500,7 +501,7 @@ void
e_cal_component_preview_display (ECalComponentPreview *preview,
ECalClient *client,
ECalComponent *comp,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format)
{
g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
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-subscriber.c b/src/calendar/gui/e-cal-data-model-subscriber.c
index 141a5cb08f..991c02aadd 100644
--- a/src/calendar/gui/e-cal-data-model-subscriber.c
+++ b/src/calendar/gui/e-cal-data-model-subscriber.c
@@ -31,7 +31,7 @@ e_cal_data_model_subscriber_default_init (ECalDataModelSubscriberInterface *ifac
* e_cal_data_model_subscriber_component_added:
* @subscriber: an #ECalDataModelSubscriber
* @client: an #ECalClient, which notifies about the component addition
- * @icalcomp: an #ECalComponent which was added
+ * @comp: an #ECalComponent which was added
*
* Notifies the @subscriber about an added component which belongs
* to the time range used by the @subscriber.
diff --git a/src/calendar/gui/e-cal-data-model.c b/src/calendar/gui/e-cal-data-model.c
index 2e2aab826e..6bb91c1f7d 100644
--- a/src/calendar/gui/e-cal-data-model.c
+++ b/src/calendar/gui/e-cal-data-model.c
@@ -40,7 +40,7 @@ struct _ECalDataModelPrivate {
gboolean skip_cancelled;
gchar *filter;
gchar *full_filter; /* to be used with views */
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t range_start;
time_t range_end;
@@ -91,7 +91,7 @@ typedef struct _ViewData {
GHashTable *components; /* ECalComponentId ~> ComponentData */
GHashTable *lost_components; /* ECalComponentId ~> ComponentData; when re-running view, valid till
'complete' is received */
gboolean received_complete;
- GSList *to_expand_recurrences; /* icalcomponent */
+ GSList *to_expand_recurrences; /* ICalComponent */
GSList *expanded_recurrences; /* ComponentData */
gint pending_expand_recurrences; /* how many is waiting to be processed */
@@ -138,8 +138,8 @@ static gboolean
component_data_equal (ComponentData *comp_data1,
ComponentData *comp_data2)
{
- icalcomponent *icomp1, *icomp2;
- struct icaltimetype tt1, tt2;
+ ICalComponent *icomp1, *icomp2;
+ ICalTime *tt1, *tt2;
gchar *as_str1, *as_str2;
gboolean equal;
@@ -157,28 +157,40 @@ component_data_equal (ComponentData *comp_data1,
icomp2 = e_cal_component_get_icalcomponent (comp_data2->component);
if (!icomp1 || !icomp2 ||
- icalcomponent_get_sequence (icomp1) != icalcomponent_get_sequence (icomp2) ||
- g_strcmp0 (icalcomponent_get_uid (icomp1), icalcomponent_get_uid (icomp2)) != 0)
+ i_cal_component_get_sequence (icomp1) != i_cal_component_get_sequence (icomp2) ||
+ g_strcmp0 (i_cal_component_get_uid (icomp1), i_cal_component_get_uid (icomp2)) != 0)
return FALSE;
- tt1 = icalcomponent_get_recurrenceid (icomp1);
- tt2 = icalcomponent_get_recurrenceid (icomp2);
- if ((icaltime_is_valid_time (tt1) ? 1 : 0) != (icaltime_is_valid_time (tt2) ? 1 : 0) ||
- (icaltime_is_null_time (tt1) ? 1 : 0) != (icaltime_is_null_time (tt2) ? 1 : 0) ||
- icaltime_compare (tt1, tt2) != 0)
+ tt1 = i_cal_component_get_recurrenceid (icomp1);
+ tt2 = i_cal_component_get_recurrenceid (icomp2);
+ if (((!tt1 || i_cal_time_is_valid_time (tt1)) ? 1 : 0) != ((!tt2 || i_cal_time_is_valid_time (tt2)) ?
1 : 0) ||
+ ((!tt1 || i_cal_time_is_null_time (tt1)) ? 1 : 0) != ((!tt2 || i_cal_time_is_null_time (tt2)) ? 1
: 0) ||
+ i_cal_time_compare (tt1, tt2) != 0) {
+ g_clear_object (&tt1);
+ g_clear_object (&tt2);
return FALSE;
+ }
+
+ g_clear_object (&tt1);
+ g_clear_object (&tt2);
- tt1 = icalcomponent_get_dtstamp (icomp1);
- tt2 = icalcomponent_get_dtstamp (icomp2);
- if ((icaltime_is_valid_time (tt1) ? 1 : 0) != (icaltime_is_valid_time (tt2) ? 1 : 0) ||
- (icaltime_is_null_time (tt1) ? 1 : 0) != (icaltime_is_null_time (tt2) ? 1 : 0) ||
- icaltime_compare (tt1, tt2) != 0)
+ tt1 = i_cal_component_get_dtstamp (icomp1);
+ tt2 = i_cal_component_get_dtstamp (icomp2);
+ if (((!tt1 || i_cal_time_is_valid_time (tt1)) ? 1 : 0) != ((!tt2 || i_cal_time_is_valid_time (tt2)) ?
1 : 0) ||
+ ((!tt1 || i_cal_time_is_null_time (tt1)) ? 1 : 0) != ((!tt2 || i_cal_time_is_null_time (tt2)) ? 1
: 0) ||
+ i_cal_time_compare (tt1, tt2) != 0) {
+ g_clear_object (&tt1);
+ g_clear_object (&tt2);
return FALSE;
+ }
+
+ g_clear_object (&tt1);
+ g_clear_object (&tt2);
/* Maybe not so effective compare, but might be still more effective
than updating whole UI with false notifications */
- as_str1 = icalcomponent_as_ical_string_r (icomp1);
- as_str2 = icalcomponent_as_ical_string_r (icomp2);
+ as_str1 = i_cal_component_as_ical_string_r (icomp1);
+ as_str2 = i_cal_component_as_ical_string_r (icomp2);
equal = g_strcmp0 (as_str1, as_str2) == 0;
@@ -201,8 +213,8 @@ view_data_new (ECalClient *client)
view_data->is_used = TRUE;
view_data->client = g_object_ref (client);
view_data->components = g_hash_table_new_full (
- (GHashFunc) e_cal_component_id_hash, (GEqualFunc) e_cal_component_id_equal,
- (GDestroyNotify) e_cal_component_free_id, component_data_free);
+ e_cal_component_id_hash, e_cal_component_id_equal,
+ e_cal_component_id_free, component_data_free);
return view_data;
}
@@ -254,7 +266,7 @@ view_data_unref (gpointer ptr)
g_hash_table_destroy (view_data->components);
if (view_data->lost_components)
g_hash_table_destroy (view_data->lost_components);
- g_slist_free_full (view_data->to_expand_recurrences, (GDestroyNotify)
icalcomponent_free);
+ g_slist_free_full (view_data->to_expand_recurrences, g_object_unref);
g_slist_free_full (view_data->expanded_recurrences, component_data_free);
g_rec_mutex_clear (&view_data->lock);
g_free (view_data);
@@ -657,7 +669,9 @@ cal_data_model_remove_one_view_component_cb (ECalDataModel *data_model,
g_return_if_fail (id != NULL);
- e_cal_data_model_subscriber_component_removed (subscriber, client, id->uid, id->rid);
+ e_cal_data_model_subscriber_component_removed (subscriber, client,
+ e_cal_component_id_get_uid (id),
+ e_cal_component_id_get_rid (id));
}
static void
@@ -763,8 +777,8 @@ cal_data_model_update_full_filter (ECalDataModel *data_model)
iso_start = isodate_from_time_t (range_start);
iso_end = isodate_from_time_t (range_end);
- if (data_model->priv->zone && data_model->priv->zone != icaltimezone_get_utc_timezone ())
- default_tzloc = icaltimezone_get_location (data_model->priv->zone);
+ if (data_model->priv->zone && data_model->priv->zone != i_cal_timezone_get_utc_timezone ())
+ default_tzloc = i_cal_timezone_get_location (data_model->priv->zone);
if (!default_tzloc)
default_tzloc = "";
@@ -890,7 +904,9 @@ cal_data_model_process_added_component (ECalDataModel *data_model,
if (g_hash_table_remove (new_subscribers, subscriber))
e_cal_data_model_subscriber_component_modified (subscriber,
view_data->client, comp_data->component);
else if (old_id)
- e_cal_data_model_subscriber_component_removed (subscriber,
view_data->client, old_id->uid, old_id->rid);
+ e_cal_data_model_subscriber_component_removed (subscriber,
view_data->client,
+ e_cal_component_id_get_uid (old_id),
+ e_cal_component_id_get_rid (old_id));
}
/* Those which left in the new_subscribers have the component added. */
@@ -912,8 +928,7 @@ cal_data_model_process_added_component (ECalDataModel *data_model,
view_data_unlock (view_data);
- if (old_id)
- e_cal_component_free_id (old_id);
+ e_cal_component_id_free (old_id);
}
typedef struct _GatherComponentsData {
@@ -939,7 +954,7 @@ cal_data_model_gather_components (gpointer key,
g_return_if_fail (gather_data->pcomponent_ids != NULL || gather_data->component_ids_hash != NULL);
g_return_if_fail (gather_data->pcomponent_ids == NULL || gather_data->component_ids_hash == NULL);
- if ((gather_data->all_instances || !comp_data->is_detached) && g_strcmp0 (id->uid, gather_data->uid)
== 0) {
+ if ((gather_data->all_instances || !comp_data->is_detached) && g_strcmp0 (e_cal_component_id_get_uid
(id), gather_data->uid) == 0) {
if (gather_data->component_ids_hash) {
ComponentData *comp_data_copy;
@@ -1000,21 +1015,21 @@ cal_data_model_notify_recurrences_cb (gpointer user_data)
gathered_uids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
known_instances = g_hash_table_new_full (
(GHashFunc) e_cal_component_id_hash, (GEqualFunc) e_cal_component_id_equal,
- (GDestroyNotify) e_cal_component_free_id, component_data_free);
+ (GDestroyNotify) e_cal_component_id_free, component_data_free);
for (link = expanded_recurrences; link && view_data->is_used; link = g_slist_next (link)) {
ComponentData *comp_data = link->data;
- icalcomponent *icomp;
+ ICalComponent *icomp;
const gchar *uid;
if (!comp_data)
continue;
icomp = e_cal_component_get_icalcomponent (comp_data->component);
- if (!icomp || !icalcomponent_get_uid (icomp))
+ if (!icomp || !i_cal_component_get_uid (icomp))
continue;
- uid = icalcomponent_get_uid (icomp);
+ uid = i_cal_component_get_uid (icomp);
if (!g_hash_table_contains (gathered_uids, uid)) {
GatherComponentsData gather_data;
@@ -1071,57 +1086,75 @@ cal_data_model_notify_recurrences_cb (gpointer user_data)
typedef struct
{
ECalClient *client;
- icaltimezone *zone;
+ ICalTimezone *zone;
GSList **pexpanded_recurrences;
gboolean skip_cancelled;
} GenerateInstancesData;
static gboolean
-cal_data_model_instance_generated (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+cal_data_model_instance_generated (ICalComponent *icomp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- GenerateInstancesData *gid = data;
+ GenerateInstancesData *gid = user_data;
ComponentData *comp_data;
ECalComponent *comp_copy;
- icalproperty_status status = ICAL_STATUS_NONE;
- icaltimetype tt, tt2;
+ ICalTime *tt, *tt2;
+ time_t start_tt, end_tt;
g_return_val_if_fail (gid != NULL, FALSE);
- e_cal_component_get_status (comp, &status);
- if (gid->skip_cancelled && status == ICAL_STATUS_CANCELLED)
- return TRUE;
+ if (gid->skip_cancelled) {
+ ICalProperty *prop;
+
+ prop = i_cal_component_get_first_property (icomp, I_CAL_STATUS_PROPERTY);
+ if (prop && i_cal_property_get_status (prop) == I_CAL_STATUS_CANCELLED) {
+ g_object_unref (prop);
+ return TRUE;
+ }
- comp_copy = e_cal_component_clone (comp);
+ g_clear_object (&prop);
+ }
+
+ comp_copy = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
g_return_val_if_fail (comp_copy != NULL, FALSE);
- tt = icalcomponent_get_dtstart (e_cal_component_get_icalcomponent (comp_copy));
- tt2 = icaltime_from_timet_with_zone (instance_start, tt.is_date, gid->zone);
- if (tt.is_date || !tt.zone || tt.zone == icaltimezone_get_utc_timezone ())
- tt2.zone = NULL;
+ tt = i_cal_component_get_dtstart (e_cal_component_get_icalcomponent (comp_copy));
+ tt2 = i_cal_time_convert_to_zone (instance_start, gid->zone);
+ if (i_cal_time_is_date (tt) || !i_cal_time_get_timezone (tt) || i_cal_time_is_utc (tt))
+ i_cal_time_set_timezone (tt2, NULL);
else
- tt2.zone = gid->zone;
- icalcomponent_set_dtstart (e_cal_component_get_icalcomponent (comp_copy), tt2);
-
- tt = icalcomponent_get_dtend (e_cal_component_get_icalcomponent (comp_copy));
- tt2 = icaltime_from_timet_with_zone (instance_end, tt.is_date, gid->zone);
- if (tt.is_date || !tt.zone || tt.zone == icaltimezone_get_utc_timezone ())
- tt2.zone = NULL;
+ i_cal_time_set_timezone (tt2, gid->zone);
+ i_cal_component_set_dtstart (e_cal_component_get_icalcomponent (comp_copy), tt2);
+ g_clear_object (&tt);
+ g_clear_object (&tt2);
+
+ tt = i_cal_component_get_dtend (e_cal_component_get_icalcomponent (comp_copy));
+ tt2 = i_cal_time_convert_to_zone (instance_end, gid->zone);
+ if (i_cal_time_is_date (tt) || !i_cal_time_get_timezone (tt) || i_cal_time_is_utc (tt))
+ i_cal_time_set_timezone (tt2, NULL);
else
- tt2.zone = gid->zone;
- icalcomponent_set_dtend (e_cal_component_get_icalcomponent (comp_copy), tt2);
-
- e_cal_component_rescan (comp_copy);
+ i_cal_time_set_timezone (tt2, gid->zone);
+ i_cal_component_set_dtend (e_cal_component_get_icalcomponent (comp_copy), tt2);
+ g_clear_object (&tt);
+ g_clear_object (&tt2);
cal_comp_get_instance_times (gid->client, e_cal_component_get_icalcomponent (comp_copy),
- gid->zone, &instance_start, NULL, &instance_end, NULL, NULL);
+ gid->zone, &tt, &tt2, cancellable);
+
+ start_tt = i_cal_time_as_timet (tt);
+ end_tt = i_cal_time_as_timet (tt2);
- if (instance_end > instance_start)
- instance_end--;
+ g_clear_object (&tt);
+ g_clear_object (&tt2);
- comp_data = component_data_new (comp_copy, instance_start, instance_end, FALSE);
+ if (end_tt > start_tt)
+ end_tt--;
+
+ comp_data = component_data_new (comp_copy, start_tt, end_tt, FALSE);
*gid->pexpanded_recurrences = g_slist_prepend (*gid->pexpanded_recurrences, comp_data);
g_object_unref (comp_copy);
@@ -1172,7 +1205,7 @@ cal_data_model_expand_recurrences_thread (ECalDataModel *data_model,
view_data_unlock (view_data);
for (link = to_expand_recurrences; link && view_data->is_used; link = g_slist_next (link)) {
- icalcomponent *icomp = link->data;
+ ICalComponent *icomp = link->data;
GenerateInstancesData gid;
if (!icomp)
@@ -1180,14 +1213,16 @@ cal_data_model_expand_recurrences_thread (ECalDataModel *data_model,
gid.client = client;
gid.pexpanded_recurrences = &expanded_recurrences;
- gid.zone = data_model->priv->zone;
+ gid.zone = g_object_ref (data_model->priv->zone);
gid.skip_cancelled = data_model->priv->skip_cancelled;
e_cal_client_generate_instances_for_object_sync (client, icomp, range_start, range_end,
cal_data_model_instance_generated, &gid);
+
+ g_clear_object (&gid.zone);
}
- g_slist_free_full (to_expand_recurrences, (GDestroyNotify) icalcomponent_free);
+ g_slist_free_full (to_expand_recurrences, g_object_unref);
view_data_lock (view_data);
if (expanded_recurrences)
@@ -1259,9 +1294,9 @@ cal_data_model_process_modified_or_added_objects (ECalClientView *view,
cal_data_model_freeze_all_subscribers (data_model);
for (link = objects; link; link = g_slist_next (link)) {
- icalcomponent *icomp = link->data;
+ ICalComponent *icomp = link->data;
- if (!icomp || !icalcomponent_get_uid (icomp))
+ if (!icomp || !i_cal_component_get_uid (icomp))
continue;
if (data_model->priv->expand_recurrences &&
@@ -1270,22 +1305,29 @@ cal_data_model_process_modified_or_added_objects (ECalClientView *view,
/* This component requires an expand of recurrences, which
will be done in a dedicated thread, thus remember it */
to_expand_recurrences = g_slist_prepend (to_expand_recurrences,
- icalcomponent_new_clone (icomp));
+ i_cal_component_new_clone (icomp));
} else {
/* Single or detached instance, the simple case */
ECalComponent *comp;
ComponentData *comp_data;
+ ICalTime *start_tt = NULL, *end_tt = NULL;
time_t instance_start, instance_end;
if (data_model->priv->skip_cancelled &&
- icalcomponent_get_status (icomp) == ICAL_STATUS_CANCELLED)
+ i_cal_component_get_status (icomp) == I_CAL_STATUS_CANCELLED)
continue;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone
(icomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(icomp));
if (!comp)
continue;
- cal_comp_get_instance_times (client, icomp, data_model->priv->zone,
&instance_start, NULL, &instance_end, NULL, NULL);
+ cal_comp_get_instance_times (client, icomp, data_model->priv->zone,
&start_tt, &end_tt, NULL);
+
+ instance_start = i_cal_time_as_timet (start_tt);
+ instance_end = i_cal_time_as_timet (end_tt);
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
if (instance_end > instance_start)
instance_end--;
@@ -1379,11 +1421,11 @@ cal_data_model_view_objects_removed (ECalClientView *view,
const ECalComponentId *id = link->data;
if (id) {
- if (!id->rid || !*id->rid) {
- if (!g_hash_table_contains (gathered_uids, id->uid)) {
+ if (!e_cal_component_id_get_rid (id)) {
+ if (!g_hash_table_contains (gathered_uids, e_cal_component_id_get_uid
(id))) {
GatherComponentsData gather_data;
- gather_data.uid = id->uid;
+ gather_data.uid = e_cal_component_id_get_uid (id);
gather_data.pcomponent_ids = &removed;
gather_data.component_ids_hash = NULL;
gather_data.copy_ids = TRUE;
@@ -1395,7 +1437,7 @@ cal_data_model_view_objects_removed (ECalClientView *view,
g_hash_table_foreach (view_data->lost_components,
cal_data_model_gather_components,
&gather_data);
- g_hash_table_insert (gathered_uids, id->uid, GINT_TO_POINTER
(1));
+ g_hash_table_insert (gathered_uids, (gpointer)
e_cal_component_id_get_uid (id), GINT_TO_POINTER (1));
}
} else {
removed = g_list_prepend (removed, e_cal_component_id_copy (id));
@@ -1437,7 +1479,7 @@ cal_data_model_view_objects_removed (ECalClientView *view,
cal_data_model_thaw_all_subscribers (data_model);
- g_list_free_full (removed, (GDestroyNotify) e_cal_component_free_id);
+ g_list_free_full (removed, (GDestroyNotify) e_cal_component_id_free);
g_hash_table_destroy (gathered_uids);
}
view_data_unlock (view_data);
@@ -1691,7 +1733,7 @@ cal_data_model_update_client_view (ECalDataModel *data_model,
view_data->lost_components = view_data->components;
view_data->components = g_hash_table_new_full (
(GHashFunc) e_cal_component_id_hash, (GEqualFunc) e_cal_component_id_equal,
- (GDestroyNotify) e_cal_component_free_id, component_data_free);
+ (GDestroyNotify) e_cal_component_id_free, component_data_free);
}
view_data_unlock (view_data);
@@ -1842,7 +1884,9 @@ cal_data_model_remove_from_subscriber_except_its_range (ECalDataModel *data_mode
time range will be removed */
if (!(instance_start <= subs_data->range_end &&
instance_end >= subs_data->range_start))
- e_cal_data_model_subscriber_component_removed (subs_data->subscriber, client, id->uid,
id->rid);
+ e_cal_data_model_subscriber_component_removed (subs_data->subscriber, client,
+ e_cal_component_id_get_uid (id),
+ e_cal_component_id_get_rid (id));
return TRUE;
}
@@ -1853,7 +1897,7 @@ cal_data_model_set_client_default_zone_cb (gpointer key,
gpointer user_data)
{
ECalClient *client = value;
- icaltimezone *zone = user_data;
+ ICalTimezone *zone = user_data;
g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (zone != NULL);
@@ -2007,6 +2051,7 @@ cal_data_model_finalize (GObject *object)
g_slist_free_full (data_model->priv->subscribers, subscriber_data_free);
g_free (data_model->priv->filter);
g_free (data_model->priv->full_filter);
+ g_clear_object (&data_model->priv->zone);
e_weak_ref_free (data_model->priv->submit_thread_job_responder);
g_rec_mutex_clear (&data_model->priv->props_lock);
@@ -2084,7 +2129,7 @@ e_cal_data_model_init (ECalDataModel *data_model)
data_model->priv->disposing = FALSE;
data_model->priv->expand_recurrences = FALSE;
data_model->priv->skip_cancelled = FALSE;
- data_model->priv->zone = icaltimezone_get_utc_timezone ();
+ data_model->priv->zone = g_object_ref (i_cal_timezone_get_utc_timezone ());
data_model->priv->views_update_freeze = 0;
data_model->priv->views_update_required = FALSE;
@@ -2342,14 +2387,14 @@ e_cal_data_model_set_skip_cancelled (ECalDataModel *data_model,
* Obtains a timezone being used for calendar views. The returned
* timezone is owned by the @data_model.
*
- * Returns: (transfer none): An #icaltimezone being used for calendar views.
+ * Returns: (transfer none): An #ICalTimezone being used for calendar views.
*
* Since: 3.16
**/
-icaltimezone *
+ICalTimezone *
e_cal_data_model_get_timezone (ECalDataModel *data_model)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_val_if_fail (E_IS_CAL_DATA_MODEL (data_model), NULL);
@@ -2361,10 +2406,11 @@ e_cal_data_model_get_timezone (ECalDataModel *data_model)
return zone;
}
+
/**
* e_cal_data_model_set_timezone:
* @data_model: an #EDataModel instance
- * @zone: an #icaltimezone
+ * @zone: an #ICalTimezone
*
* Sets a trimezone to be used for calendar views. This change
* regenerates all views.
@@ -2373,7 +2419,7 @@ e_cal_data_model_get_timezone (ECalDataModel *data_model)
**/
void
e_cal_data_model_set_timezone (ECalDataModel *data_model,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
g_return_if_fail (E_IS_CAL_DATA_MODEL (data_model));
g_return_if_fail (zone != NULL);
@@ -2381,7 +2427,8 @@ e_cal_data_model_set_timezone (ECalDataModel *data_model,
LOCK_PROPS ();
if (data_model->priv->zone != zone) {
- data_model->priv->zone = zone;
+ g_clear_object (&data_model->priv->zone);
+ data_model->priv->zone = g_object_ref (zone);
g_hash_table_foreach (data_model->priv->clients, cal_data_model_set_client_default_zone_cb,
zone);
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.c b/src/calendar/gui/e-cal-dialogs.c
index 04974e3b91..933d6aa4ea 100644
--- a/src/calendar/gui/e-cal-dialogs.c
+++ b/src/calendar/gui/e-cal-dialogs.c
@@ -41,24 +41,22 @@
static gboolean
is_past_event (ECalComponent *comp)
{
- ECalComponentDateTime end_date;
+ ECalComponentDateTime *end_date;
gboolean res;
if (!comp)
return TRUE;
- end_date.value = NULL;
+ end_date = e_cal_component_get_dtend (comp);
- e_cal_component_get_dtend (comp, &end_date);
-
- if (!end_date.value)
+ if (!end_date)
return FALSE;
- res = icaltime_compare_date_only (
- *end_date.value,
- icaltime_current_time_with_zone (
- icaltime_get_timezone (*end_date.value))) == -1;
- e_cal_component_free_datetime (&end_date);
+ res = i_cal_time_compare_date_only (
+ e_cal_component_datetime_get_value (end_date),
+ i_cal_time_current_time_with_zone (i_cal_time_get_timezone
(e_cal_component_datetime_get_value (end_date)))) == -1;
+
+ e_cal_component_datetime_free (end_date);
return res;
}
@@ -157,11 +155,11 @@ struct ForeachTzidData
};
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);
@@ -171,7 +169,7 @@ add_timezone_to_cal_cb (icalparameter *param,
if (!ftd->success)
return;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (!tzid || !*tzid)
return;
@@ -232,29 +230,29 @@ copy_source_thread (EAlertSinkThreadJobData *job_data,
n_objects = g_slist_length (objects);
for (link = objects, ii = 0; link && ftd.success && !g_cancellable_is_cancelled (cancellable); link =
g_slist_next (link), ii++) {
- icalcomponent *icalcomp = link->data;
- icalcomponent *existing_icalcomp = NULL;
+ ICalComponent *icomp = link->data;
+ ICalComponent *existing_icomp = NULL;
gint percent = 100 * (ii + 1) / n_objects;
GError *local_error = NULL;
- if (e_cal_client_get_object_sync (to_client, icalcomponent_get_uid (icalcomp), NULL,
&existing_icalcomp, cancellable, &local_error) &&
- icalcomp != NULL) {
- if (!e_cal_client_modify_object_sync (to_client, icalcomp, E_CAL_OBJ_MOD_ALL,
cancellable, error))
+ if (e_cal_client_get_object_sync (to_client, i_cal_component_get_uid (icomp), NULL,
&existing_icomp, cancellable, &local_error) &&
+ icomp != NULL) {
+ if (!e_cal_client_modify_object_sync (to_client, icomp, E_CAL_OBJ_MOD_ALL,
E_CAL_OPERATION_FLAG_NONE, cancellable, error))
break;
- icalcomponent_free (existing_icalcomp);
+ g_object_unref (existing_icomp);
} else if (local_error && !g_error_matches (local_error, E_CAL_CLIENT_ERROR,
E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND)) {
g_propagate_error (error, local_error);
break;
} else {
- icalcomponent_foreach_tzid (icalcomp, add_timezone_to_cal_cb, &ftd);
+ i_cal_component_foreach_tzid (icomp, add_timezone_to_cal_cb, &ftd);
g_clear_error (&local_error);
if (!ftd.success)
break;
- if (!e_cal_client_create_object_sync (to_client, icalcomp, NULL, cancellable, error))
+ if (!e_cal_client_create_object_sync (to_client, icomp, E_CAL_OPERATION_FLAG_NONE,
NULL, cancellable, error))
break;
}
@@ -267,7 +265,7 @@ copy_source_thread (EAlertSinkThreadJobData *job_data,
if (ii > 0 && ftd.success)
csd->to_client = g_object_ref (to_client);
out:
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
g_clear_object (&from_client);
g_clear_object (&to_client);
}
@@ -391,13 +389,16 @@ e_cal_dialogs_delete_component (ECalComponent *comp,
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (comp) {
- ECalComponentText summary;
-
vtype = e_cal_component_get_vtype (comp);
if (!consider_as_untitled) {
- e_cal_component_get_summary (comp, &summary);
- arg0 = g_strdup (summary.value);
+ ECalComponentText *summary;
+
+ summary = e_cal_component_get_summary (comp);
+ if (summary) {
+ arg0 = g_strdup (e_cal_component_text_get_value (summary));
+ e_cal_component_text_free (summary);
+ }
}
switch (vtype) {
@@ -431,9 +432,7 @@ e_cal_dialogs_delete_component (ECalComponent *comp,
break;
default:
- g_message (
- "delete_component_dialog(): Cannot handle object of type %d",
- vtype);
+ g_message ("%s: Cannot handle object of type %d", G_STRFUNC, vtype);
g_free (arg0);
return FALSE;
}
@@ -461,9 +460,7 @@ e_cal_dialogs_delete_component (ECalComponent *comp,
break;
default:
- g_message (
- "delete_component_dialog(): Cannot handle objects of type %d",
- vtype);
+ g_message ("%s: Cannot handle objects of type %d", G_STRFUNC, vtype);
return FALSE;
}
@@ -634,18 +631,21 @@ ecal_event (ECalendarItem *calitem,
{
GoToDialog *dlg = user_data;
GDate start_date, end_date;
- struct icaltimetype tt = icaltime_null_time ();
- icaltimezone *timezone;
+ ICalTime *tt = i_cal_time_null_time ();
+ ICalTimezone *timezone;
time_t et;
g_warn_if_fail (e_calendar_item_get_selection (calitem, &start_date, &end_date));
timezone = e_cal_data_model_get_timezone (dlg->data_model);
- tt.year = g_date_get_year (&start_date);
- tt.month = g_date_get_month (&start_date);
- tt.day = g_date_get_day (&start_date);
+ i_cal_time_set_date (tt,
+ g_date_get_year (&start_date),
+ g_date_get_month (&start_date),
+ g_date_get_day (&start_date));
+
+ et = i_cal_time_as_timet_with_zone (tt, timezone);
- et = icaltime_as_timet_with_zone (tt, timezone);
+ g_clear_object (&tt);
*(dlg->out_move_type) = E_CALENDAR_VIEW_MOVE_TO_EXACT_DAY;
*(dlg->out_exact_date) = et;
@@ -658,23 +658,18 @@ static struct tm
get_current_time (ECalendarItem *calitem,
gpointer data)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
+ ICalTime *tt;
struct tm tmp_tm = { 0 };
- struct icaltimetype tt;
/* Get the current timezone. */
zone = calendar_config_get_icaltimezone ();
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, zone);
- /* Now copy it to the struct tm and return it. */
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
+
+ g_clear_object (&tt);
return tmp_tm;
}
@@ -790,15 +785,17 @@ e_cal_dialogs_goto_run (GtkWindow *parent,
dlg->month_val = g_date_get_month (from_date) - 1;
dlg->day_val = g_date_get_day (from_date);
} else {
- struct icaltimetype tt;
- icaltimezone *timezone;
+ ICalTime *tt;
+ ICalTimezone *timezone;
timezone = e_cal_data_model_get_timezone (dlg->data_model);
- tt = icaltime_current_time_with_zone (timezone);
+ tt = i_cal_time_current_time_with_zone (timezone);
+
+ dlg->year_val = i_cal_time_get_year (tt);
+ dlg->month_val = i_cal_time_get_month (tt) - 1;
+ dlg->day_val = i_cal_time_get_day (tt);
- dlg->year_val = tt.year;
- dlg->month_val = tt.month - 1;
- dlg->day_val = tt.day;
+ g_clear_object (&tt);
}
g_signal_connect (
@@ -909,13 +906,13 @@ e_cal_dialogs_recur_component (ECalClient *client,
rb_this = gtk_radio_button_new_with_label (NULL, _("This Instance Only"));
gtk_container_add (GTK_CONTAINER (vbox), rb_this);
- if (!e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) {
+ if (!e_client_check_capability (E_CLIENT (client), E_CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) {
rb_prior = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This
and Prior Instances"));
gtk_container_add (GTK_CONTAINER (vbox), rb_prior);
} else
rb_prior = NULL;
- if (!e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
+ if (!e_client_check_capability (E_CLIENT (client), E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
rb_future = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This
and Future Instances"));
gtk_container_add (GTK_CONTAINER (vbox), rb_future);
} else
@@ -949,7 +946,7 @@ e_cal_dialogs_recur_component (ECalClient *client,
gboolean
e_cal_dialogs_recur_icalcomp (ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalObjModType *mod,
GtkWindow *parent,
gboolean delegated)
@@ -957,9 +954,9 @@ e_cal_dialogs_recur_icalcomp (ECalClient *client,
ECalComponent *comp;
gboolean res;
- g_return_val_if_fail (icalcomp != NULL, FALSE);
+ g_return_val_if_fail (icomp != NULL, 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;
@@ -1044,31 +1041,31 @@ component_has_new_attendees (ECalComponent *comp)
static gboolean
have_nonprocedural_alarm (ECalComponent *comp)
{
- GList *uids, *l;
+ GSList *uids, *link;
g_return_val_if_fail (comp != NULL, FALSE);
uids = e_cal_component_get_alarm_uids (comp);
- for (l = uids; l; l = l->next) {
+ for (link = uids; link; link = g_slist_next (link)) {
ECalComponentAlarm *alarm;
ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
- alarm = e_cal_component_get_alarm (comp, (const gchar *) l->data);
+ alarm = e_cal_component_get_alarm (comp, link->data);
if (alarm) {
- e_cal_component_alarm_get_action (alarm, &action);
+ action = e_cal_component_alarm_get_action (alarm);
e_cal_component_alarm_free (alarm);
if (action != E_CAL_COMPONENT_ALARM_NONE &&
action != E_CAL_COMPONENT_ALARM_PROCEDURE &&
action != E_CAL_COMPONENT_ALARM_UNKNOWN) {
- cal_obj_uid_list_free (uids);
+ g_slist_free_full (uids, g_free);
return TRUE;
}
}
}
- cal_obj_uid_list_free (uids);
+ g_slist_free_full (uids, g_free);
return FALSE;
}
@@ -1278,22 +1275,22 @@ e_cal_dialogs_send_dragged_or_resized_component (GtkWindow *parent,
gboolean
e_cal_dialogs_send_component_prompt_subject (GtkWindow *parent,
- icalcomponent *component)
+ ICalComponent *component)
{
- icalcomponent_kind kind;
+ ICalComponentKind kind;
const gchar *id;
- kind = icalcomponent_isa (component);
+ kind = i_cal_component_isa (component);
switch (kind) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
id = "calendar:prompt-save-no-subject-calendar";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
id = "calendar:prompt-save-no-subject-task";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
id = "calendar:prompt-send-no-subject-memo";
break;
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-list-view.c b/src/calendar/gui/e-cal-list-view.c
index f547e2b2a3..73d8b58a82 100644
--- a/src/calendar/gui/e-cal-list-view.c
+++ b/src/calendar/gui/e-cal-list-view.c
@@ -39,6 +39,14 @@
#include "calendar-config.h"
#include "misc.h"
+struct _ECalListViewPrivate {
+ /* The main display table */
+ ETable *table;
+
+ /* The last ECalendarViewEvent we returned from e_cal_list_view_get_selected_events(), to be freed */
+ ECalendarViewEvent *cursor_event;
+};
+
enum {
PROP_0,
PROP_IS_EDITING
@@ -93,6 +101,8 @@ e_cal_list_view_class_init (ECalListViewClass *class)
widget_class = (GtkWidgetClass *) class;
view_class = (ECalendarViewClass *) class;
+ g_type_class_add_private (class, sizeof (ECalListViewPrivate));
+
/* Method override */
object_class->dispose = e_cal_list_view_dispose;
object_class->get_property = e_cal_list_view_get_property;
@@ -112,9 +122,10 @@ e_cal_list_view_class_init (ECalListViewClass *class)
static void
e_cal_list_view_init (ECalListView *cal_list_view)
{
- cal_list_view->table = NULL;
- cal_list_view->cursor_event = NULL;
- cal_list_view->set_table_id = 0;
+ cal_list_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (cal_list_view, E_TYPE_CAL_LIST_VIEW,
ECalListViewPrivate);
+
+ cal_list_view->priv->table = NULL;
+ cal_list_view->priv->cursor_event = NULL;
}
/* Returns the current time, for the ECellDateEdit items. */
@@ -123,21 +134,16 @@ get_current_time_cb (ECellDateEdit *ecde,
gpointer data)
{
ECalListView *cal_list_view = data;
- icaltimezone *zone;
- struct tm tmp_tm = { 0 };
- struct icaltimetype tt;
+ ICalTimezone *zone;
+ ICalTime *tt;
+ struct tm tmp_tm;
zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (cal_list_view));
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, zone);
- /* Now copy it to the struct tm and return it. */
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
+
+ g_clear_object (&tt);
return tmp_tm;
}
@@ -216,7 +222,6 @@ setup_e_table (ECalListView *cal_list_view)
e_table_extras_add_cell (extras, "dateedit", popup_cell);
g_object_unref (popup_cell);
- cal_list_view->dates_cell = E_CELL_DATE_EDIT (popup_cell);
gtk_widget_hide (E_CELL_DATE_EDIT (popup_cell)->none_button);
@@ -292,7 +297,7 @@ setup_e_table (ECalListView *cal_list_view)
widget = e_table_new (E_TABLE_MODEL (model), extras, specification);
gtk_container_add (GTK_CONTAINER (container), widget);
- cal_list_view->table = E_TABLE (widget);
+ cal_list_view->priv->table = E_TABLE (widget);
gtk_widget_show (widget);
g_object_unref (specification);
@@ -301,27 +306,27 @@ setup_e_table (ECalListView *cal_list_view)
/* Connect signals */
g_signal_connect (
- cal_list_view->table, "double_click",
+ cal_list_view->priv->table, "double_click",
G_CALLBACK (e_cal_list_view_on_table_double_click),
cal_list_view);
g_signal_connect (
- cal_list_view->table, "right-click",
+ cal_list_view->priv->table, "right-click",
G_CALLBACK (e_cal_list_view_on_table_right_click),
cal_list_view);
g_signal_connect (
- cal_list_view->table, "key-press",
+ cal_list_view->priv->table, "key-press",
G_CALLBACK (e_cal_list_view_on_table_key_press),
cal_list_view);
g_signal_connect (
- cal_list_view->table, "white-space-event",
+ cal_list_view->priv->table, "white-space-event",
G_CALLBACK (e_cal_list_view_on_table_white_space_event),
cal_list_view);
g_signal_connect_after (
- cal_list_view->table, "cursor_change",
+ cal_list_view->priv->table, "cursor_change",
G_CALLBACK (e_cal_list_view_cursor_change_cb),
cal_list_view);
e_signal_connect_notify_after (
- cal_list_view->table, "notify::is-editing",
+ cal_list_view->priv->table, "notify::is-editing",
G_CALLBACK (e_cal_list_view_table_editing_changed_cb),
cal_list_view);
}
@@ -351,19 +356,14 @@ e_cal_list_view_dispose (GObject *object)
cal_list_view = E_CAL_LIST_VIEW (object);
- if (cal_list_view->set_table_id) {
- g_source_remove (cal_list_view->set_table_id);
- cal_list_view->set_table_id = 0;
- }
-
- if (cal_list_view->cursor_event) {
- g_free (cal_list_view->cursor_event);
- cal_list_view->cursor_event = NULL;
+ if (cal_list_view->priv->cursor_event) {
+ g_free (cal_list_view->priv->cursor_event);
+ cal_list_view->priv->cursor_event = NULL;
}
- if (cal_list_view->table) {
- gtk_widget_destroy (GTK_WIDGET (cal_list_view->table));
- cal_list_view->table = NULL;
+ if (cal_list_view->priv->table) {
+ gtk_widget_destroy (GTK_WIDGET (cal_list_view->priv->table));
+ cal_list_view->priv->table = NULL;
}
/* Chain up to parent's dispose() method. */
@@ -491,38 +491,53 @@ e_cal_list_view_get_selected_time_range (ECalendarView *cal_view,
time_t *end_time)
{
GList *selected;
- icaltimezone *zone;
+ ICalTimezone *zone;
selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
- ECalComponentDateTime dtstart, dtend;
ECalComponent *comp;
if (!is_comp_data_valid (event))
return FALSE;
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone
(event->comp_data->icalcomp));
+ e_cal_component_set_icalcomponent (comp, i_cal_component_new_clone
(event->comp_data->icalcomp));
if (start_time) {
- e_cal_component_get_dtstart (comp, &dtstart);
- if (dtstart.tzid) {
- zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (comp),
dtstart.tzid);
+ ECalComponentDateTime *dt;
+
+ dt = e_cal_component_get_dtstart (comp);
+
+ if (dt) {
+ if (e_cal_component_datetime_get_tzid (dt)) {
+ zone = i_cal_component_get_timezone
(e_cal_component_get_icalcomponent (comp), e_cal_component_datetime_get_tzid (dt));
+ } else {
+ zone = NULL;
+ }
+ *start_time = i_cal_time_as_timet_with_zone
(e_cal_component_datetime_get_value (dt), zone);
} else {
- zone = NULL;
+ *start_time = (time_t) 0;
}
- *start_time = icaltime_as_timet_with_zone (*dtstart.value, zone);
- e_cal_component_free_datetime (&dtstart);
+
+ e_cal_component_datetime_free (dt);
}
if (end_time) {
- e_cal_component_get_dtend (comp, &dtend);
- if (dtend.tzid) {
- zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (comp),
dtend.tzid);
+ ECalComponentDateTime *dt;
+
+ dt = e_cal_component_get_dtend (comp);
+
+ if (dt) {
+ if (e_cal_component_datetime_get_tzid (dt)) {
+ zone = i_cal_component_get_timezone
(e_cal_component_get_icalcomponent (comp), e_cal_component_datetime_get_tzid (dt));
+ } else {
+ zone = NULL;
+ }
+ *end_time = i_cal_time_as_timet_with_zone (e_cal_component_datetime_get_value
(dt), zone);
} else {
- zone = NULL;
+ *end_time = (time_t) 0;
}
- *end_time = icaltime_as_timet_with_zone (*dtend.value, zone);
- e_cal_component_free_datetime (&dtend);
+
+ e_cal_component_datetime_free (dt);
}
g_object_unref (comp);
@@ -540,18 +555,18 @@ e_cal_list_view_get_selected_events (ECalendarView *cal_view)
GList *event_list = NULL;
gint cursor_row;
- if (E_CAL_LIST_VIEW (cal_view)->cursor_event) {
- g_free (E_CAL_LIST_VIEW (cal_view)->cursor_event);
- E_CAL_LIST_VIEW (cal_view)->cursor_event = NULL;
+ if (E_CAL_LIST_VIEW (cal_view)->priv->cursor_event) {
+ g_free (E_CAL_LIST_VIEW (cal_view)->priv->cursor_event);
+ E_CAL_LIST_VIEW (cal_view)->priv->cursor_event = NULL;
}
cursor_row = e_table_get_cursor_row (
- E_CAL_LIST_VIEW (cal_view)->table);
+ E_CAL_LIST_VIEW (cal_view)->priv->table);
if (cursor_row >= 0) {
ECalendarViewEvent *event;
- event = E_CAL_LIST_VIEW (cal_view)->cursor_event = g_new0 (ECalendarViewEvent, 1);
+ event = E_CAL_LIST_VIEW (cal_view)->priv->cursor_event = g_new0 (ECalendarViewEvent, 1);
event->comp_data =
e_cal_model_get_component_at (
e_calendar_view_get_model (cal_view),
@@ -562,22 +577,27 @@ e_cal_list_view_get_selected_events (ECalendarView *cal_view)
return event_list;
}
+/* It also frees 'itt' */
static void
-adjust_range (icaltimetype icaltime,
+adjust_range (ICalTime *itt,
time_t *earliest,
time_t *latest,
gboolean *set)
{
time_t t;
- if (!icaltime_is_valid_time (icaltime))
+ if (!itt || !i_cal_time_is_valid_time (itt)) {
+ g_clear_object (&itt);
return;
+ }
+
+ t = i_cal_time_as_timet (itt);
- t = icaltime_as_timet (icaltime);
*earliest = MIN (*earliest, t);
*latest = MAX (*latest, t);
-
*set = TRUE;
+
+ g_clear_object (&itt);
}
/* NOTE: Time use for this function increases linearly with number of events.
@@ -596,18 +616,18 @@ e_cal_list_view_get_visible_time_range (ECalendarView *cal_view,
for (i = 0; i < n_rows; i++) {
ECalModelComponent *comp;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
comp = e_cal_model_get_component_at (e_calendar_view_get_model (cal_view), i);
if (!comp)
continue;
- icalcomp = comp->icalcomp;
- if (!icalcomp)
+ icomp = comp->icalcomp;
+ if (!icomp)
continue;
- adjust_range (icalcomponent_get_dtstart (icalcomp), &earliest, &latest, &set);
- adjust_range (icalcomponent_get_dtend (icalcomp), &earliest, &latest, &set);
+ adjust_range (i_cal_component_get_dtstart (icomp), &earliest, &latest, &set);
+ adjust_range (i_cal_component_get_dtend (icomp), &earliest, &latest, &set);
}
if (set) {
@@ -651,5 +671,5 @@ e_cal_list_view_is_editing (ECalListView *eclv)
{
g_return_val_if_fail (E_IS_CAL_LIST_VIEW (eclv), FALSE);
- return eclv->table && e_table_is_editing (eclv->table);
+ return eclv->priv->table && e_table_is_editing (eclv->priv->table);
}
diff --git a/src/calendar/gui/e-cal-list-view.h b/src/calendar/gui/e-cal-list-view.h
index b8a6aaabb8..72973f7c99 100644
--- a/src/calendar/gui/e-cal-list-view.h
+++ b/src/calendar/gui/e-cal-list-view.h
@@ -55,26 +55,14 @@
G_BEGIN_DECLS
-typedef struct _ECalListView ECalListView;
-typedef struct _ECalListViewClass ECalListViewClass;
+typedef struct _ECalListView ECalListView;
+typedef struct _ECalListViewClass ECalListViewClass;
+typedef struct _ECalListViewPrivate ECalListViewPrivate;
struct _ECalListView {
ECalendarView parent;
- /* The main display table */
- ETable *table;
-
- /* The default category for new events */
- gchar *default_category;
-
- /* Date editing cell */
- ECellDateEdit *dates_cell;
-
- /* The last ECalendarViewEvent we returned from e_cal_list_view_get_selected_events(), to be freed */
- ECalendarViewEvent *cursor_event;
-
- /* Idle handler ID for setting a new ETableModel */
- gint set_table_id;
+ ECalListViewPrivate *priv;
};
struct _ECalListViewClass {
diff --git a/src/calendar/gui/e-cal-model-calendar.c b/src/calendar/gui/e-cal-model-calendar.c
index 8ce31daf9f..cac1fe3fc0 100644
--- a/src/calendar/gui/e-cal-model-calendar.c
+++ b/src/calendar/gui/e-cal-model-calendar.c
@@ -49,102 +49,119 @@ static ECellDateEditValue *
get_dtend (ECalModelCalendar *model,
ECalModelComponent *comp_data)
{
- struct icaltimetype tt_end;
+ ICalTime *tt_end;
if (!comp_data->dtend) {
- icalproperty *prop;
- icaltimezone *zone = NULL, *model_zone = NULL;
- gboolean got_zone = FALSE;
+ ICalProperty *prop;
+ ICalTimezone *zone = NULL, *model_zone = NULL;
+ gboolean got_zone = FALSE, is_date;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTEND_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DTEND_PROPERTY);
if (!prop)
return NULL;
- tt_end = icalproperty_get_dtend (prop);
+ tt_end = i_cal_property_get_dtend (prop);
- if (icaltime_get_tzid (tt_end)
- && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid (tt_end), &zone,
NULL, NULL))
+ if (i_cal_time_get_tzid (tt_end) &&
+ e_cal_client_get_timezone_sync (comp_data->client, i_cal_time_get_tzid (tt_end), &zone,
NULL, NULL))
got_zone = TRUE;
model_zone = e_cal_model_get_timezone (E_CAL_MODEL (model));
+ is_date = i_cal_time_is_date (tt_end);
+
+ g_clear_object (&tt_end);
+ g_clear_object (&prop);
+
if (got_zone) {
- tt_end = icaltime_from_timet_with_zone (comp_data->instance_end, tt_end.is_date,
zone);
+ tt_end = i_cal_time_from_timet_with_zone (comp_data->instance_end, is_date, zone);
} else {
- tt_end = icaltime_from_timet_with_zone (
- comp_data->instance_end,
- tt_end.is_date, model_zone);
+ tt_end = i_cal_time_from_timet_with_zone (comp_data->instance_end, is_date,
model_zone);
}
- if (!icaltime_is_valid_time (tt_end) || icaltime_is_null_time (tt_end))
+ if (!i_cal_time_is_valid_time (tt_end) || i_cal_time_is_null_time (tt_end)) {
+ g_clear_object (&tt_end);
return NULL;
+ }
- if (tt_end.is_date && icalcomponent_get_first_property (comp_data->icalcomp,
ICAL_DTSTART_PROPERTY)) {
- struct icaltimetype tt_start;
- icaltimezone *start_zone = NULL;
+ if (i_cal_time_is_date (tt_end) &&
+ (prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DTSTART_PROPERTY))
!= NULL) {
+ ICalTime *tt_start;
+ ICalTimezone *start_zone = NULL;
gboolean got_start_zone = FALSE;
- tt_start = icalproperty_get_dtstart (prop);
+ tt_start = i_cal_property_get_dtstart (prop);
- if (icaltime_get_tzid (tt_start)
- && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid
(tt_start), &start_zone, NULL, NULL))
+ if (i_cal_time_get_tzid (tt_start) &&
+ e_cal_client_get_timezone_sync (comp_data->client, i_cal_time_get_tzid
(tt_start), &start_zone, NULL, NULL))
got_start_zone = TRUE;
+ is_date = i_cal_time_is_date (tt_end);
+
+ g_clear_object (&tt_start);
+
if (got_start_zone) {
- tt_start = icaltime_from_timet_with_zone (comp_data->instance_start,
tt_start.is_date, start_zone);
+ tt_start = i_cal_time_from_timet_with_zone (comp_data->instance_start,
is_date, start_zone);
} else {
- tt_start = icaltime_from_timet_with_zone (
- comp_data->instance_start,
- tt_start.is_date, model_zone);
+ tt_start = i_cal_time_from_timet_with_zone (comp_data->instance_start,
is_date, model_zone);
}
- icaltime_adjust (&tt_start, 1, 0, 0, 0);
+ i_cal_time_adjust (tt_start, 1, 0, 0, 0);
/* Decrease by a day only if the DTSTART will still be before, or the same as, DTEND
*/
- if (icaltime_compare (tt_start, tt_end) <= 0)
- icaltime_adjust (&tt_end, -1, 0, 0, 0);
+ if (i_cal_time_compare (tt_start, tt_end) <= 0)
+ i_cal_time_adjust (tt_end, -1, 0, 0, 0);
+
+ g_clear_object (&tt_start);
}
- comp_data->dtend = g_new0 (ECellDateEditValue, 1);
- comp_data->dtend->tt = tt_end;
+ g_clear_object (&prop);
- if (got_zone)
- comp_data->dtend->zone = zone;
- else
- comp_data->dtend->zone = NULL;
+ comp_data->dtend = e_cell_date_edit_value_new_take (tt_end, (got_zone && zone) ?
e_cal_util_copy_timezone (zone) : NULL);
}
- return e_cal_model_copy_cell_date_value (comp_data->dtend);
+ return e_cell_date_edit_value_copy (comp_data->dtend);
}
static gpointer
get_location (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ const gchar *res = NULL;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
- if (prop)
- return (gpointer) icalproperty_get_location (prop);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_LOCATION_PROPERTY);
+ if (prop) {
+ res = i_cal_property_get_location (prop);
+ g_clear_object (&prop);
+ }
- return (gpointer) "";
+ if (!res)
+ res = "";
+
+ return (gpointer) res;
}
static gpointer
get_transparency (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_TRANSP_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_TRANSP_PROPERTY);
if (prop) {
- icalproperty_transp transp;
-
- transp = icalproperty_get_transp (prop);
- if (transp == ICAL_TRANSP_TRANSPARENT ||
- transp == ICAL_TRANSP_TRANSPARENTNOCONFLICT)
- return _("Free");
- else if (transp == ICAL_TRANSP_OPAQUE ||
- transp == ICAL_TRANSP_OPAQUENOCONFLICT)
- return _("Busy");
+ ICalPropertyTransp transp;
+ const gchar *res = NULL;
+
+ transp = i_cal_property_get_transp (prop);
+ if (transp == I_CAL_TRANSP_TRANSPARENT ||
+ transp == I_CAL_TRANSP_TRANSPARENTNOCONFLICT)
+ res = _("Free");
+ else if (transp == I_CAL_TRANSP_OPAQUE ||
+ transp == I_CAL_TRANSP_OPAQUENOCONFLICT)
+ res = _("Busy");
+
+ g_clear_object (&prop);
+
+ return (gpointer) res;
}
return NULL;
@@ -155,28 +172,29 @@ set_dtend (ECalModel *model,
ECalModelComponent *comp_data,
gconstpointer value)
{
- e_cal_model_update_comp_time (model, comp_data, value, ICAL_DTEND_PROPERTY, icalproperty_set_dtend,
icalproperty_new_dtend);
+ e_cal_model_update_comp_time (model, comp_data, value, I_CAL_DTEND_PROPERTY,
i_cal_property_set_dtend, i_cal_property_new_dtend);
}
static void
set_location (ECalModelComponent *comp_data,
gconstpointer value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_LOCATION_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
} else {
- if (prop)
- icalproperty_set_location (prop, (const gchar *) value);
- else {
- prop = icalproperty_new_location ((const gchar *) value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_location (prop, (const gchar *) value);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_location ((const gchar *) value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
@@ -185,36 +203,37 @@ static void
set_transparency (ECalModelComponent *comp_data,
gconstpointer value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_TRANSP_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_TRANSP_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
} else {
- icalproperty_transp transp;
+ ICalPropertyTransp transp;
if (!g_ascii_strcasecmp (value, "FREE"))
- transp = ICAL_TRANSP_TRANSPARENT;
+ transp = I_CAL_TRANSP_TRANSPARENT;
else if (!g_ascii_strcasecmp (value, "OPAQUE"))
- transp = ICAL_TRANSP_OPAQUE;
+ transp = I_CAL_TRANSP_OPAQUE;
else {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
return;
}
- if (prop)
- icalproperty_set_transp (prop, transp);
- else {
- prop = icalproperty_new_transp (transp);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_transp (prop, transp);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_transp (transp);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
@@ -310,7 +329,7 @@ cal_model_calendar_set_value_at (ETableModel *etm,
if (!comp_data)
return;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
if (!comp) {
return;
}
@@ -379,7 +398,7 @@ cal_model_calendar_duplicate_value (ETableModel *etm,
switch (col) {
case E_CAL_MODEL_CALENDAR_FIELD_DTEND :
- return e_cal_model_copy_cell_date_value (value);
+ return e_cell_date_edit_value_copy (value);
case E_CAL_MODEL_CALENDAR_FIELD_LOCATION :
case E_CAL_MODEL_CALENDAR_FIELD_TRANSPARENCY :
return g_strdup (value);
diff --git a/src/calendar/gui/e-cal-model-memos.c b/src/calendar/gui/e-cal-model-memos.c
index f7ee2b03d6..7a19dce3d6 100644
--- a/src/calendar/gui/e-cal-model-memos.c
+++ b/src/calendar/gui/e-cal-model-memos.c
@@ -64,17 +64,21 @@ cal_model_memos_fill_component_from_values (ECalModel *model,
ECalModelComponent *comp_data,
GHashTable *values)
{
- icaltimetype start;
+ ICalTime *dtstart;
g_return_if_fail (E_IS_CAL_MODEL_MEMOS (model));
g_return_if_fail (comp_data != NULL);
g_return_if_fail (values != NULL);
- start = icalcomponent_get_dtstart (comp_data->icalcomp);
- if (icaltime_compare_date_only (start, icaltime_null_time ()) == 0) {
- start = icaltime_today ();
- icalcomponent_set_dtstart (comp_data->icalcomp, start);
+ dtstart = i_cal_component_get_dtstart (comp_data->icalcomp);
+ if (!dtstart || i_cal_time_is_null_time (dtstart) || !i_cal_time_is_valid_time (dtstart)) {
+ g_clear_object (&dtstart);
+
+ dtstart = i_cal_time_today ();
+ i_cal_component_set_dtstart (comp_data->icalcomp, dtstart);
}
+
+ g_clear_object (&dtstart);
}
static gint
diff --git a/src/calendar/gui/e-cal-model-tasks.c b/src/calendar/gui/e-cal-model-tasks.c
index 71bb3ae069..978f530361 100644
--- a/src/calendar/gui/e-cal-model-tasks.c
+++ b/src/calendar/gui/e-cal-model-tasks.c
@@ -83,28 +83,26 @@ ensure_task_complete (ECalModelComponent *comp_data,
static void
ensure_task_partially_complete (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
/* Date Completed. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY, TRUE);
/* Percent. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY);
if (!prop)
- icalcomponent_add_property (comp_data->icalcomp, icalproperty_new_percentcomplete (50));
- else if (icalproperty_get_percentcomplete (prop) == 0 || icalproperty_get_percentcomplete (prop) ==
100)
- icalproperty_set_percentcomplete (prop, 50);
+ i_cal_component_take_property (comp_data->icalcomp, i_cal_property_new_percentcomplete (50));
+ else if (i_cal_property_get_percentcomplete (prop) == 0 || i_cal_property_get_percentcomplete (prop)
== 100)
+ i_cal_property_set_percentcomplete (prop, 50);
+ g_clear_object (&prop);
/* Status. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
if (prop)
- icalproperty_set_status (prop, ICAL_STATUS_INPROCESS);
+ i_cal_property_set_status (prop, I_CAL_STATUS_INPROCESS);
else
- icalcomponent_add_property (comp_data->icalcomp, icalproperty_new_status
(ICAL_STATUS_INPROCESS));
+ i_cal_component_take_property (comp_data->icalcomp, i_cal_property_new_status
(I_CAL_STATUS_INPROCESS));
+ g_clear_object (&prop);
}
/* This makes sure a task is marked as incomplete. It clears the
@@ -112,154 +110,177 @@ ensure_task_partially_complete (ECalModelComponent *comp_data)
* and if the status is "Completed" it sets it to "Needs Action".
* Note that this doesn't update the component on the client. */
static void
-ensure_task_not_complete (ECalModelComponent *comp_data)
+ensure_task_not_complete (ECalModelComponent *comp_data,
+ gboolean with_status)
{
- icalproperty *prop;
+ ICalProperty *prop;
/* Date Completed. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY, TRUE);
/* Percent. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
- if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY,
TRUE);
/* Status. */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
- if (prop)
- icalproperty_set_status (prop, ICAL_STATUS_NEEDSACTION);
+ if (with_status) {
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
+ if (prop) {
+ i_cal_property_set_status (prop, I_CAL_STATUS_NEEDSACTION);
+ g_object_unref (prop);
+ }
+ }
}
static ECellDateEditValue *
get_completed (ECalModelComponent *comp_data)
{
- struct icaltimetype tt_completed;
-
if (!comp_data->completed) {
- icaltimezone *zone;
- icalproperty *prop;
+ ICalTime *tt_completed;
+ ICalTimezone *zone = NULL;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY);
if (!prop)
return NULL;
- tt_completed = icalproperty_get_completed (prop);
- if (!icaltime_is_valid_time (tt_completed) || icaltime_is_null_time (tt_completed))
+ tt_completed = i_cal_property_get_completed (prop);
+ g_clear_object (&prop);
+
+ if (!i_cal_time_is_valid_time (tt_completed) || i_cal_time_is_null_time (tt_completed)) {
+ g_clear_object (&tt_completed);
return NULL;
+ }
- comp_data->completed = g_new0 (ECellDateEditValue, 1);
- comp_data->completed->tt = tt_completed;
+ if (!i_cal_time_get_tzid (tt_completed) ||
+ !e_cal_client_get_timezone_sync (comp_data->client, i_cal_time_get_tzid (tt_completed),
&zone, NULL, NULL))
+ zone = NULL;
- if (icaltime_get_tzid (tt_completed)
- && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid (tt_completed),
&zone, NULL, NULL))
- comp_data->completed->zone = zone;
- else
- comp_data->completed->zone = NULL;
+ comp_data->completed = e_cell_date_edit_value_new_take (tt_completed, zone ?
e_cal_util_copy_timezone (zone) : NULL);
}
- return e_cal_model_copy_cell_date_value (comp_data->completed);
+ return e_cell_date_edit_value_copy (comp_data->completed);
}
static ECellDateEditValue *
get_due (ECalModelComponent *comp_data)
{
- struct icaltimetype tt_due;
-
if (!comp_data->due) {
- icaltimezone *zone;
- icalproperty *prop;
+ ICalTime *tt_due;
+ ICalTimezone *zone = NULL;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DUE_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DUE_PROPERTY);
if (!prop)
return NULL;
- tt_due = icalproperty_get_due (prop);
- if (!icaltime_is_valid_time (tt_due) || icaltime_is_null_time (tt_due))
+ tt_due = i_cal_property_get_due (prop);
+
+ g_clear_object (&prop);
+
+ if (!i_cal_time_is_valid_time (tt_due) || i_cal_time_is_null_time (tt_due)) {
+ g_clear_object (&tt_due);
return NULL;
+ }
- comp_data->due = g_new0 (ECellDateEditValue, 1);
- comp_data->due->tt = tt_due;
+ if (!i_cal_time_get_tzid (tt_due) ||
+ !e_cal_client_get_timezone_sync (comp_data->client, i_cal_time_get_tzid (tt_due), &zone,
NULL, NULL))
+ zone = NULL;
- if (icaltime_get_tzid (tt_due)
- && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid (tt_due), &zone,
NULL, NULL))
- comp_data->due->zone = zone;
- else
- comp_data->due->zone = NULL;
+ comp_data->due = e_cell_date_edit_value_new_take (tt_due, zone ? e_cal_util_copy_timezone
(zone) : NULL);
}
- return e_cal_model_copy_cell_date_value (comp_data->due);
+ return e_cell_date_edit_value_copy (comp_data->due);
}
static gpointer
get_geo (ECalModelComponent *comp_data)
{
- icalproperty *prop;
- struct icalgeotype geo;
+ ICalProperty *prop;
+ ICalGeo *geo = NULL;
static gchar buf[32];
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_GEO_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_GEO_PROPERTY);
if (prop) {
- geo = icalproperty_get_geo (prop);
- g_snprintf (
- buf, sizeof (buf), "%g %s, %g %s",
- fabs (geo.lat),
- geo.lat >= 0.0 ? "N" : "S",
- fabs (geo.lon),
- geo.lon >= 0.0 ? "E" : "W");
- return buf;
+ geo = i_cal_property_get_geo (prop);
+ if (geo) {
+ g_snprintf (
+ buf, sizeof (buf), "%g %s, %g %s",
+ fabs (i_cal_geo_get_lat (geo)),
+ i_cal_geo_get_lat (geo) >= 0.0 ? "N" : "S",
+ fabs (i_cal_geo_get_lon (geo)),
+ i_cal_geo_get_lon (geo) >= 0.0 ? "E" : "W");
+ g_object_unref (prop);
+ g_object_unref (geo);
+ return buf;
+ }
}
+ g_clear_object (&prop);
+ g_clear_object (&geo);
+
return (gpointer) "";
}
static gint
get_percent (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ gint percent = 0;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
- if (prop)
- return icalproperty_get_percentcomplete (prop);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY);
+ if (prop) {
+ percent = i_cal_property_get_percentcomplete (prop);
+ g_object_unref (prop);
+ }
- return 0;
+ return percent;
}
static gpointer
get_priority (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ const gchar *value = NULL;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PRIORITY_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PRIORITY_PROPERTY);
if (prop)
- return (gpointer) e_cal_util_priority_to_string (icalproperty_get_priority (prop));
+ value = e_cal_util_priority_to_string (i_cal_property_get_priority (prop));
- return (gpointer) "";
+ if (!value)
+ value = "";
+
+ return (gpointer) value;
}
static gboolean
is_status_canceled (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ gboolean res;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
- return prop && icalproperty_get_status (prop) == ICAL_STATUS_CANCELLED;
+ res = prop && i_cal_property_get_status (prop) == I_CAL_STATUS_CANCELLED;
+
+ g_clear_object (&prop);
+
+ return res;
}
static gpointer
get_status (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
if (prop) {
- switch (icalproperty_get_status (prop)) {
+ ICalPropertyStatus status;
+
+ status = i_cal_property_get_status (prop);
+
+ g_object_unref (prop);
+
+ switch (status) {
case ICAL_STATUS_NONE:
return (gpointer) "";
case ICAL_STATUS_NEEDSACTION:
@@ -281,43 +302,59 @@ get_status (ECalModelComponent *comp_data)
static gpointer
get_url (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ const gchar *url;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY);
- if (prop)
- return (gpointer) icalproperty_get_url (prop);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
+ if (prop) {
+ url = i_cal_property_get_url (prop);
+ g_object_unref (prop);
+ }
- return (gpointer) "";
+ return (gpointer) (url ? url : "");
}
static gpointer
get_location (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ const gchar *location;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
- if (prop)
- return (gpointer) icalproperty_get_location (prop);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_LOCATION_PROPERTY);
+ if (prop) {
+ location = i_cal_property_get_location (prop);
+ g_object_unref (prop);
+ }
- return (gpointer) "";
+ return (gpointer) (location ? location : "");
}
static gboolean
is_complete (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop)
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY);
+ if (prop) {
+ g_object_unref (prop);
return TRUE;
+ }
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
- if (prop && icalproperty_get_percentcomplete (prop) == 100)
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY);
+ if (prop && i_cal_property_get_percentcomplete (prop) == 100) {
+ g_object_unref (prop);
return TRUE;
+ }
+
+ g_clear_object (&prop);
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
- if (prop && icalproperty_get_status (prop) == ICAL_STATUS_COMPLETED)
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
+ if (prop && i_cal_property_get_status (prop) == I_CAL_STATUS_COMPLETED) {
+ g_object_unref (prop);
return TRUE;
+ }
+
+ g_clear_object (&prop);
return FALSE;
}
@@ -334,27 +371,33 @@ static ECalModelTasksDueStatus
get_due_status (ECalModelTasks *model,
ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
/* First, do we have a due date? */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DUE_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DUE_PROPERTY);
if (!prop)
return E_CAL_MODEL_TASKS_DUE_NEVER;
else {
- struct icaltimetype now_tt, due_tt;
- icaltimezone *zone = NULL;
+ ICalTime *now_tt, *due_tt;
+ ICalTimezone *zone = NULL;
/* Second, is it already completed? */
- if (is_complete (comp_data))
+ if (is_complete (comp_data)) {
+ g_object_unref (prop);
return E_CAL_MODEL_TASKS_DUE_COMPLETE;
+ }
/* Third, are we overdue as of right now? */
- due_tt = icalproperty_get_due (prop);
- if (due_tt.is_date) {
+ due_tt = i_cal_property_get_due (prop);
+ if (i_cal_time_is_date (due_tt)) {
gint cmp;
- now_tt = icaltime_current_time_with_zone (e_cal_model_get_timezone (E_CAL_MODEL
(model)));
- cmp = icaltime_compare_date_only (due_tt, now_tt);
+ now_tt = i_cal_time_current_time_with_zone (e_cal_model_get_timezone (E_CAL_MODEL
(model)));
+ cmp = i_cal_time_compare_date_only (due_tt, now_tt);
+
+ g_object_unref (now_tt);
+ g_object_unref (due_tt);
+ g_object_unref (prop);
if (cmp < 0)
return E_CAL_MODEL_TASKS_DUE_OVERDUE;
@@ -363,28 +406,42 @@ get_due_status (ECalModelTasks *model,
else
return E_CAL_MODEL_TASKS_DUE_FUTURE;
} else {
- icalparameter *param;
+ ECalModelTasksDueStatus res;
+ ICalParameter *param;
const gchar *tzid;
- if (!(param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER)))
+ if (!(param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER))) {
+ g_object_unref (due_tt);
+ g_object_unref (prop);
return E_CAL_MODEL_TASKS_DUE_FUTURE;
+ }
/* Get the current time in the same timezone as the DUE date.*/
- tzid = icalparameter_get_tzid (param);
- e_cal_client_get_timezone_sync (
- comp_data->client, tzid, &zone, NULL, NULL);
- if (zone == NULL)
+ tzid = i_cal_parameter_get_tzid (param);
+ if (!e_cal_client_get_timezone_sync (comp_data->client, tzid, &zone, NULL, NULL))
+ zone = NULL;
+
+ g_object_unref (param);
+ g_object_unref (prop);
+
+ if (zone == NULL) {
+ g_object_unref (due_tt);
return E_CAL_MODEL_TASKS_DUE_FUTURE;
+ }
- now_tt = icaltime_current_time_with_zone (zone);
+ now_tt = i_cal_time_current_time_with_zone (zone);
- if (icaltime_compare (due_tt, now_tt) <= 0)
- return E_CAL_MODEL_TASKS_DUE_OVERDUE;
+ if (i_cal_time_compare (due_tt, now_tt) <= 0)
+ res = E_CAL_MODEL_TASKS_DUE_OVERDUE;
+ else if (i_cal_time_compare_date_only (due_tt, now_tt) == 0)
+ res = E_CAL_MODEL_TASKS_DUE_TODAY;
else
- if (icaltime_compare_date_only (due_tt, now_tt) == 0)
- return E_CAL_MODEL_TASKS_DUE_TODAY;
- else
- return E_CAL_MODEL_TASKS_DUE_FUTURE;
+ res = E_CAL_MODEL_TASKS_DUE_FUTURE;
+
+ g_clear_object (&due_tt);
+ g_clear_object (&now_tt);
+
+ return res;
}
}
}
@@ -414,19 +471,21 @@ set_completed (ECalModelTasks *model,
ECellDateEditValue *dv = (ECellDateEditValue *) value;
if (!dv)
- ensure_task_not_complete (comp_data);
+ ensure_task_not_complete (comp_data, TRUE);
else {
+ ICalTime *tt;
time_t t;
- if (dv->tt.is_date) {
+ tt = e_cell_date_edit_value_get_time (dv);
+ if (i_cal_time_is_date (tt)) {
/* if it's a date, it will be floating,
* but completed needs a date time value */
- dv->tt.is_date = FALSE;
- t = icaltime_as_timet_with_zone (dv->tt, e_cal_model_get_timezone (E_CAL_MODEL
(model)));
+ i_cal_time_set_is_date (tt, FALSE);
+ t = i_cal_time_as_timet_with_zone (tt, e_cal_model_get_timezone (E_CAL_MODEL
(model)));
} else {
/* we assume that COMPLETED is entered in the current timezone,
* even though it gets stored in UTC */
- t = icaltime_as_timet_with_zone (dv->tt, dv->zone);
+ t = i_cal_time_as_timet_with_zone (tt, e_cell_date_edit_value_get_zone (dv));
}
ensure_task_complete (comp_data, t);
@@ -442,7 +501,7 @@ set_complete (ECalModelComponent *comp_data,
if (state)
ensure_task_complete (comp_data, -1);
else
- ensure_task_not_complete (comp_data);
+ ensure_task_not_complete (comp_data, TRUE);
}
static void
@@ -450,7 +509,7 @@ set_due (ECalModel *model,
ECalModelComponent *comp_data,
gconstpointer value)
{
- e_cal_model_update_comp_time (model, comp_data, value, ICAL_DUE_PROPERTY, icalproperty_set_due,
icalproperty_new_due);
+ e_cal_model_update_comp_time (model, comp_data, value, I_CAL_DUE_PROPERTY, i_cal_property_set_due,
i_cal_property_new_due);
}
/* FIXME: We need to set the "transient_for" property for the dialog, but the
@@ -472,32 +531,32 @@ static void
set_geo (ECalModelComponent *comp_data,
const gchar *value)
{
- gdouble latitude, longitude;
+ gdouble latitude = 0.0, longitude = 0.0;
gint matched;
- struct icalgeotype geo;
- icalproperty *prop;
+ ICalGeo *geo;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_GEO_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_GEO_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
} else {
matched = sscanf (value, "%lg , %lg", &latitude, &longitude);
if (matched != 2)
show_geo_warning ();
- geo.lat = latitude;
- geo.lon = longitude;
- if (prop)
- icalproperty_set_geo (prop, geo);
- else {
- prop = icalproperty_new_geo (geo);
- icalcomponent_add_property (comp_data->icalcomp, prop);
- }
+ geo = i_cal_geo_new (latitude, longitude);
+ if (prop) {
+ i_cal_property_set_geo (prop, geo);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_geo (geo);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
+ }
}
}
@@ -505,41 +564,46 @@ static void
set_status (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty_status status;
- icalproperty *prop;
+ ICalPropertyStatus status;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
/* an empty string is the same as 'None' */
- if (!value[0])
+ if (!value[0]) {
+ g_clear_object (&prop);
return;
+ }
/* Translators: "None" for task's status */
- if (!e_util_utf8_strcasecmp (value, C_("cal-task-status", "None")))
+ if (!e_util_utf8_strcasecmp (value, C_("cal-task-status", "None"))) {
+ g_clear_object (&prop);
return;
- else if (!e_util_utf8_strcasecmp (value, _("Not Started")))
- status = ICAL_STATUS_NEEDSACTION;
+ } else if (!e_util_utf8_strcasecmp (value, _("Not Started")))
+ status = I_CAL_STATUS_NEEDSACTION;
else if (!e_util_utf8_strcasecmp (value, _("In Progress")))
- status = ICAL_STATUS_INPROCESS;
+ status = I_CAL_STATUS_INPROCESS;
else if (!e_util_utf8_strcasecmp (value, _("Completed")))
- status = ICAL_STATUS_COMPLETED;
+ status = I_CAL_STATUS_COMPLETED;
else if (!e_util_utf8_strcasecmp (value, _("Cancelled")))
- status = ICAL_STATUS_CANCELLED;
+ status = I_CAL_STATUS_CANCELLED;
else {
+ g_clear_object (&prop);
g_warning ("Invalid status: %s\n", value);
return;
}
- if (prop)
- icalproperty_set_status (prop, status);
- else {
- prop = icalproperty_new_status (status);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_status (prop, status);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_status (status);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
switch (status) {
case ICAL_STATUS_NEEDSACTION:
- ensure_task_not_complete (comp_data);
+ ensure_task_not_complete (comp_data, TRUE);
break;
case ICAL_STATUS_INPROCESS:
@@ -547,9 +611,7 @@ set_status (ECalModelComponent *comp_data,
break;
case ICAL_STATUS_CANCELLED:
- ensure_task_not_complete (comp_data);
- /* do this again, because the previous function changed status to NEEDSACTION */
- icalproperty_set_status (prop, status);
+ ensure_task_not_complete (comp_data, FALSE);
break;
case ICAL_STATUS_COMPLETED:
@@ -567,53 +629,53 @@ static void
set_percent (ECalModelComponent *comp_data,
gconstpointer value)
{
- icalproperty *prop;
+ ICalProperty *prop;
gint percent = GPOINTER_TO_INT (value);
g_return_if_fail (percent >= -1);
g_return_if_fail (percent <= 100);
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY);
/* A value of -1 means it isn't set */
if (percent == -1) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
- ensure_task_not_complete (comp_data);
+ ensure_task_not_complete (comp_data, TRUE);
} else {
- if (prop)
- icalproperty_set_percentcomplete (prop, percent);
- else {
- prop = icalproperty_new_percentcomplete (percent);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_percentcomplete (prop, percent);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_percentcomplete (percent);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
if (percent == 100)
ensure_task_complete (comp_data, -1);
else {
- prop = icalcomponent_get_first_property (comp_data->icalcomp,
ICAL_COMPLETED_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp,
I_CAL_COMPLETED_PROPERTY);
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
if (percent > 0)
set_status (comp_data, _("In Progress"));
}
}
-
}
static void
set_priority (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
gint priority;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PRIORITY_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_PRIORITY_PROPERTY);
priority = e_cal_util_priority_from_string (value);
if (priority == -1) {
@@ -621,11 +683,12 @@ set_priority (ECalModelComponent *comp_data,
priority = 0;
}
- if (prop)
- icalproperty_set_priority (prop, priority);
- else {
- prop = icalproperty_new_priority (priority);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_priority (prop, priority);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_priority (priority);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
@@ -633,21 +696,22 @@ static void
set_url (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
} else {
- if (prop)
- icalproperty_set_url (prop, value);
- else {
- prop = icalproperty_new_url (value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_url (prop, value);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_url (value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
@@ -656,21 +720,22 @@ static void
set_location (ECalModelComponent *comp_data,
gconstpointer value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_LOCATION_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_LOCATION_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
} else {
- if (prop)
- icalproperty_set_location (prop, (const gchar *) value);
- else {
- prop = icalproperty_new_location ((const gchar *) value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_location (prop, (const gchar *) value);
+ g_object_unref (prop);
+ } else {
+ prop = i_cal_property_new_location ((const gchar *) value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
@@ -1003,7 +1068,7 @@ cal_model_tasks_duplicate_value (ETableModel *etm,
switch (col) {
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_DUE :
- return e_cal_model_copy_cell_date_value (value);
+ return e_cell_date_edit_value_copy (value);
case E_CAL_MODEL_TASKS_FIELD_GEO :
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
@@ -1386,7 +1451,7 @@ void
e_cal_model_tasks_mark_comp_incomplete (ECalModelTasks *model,
ECalModelComponent *comp_data)
{
- icalproperty *prop,*prop1;
+ ICalProperty *prop;
g_return_if_fail (model != NULL);
g_return_if_fail (comp_data != NULL);
@@ -1395,25 +1460,18 @@ e_cal_model_tasks_mark_comp_incomplete (ECalModelTasks *model,
/*e_table_model_pre_change (E_TABLE_MODEL (model));*/
/* Status */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_STATUS_PROPERTY);
if (prop)
- icalproperty_set_status (prop, ICAL_STATUS_NEEDSACTION);
+ i_cal_property_set_status (prop, ICAL_STATUS_NEEDSACTION);
else
- icalcomponent_add_property (comp_data->icalcomp, icalproperty_new_status
(ICAL_STATUS_NEEDSACTION));
+ i_cal_component_take_property (comp_data->icalcomp, i_cal_property_new_status
(I_CAL_STATUS_NEEDSACTION));
+ g_clear_object (&prop);
/*complete property*/
- prop1 = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop1) {
- icalcomponent_remove_property (comp_data->icalcomp, prop1);
- icalproperty_free (prop1);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY, TRUE);
/* Percent. */
- prop1 = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
- if (prop1) {
- icalcomponent_remove_property (comp_data->icalcomp, prop1);
- icalproperty_free (prop1);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_PERCENTCOMPLETE_PROPERTY,
TRUE);
/*e_table_model_row_changed (E_TABLE_MODEL (model), model_row);*/
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index 78bf368f18..6ea645bc2e 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -64,8 +64,8 @@ struct _ECalModelPrivate {
/* Array for storing the objects. Each element is of type ECalModelComponent */
GPtrArray *objects;
- icalcomponent_kind kind;
- icaltimezone *zone;
+ ICalComponentKind kind;
+ ICalTimezone *zone;
/* The time range to display */
time_t start;
@@ -197,36 +197,26 @@ G_DEFINE_TYPE (ECalModelComponent, e_cal_model_component, G_TYPE_OBJECT)
static void
e_cal_model_component_set_icalcomponent (ECalModelComponent *comp_data,
ECalModel *model,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
if (model != NULL)
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (comp_data != NULL);
- #define free_ptr(x) { \
- if (x) { \
- g_free (x); \
- x = NULL; \
- } \
- }
-
- if (comp_data->icalcomp)
- icalcomponent_free (comp_data->icalcomp);
- comp_data->icalcomp = icalcomp;
+ g_clear_object (&comp_data->icalcomp);
+ comp_data->icalcomp = icomp;
if (comp_data->priv->categories_str)
g_string_free (comp_data->priv->categories_str, TRUE);
comp_data->priv->categories_str = NULL;
- free_ptr (comp_data->dtstart);
- free_ptr (comp_data->dtend);
- free_ptr (comp_data->due);
- free_ptr (comp_data->completed);
- free_ptr (comp_data->created);
- free_ptr (comp_data->lastmodified);
- free_ptr (comp_data->color);
-
- #undef free_ptr
+ g_clear_pointer (&comp_data->dtstart, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->dtend, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->due, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->completed, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->created, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->lastmodified, e_cell_date_edit_value_free);
+ g_clear_pointer (&comp_data->color, g_free);
if (comp_data->icalcomp && model)
e_cal_model_set_instance_times (comp_data, model->priv->zone);
@@ -271,14 +261,14 @@ static gpointer
get_categories (ECalModelComponent *comp_data)
{
if (!comp_data->priv->categories_str) {
- icalproperty *prop;
+ ICalProperty *prop;
comp_data->priv->categories_str = g_string_new ("");
- for (prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_CATEGORIES_PROPERTY);
+ for (prop = i_cal_component_get_first_property (comp_data->icalcomp,
I_CAL_CATEGORIES_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (comp_data->icalcomp, ICAL_CATEGORIES_PROPERTY)) {
- const gchar *categories = icalproperty_get_categories (prop);
+ g_object_unref (prop), prop = i_cal_component_get_next_property (comp_data->icalcomp,
I_CAL_CATEGORIES_PROPERTY)) {
+ const gchar *categories = i_cal_property_get_categories (prop);
if (!categories)
continue;
@@ -294,23 +284,24 @@ get_categories (ECalModelComponent *comp_data)
static gchar *
get_classification (ECalModelComponent *comp_data)
{
- icalproperty *prop;
- icalproperty_class class;
+ ICalProperty *prop;
+ ICalProperty_Class class_prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_CLASS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_CLASS_PROPERTY);
if (!prop)
return _("Public");
- class = icalproperty_get_class (prop);
+ class_prop = i_cal_property_get_class (prop);
- switch (class)
- {
- case ICAL_CLASS_PUBLIC:
+ g_clear_object (&prop);
+
+ switch (class_prop) {
+ case I_CAL_CLASS_PUBLIC:
return _("Public");
- case ICAL_CLASS_PRIVATE:
+ case I_CAL_CLASS_PRIVATE:
return _("Private");
- case ICAL_CLASS_CONFIDENTIAL:
+ case I_CAL_CLASS_CONFIDENTIAL:
return _("Confidential");
default:
return _("Unknown");
@@ -329,19 +320,18 @@ get_color (ECalModel *model,
static gpointer
get_description (ECalModelComponent *comp_data)
{
- icalproperty *prop;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DESCRIPTION_PROPERTY);
- if (prop) {
- GString *str = g_string_new (NULL);
- do {
- str = g_string_append (str, icalproperty_get_description (prop));
- } while ((prop = icalcomponent_get_next_property (comp_data->icalcomp,
ICAL_DESCRIPTION_PROPERTY)));
+ ICalProperty *prop;
+ GString *str = NULL;
- return g_string_free (str, FALSE);
+ for (prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DESCRIPTION_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (comp_data->icalcomp,
I_CAL_DESCRIPTION_PROPERTY)) {
+ if (!str)
+ str = g_string_new (NULL);
+ g_string_append (str, i_cal_property_get_description (prop));
}
- return g_strdup ("");
+ return str ? g_string_free (str, FALSE) : g_strdup ("");
}
static ECellDateEditValue *
@@ -349,65 +339,67 @@ get_dtstart (ECalModel *model,
ECalModelComponent *comp_data)
{
ECalModelPrivate *priv;
- struct icaltimetype tt_start;
+ ICalTime *tt_start;
priv = model->priv;
if (!comp_data->dtstart) {
- icalproperty *prop;
- icaltimezone *zone;
+ ICalProperty *prop;
+ ICalTimezone *zone;
gboolean got_zone = FALSE;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTSTART_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_DTSTART_PROPERTY);
if (!prop)
return NULL;
- tt_start = icalproperty_get_dtstart (prop);
+ tt_start = i_cal_property_get_dtstart (prop);
- if (icaltime_get_tzid (tt_start)
- && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid (tt_start),
&zone, NULL, NULL))
+ if (i_cal_time_get_tzid (tt_start)
+ && e_cal_client_get_timezone_sync (comp_data->client, i_cal_time_get_tzid (tt_start),
&zone, NULL, NULL))
got_zone = TRUE;
if (e_cal_data_model_get_expand_recurrences (priv->data_model)) {
- if (got_zone)
- tt_start = icaltime_from_timet_with_zone (comp_data->instance_start,
tt_start.is_date, zone);
- else if (priv->zone)
- tt_start = icaltime_from_timet_with_zone (comp_data->instance_start,
tt_start.is_date, priv->zone);
+ gboolean is_date = i_cal_time_is_date (tt_start);
+
+ if (got_zone) {
+ g_clear_object (&tt_start);
+ tt_start = i_cal_time_from_timet_with_zone (comp_data->instance_start,
is_date, zone);
+ } else if (priv->zone) {
+ g_clear_object (&tt_start);
+ tt_start = i_cal_time_from_timet_with_zone (comp_data->instance_start,
is_date, priv->zone);
+ }
}
- if (!icaltime_is_valid_time (tt_start) || icaltime_is_null_time (tt_start))
- return NULL;
+ g_object_unref (prop);
- comp_data->dtstart = g_new0 (ECellDateEditValue, 1);
- comp_data->dtstart->tt = tt_start;
+ if (!i_cal_time_is_valid_time (tt_start) || i_cal_time_is_null_time (tt_start)) {
+ g_clear_object (&tt_start);
+ return NULL;
+ }
- if (got_zone)
- comp_data->dtstart->zone = zone;
- else
- comp_data->dtstart->zone = NULL;
+ comp_data->dtstart = e_cell_date_edit_value_new_take (tt_start, (got_zone && zone) ?
e_cal_util_copy_timezone (zone) : NULL);
}
- return e_cal_model_copy_cell_date_value (comp_data->dtstart);
+ return e_cell_date_edit_value_copy (comp_data->dtstart);
}
static ECellDateEditValue *
get_datetime_from_utc (ECalModel *model,
ECalModelComponent *comp_data,
- icalproperty_kind propkind,
- struct icaltimetype (*get_value) (const icalproperty *prop),
+ ICalPropertyKind propkind,
+ ICalTime * (*get_value) (ICalProperty *prop),
ECellDateEditValue **buffer)
{
g_return_val_if_fail (buffer != NULL, NULL);
if (!*buffer) {
ECalModelPrivate *priv;
- struct icaltimetype tt_value;
- icalproperty *prop;
- ECellDateEditValue *res;
+ ICalTime *tt_value;
+ ICalProperty *prop;
priv = model->priv;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, propkind);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, propkind);
if (!prop)
return NULL;
@@ -415,37 +407,43 @@ get_datetime_from_utc (ECalModel *model,
/* these are always in UTC, thus convert to default zone, if any and done */
if (priv->zone)
- icaltimezone_convert_time (&tt_value, icaltimezone_get_utc_timezone (), priv->zone);
+ i_cal_timezone_convert_time (tt_value, i_cal_timezone_get_utc_timezone (),
priv->zone);
- if (!icaltime_is_valid_time (tt_value) || icaltime_is_null_time (tt_value))
- return NULL;
+ g_object_unref (prop);
- res = g_new0 (ECellDateEditValue, 1);
- res->tt = tt_value;
- res->zone = NULL;
+ if (!i_cal_time_is_valid_time (tt_value) || i_cal_time_is_null_time (tt_value)) {
+ g_clear_object (&tt_value);
+ return NULL;
+ }
- *buffer = res;
+ *buffer = e_cell_date_edit_value_new_take (tt_value, NULL);
}
- return e_cal_model_copy_cell_date_value (*buffer);
+ return e_cell_date_edit_value_copy (*buffer);
}
static gpointer
get_summary (ECalModelComponent *comp_data)
{
- icalproperty *prop;
+ ICalProperty *prop;
+ gchar *res = NULL;
+
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_SUMMARY_PROPERTY);
+ if (prop)
+ res = g_strdup (i_cal_property_get_summary (prop));
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_SUMMARY_PROPERTY);
- if (prop && icalproperty_get_summary (prop))
- return g_strdup (icalproperty_get_summary (prop));
+ g_clear_object (&prop);
- return g_strdup ("");
+ if (!res)
+ res = g_strdup ("");
+
+ return res;
}
static gchar *
get_uid (ECalModelComponent *comp_data)
{
- return (gchar *) icalcomponent_get_uid (comp_data->icalcomp);
+ return (gchar *) i_cal_component_get_uid (comp_data->icalcomp);
}
static gchar *
@@ -462,17 +460,10 @@ static void
set_categories (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
/* remove all categories first */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_CATEGORIES_PROPERTY);
- while (prop) {
- icalproperty *to_remove = prop;
- prop = icalcomponent_get_next_property (comp_data->icalcomp, ICAL_CATEGORIES_PROPERTY);
-
- icalcomponent_remove_property (comp_data->icalcomp, to_remove);
- icalproperty_free (to_remove);
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_CATEGORIES_PROPERTY, TRUE);
if (comp_data->priv->categories_str)
g_string_free (comp_data->priv->categories_str, TRUE);
@@ -482,8 +473,8 @@ set_categories (ECalModelComponent *comp_data,
* it'll be populated on demand (in the get_categories() function)
*/
if (value && *value) {
- prop = icalproperty_new_categories (value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ prop = i_cal_property_new_categories (value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
@@ -491,31 +482,33 @@ static void
set_classification (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_CLASS_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_CLASS_PROPERTY);
if (!value || !(*value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_clear_object (&prop);
}
} else {
- icalproperty_class ical_class;
+ ICalProperty_Class ical_class;
if (!g_ascii_strcasecmp (value, "PUBLIC"))
- ical_class = ICAL_CLASS_PUBLIC;
+ ical_class = I_CAL_CLASS_PUBLIC;
else if (!g_ascii_strcasecmp (value, "PRIVATE"))
- ical_class = ICAL_CLASS_PRIVATE;
+ ical_class = I_CAL_CLASS_PRIVATE;
else if (!g_ascii_strcasecmp (value, "CONFIDENTIAL"))
- ical_class = ICAL_CLASS_CONFIDENTIAL;
+ ical_class = I_CAL_CLASS_CONFIDENTIAL;
else
- ical_class = ICAL_CLASS_NONE;
+ ical_class = I_CAL_CLASS_NONE;
if (!prop) {
- prop = icalproperty_new_class (ical_class);
- icalcomponent_add_property (comp_data->icalcomp, prop);
- } else
- icalproperty_set_class (prop, ical_class);
+ prop = i_cal_property_new_class (ical_class);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
+ } else {
+ i_cal_property_set_class (prop, ical_class);
+ g_clear_object (&prop);
+ }
}
}
@@ -523,27 +516,17 @@ static void
set_description (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
/* remove old description(s) */
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DESCRIPTION_PROPERTY);
- while (prop) {
- icalproperty *next;
-
- next = icalcomponent_get_next_property (comp_data->icalcomp, ICAL_DESCRIPTION_PROPERTY);
-
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
-
- prop = next;
- }
+ e_cal_util_component_remove_property_by_kind (comp_data->icalcomp, I_CAL_DESCRIPTION_PROPERTY, TRUE);
/* now add the new description */
if (!value || !(*value))
return;
- prop = icalproperty_new_description (value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ prop = i_cal_property_new_description (value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
static void
@@ -553,61 +536,62 @@ set_dtstart (ECalModel *model,
{
e_cal_model_update_comp_time (
model, comp_data, value,
- ICAL_DTSTART_PROPERTY,
- icalproperty_set_dtstart,
- icalproperty_new_dtstart);
+ I_CAL_DTSTART_PROPERTY,
+ i_cal_property_set_dtstart,
+ i_cal_property_new_dtstart);
}
static void
set_summary (ECalModelComponent *comp_data,
const gchar *value)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_SUMMARY_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_SUMMARY_PROPERTY);
if (string_is_empty (value)) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_clear_object (&prop);
}
} else {
- if (prop)
- icalproperty_set_summary (prop, value);
- else {
- prop = icalproperty_new_summary (value);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ if (prop) {
+ i_cal_property_set_summary (prop, value);
+ g_clear_object (&prop);
+ } else {
+ prop = i_cal_property_new_summary (value);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
static void
datetime_to_zone (ECalClient *client,
- struct icaltimetype *tt,
- icaltimezone *tt_zone,
+ ICalTime *tt,
+ ICalTimezone *tt_zone,
const gchar *tzid)
{
- icaltimezone *from, *to;
+ ICalTimezone *from, *to;
const gchar *tt_tzid = NULL;
g_return_if_fail (tt != NULL);
if (tt_zone)
- tt_tzid = icaltimezone_get_tzid (tt_zone);
+ tt_tzid = i_cal_timezone_get_tzid (tt_zone);
if (tt_tzid == NULL || tzid == NULL ||
tt_tzid == tzid || g_str_equal (tt_tzid, tzid))
return;
from = tt_zone;
- 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);
+ /* do not abort on failure here, maybe the zone is not available there */
+ if (!e_cal_client_get_timezone_sync (client, tzid, &to, NULL, NULL))
+ to = NULL;
}
- icaltimezone_convert_time (tt, from, to);
+ i_cal_timezone_convert_time (tt, from, to);
}
static void
@@ -1190,9 +1174,9 @@ cal_model_dispose (GObject *object)
g_clear_object (&priv->registry);
g_clear_object (&priv->shell);
g_clear_object (&priv->client_cache);
+ g_clear_object (&priv->zone);
- g_free (priv->default_source_uid);
- priv->default_source_uid = NULL;
+ g_clear_pointer (&priv->default_source_uid, g_free);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_cal_model_parent_class)->dispose (object);
@@ -1234,9 +1218,7 @@ cal_model_get_color_for_component (ECalModel *model,
const gchar *extension_name;
const gchar *uid;
gint i, first_empty = 0;
- #ifdef HAVE_ICAL_COLOR_PROPERTY
- icalproperty *prop;
- #endif
+ ICalProperty *prop;
static AssignedColorData assigned_colors[] = {
{ "#BECEDD", NULL }, /* 190 206 221 Blue */
@@ -1253,20 +1235,22 @@ cal_model_get_color_for_component (ECalModel *model,
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
- #ifdef HAVE_ICAL_COLOR_PROPERTY
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COLOR_PROPERTY);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_COLOR_PROPERTY);
if (prop) {
GdkRGBA rgba;
- color_spec = icalproperty_get_color (prop);
+ color_spec = i_cal_property_get_color (prop);
if (color_spec && gdk_rgba_parse (&rgba, color_spec)) {
g_free (comp_data->color);
comp_data->color = g_strdup (color_spec);
+ g_object_unref (prop);
+
return comp_data->color;
}
+
+ g_object_unref (prop);
}
- #endif
switch (e_cal_client_get_source_type (comp_data->client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -1398,7 +1382,7 @@ cal_model_create_component_from_values_thread (EAlertSinkThreadJobData *job_data
ESource *source;
EClient *client;
ECalModelComponent *comp_data;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *source_uid;
gchar *display_name;
GError *local_error = NULL;
@@ -1456,15 +1440,17 @@ cal_model_create_component_from_values_thread (EAlertSinkThreadJobData *job_data
if (tt > 0) {
/* Store Memo DTSTART as date, not as date-time */
- struct icaltimetype itt = icaltime_from_timet_with_zone (tt,
- icalcomponent_isa (comp_data->icalcomp) == ICAL_VJOURNAL_COMPONENT,
e_cal_model_get_timezone (ccd->model));
- icalproperty *prop = icalcomponent_get_first_property (comp_data->icalcomp,
ICAL_DTSTART_PROPERTY);
+ ICalTime *itt = i_cal_time_from_timet_with_zone (tt,
+ i_cal_component_isa (comp_data->icalcomp) ==
I_CAL_VJOURNAL_COMPONENT, e_cal_model_get_timezone (ccd->model));
+
+ prop = i_cal_component_get_first_property (comp_data->icalcomp,
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 (comp_data->icalcomp, prop);
+ prop = i_cal_property_new_dtstart (itt);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
}
}
}
@@ -1475,24 +1461,28 @@ cal_model_create_component_from_values_thread (EAlertSinkThreadJobData *job_data
model_class->fill_component_from_values (ccd->model, comp_data, ccd->values);
}
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_CLASS_PROPERTY);
- if (!prop || icalproperty_get_class (prop) == ICAL_CLASS_NONE) {
- icalproperty_class ical_class = ICAL_CLASS_PUBLIC;
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, I_CAL_CLASS_PROPERTY);
+ if (!prop || i_cal_property_get_class (prop) == I_CAL_CLASS_NONE) {
+ ICalProperty_Class ical_class = I_CAL_CLASS_PUBLIC;
GSettings *settings;
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
if (g_settings_get_boolean (settings, "classify-private"))
- ical_class = ICAL_CLASS_PRIVATE;
+ ical_class = I_CAL_CLASS_PRIVATE;
g_object_unref (settings);
if (!prop) {
- prop = icalproperty_new_class (ical_class);
- icalcomponent_add_property (comp_data->icalcomp, prop);
- } else
- icalproperty_set_class (prop, ical_class);
+ prop = i_cal_property_new_class (ical_class);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
+ } else {
+ i_cal_property_set_class (prop, ical_class);
+ g_object_unref (prop);
+ }
+ } else {
+ g_clear_object (&prop);
}
- ccd->success = e_cal_client_create_object_sync (comp_data->client, comp_data->icalcomp, &uid,
cancellable, error);
+ ccd->success = e_cal_client_create_object_sync (comp_data->client, comp_data->icalcomp,
E_CAL_OPERATION_FLAG_NONE, &uid, cancellable, error);
g_free (uid);
}
@@ -1602,25 +1592,20 @@ cal_model_value_at (ETableModel *etm,
case E_CAL_MODEL_FIELD_CREATED :
return (gpointer) get_datetime_from_utc (
model, comp_data, ICAL_CREATED_PROPERTY,
- icalproperty_get_created, &comp_data->created);
+ i_cal_property_get_created, &comp_data->created);
case E_CAL_MODEL_FIELD_LASTMODIFIED :
return (gpointer) get_datetime_from_utc (
- model, comp_data, ICAL_LASTMODIFIED_PROPERTY,
- icalproperty_get_lastmodified, &comp_data->lastmodified);
+ model, comp_data, I_CAL_LASTMODIFIED_PROPERTY,
+ i_cal_property_get_lastmodified, &comp_data->lastmodified);
case E_CAL_MODEL_FIELD_HAS_ALARMS :
- return GINT_TO_POINTER (
- icalcomponent_get_first_component (
- comp_data->icalcomp,
- ICAL_VALARM_COMPONENT) != NULL);
+ return GINT_TO_POINTER (e_cal_util_component_has_property (comp_data->icalcomp,
I_CAL_VALARM_COMPONENT));
case E_CAL_MODEL_FIELD_ICON :
{
ECalComponent *comp;
- icalcomponent *icalcomp;
gint retval = 0;
- comp = e_cal_component_new ();
- icalcomp = icalcomponent_new_clone (comp_data->icalcomp);
- if (e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(comp_data->icalcomp));
+ if (comp) {
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
g_object_unref (comp);
return GINT_TO_POINTER (retval);
@@ -1633,14 +1618,14 @@ cal_model_value_at (ETableModel *etm,
else {
GSList *attendees = NULL, *sl;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
for (sl = attendees; sl != NULL; sl = sl->next) {
ECalComponentAttendee *ca = sl->data;
const gchar *text;
- text = itip_strip_mailto (ca->value);
+ text = itip_strip_mailto (e_cal_component_attendee_get_value (ca));
if (itip_address_is_user (registry, text)) {
- if (ca->delto != NULL)
+ if (e_cal_component_attendee_get_delegatedto (ca) != NULL)
retval = 3;
else
retval = 2;
@@ -1648,12 +1633,11 @@ cal_model_value_at (ETableModel *etm,
}
}
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
- } else
- icalcomponent_free (icalcomp);
- g_object_unref (comp);
+ g_object_unref (comp);
+ }
return GINT_TO_POINTER (retval);
}
@@ -1664,7 +1648,7 @@ cal_model_value_at (ETableModel *etm,
case E_CAL_MODEL_FIELD_SOURCE:
return get_source_description (registry, comp_data);
case E_CAL_MODEL_FIELD_CANCELLED:
- return GINT_TO_POINTER (icalcomponent_get_status (comp_data->icalcomp) ==
ICAL_STATUS_CANCELLED ? 1 : 0);
+ return GINT_TO_POINTER (i_cal_component_get_status (comp_data->icalcomp) ==
I_CAL_STATUS_CANCELLED ? 1 : 0);
}
return (gpointer) "";
@@ -1765,11 +1749,11 @@ cal_model_duplicate_value (ETableModel *etm,
case E_CAL_MODEL_FIELD_CANCELLED:
return (gpointer) value;
case E_CAL_MODEL_FIELD_COMPONENT :
- return icalcomponent_new_clone ((icalcomponent *) value);
+ return i_cal_component_new_clone ((ICalComponent *) value);
case E_CAL_MODEL_FIELD_DTSTART :
case E_CAL_MODEL_FIELD_CREATED :
case E_CAL_MODEL_FIELD_LASTMODIFIED :
- return e_cal_model_copy_cell_date_value (value);
+ return e_cell_date_edit_value_copy (value);
}
return NULL;
@@ -1804,7 +1788,7 @@ cal_model_free_value (ETableModel *etm,
break;
case E_CAL_MODEL_FIELD_COMPONENT :
if (value)
- icalcomponent_free ((icalcomponent *) value);
+ g_object_unref ((ICalComponent *) value);
break;
}
}
@@ -1936,19 +1920,16 @@ e_cal_model_get_component_index (ECalModel *model,
if (comp_data) {
const gchar *uid;
- gchar *rid = NULL;
- struct icaltimetype icalrid;
- gboolean has_rid = (id->rid && *id->rid);
+ gchar *rid;
+ gboolean has_rid = e_cal_component_id_get_rid (id) != NULL;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- icalrid = icalcomponent_get_recurrenceid (comp_data->icalcomp);
- if (!icaltime_is_null_time (icalrid))
- rid = icaltime_as_ical_string_r (icalrid);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (uid && *uid) {
- if ((!client || comp_data->client == client) && strcmp (id->uid, uid) == 0) {
+ if ((!client || comp_data->client == client) && strcmp (uid,
e_cal_component_id_get_uid (id)) == 0) {
if (has_rid) {
- if (!(rid && *rid && strcmp (rid, id->rid) == 0)) {
+ if (!(rid && *rid && strcmp (rid, e_cal_component_id_get_rid
(id)) == 0)) {
g_free (rid);
continue;
}
@@ -1975,7 +1956,7 @@ cal_model_data_subscriber_component_added_or_modified (ECalDataModelSubscriber *
ECalModelComponent *comp_data;
ETableModel *table_model;
ECalComponentId *id;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
gint index;
model = E_CAL_MODEL (subscriber);
@@ -1984,13 +1965,13 @@ cal_model_data_subscriber_component_added_or_modified (ECalDataModelSubscriber *
index = e_cal_model_get_component_index (model, client, id);
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
if (index < 0 && !is_added)
return;
table_model = E_TABLE_MODEL (model);
- icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+ icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
if (index < 0) {
e_table_model_pre_change (table_model);
@@ -1998,7 +1979,7 @@ cal_model_data_subscriber_component_added_or_modified (ECalDataModelSubscriber *
comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL);
comp_data->is_new_component = FALSE;
comp_data->client = g_object_ref (client);
- comp_data->icalcomp = icalcomp;
+ comp_data->icalcomp = icomp;
e_cal_model_set_instance_times (comp_data, model->priv->zone);
g_ptr_array_add (model->priv->objects, comp_data);
@@ -2007,7 +1988,7 @@ cal_model_data_subscriber_component_added_or_modified (ECalDataModelSubscriber *
e_table_model_pre_change (table_model);
comp_data = g_ptr_array_index (model->priv->objects, index);
- e_cal_model_component_set_icalcomponent (comp_data, model, icalcomp);
+ e_cal_model_component_set_icalcomponent (comp_data, model, icomp);
e_table_model_row_changed (table_model, index);
}
@@ -2038,16 +2019,17 @@ e_cal_model_data_subscriber_component_removed (ECalDataModelSubscriber *subscrib
ECalModel *model;
ECalModelComponent *comp_data;
ETableModel *table_model;
- ECalComponentId id;
+ ECalComponentId *id;
GSList *link;
gint index;
model = E_CAL_MODEL (subscriber);
- id.uid = (gchar *) uid;
- id.rid = (gchar *) rid;
+ id = e_cal_component_id_new (uid, rid);
+
+ index = e_cal_model_get_component_index (model, client, id);
- index = e_cal_model_get_component_index (model, client, &id);
+ e_cal_component_id_free (id);
if (index < 0)
return;
@@ -2577,10 +2559,10 @@ e_cal_model_class_init (ECalModelClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalModelClass, timezone_changed),
NULL, NULL,
- e_marshal_VOID__POINTER_POINTER,
+ e_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
+ I_CAL_TYPE_TIMEZONE,
+ I_CAL_TYPE_TIMEZONE);
signals[OBJECT_CREATED] = g_signal_new (
"object-created",
@@ -2640,25 +2622,25 @@ void
e_cal_model_update_comp_time (ECalModel *model,
ECalModelComponent *comp_data,
gconstpointer time_value,
- icalproperty_kind kind,
- void (*set_func) (icalproperty *prop,
- struct icaltimetype v),
- icalproperty * (*new_func) (struct icaltimetype v))
+ ICalPropertyKind kind,
+ void (*set_func) (ICalProperty *prop,
+ ICalTime *v),
+ ICalProperty * (*new_func) (ICalTime *v))
{
ECellDateEditValue *dv = (ECellDateEditValue *) time_value;
- icalproperty *prop;
- icalparameter *param;
- icaltimezone *model_zone;
- struct icaltimetype tt;
+ ICalProperty *prop;
+ ICalParameter *param;
+ ICalTimezone *model_zone;
+ ICalTime *tt;
g_return_if_fail (model != NULL);
g_return_if_fail (comp_data != NULL);
g_return_if_fail (set_func != NULL);
g_return_if_fail (new_func != NULL);
- prop = icalcomponent_get_first_property (comp_data->icalcomp, kind);
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, kind);
if (prop)
- param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
else
param = NULL;
@@ -2666,39 +2648,43 @@ e_cal_model_update_comp_time (ECalModel *model,
* we remove it if it exists. */
if (!dv) {
if (prop) {
- icalcomponent_remove_property (comp_data->icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (comp_data->icalcomp, prop);
+ g_object_unref (prop);
}
return;
}
model_zone = e_cal_model_get_timezone (model);
- tt = dv->tt;
- datetime_to_zone (comp_data->client, &tt, model_zone, param ? icalparameter_get_tzid (param) : NULL);
+ tt = e_cell_date_edit_value_get_time (dv);
+ datetime_to_zone (comp_data->client, tt, model_zone, param ? i_cal_parameter_get_tzid (param) : NULL);
if (prop) {
set_func (prop, tt);
} else {
prop = new_func (tt);
- icalcomponent_add_property (comp_data->icalcomp, prop);
+ i_cal_component_take_property (comp_data->icalcomp, prop);
+
+ prop = i_cal_component_get_first_property (comp_data->icalcomp, kind);
}
if (param) {
- const gchar *tzid = icalparameter_get_tzid (param);
+ const gchar *tzid = i_cal_parameter_get_tzid (param);
/* If the TZID is set to "UTC", we don't want to save the TZID. */
if (!tzid || !*tzid || !strcmp (tzid, "UTC")) {
- icalproperty_remove_parameter_by_kind (prop, ICAL_TZID_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_TZID_PARAMETER);
}
} else if (model_zone) {
- const gchar *tzid = icaltimezone_get_tzid (model_zone);
+ const gchar *tzid = i_cal_timezone_get_tzid (model_zone);
if (tzid && *tzid) {
- param = icalparameter_new_tzid (tzid);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_tzid (tzid);
+ i_cal_property_take_parameter (prop, param);
}
}
+
+ g_clear_object (&prop);
}
/**
@@ -2826,24 +2812,24 @@ e_cal_model_set_confirm_delete (ECalModel *model,
g_object_notify (G_OBJECT (model), "confirm-delete");
}
-icalcomponent_kind
+ICalComponentKind
e_cal_model_get_component_kind (ECalModel *model)
{
- g_return_val_if_fail (E_IS_CAL_MODEL (model), ICAL_NO_COMPONENT);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), I_CAL_NO_COMPONENT);
return model->priv->kind;
}
void
e_cal_model_set_component_kind (ECalModel *model,
- icalcomponent_kind kind)
+ ICalComponentKind kind)
{
g_return_if_fail (E_IS_CAL_MODEL (model));
model->priv->kind = kind;
}
-icaltimezone *
+ICalTimezone *
e_cal_model_get_timezone (ECalModel *model)
{
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
@@ -2853,9 +2839,10 @@ e_cal_model_get_timezone (ECalModel *model)
void
e_cal_model_set_timezone (ECalModel *model,
- icaltimezone *zone)
+ const ICalTimezone *zone)
{
- icaltimezone *old_zone;
+ ICalTimezone *old_zone;
+
g_return_if_fail (E_IS_CAL_MODEL (model));
if (model->priv->zone == zone)
@@ -2863,7 +2850,7 @@ e_cal_model_set_timezone (ECalModel *model,
e_table_model_pre_change (E_TABLE_MODEL (model));
old_zone = model->priv->zone;
- model->priv->zone = zone;
+ model->priv->zone = zone ? e_cal_util_copy_timezone (zone) : NULL;
/* the timezone affects the times shown for date fields,
* so we need to redisplay everything */
@@ -2872,7 +2859,9 @@ e_cal_model_set_timezone (ECalModel *model,
g_object_notify (G_OBJECT (model), "timezone");
g_signal_emit (
model, signals[TIMEZONE_CHANGED], 0,
- old_zone, zone);
+ old_zone, model->priv->zone);
+
+ g_clear_object (&old_zone);
}
gboolean
@@ -3635,19 +3624,17 @@ search_by_id_and_client (ECalModelPrivate *priv,
if (comp_data) {
const gchar *uid;
- gchar *rid = NULL;
- struct icaltimetype icalrid;
- gboolean has_rid = (id->rid && *id->rid);
+ gchar *rid;
+ gboolean has_rid = e_cal_component_id_get_rid (id) != NULL;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- icalrid = icalcomponent_get_recurrenceid (comp_data->icalcomp);
- if (!icaltime_is_null_time (icalrid))
- rid = icaltime_as_ical_string_r (icalrid);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (uid && *uid) {
- if ((!client || comp_data->client == client) && !strcmp (id->uid, uid)) {
+ if ((!client || comp_data->client == client) &&
+ !g_strcmp0 (e_cal_component_id_get_uid (id), uid)) {
if (has_rid) {
- if (!(rid && *rid && !strcmp (rid, id->rid))) {
+ if (!(rid && *rid && !g_strcmp0 (e_cal_component_id_get_rid
(id), rid))) {
g_free (rid);
continue;
}
@@ -3747,7 +3734,7 @@ e_cal_model_set_time_range (ECalModel *model,
/**
* e_cal_model_create_component_with_defaults_sync
*/
-icalcomponent *
+ICalComponent *
e_cal_model_create_component_with_defaults_sync (ECalModel *model,
ECalClient *client,
gboolean all_day,
@@ -3755,13 +3742,13 @@ e_cal_model_create_component_with_defaults_sync (ECalModel *model,
GError **error)
{
ECalComponent *comp = NULL;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
if (client) {
switch (model->priv->kind) {
- case ICAL_VEVENT_COMPONENT :
+ case I_CAL_VEVENT_COMPONENT :
comp = cal_comp_event_new_with_defaults_sync (
client, all_day,
e_cal_model_get_use_default_reminder (model),
@@ -3769,10 +3756,10 @@ e_cal_model_create_component_with_defaults_sync (ECalModel *model,
e_cal_model_get_default_reminder_units (model),
cancellable, error);
break;
- case ICAL_VTODO_COMPONENT :
+ case I_CAL_VTODO_COMPONENT :
comp = cal_comp_task_new_with_defaults_sync (client, cancellable, error);
break;
- case ICAL_VJOURNAL_COMPONENT :
+ case I_CAL_VJOURNAL_COMPONENT :
comp = cal_comp_memo_new_with_defaults_sync (client, cancellable, error);
break;
default:
@@ -3782,23 +3769,23 @@ e_cal_model_create_component_with_defaults_sync (ECalModel *model,
}
if (comp) {
- icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+ icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
g_object_unref (comp);
} else {
- icalcomp = icalcomponent_new (model->priv->kind);
+ icomp = i_cal_component_new (model->priv->kind);
}
/* make sure the component has a UID */
- if (!icalcomponent_get_uid (icalcomp)) {
+ if (!i_cal_component_get_uid (icomp)) {
gchar *uid;
uid = e_util_generate_uid ();
- icalcomponent_set_uid (icalcomp, uid);
+ i_cal_component_set_uid (icomp, uid);
g_free (uid);
}
- return icalcomp;
+ return icomp;
}
/**
@@ -3815,17 +3802,17 @@ e_cal_model_get_attendees_status_info (ECalModel *model,
ECalClient *cal_client)
{
struct _values {
- icalparameter_partstat status;
+ ICalParameterPartstat status;
const gchar *caption;
gint count;
} values[] = {
- { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 },
- { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 },
- { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 },
- { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 },
- { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 },
- { ICAL_PARTSTAT_NONE, N_("Other"), 0 },
- { ICAL_PARTSTAT_X, NULL, -1 }
+ { I_CAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 },
+ { I_CAL_PARTSTAT_DECLINED, N_("Declined"), 0 },
+ { I_CAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 },
+ { I_CAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 },
+ { I_CAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 },
+ { I_CAL_PARTSTAT_NONE, N_("Other"), 0 },
+ { I_CAL_PARTSTAT_X, NULL, -1 }
};
ESourceRegistry *registry;
@@ -3842,19 +3829,19 @@ e_cal_model_get_attendees_status_info (ECalModel *model,
!itip_organizer_is_user_ex (registry, comp, cal_client, TRUE))
return NULL;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
for (a = attendees; a; a = a->next) {
ECalComponentAttendee *att = a->data;
- if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL &&
- (att->role == ICAL_ROLE_CHAIR ||
- att->role == ICAL_ROLE_REQPARTICIPANT ||
- att->role == ICAL_ROLE_OPTPARTICIPANT)) {
+ if (att && e_cal_component_attendee_get_cutype (att) == I_CAL_CUTYPE_INDIVIDUAL &&
+ (e_cal_component_attendee_get_role (att) == I_CAL_ROLE_CHAIR ||
+ e_cal_component_attendee_get_role (att) == I_CAL_ROLE_REQPARTICIPANT ||
+ e_cal_component_attendee_get_role (att) == I_CAL_ROLE_OPTPARTICIPANT)) {
have = TRUE;
for (i = 0; values[i].count != -1; i++) {
- if (att->status == values[i].status || values[i].status ==
ICAL_PARTSTAT_NONE) {
+ if (e_cal_component_attendee_get_partstat (att) == values[i].status ||
values[i].status == I_CAL_PARTSTAT_NONE) {
values[i].count++;
break;
}
@@ -3883,8 +3870,7 @@ e_cal_model_get_attendees_status_info (ECalModel *model,
res = g_string_free (str, FALSE);
}
- if (attendees)
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return res;
}
@@ -3994,7 +3980,6 @@ e_cal_model_date_value_to_string (ECalModel *model,
{
ECalModelPrivate *priv;
ECellDateEditValue *dv = (ECellDateEditValue *) value;
- struct icaltimetype tt;
struct tm tmp_tm;
gchar buffer[64];
@@ -4006,18 +3991,7 @@ e_cal_model_date_value_to_string (ECalModel *model,
return g_strdup ("");
/* We currently convert all the dates to the current timezone. */
- tt = dv->tt;
- icaltimezone_convert_time (&tt, dv->zone, priv->zone);
-
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
-
- tmp_tm.tm_wday = time_day_of_week (tt.day, tt.month - 1, tt.year);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (e_cell_date_edit_value_get_time (dv),
e_cell_date_edit_value_get_zone (dv), priv->zone);
memset (buffer, 0, sizeof (buffer));
e_time_format_date_and_time (&tmp_tm, priv->use_24_hour_format,
@@ -4028,26 +4002,35 @@ e_cal_model_date_value_to_string (ECalModel *model,
typedef struct _GenerateInstacesData {
ECalModelGenerateInstancesData mdata;
- ECalRecurInstanceFn cb;
+ ECalRecurInstanceCb cb;
ECalClient *client;
- icaltimezone *zone;
+ ICalTimezone *zone;
} GenerateInstancesData;
static gboolean
-ecm_generate_instances_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer user_data)
+ecm_generate_instances_cb (ICalComponent *comp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
GenerateInstancesData *gid = user_data;
+ ICalTime *changed_instance_start = NULL, *changed_instance_end = NULL;
+ gboolean res;
g_return_val_if_fail (gid != NULL, FALSE);
g_return_val_if_fail (gid->mdata.comp_data != NULL, FALSE);
- cal_comp_get_instance_times (gid->mdata.comp_data->client, e_cal_component_get_icalcomponent (comp),
- gid->zone, &instance_start, NULL, &instance_end, NULL, NULL);
+ cal_comp_get_instance_times (gid->mdata.comp_data->client, comp,
+ gid->zone, &changed_instance_start, &changed_instance_end, cancellable);
+
+ res = gid->cb (comp, changed_instance_start, changed_instance_end, &gid->mdata, cancellable, error);
- return gid->cb (comp, instance_start, instance_end, &gid->mdata);
+ g_clear_object (&changed_instance_start);
+ g_clear_object (&changed_instance_end);
+
+ return res;
}
/**
@@ -4059,7 +4042,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;
@@ -4099,35 +4082,46 @@ e_cal_model_get_object_array (ECalModel *model)
void
e_cal_model_set_instance_times (ECalModelComponent *comp_data,
- const icaltimezone *zone)
+ const ICalTimezone *zone)
{
- if (icalcomponent_isa (comp_data->icalcomp) == ICAL_VEVENT_COMPONENT) {
- struct icaltimetype start_time, end_time;
+ ICalTime *instance_start = NULL, *instance_end = NULL;
- start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
- end_time = icalcomponent_get_dtend (comp_data->icalcomp);
+ if (i_cal_component_isa (comp_data->icalcomp) == I_CAL_VEVENT_COMPONENT) {
+ ICalTime *start_time, *end_time;
- if (start_time.is_date && icaltime_is_null_time (end_time)) {
+ start_time = i_cal_component_get_dtstart (comp_data->icalcomp);
+ end_time = i_cal_component_get_dtend (comp_data->icalcomp);
+
+ if (i_cal_time_is_date (start_time) && i_cal_time_is_null_time (end_time)) {
/* If end_time is null and it's an all day event,
* just make start_time = end_time so that end_time
* will be a valid date
*/
- end_time = start_time;
- icaltime_adjust (&end_time, 1, 0, 0, 0);
- icalcomponent_set_dtend (comp_data->icalcomp, end_time);
- } else if (start_time.is_date && end_time.is_date &&
- (icaltime_compare_date_only (start_time, end_time) == 0)) {
+ end_time = i_cal_time_new_clone (start_time);
+ i_cal_time_adjust (end_time, 1, 0, 0, 0);
+ i_cal_component_set_dtend (comp_data->icalcomp, end_time);
+ } else if (i_cal_time_is_date (start_time) && i_cal_time_is_date (end_time) &&
+ (i_cal_time_compare_date_only (start_time, end_time) == 0)) {
/* If both DTSTART and DTEND are DATE values, and they are the
* same day, we add 1 day to DTEND. This means that most
* events created with the old Evolution behavior will still
* work OK. */
- icaltime_adjust (&end_time, 1, 0, 0, 0);
- icalcomponent_set_dtend (comp_data->icalcomp, end_time);
+ i_cal_time_adjust (end_time, 1, 0, 0, 0);
+ i_cal_component_set_dtend (comp_data->icalcomp, end_time);
}
+
+ g_clear_object (&start_time);
+ g_clear_object (&end_time);
}
cal_comp_get_instance_times (comp_data->client, comp_data->icalcomp, zone,
- &comp_data->instance_start, NULL, &comp_data->instance_end, NULL, NULL);
+ &instance_start, &instance_end, NULL);
+
+ comp_data->instance_start = instance_start ? i_cal_time_as_timet (instance_start) :
comp_data->instance_start;
+ comp_data->instance_end = instance_end ? i_cal_time_as_timet (instance_end) : comp_data->instance_end;
+
+ g_clear_object (&instance_start);
+ g_clear_object (&instance_end);
}
/**
@@ -4191,20 +4185,3 @@ e_cal_model_emit_object_created (ECalModel *model,
g_signal_emit (model, signals[OBJECT_CREATED], 0, where);
}
-
-
-ECellDateEditValue *
-e_cal_model_copy_cell_date_value (const ECellDateEditValue *value)
-{
- ECellDateEditValue *copy;
-
- if (!value)
- return NULL;
-
-
- copy = g_new0 (ECellDateEditValue, 1);
- copy->tt = value->tt;
- copy->zone = value->zone;
-
- return copy;
-}
diff --git a/src/calendar/gui/e-cal-model.h b/src/calendar/gui/e-cal-model.h
index ce56036782..39219bdd5c 100644
--- a/src/calendar/gui/e-cal-model.h
+++ b/src/calendar/gui/e-cal-model.h
@@ -105,7 +105,7 @@ struct _ECalModelComponent {
GObject object;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icalcomp;
time_t instance_start;
time_t instance_end;
gboolean is_new_component;
@@ -162,8 +162,8 @@ struct _ECalModelClass {
void (*comps_deleted) (ECalModel *model,
gpointer list);
void (*timezone_changed) (ECalModel *model,
- icaltimezone *old_zone,
- icaltimezone *new_zone);
+ ICalTimezone *old_zone,
+ ICalTimezone *new_zone);
void (*object_created) (ECalModel *model,
ECalClient *where);
};
@@ -177,16 +177,16 @@ ESourceRegistry *
e_cal_model_get_registry (ECalModel *model);
EShell * e_cal_model_get_shell (ECalModel *model);
EClientCache * e_cal_model_get_client_cache (ECalModel *model);
-icalcomponent_kind
+ICalComponentKind
e_cal_model_get_component_kind (ECalModel *model);
void e_cal_model_set_component_kind (ECalModel *model,
- icalcomponent_kind kind);
+ ICalComponentKind kind);
gboolean e_cal_model_get_confirm_delete (ECalModel *model);
void e_cal_model_set_confirm_delete (ECalModel *model,
gboolean confirm_delete);
-icaltimezone * e_cal_model_get_timezone (ECalModel *model);
+ICalTimezone * e_cal_model_get_timezone (ECalModel *model);
void e_cal_model_set_timezone (ECalModel *model,
- icaltimezone *zone);
+ const ICalTimezone *zone);
gboolean e_cal_model_get_compress_weekend
(ECalModel *model);
void e_cal_model_set_compress_weekend
@@ -334,7 +334,7 @@ void e_cal_model_get_time_range (ECalModel *model,
void e_cal_model_set_time_range (ECalModel *model,
time_t start,
time_t end);
-icalcomponent * e_cal_model_create_component_with_defaults_sync
+ICalComponent * e_cal_model_create_component_with_defaults_sync
(ECalModel *model,
ECalClient *client,
gboolean all_day,
@@ -371,11 +371,11 @@ 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,
- const icaltimezone *zone);
+ const ICalTimezone *zone);
gboolean e_cal_model_test_row_editable (ECalModel *model,
gint row);
void e_cal_model_set_default_time_func
@@ -386,10 +386,10 @@ void e_cal_model_set_default_time_func
void e_cal_model_update_comp_time (ECalModel *model,
ECalModelComponent *comp_data,
gconstpointer time_value,
- icalproperty_kind kind,
- void (*set_func) (icalproperty *prop,
- struct icaltimetype v),
- icalproperty * (*new_func) (struct icaltimetype v));
+ ICalPropertyKind kind,
+ void (*set_func) (ICalProperty *prop,
+ ICalTime *v),
+ ICalProperty * (*new_func) (ICalTime *v));
void e_cal_model_emit_object_created (ECalModel *model,
ECalClient *where);
@@ -405,10 +405,6 @@ void e_cal_model_util_set_value (GHashTable *values,
gpointer e_cal_model_util_get_value (GHashTable *values,
gint column);
-ECellDateEditValue *
- e_cal_model_copy_cell_date_value
- (const ECellDateEditValue *value);
-
G_END_DECLS
#endif /* E_CAL_MODEL_H */
diff --git a/src/calendar/gui/e-cal-ops.c b/src/calendar/gui/e-cal-ops.c
index b885aa6926..f7d27da6e4 100644
--- a/src/calendar/gui/e-cal-ops.c
+++ b/src/calendar/gui/e-cal-ops.c
@@ -1178,7 +1178,7 @@ cal_ops_delete_completed_thread (EAlertSinkThreadJobData *job_data,
}
}
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
/* did not process all objects => an error occurred */
if (olink != NULL)
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..a1ebc1425b 100644
--- a/src/calendar/gui/e-calendar-view.c
+++ b/src/calendar/gui/e-calendar-view.c
@@ -104,30 +104,30 @@ calendar_view_add_retract_data (ECalComponent *comp,
const gchar *retract_comment,
ECalObjModType mod)
{
- icalcomponent *icalcomp = NULL;
- icalproperty *icalprop = NULL;
+ ICalComponent *icomp;
+ ICalProperty *prop;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
if (retract_comment && *retract_comment)
- icalprop = icalproperty_new_x (retract_comment);
+ prop = i_cal_property_new_x (retract_comment);
else
- icalprop = icalproperty_new_x ("0");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
- icalcomponent_add_property (icalcomp, icalprop);
+ prop = i_cal_property_new_x ("0");
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-RETRACT-COMMENT");
+ i_cal_component_take_property (icomp, prop);
if (mod == E_CAL_OBJ_MOD_ALL)
- icalprop = icalproperty_new_x ("All");
+ prop = i_cal_property_new_x ("All");
else
- icalprop = icalproperty_new_x ("This");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RECUR-MOD");
- icalcomponent_add_property (icalcomp, icalprop);
+ prop = i_cal_property_new_x ("This");
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-RECUR-MOD");
+ i_cal_component_take_property (icomp, prop);
}
static gboolean
calendar_view_check_for_retract (ECalComponent *comp,
ECalClient *client)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
const gchar *strip;
gchar *email = NULL;
gboolean ret_val;
@@ -138,15 +138,20 @@ calendar_view_check_for_retract (ECalComponent *comp,
if (!e_cal_client_check_save_schedules (client))
return FALSE;
- e_cal_component_get_organizer (comp, &organizer);
- strip = itip_strip_mailto (organizer.value);
+ organizer = e_cal_component_get_organizer (comp);
+ if (!organizer)
+ return FALSE;
+
+ strip = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
ret_val =
- e_client_get_backend_property_sync (E_CLIENT (client),
CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL) &&
+ e_client_get_backend_property_sync (E_CLIENT (client),
E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL, NULL) &&
(g_ascii_strcasecmp (email, strip) == 0);
g_free (email);
+ e_cal_component_organizer_free (organizer);
+
return ret_val;
}
@@ -168,7 +173,7 @@ calendar_view_delete_event (ECalendarView *cal_view,
registry = e_cal_model_get_registry (model);
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ e_cal_component_set_icalcomponent (comp, i_cal_component_new_clone (event->comp_data->icalcomp));
vtype = e_cal_component_get_vtype (comp);
/*FIXME remove it once the we dont set the recurrence id for all the generated instances */
@@ -182,13 +187,13 @@ calendar_view_delete_event (ECalendarView *cal_view,
delete = e_cal_dialogs_prompt_retract (GTK_WIDGET (cal_view), comp, &retract_comment,
&retract);
if (retract) {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
calendar_view_add_retract_data (comp, retract_comment, E_CAL_OBJ_MOD_ALL);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ i_cal_component_set_method (icomp, I_CAL_METHOD_CANCEL);
- e_cal_ops_send_component (model, event->comp_data->client, icalcomp);
+ e_cal_ops_send_component (model, event->comp_data->client, icomp);
}
} else if (e_cal_model_get_confirm_delete (model))
delete = e_cal_dialogs_delete_component (
@@ -207,15 +212,17 @@ calendar_view_delete_event (ECalendarView *cal_view,
event->comp_data->client,
comp, TRUE)) {
if (only_occurrence && !e_cal_component_is_instance (comp)) {
- ECalComponentRange range;
+ ECalComponentRange *range;
+ ECalComponentDateTime *dtstart;
+
+ dtstart = e_cal_component_get_dtstart (comp);
+ i_cal_time_set_is_date (e_cal_component_datetime_get_value (dtstart), 1);
/* set the recurrence ID of the object we send */
- range.type = E_CAL_COMPONENT_RANGE_SINGLE;
- e_cal_component_get_dtstart (comp, &range.datetime);
- range.datetime.value->is_date = 1;
- e_cal_component_set_recurid (comp, &range);
+ range = e_cal_component_range_new_take (E_CAL_COMPONENT_RANGE_SINGLE,
dtstart);
+ e_cal_component_set_recurid (comp, range);
- e_cal_component_free_datetime (&range.datetime);
+ e_cal_component_range_free (range);
}
itip_send_component_with_model (model, E_CAL_COMPONENT_METHOD_CANCEL,
@@ -223,7 +230,7 @@ calendar_view_delete_event (ECalendarView *cal_view,
NULL, TRUE, FALSE, FALSE);
}
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
if (!uid || !*uid) {
g_object_unref (comp);
g_free (rid);
@@ -234,16 +241,19 @@ calendar_view_delete_event (ECalendarView *cal_view,
if (e_cal_component_is_instance (comp)) {
e_cal_ops_remove_component (model, event->comp_data->client, uid, rid,
E_CAL_OBJ_MOD_THIS, FALSE);
} else {
- struct icaltimetype instance_rid;
- ECalComponentDateTime dt;
- icaltimezone *zone = NULL;
+ ICalTime *instance_rid;
+ ICalTimezone *zone = NULL;
+ ECalComponentDateTime *dt;
- e_cal_component_get_dtstart (comp, &dt);
+ dt = e_cal_component_get_dtstart (comp);
- if (dt.tzid) {
+ if (dt && e_cal_component_datetime_get_tzid (dt)) {
GError *local_error = NULL;
- e_cal_client_get_timezone_sync (event->comp_data->client, dt.tzid,
&zone, NULL, &local_error);
+ if (!e_cal_client_get_timezone_sync (event->comp_data->client,
+ e_cal_component_datetime_get_tzid (dt), &zone, NULL,
&local_error))
+ zone = NULL;
+
if (local_error != NULL) {
zone = e_calendar_view_get_timezone (cal_view);
g_clear_error (&local_error);
@@ -252,14 +262,16 @@ calendar_view_delete_event (ECalendarView *cal_view,
zone = e_calendar_view_get_timezone (cal_view);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- instance_rid = icaltime_from_timet_with_zone (
+ instance_rid = i_cal_time_from_timet_with_zone (
event->comp_data->instance_start,
- TRUE, zone ? zone : icaltimezone_get_utc_timezone ());
+ TRUE, zone ? zone : i_cal_timezone_get_utc_timezone ());
e_cal_util_remove_instances (event->comp_data->icalcomp, instance_rid,
E_CAL_OBJ_MOD_THIS);
e_cal_ops_modify_component (model, event->comp_data->client,
event->comp_data->icalcomp,
E_CAL_OBJ_MOD_THIS, E_CAL_OPS_SEND_FLAG_DONT_SEND);
+
+ g_clear_object (&instance_rid);
}
} else if (e_cal_util_component_is_instance (event->comp_data->icalcomp) ||
e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
@@ -437,19 +449,19 @@ calendar_view_update_actions (ESelectable *selectable,
for (iter = list; iter != NULL; iter = iter->next) {
ECalendarViewEvent *event = iter->data;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
if (event == NULL || event->comp_data == NULL)
continue;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
sources_are_editable = sources_are_editable && !e_client_is_readonly (E_CLIENT (client));
recurring |=
- e_cal_util_component_is_instance (icalcomp) ||
- e_cal_util_component_has_recurrences (icalcomp);
+ e_cal_util_component_is_instance (icomp) ||
+ e_cal_util_component_has_recurrences (icomp);
}
g_list_free (list);
@@ -510,52 +522,64 @@ calendar_view_cut_clipboard (ESelectable *selectable)
}
static void
-add_related_timezones (icalcomponent *des_icalcomp,
- icalcomponent *src_icalcomp,
- ECalClient *client)
+add_related_timezones (ICalComponent *des_icomp,
+ ICalComponent *src_icomp,
+ ECalClient *client)
{
- icalproperty_kind look_in[] = {
- ICAL_DTSTART_PROPERTY,
- ICAL_DTEND_PROPERTY,
- ICAL_NO_PROPERTY
+ ICalPropertyKind look_in[] = {
+ I_CAL_DTSTART_PROPERTY,
+ I_CAL_DTEND_PROPERTY,
+ I_CAL_NO_PROPERTY
};
- gint i;
+ gint ii;
- g_return_if_fail (des_icalcomp != NULL);
- g_return_if_fail (src_icalcomp != NULL);
+ g_return_if_fail (des_icomp != NULL);
+ g_return_if_fail (src_icomp != NULL);
g_return_if_fail (client != NULL);
- for (i = 0; look_in[i] != ICAL_NO_PROPERTY; i++) {
- icalproperty *prop = icalcomponent_get_first_property (src_icalcomp, look_in[i]);
+ for (ii = 0; look_in[ii] != I_CAL_NO_PROPERTY; ii++) {
+ ICalProperty *prop = i_cal_component_get_first_property (src_icomp, look_in[ii]);
if (prop) {
- icalparameter *par = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
+ ICalParameter *par = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
if (par) {
- const gchar *tzid = icalparameter_get_tzid (par);
+ const gchar *tzid = i_cal_parameter_get_tzid (par);
if (tzid) {
GError *error = NULL;
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
- e_cal_client_get_timezone_sync (
- client, tzid, &zone, NULL, &error);
+ if (!e_cal_client_get_timezone_sync (client, tzid, &zone, NULL,
&error))
+ zone = NULL;
if (error != NULL) {
g_warning (
"%s: Cannot get timezone for '%s'. %s",
G_STRFUNC, tzid, error->message);
g_error_free (error);
- } else if (zone &&
- icalcomponent_get_timezone (des_icalcomp,
icaltimezone_get_tzid (zone)) == NULL) {
- /* do not duplicate timezones in the component */
- icalcomponent *vtz_comp;
+ } else if (zone) {
+ ICalTimezone *existing_zone;
- vtz_comp = icaltimezone_get_component (zone);
- if (vtz_comp)
- icalcomponent_add_component (des_icalcomp,
icalcomponent_new_clone (vtz_comp));
+ /* do not duplicate timezones in the component */
+ existing_zone = i_cal_component_get_timezone (des_icomp,
i_cal_timezone_get_tzid (zone));
+ if (existing_zone) {
+ g_object_unref (existing_zone);
+ } else {
+ ICalComponent *vtz_comp;
+
+ vtz_comp = i_cal_timezone_get_component (zone);
+ if (vtz_comp) {
+ i_cal_component_take_component (des_icomp,
i_cal_component_new_clone (vtz_comp));
+ g_object_unref (vtz_comp);
+ }
+ }
}
}
+
+ g_object_unref (par);
}
+
+ g_object_unref (prop);
}
}
}
@@ -567,8 +591,7 @@ calendar_view_copy_clipboard (ESelectable *selectable)
ECalendarViewPrivate *priv;
GList *selected, *l;
gchar *comp_str;
- icalcomponent *vcal_comp;
- icalcomponent *new_icalcomp;
+ ICalComponent *vcal_comp;
ECalendarViewEvent *event;
GtkClipboard *clipboard;
@@ -598,18 +621,20 @@ calendar_view_copy_clipboard (ESelectable *selectable)
}
for (l = selected; l != NULL; l = l->next) {
+ ICalComponent *new_icomp;
+
event = (ECalendarViewEvent *) l->data;
if (!is_comp_data_valid (event))
continue;
- new_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp);
+ new_icomp = i_cal_component_new_clone (event->comp_data->icalcomp);
/* do not remove RECURRENCE-IDs from copied objects */
- icalcomponent_add_component (vcal_comp, new_icalcomp);
+ i_cal_component_take_component (vcal_comp, new_icomp);
}
- comp_str = icalcomponent_as_ical_string_r (vcal_comp);
+ comp_str = i_cal_component_as_ical_string_r (vcal_comp);
/* copy the VCALENDAR to the clipboard */
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
@@ -617,7 +642,7 @@ calendar_view_copy_clipboard (ESelectable *selectable)
gtk_clipboard_store (clipboard);
/* free memory */
- icalcomponent_free (vcal_comp);
+ g_object_unref (vcal_comp);
g_free (comp_str);
g_list_free (selected);
}
@@ -625,7 +650,7 @@ calendar_view_copy_clipboard (ESelectable *selectable)
static void
calendar_view_component_created_cb (ECalModel *model,
ECalClient *client,
- icalcomponent *original_icalcomp,
+ ICalComponent *original_icomp,
const gchar *new_uid,
gpointer user_data)
{
@@ -634,7 +659,7 @@ calendar_view_component_created_cb (ECalModel *model,
ESourceRegistry *registry;
GtkWidget *toplevel = user_data;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (original_icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (original_icomp));
g_return_if_fail (comp != NULL);
registry = e_cal_model_get_registry (model);
@@ -657,17 +682,18 @@ static void
e_calendar_view_add_event_sync (ECalModel *model,
ECalClient *client,
time_t dtstart,
- icaltimezone *default_zone,
- icalcomponent *icalcomp,
+ ICalTimezone *default_zone,
+ ICalComponent *icomp,
gboolean all_day,
gboolean is_day_view,
gint time_division,
GtkWidget *top_level)
{
ECalComponent *comp;
- struct icaltimetype itime, old_dtstart, old_dtend;
+ ICalTime *itime, *btime, *old_dtstart, *old_dtend;
+ ICalDuration *ic_dur, *ic_oneday;
+ ICalTimezone *old_dtstart_zone;
time_t tt_start, tt_end, new_dtstart = 0;
- struct icaldurationtype ic_dur, ic_oneday;
gchar *uid;
gint start_offset, end_offset;
gboolean all_day_event = FALSE;
@@ -675,30 +701,36 @@ e_calendar_view_add_event_sync (ECalModel *model,
start_offset = 0;
end_offset = 0;
- old_dtstart = icalcomponent_get_dtstart (icalcomp);
- tt_start = icaltime_as_timet (old_dtstart);
- old_dtend = icalcomponent_get_dtend (icalcomp);
- tt_end = icaltime_as_timet (old_dtend);
- ic_dur = icaldurationtype_from_int (tt_end - tt_start);
+ old_dtstart = i_cal_component_get_dtstart (icomp);
+ tt_start = i_cal_time_as_timet (old_dtstart);
+ old_dtend = i_cal_component_get_dtend (icomp);
+ tt_end = i_cal_time_as_timet (old_dtend);
+ ic_dur = i_cal_duration_from_int (tt_end - tt_start);
- if (icaldurationtype_as_int (ic_dur) > 60 *60 *24) {
+ if (i_cal_duration_as_int (ic_dur) > 60 * 60 * 24) {
/* This is a long event */
- start_offset = old_dtstart.hour * 60 + old_dtstart.minute;
- end_offset = old_dtstart.hour * 60 + old_dtend.minute;
+ start_offset = i_cal_time_get_hour (old_dtstart) * 60 + i_cal_time_get_minute (old_dtstart);
+ end_offset = i_cal_time_get_hour (old_dtstart) * 60 + i_cal_time_get_minute (old_dtend);
}
- ic_oneday = icaldurationtype_null_duration ();
- ic_oneday.days = 1;
+ ic_oneday = i_cal_duration_null_duration ();
+ i_cal_duration_set_days (ic_oneday, 1);
+
+ old_dtstart_zone = i_cal_time_get_timezone (old_dtstart);
+ if (!old_dtstart_zone)
+ old_dtstart_zone = default_zone;
if (is_day_view) {
if (start_offset == 0 && end_offset == 0 && all_day)
all_day_event = TRUE;
if (all_day_event) {
- ic_dur = ic_oneday;
- } else if (icaldurationtype_as_int (ic_dur) >= 60 *60 *24 && !all_day) {
+ g_clear_object (&ic_dur);
+ ic_dur = g_object_ref (ic_oneday);
+ } else if (i_cal_duration_as_int (ic_dur) >= 60 * 60 * 24 && !all_day) {
+ g_clear_object (&ic_dur);
/* copy & paste from top canvas to main canvas */
- ic_dur = icaldurationtype_from_int (time_division * 60);
+ ic_dur = i_cal_duration_from_int (time_division * 60);
}
if (all_day)
@@ -706,39 +738,46 @@ e_calendar_view_add_event_sync (ECalModel *model,
else
new_dtstart = dtstart;
} else {
- if (old_dtstart.is_date && old_dtend.is_date
- && memcmp (&ic_dur, &ic_oneday, sizeof (ic_dur)) == 0) {
+ if (i_cal_time_is_date (old_dtstart) && i_cal_time_is_date (old_dtend) &&
+ i_cal_duration_as_int (ic_dur) == i_cal_duration_as_int (ic_oneday)) {
all_day_event = TRUE;
new_dtstart = dtstart;
} else {
- icaltimetype new_time = icaltime_from_timet_with_zone (dtstart, FALSE, default_zone);
+ ICalTime *new_time = i_cal_time_from_timet_with_zone (dtstart, FALSE, default_zone);
+
+ i_cal_time_set_hour (new_time, i_cal_time_get_hour (old_dtstart));
+ i_cal_time_set_minute (new_time, i_cal_time_get_minute (old_dtstart));
+ i_cal_time_set_second (new_time, i_cal_time_get_second (old_dtstart));
- new_time.hour = old_dtstart.hour;
- new_time.minute = old_dtstart.minute;
- new_time.second = old_dtstart.second;
+ new_dtstart = i_cal_time_as_timet_with_zone (new_time, old_dtstart_zone);
- new_dtstart = icaltime_as_timet_with_zone (new_time, old_dtstart.zone ?
old_dtstart.zone : default_zone);
+ g_clear_object (&new_time);
}
}
- itime = icaltime_from_timet_with_zone (new_dtstart, FALSE, old_dtstart.zone ? old_dtstart.zone :
default_zone);
+ itime = i_cal_time_from_timet_with_zone (new_dtstart, FALSE, old_dtstart_zone);
/* set the timezone properly */
- itime.zone = old_dtstart.zone ? old_dtstart.zone : default_zone;
+ i_cal_time_set_timezone (itime, old_dtstart_zone);
if (all_day_event)
- itime.is_date = TRUE;
- icalcomponent_set_dtstart (icalcomp, itime);
+ i_cal_time_set_is_date (itime, TRUE);
+ i_cal_component_set_dtstart (icomp, itime);
- itime.is_date = FALSE;
- itime = icaltime_add (itime, ic_dur);
+ i_cal_time_set_is_date (itime, FALSE);
+ btime = i_cal_time_add (itime, ic_dur);
if (all_day_event)
- itime.is_date = TRUE;
- icalcomponent_set_dtend (icalcomp, itime);
+ i_cal_time_set_is_date (itime, TRUE);
+ i_cal_component_set_dtend (icomp, itime);
+
+ g_clear_object (&itime);
+ g_clear_object (&btime);
+ g_clear_object (&old_dtstart);
+ g_clear_object (&old_dtend);
+ g_clear_object (&ic_dur);
+ g_clear_object (&ic_oneday);
/* The new uid stuff can go away once we actually set it in the backend */
uid = e_util_generate_uid ();
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
e_cal_component_set_uid (comp, uid);
g_free (uid);
@@ -785,15 +824,14 @@ paste_clipboard_data_free (gpointer ptr)
GSList *found = NULL;
/* Remove them one by one after ensuring it has been copied to the
destination successfully */
- found = g_slist_find_custom (pcd->copied_uids, icalcomponent_get_uid
(comp_data->icalcomp), (GCompareFunc) strcmp);
+ found = g_slist_find_custom (pcd->copied_uids, i_cal_component_get_uid
(comp_data->icalcomp), (GCompareFunc) strcmp);
if (!found)
continue;
g_free (found->data);
pcd->copied_uids = g_slist_delete_link (pcd->copied_uids, found);
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone
(comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(comp_data->icalcomp));
if (itip_has_any_attendees (comp) &&
(itip_organizer_is_user (registry, comp, comp_data->client) ||
@@ -802,7 +840,7 @@ paste_clipboard_data_free (gpointer ptr)
itip_send_component_with_model (model, E_CAL_COMPONENT_METHOD_CANCEL,
comp, comp_data->client, NULL, NULL, NULL, TRUE, FALSE, TRUE);
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
if (e_cal_component_is_instance (comp)) {
gchar *rid = NULL;
@@ -842,9 +880,9 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
GError **error)
{
PasteClipboardData *pcd = user_data;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
- icaltimezone *default_zone;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
+ ICalTimezone *default_zone;
ECalModel *model;
ESourceRegistry *registry;
ESource *source = NULL, *default_source = NULL;
@@ -860,8 +898,8 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (pcd != NULL);
- icalcomp = icalparser_parse_string (pcd->ical_str);
- if (!icalcomp) {
+ icomp = i_cal_parser_parse_string (pcd->ical_str);
+ if (!icomp) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
_("Pasted text doesn’t contain valid iCalendar data"));
return;
@@ -871,17 +909,17 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
registry = e_cal_model_get_registry (model);
switch (e_cal_model_get_component_kind (model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
default_source = e_source_registry_ref_default_calendar (registry);
extension_name = E_SOURCE_EXTENSION_CALENDAR;
message = _("Default calendar not found");
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
default_source = e_source_registry_ref_default_memo_list (registry);
extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
message = _("Default memo list not found");
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
default_source = e_source_registry_ref_default_task_list (registry);
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
message = _("Default task list not found");
@@ -918,38 +956,41 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
}
client = E_CAL_CLIENT (e_client);
- kind = icalcomponent_isa (icalcomp);
+ kind = i_cal_component_isa (icomp);
default_zone = e_cal_model_get_timezone (model);
all_day = pcd->selection_end - pcd->selection_start == 60 * 60 * 24;
copied_components = 0;
- if (kind == ICAL_VCALENDAR_COMPONENT) {
- icalcomponent *subcomp;
+ if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ ICalComponent *subcomp;
/* add timezones first, to have them ready */
- 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;
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
I_CAL_VTIMEZONE_COMPONENT)) {
+ ICalTimezone *zone;
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
+ zone = i_cal_timezone_new ();
+ i_cal_timezone_set_component (zone, i_cal_component_new_clone (subcomp));
if (!e_cal_client_add_timezone_sync (client, zone, cancellable, error)) {
- icaltimezone_free (zone, 1);
+ g_object_unref (subcomp);
+ g_object_unref (zone);
goto out;
}
- icaltimezone_free (zone, 1);
+ g_object_unref (zone);
}
- for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
subcomp;
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VEVENT_COMPONENT)) {
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
I_CAL_VEVENT_COMPONENT)) {
if (e_cal_util_component_has_recurrences (subcomp)) {
- icalproperty *icalprop = icalcomponent_get_first_property (subcomp,
ICAL_RRULE_PROPERTY);
- if (icalprop)
- icalproperty_remove_parameter_by_name (icalprop,
"X-EVOLUTION-ENDDATE");
+ ICalProperty *prop = i_cal_component_get_first_property (subcomp,
I_CAL_RRULE_PROPERTY);
+ if (prop) {
+ i_cal_property_remove_parameter_by_name (prop, "X-EVOLUTION-ENDDATE");
+ g_object_unref (prop);
+ }
}
e_calendar_view_add_event_sync (model, client, pcd->selection_start, default_zone,
subcomp, all_day,
@@ -957,15 +998,15 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
copied_components++;
if (pcd->selected_cut_list)
- pcd->copied_uids = g_slist_prepend (pcd->copied_uids, g_strdup
(icalcomponent_get_uid (subcomp)));
+ pcd->copied_uids = g_slist_prepend (pcd->copied_uids, g_strdup
(i_cal_component_get_uid (subcomp)));
}
} else if (kind == e_cal_model_get_component_kind (model)) {
- e_calendar_view_add_event_sync (model, client, pcd->selection_start, default_zone, icalcomp,
all_day,
+ e_calendar_view_add_event_sync (model, client, pcd->selection_start, default_zone, icomp,
all_day,
pcd->is_day_view, pcd->time_division, pcd->top_level);
copied_components++;
if (pcd->selected_cut_list)
- pcd->copied_uids = g_slist_prepend (pcd->copied_uids, g_strdup (icalcomponent_get_uid
(icalcomp)));
+ pcd->copied_uids = g_slist_prepend (pcd->copied_uids, g_strdup
(i_cal_component_get_uid (icomp)));
}
pcd->success = !g_cancellable_is_cancelled (cancellable);
@@ -975,7 +1016,7 @@ cal_view_paste_clipboard_thread (EAlertSinkThreadJobData *job_data,
if (!copied_components && !g_cancellable_is_cancelled (cancellable) && error && !*error)
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("No suitable component
found"));
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
g_clear_object (&source);
g_clear_object (&default_source);
g_clear_object (&client);
@@ -1191,10 +1232,10 @@ e_calendar_view_class_init (ECalendarViewClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, timezone_changed),
NULL, NULL,
- e_marshal_VOID__POINTER_POINTER,
+ e_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_POINTER);
+ I_CAL_TYPE_TIMEZONE,
+ I_CAL_TYPE_TIMEZONE);
signals[EVENT_CHANGED] = g_signal_new (
"event-changed",
@@ -1293,18 +1334,19 @@ e_calendar_view_get_model (ECalendarView *cal_view)
return cal_view->priv->model;
}
-icaltimezone *
+ICalTimezone *
e_calendar_view_get_timezone (ECalendarView *cal_view)
{
g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL);
+
return e_cal_model_get_timezone (cal_view->priv->model);
}
void
e_calendar_view_set_timezone (ECalendarView *cal_view,
- icaltimezone *zone)
+ const ICalTimezone *zone)
{
- icaltimezone *old_zone;
+ ICalTimezone *old_zone;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
@@ -1312,10 +1354,15 @@ e_calendar_view_set_timezone (ECalendarView *cal_view,
if (old_zone == zone)
return;
+ if (old_zone)
+ g_object_ref (old_zone);
+
e_cal_model_set_timezone (cal_view->priv->model, zone);
g_signal_emit (
cal_view, signals[TIMEZONE_CHANGED], 0,
old_zone, zone);
+
+ g_clear_object (&old_zone);
}
GtkTargetList *
@@ -1576,9 +1623,9 @@ object_created_cb (ECompEditor *comp_editor,
ECompEditor *
e_calendar_view_open_event_with_flags (ECalendarView *cal_view,
- ECalClient *client,
- icalcomponent *icalcomp,
- guint32 flags)
+ ECalClient *client,
+ ICalComponent *icomp,
+ guint32 flags)
{
ECompEditor *comp_editor;
EShell *shell;
@@ -1586,7 +1633,7 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view,
/* FIXME ECalendarView should own an EShell pointer. */
shell = e_shell_get_default ();
- comp_editor = e_comp_editor_find_existing_for (e_client_get_source (E_CLIENT (client)), icalcomp);
+ comp_editor = e_comp_editor_find_existing_for (e_client_get_source (E_CLIENT (client)), icomp);
if (!comp_editor) {
GtkWidget *toplevel;
@@ -1595,7 +1642,7 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view,
toplevel = NULL;
comp_editor = e_comp_editor_open_for_component (GTK_WINDOW (toplevel),
- shell, e_client_get_source (E_CLIENT (client)), icalcomp, flags);
+ shell, e_client_get_source (E_CLIENT (client)), icomp, flags);
g_signal_connect (
comp_editor, "object-created",
@@ -1611,7 +1658,7 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view,
* e_calendar_view_edit_appointment
* @cal_view: A calendar view.
* @client: Calendar client.
- * @icalcomp: The object to be edited.
+ * @icomp: The object to be edited.
* @mode: one of #EEditEventMode
*
* Opens an editor window to allow the user to edit the selected
@@ -1619,9 +1666,9 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view,
*/
void
e_calendar_view_edit_appointment (ECalendarView *cal_view,
- ECalClient *client,
- icalcomponent *icalcomp,
- EEditEventMode mode)
+ ECalClient *client,
+ ICalComponent *icomp,
+ EEditEventMode mode)
{
ECalModel *model;
ESourceRegistry *registry;
@@ -1629,15 +1676,14 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view,
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (icomp != NULL);
model = e_calendar_view_get_model (cal_view);
registry = e_cal_model_get_registry (model);
- if ((mode == EDIT_EVENT_AUTODETECT && icalcomponent_get_first_property (icalcomp,
ICAL_ATTENDEE_PROPERTY) != NULL)
+ if ((mode == EDIT_EVENT_AUTODETECT && e_cal_util_component_has_attendee (icomp))
|| mode == EDIT_EVENT_FORCE_MEETING) {
- ECalComponent *comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ ECalComponent *comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(icomp));
flags |= E_COMP_EDITOR_FLAG_WITH_ATTENDEES;
if (itip_organizer_is_user (registry, comp, client) ||
itip_sentby_is_user (registry, comp, client) ||
@@ -1646,7 +1692,7 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view,
g_object_unref (comp);
}
- e_calendar_view_open_event_with_flags (cal_view, client, icalcomp, flags);
+ e_calendar_view_open_event_with_flags (cal_view, client, icomp, flags);
}
static void
@@ -1682,15 +1728,15 @@ tooltip_key_event (GtkWidget *tooltip,
}
static gchar *
-get_label (struct icaltimetype *tt,
- icaltimezone *f_zone,
- icaltimezone *t_zone)
+get_label (ICalTime *tt,
+ ICalTimezone *f_zone,
+ ICalTimezone *t_zone)
{
struct tm tmp_tm;
- tmp_tm = icaltimetype_to_tm_with_zone (tt, f_zone, t_zone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (tt, f_zone, t_zone);
- return e_datetime_format_format_tm ("calendar", "table", tt->is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tmp_tm);
+ return e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (tt) ? DTFormatKindDate :
DTFormatKindDateTime, &tmp_tm);
}
void
@@ -1764,11 +1810,9 @@ gboolean
e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
{
GtkWidget *label, *box, *hbox, *ebox, *frame, *toplevel;
- const gchar *str;
gchar *tmp, *tmp1 = NULL, *tmp2 = NULL;
- ECalComponentOrganizer organiser;
- ECalComponentDateTime dtstart, dtend;
- icalcomponent *clone_comp;
+ ECalComponentOrganizer *organizer;
+ ECalComponentDateTime *dtstart, *dtend;
time_t t_start, t_end;
ECalendarViewEvent *pevent;
GtkWidget *widget;
@@ -1777,12 +1821,11 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
GdkDeviceManager *device_manager;
GdkRGBA bg_rgba, fg_rgba;
GQueue *grabbed_keyboards;
- ECalComponent *newcomp = e_cal_component_new ();
- icaltimezone *zone, *default_zone;
+ ECalComponent *newcomp;
+ ICalTimezone *zone, *default_zone;
ECalModel *model;
ECalClient *client = NULL;
GList *list, *link;
- gboolean free_text = FALSE;
/* This function is a timeout callback. */
@@ -1800,7 +1843,7 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
if (GTK_IS_WIDGET (widget))
gtk_widget_destroy (widget);
- default_zone = e_calendar_view_get_timezone (data->cal_view);
+ default_zone = e_calendar_view_get_timezone (data->cal_view);
pevent = data->get_view_event (data->cal_view, data->day, data->event_num);
if (!is_comp_data_valid (pevent))
@@ -1808,30 +1851,31 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
client = pevent->comp_data->client;
- clone_comp = icalcomponent_new_clone (pevent->comp_data->icalcomp);
- if (!e_cal_component_set_icalcomponent (newcomp, clone_comp))
+ newcomp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(pevent->comp_data->icalcomp));
+ if (!newcomp) {
g_warning ("couldn't update calendar component with modified data from backend\n");
+ return FALSE;
+ }
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->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);
@@ -1843,19 +1887,19 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
gtk_box_pack_start ((GtkBox *) box, ebox, FALSE, FALSE, 0);
g_free (tmp);
- e_cal_component_get_organizer (newcomp, &organiser);
- if (organiser.cn) {
- gchar *ptr;
- ptr = strchr (organiser.value, ':');
+ organizer = e_cal_component_get_organizer (newcomp);
+ if (organizer && e_cal_component_organizer_get_cn (organizer)) {
+ const gchar *email;
- if (ptr) {
- ptr++;
+ email = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
+
+ if (email) {
/* To Translators: It will display "Organiser: NameOfTheUser <email ofuser com>" */
- tmp = g_strdup_printf (_("Organizer: %s <%s>"), organiser.cn, ptr);
- }
- else
+ tmp = g_strdup_printf (_("Organizer: %s <%s>"), e_cal_component_organizer_get_cn
(organizer), email);
+ } else {
/* With SunOne accouts, there may be no ':' in organiser.value*/
- tmp = g_strdup_printf (_("Organizer: %s"), organiser.cn);
+ tmp = g_strdup_printf (_("Organizer: %s"), e_cal_component_organizer_get_cn
(organizer));
+ }
label = gtk_label_new (tmp);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -1867,11 +1911,13 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
g_free (tmp);
}
- e_cal_component_get_location (newcomp, &str);
+ e_cal_component_organizer_free (organizer);
+
+ tmp1 = e_cal_component_get_location (newcomp);
- if (str) {
+ if (tmp1) {
/* Translators: It will display "Location: PlaceOfTheMeeting" */
- tmp = g_markup_printf_escaped (_("Location: %s"), str);
+ tmp = g_markup_printf_escaped (_("Location: %s"), tmp1);
label = gtk_label_new (NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.0);
@@ -1885,13 +1931,18 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
gtk_box_pack_start ((GtkBox *) box, ebox, FALSE, FALSE, 0);
g_free (tmp);
}
- e_cal_component_get_dtstart (newcomp, &dtstart);
- e_cal_component_get_dtend (newcomp, &dtend);
- if (dtstart.tzid) {
- zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (newcomp), dtstart.tzid);
- if (!zone)
- e_cal_client_get_timezone_sync (client, dtstart.tzid, &zone, NULL, NULL);
+ g_free (tmp1);
+ tmp1 = NULL;
+
+ dtstart = e_cal_component_get_dtstart (newcomp);
+ dtend = e_cal_component_get_dtend (newcomp);
+
+ if (dtstart && e_cal_component_datetime_get_tzid (dtstart)) {
+ zone = i_cal_component_get_timezone (e_cal_component_get_icalcomponent (newcomp),
e_cal_component_datetime_get_tzid (dtstart));
+ if (!zone &&
+ !e_cal_client_get_timezone_sync (client, e_cal_component_datetime_get_tzid (dtstart),
&zone, NULL, NULL))
+ zone = NULL;
if (!zone)
zone = default_zone;
@@ -1900,14 +1951,14 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
zone = NULL;
}
- if (dtstart.value) {
- t_start = icaltime_as_timet_with_zone (*dtstart.value, zone);
- if (dtend.value)
- t_end = icaltime_as_timet_with_zone (*dtend.value, zone);
+ if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
+ t_start = i_cal_time_as_timet_with_zone (e_cal_component_datetime_get_value (dtstart), zone);
+ if (dtend && e_cal_component_datetime_get_value (dtend))
+ t_end = i_cal_time_as_timet_with_zone (e_cal_component_datetime_get_value (dtend),
zone);
else
t_end = t_start;
- tmp1 = get_label (dtstart.value, zone, default_zone);
+ tmp1 = get_label (e_cal_component_datetime_get_value (dtstart), zone, default_zone);
tmp = calculate_time (t_start, t_end);
/* To Translators: It will display "Time: ActualStartDateAndTime (DurationOfTheMeeting)"*/
@@ -1916,8 +1967,8 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
g_free (tmp);
g_free (tmp1);
- tmp1 = get_label (dtstart.value, zone, zone);
- tmp = g_strconcat (tmp2, "\n\t[ ", tmp1, " ", icaltimezone_get_display_name (zone), "
]", NULL);
+ tmp1 = get_label (e_cal_component_datetime_get_value (dtstart), zone, zone);
+ tmp = g_strconcat (tmp2, "\n\t[ ", tmp1, " ", i_cal_timezone_get_display_name (zone),
" ]", NULL);
} else {
g_free (tmp);
tmp = tmp2;
@@ -1927,8 +1978,8 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data)
tmp = NULL;
}
- e_cal_component_free_datetime (&dtstart);
- e_cal_component_free_datetime (&dtend);
+ e_cal_component_datetime_free (dtstart);
+ e_cal_component_datetime_free (dtend);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start ((GtkBox *) hbox, gtk_label_new_with_mnemonic (tmp), FALSE, FALSE, 0);
@@ -2034,85 +2085,79 @@ 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 (ICalComponent *icomp)
{
const gchar *summary;
- g_return_val_if_fail (icalcomp != NULL && free_text != NULL, NULL);
-
- *free_text = FALSE;
- summary = icalcomponent_get_summary (icalcomp);
+ g_return_val_if_fail (icomp != NULL, NULL);
- if (icalcomp_contains_category (icalcomp, _("Birthday")) ||
- icalcomp_contains_category (icalcomp, _("Anniversary"))) {
- icalproperty *xprop;
+ summary = i_cal_component_get_summary (icomp);
- 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);
+ if (icomp_contains_category (icomp, _("Birthday")) ||
+ icomp_contains_category (icomp, _("Anniversary"))) {
+ gchar *since_year_str;
- if (xname && g_ascii_strcasecmp (xname, "X-EVOLUTION-SINCE-YEAR") == 0) {
- struct icaltimetype dtnow;
- gint since_year;
- gchar *str;
+ since_year_str = e_cal_util_component_dup_x_property (icomp, "X-EVOLUTION-SINCE-YEAR");
- str = icalproperty_get_value_as_string_r (xprop);
- since_year = str ? atoi (str) : 0;
- g_free (str);
+ if (since_year_str) {
+ ICalTime *dtstart;
+ gint since_year;
+ gchar *res = NULL;
- dtnow = icalcomponent_get_dtstart (icalcomp);
+ since_year = atoi (since_year_str);
- 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;
- }
+ dtstart = i_cal_component_get_dtstart (icomp);
- break;
+ if (since_year > 0 && dtstart && i_cal_time_is_valid_time (dtstart) &&
+ i_cal_time_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_time_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 */
void
e_calendar_view_component_created_cb (ECalModel *model,
ECalClient *client,
- icalcomponent *original_icalcomp,
+ ICalComponent *original_icomp,
const gchar *new_uid,
gpointer user_data)
{
@@ -2123,7 +2168,6 @@ e_calendar_view_component_created_cb (ECalModel *model,
e_cal_model_emit_object_created (model, client);
}
-
void
draw_curved_rectangle (cairo_t *cr,
gdouble x0,
@@ -2269,8 +2313,8 @@ e_calendar_view_get_description_text (ECalendarView *cal_view)
{
time_t start_time, end_time;
struct tm start_tm, end_tm;
- struct icaltimetype start_tt, end_tt;
- icaltimezone *zone;
+ ICalTime *tt;
+ ICalTimezone *zone;
gchar start_buffer[512] = { 0 };
gchar end_buffer[512] = { 0 };
@@ -2281,26 +2325,14 @@ e_calendar_view_get_description_text (ECalendarView *cal_view)
zone = e_cal_model_get_timezone (cal_view->priv->model);
- start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
- start_tm.tm_year = start_tt.year - 1900;
- start_tm.tm_mon = start_tt.month - 1;
- start_tm.tm_mday = start_tt.day;
- start_tm.tm_hour = start_tt.hour;
- start_tm.tm_min = start_tt.minute;
- start_tm.tm_sec = start_tt.second;
- start_tm.tm_isdst = -1;
- start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1, start_tt.year);
+ tt = i_cal_time_from_timet_with_zone (start_time, FALSE, zone);
+ start_tm = e_cal_util_icaltime_to_tm (tt);
+ g_clear_object (&tt);
/* Subtract one from end_time so we don't get an extra day. */
- end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, zone);
- end_tm.tm_year = end_tt.year - 1900;
- end_tm.tm_mon = end_tt.month - 1;
- end_tm.tm_mday = end_tt.day;
- end_tm.tm_hour = end_tt.hour;
- end_tm.tm_min = end_tt.minute;
- end_tm.tm_sec = end_tt.second;
- end_tm.tm_isdst = -1;
- end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1, end_tt.year);
+ tt = i_cal_time_from_timet_with_zone (end_time - 1, FALSE, zone);
+ end_tm = e_cal_util_icaltime_to_tm (tt);
+ g_clear_object (&tt);
if (E_IS_MONTH_VIEW (cal_view) || E_IS_CAL_LIST_VIEW (cal_view)) {
if (start_tm.tm_year == end_tm.tm_year) {
diff --git a/src/calendar/gui/e-calendar-view.h b/src/calendar/gui/e-calendar-view.h
index f114e76c43..7455d6db3b 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);
+ const 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,13 @@ void e_calendar_view_move_tip (GtkWidget *widget,
gint x,
gint y);
-const gchar * e_calendar_view_get_icalcomponent_summary
- (ECalClient *ecal,
- icalcomponent *icalcomp,
- gboolean *free_text);
+gchar * e_calendar_view_dup_component_summary
+ (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.c b/src/calendar/gui/e-cell-date-edit-text.c
index 2c7043425c..d4aac12a16 100644
--- a/src/calendar/gui/e-cell-date-edit-text.c
+++ b/src/calendar/gui/e-cell-date-edit-text.c
@@ -38,7 +38,7 @@
struct _ECellDateEditTextPrivate {
/* The timezone to display the date in. */
- icaltimezone *timezone;
+ ICalTimezone *timezone;
/* Whether to display in 24-hour format. */
gboolean use_24_hour_format;
@@ -65,7 +65,7 @@ cell_date_edit_text_set_property (GObject *object,
case PROP_TIMEZONE:
e_cell_date_edit_text_set_timezone (
E_CELL_DATE_EDIT_TEXT (object),
- g_value_get_pointer (value));
+ g_value_get_object (value));
return;
case PROP_USE_24_HOUR_FORMAT:
@@ -86,7 +86,7 @@ cell_date_edit_text_get_property (GObject *object,
{
switch (property_id) {
case PROP_TIMEZONE:
- g_value_set_pointer (
+ g_value_set_object (
value,
e_cell_date_edit_text_get_timezone (
E_CELL_DATE_EDIT_TEXT (object)));
@@ -103,6 +103,17 @@ cell_date_edit_text_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
+static void
+cell_date_edit_text_finalize (GObject *object)
+{
+ ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (object);
+
+ g_clear_object (&ecd->priv->timezone);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (e_cell_date_edit_text_parent_class)->finalize (object);
+}
+
static gchar *
cell_date_edit_text_get_text (ECellText *cell,
ETableModel *model,
@@ -111,7 +122,8 @@ cell_date_edit_text_get_text (ECellText *cell,
{
ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell);
ECellDateEditValue *dv = e_table_model_value_at (model, col, row);
- icaltimezone *timezone;
+ ICalTimezone *timezone;
+ ICalTime *tt;
struct tm tmp_tm;
gchar *res;
@@ -120,14 +132,16 @@ cell_date_edit_text_get_text (ECellText *cell,
timezone = e_cell_date_edit_text_get_timezone (ecd);
+ tt = e_cell_date_edit_value_get_time (dv);
+
/* Note that although the property may be in a different
* timezone, we convert it to the current timezone to display
* it in the table. If the user actually edits the value,
* it will be set to the current timezone. See set_value (). */
- tmp_tm = icaltimetype_to_tm_with_zone (&dv->tt, dv->zone, timezone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (tt, e_cell_date_edit_value_get_zone (dv), timezone);
res = e_datetime_format_format_tm (
- "calendar", "table", dv->tt.is_date ?
+ "calendar", "table", i_cal_time_is_date (tt) ?
DTFormatKindDate : DTFormatKindDateTime, &tmp_tm);
e_table_model_free_value (model, col, dv);
@@ -187,7 +201,7 @@ cell_date_edit_text_set_value (ECellText *cell,
ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell);
ETimeParseStatus status;
struct tm tmp_tm;
- ECellDateEditValue dv;
+ ECellDateEditValue *dv = NULL;
ECellDateEditValue *value;
gboolean is_date = TRUE;
@@ -207,28 +221,26 @@ cell_date_edit_text_set_value (ECellText *cell,
if (status == E_TIME_PARSE_NONE) {
value = NULL;
} else {
- dv.tt = icaltime_null_time ();
-
- dv.tt.year = tmp_tm.tm_year + 1900;
- dv.tt.month = tmp_tm.tm_mon + 1;
- dv.tt.day = tmp_tm.tm_mday;
- dv.tt.hour = tmp_tm.tm_hour;
- dv.tt.minute = tmp_tm.tm_min;
- dv.tt.second = tmp_tm.tm_sec;
- dv.tt.is_date = is_date;
-
- /* FIXME: We assume it is being set to the current timezone.
- * Is that OK? */
+ ICalTime *tt;
+ ICalTimezone *zone;
+
+ tt = e_cal_util_tm_to_icaltime (&tmp_tm, is_date);
+
if (is_date) {
- dv.zone = NULL;
+ zone = NULL;
} else {
- dv.zone = e_cell_date_edit_text_get_timezone (ecd);
+ zone = e_cell_date_edit_text_get_timezone (ecd);
}
- value = &dv;
+ dv = e_cell_date_edit_value_new (tt, zone);
+ value = dv;
+
+ g_clear_object (&tt);
}
e_table_model_set_value_at (model, col, row, value);
+
+ e_cell_date_edit_value_free (dv);
}
static void
@@ -242,6 +254,7 @@ e_cell_date_edit_text_class_init (ECellDateEditTextClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = cell_date_edit_text_set_property;
object_class->get_property = cell_date_edit_text_get_property;
+ object_class->finalize = cell_date_edit_text_finalize;
cell_text_class = E_CELL_TEXT_CLASS (class);
cell_text_class->get_text = cell_date_edit_text_get_text;
@@ -251,10 +264,11 @@ e_cell_date_edit_text_class_init (ECellDateEditTextClass *class)
g_object_class_install_property (
object_class,
PROP_TIMEZONE,
- g_param_spec_pointer (
+ g_param_spec_object (
"timezone",
"Time Zone",
NULL,
+ I_CAL_TYPE_TIMEZONE,
G_PARAM_READWRITE));
g_object_class_install_property (
@@ -273,7 +287,7 @@ e_cell_date_edit_text_init (ECellDateEditText *ecd)
{
ecd->priv = E_CELL_DATE_EDIT_TEXT_GET_PRIVATE (ecd);
- ecd->priv->timezone = icaltimezone_get_utc_timezone ();
+ ecd->priv->timezone = e_cal_util_copy_timezone (i_cal_timezone_get_utc_timezone ());
ecd->priv->use_24_hour_format = TRUE;
}
@@ -298,7 +312,7 @@ e_cell_date_edit_text_new (const gchar *fontname,
return cell;
}
-icaltimezone *
+ICalTimezone *
e_cell_date_edit_text_get_timezone (ECellDateEditText *ecd)
{
g_return_val_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd), NULL);
@@ -308,14 +322,15 @@ e_cell_date_edit_text_get_timezone (ECellDateEditText *ecd)
void
e_cell_date_edit_text_set_timezone (ECellDateEditText *ecd,
- icaltimezone *timezone)
+ const ICalTimezone *timezone)
{
g_return_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd));
if (ecd->priv->timezone == timezone)
return;
- ecd->priv->timezone = timezone;
+ g_clear_object (&ecd->priv->timezone);
+ ecd->priv->timezone = timezone ? e_cal_util_copy_timezone (timezone) : NULL;
g_object_notify (G_OBJECT (ecd), "timezone");
}
@@ -349,7 +364,8 @@ e_cell_date_edit_compare_cb (gconstpointer a,
{
ECellDateEditValue *dv1 = (ECellDateEditValue *) a;
ECellDateEditValue *dv2 = (ECellDateEditValue *) b;
- struct icaltimetype tt;
+ ICalTime *tt;
+ gint res;
/* First check if either is NULL. NULL dates sort last. */
if (!dv1 || !dv2) {
@@ -362,10 +378,134 @@ e_cell_date_edit_compare_cb (gconstpointer a,
}
/* Copy the 2nd value and convert it to the same timezone as the first. */
- tt = dv2->tt;
-
- icaltimezone_convert_time (&tt, dv2->zone, dv1->zone);
+ tt = i_cal_time_new_clone (e_cell_date_edit_value_get_time (dv2));
+ i_cal_timezone_convert_time (tt, e_cell_date_edit_value_get_zone (dv2),
e_cell_date_edit_value_get_zone (dv1));
/* Now we can compare them. */
- return icaltime_compare (dv1->tt, tt);
+ res = i_cal_time_compare (e_cell_date_edit_value_get_time (dv1), tt);
+
+ g_clear_object (&tt);
+
+ return res;
+}
+
+struct _ECellDateEditValue {
+ ICalTime *tt;
+ ICalTimezone *zone;
+};
+
+ECellDateEditValue *
+e_cell_date_edit_value_new (const ICalTime *tt,
+ const ICalTimezone *zone)
+{
+ g_return_val_if_fail (I_CAL_IS_TIME (tt), NULL);
+ if (zone)
+ g_return_val_if_fail (I_CAL_IS_TIMEZONE (zone), NULL);
+
+ return e_cell_date_edit_value_new_take (i_cal_time_new_clone (tt),
+ zone ? e_cal_util_copy_timezone (zone) : NULL);
+}
+
+ECellDateEditValue *
+e_cell_date_edit_value_new_take (ICalTime *tt,
+ ICalTimezone *zone)
+{
+ ECellDateEditValue *value;
+
+ g_return_val_if_fail (I_CAL_IS_TIME (tt), NULL);
+ if (zone)
+ g_return_val_if_fail (I_CAL_IS_TIMEZONE (zone), NULL);
+
+ value = g_new0 (ECellDateEditValue, 1);
+ value->tt = tt;
+ value->zone = zone;
+
+ return value;
+}
+
+ECellDateEditValue *
+e_cell_date_edit_value_copy (const ECellDateEditValue *src)
+{
+ if (!src)
+ return NULL;
+
+ return e_cell_date_edit_value_new (src->tt, src->zone);
+}
+
+void
+e_cell_date_edit_value_free (ECellDateEditValue *value)
+{
+ if (value) {
+ g_clear_object (&value->tt);
+ g_clear_object (&value->zone);
+ g_free (value);
+ }
+}
+
+ICalTime *
+e_cell_date_edit_value_get_time (const ECellDateEditValue *value)
+{
+ g_return_val_if_fail (value != NULL, NULL);
+
+ return value->tt;
+}
+
+void
+e_cell_date_edit_value_set_time (ECellDateEditValue *value,
+ const ICalTime *tt)
+{
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (I_CAL_IS_TIME (tt));
+
+ e_cell_date_edit_value_take_time (value, i_cal_time_new_clone (tt));
+}
+
+void
+e_cell_date_edit_value_take_time (ECellDateEditValue *value,
+ ICalTime *tt)
+{
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (I_CAL_IS_TIME (tt));
+
+ if (value->tt != tt) {
+ g_clear_object (&value->tt);
+ value->tt = tt;
+ } else {
+ g_clear_object (&tt);
+ }
+}
+
+ICalTimezone *
+e_cell_date_edit_value_get_zone (const ECellDateEditValue *value)
+{
+ g_return_val_if_fail (value != NULL, NULL);
+
+ return value->zone;
+}
+
+void
+e_cell_date_edit_value_set_zone (ECellDateEditValue *value,
+ const ICalTimezone *zone)
+{
+ g_return_if_fail (value != NULL);
+ if (zone)
+ g_return_if_fail (I_CAL_IS_TIMEZONE (zone));
+
+ e_cell_date_edit_value_take_zone (value, zone ? e_cal_util_copy_timezone (zone) : NULL);
+}
+
+void
+e_cell_date_edit_value_take_zone (ECellDateEditValue *value,
+ ICalTimezone *zone)
+{
+ g_return_if_fail (value != NULL);
+ if (zone)
+ g_return_if_fail (I_CAL_IS_TIMEZONE (zone));
+
+ if (zone != value->zone) {
+ g_clear_object (&value->zone);
+ value->zone = zone;
+ } else {
+ g_clear_object (&zone);
+ }
}
diff --git a/src/calendar/gui/e-cell-date-edit-text.h b/src/calendar/gui/e-cell-date-edit-text.h
index 6e69981806..e0e043a97e 100644
--- a/src/calendar/gui/e-cell-date-edit-text.h
+++ b/src/calendar/gui/e-cell-date-edit-text.h
@@ -23,7 +23,7 @@
#ifndef _E_CELL_DATE_EDIT_TEXT_H_
#define _E_CELL_DATE_EDIT_TEXT_H_
-#include <libical/ical.h>
+#include <libecal/libecal.h>
#include <e-util/e-util.h>
/* Standard GObject macros */
@@ -47,15 +47,31 @@
G_BEGIN_DECLS
+typedef struct _ECellDateEditValue ECellDateEditValue;
+
+ECellDateEditValue *
+ e_cell_date_edit_value_new (const ICalTime *tt,
+ const ICalTimezone *zone);
+ECellDateEditValue *
+ e_cell_date_edit_value_new_take (ICalTime *tt,
+ ICalTimezone *zone);
+ECellDateEditValue *
+ e_cell_date_edit_value_copy (const ECellDateEditValue *src);
+void e_cell_date_edit_value_free (ECellDateEditValue *value);
+ICalTime * e_cell_date_edit_value_get_time (const ECellDateEditValue *value);
+void e_cell_date_edit_value_set_time (ECellDateEditValue *value,
+ const ICalTime *tt);
+void e_cell_date_edit_value_take_time(ECellDateEditValue *value,
+ ICalTime *tt);
+ICalTimezone * e_cell_date_edit_value_get_zone (const ECellDateEditValue *value);
+void e_cell_date_edit_value_set_zone (ECellDateEditValue *value,
+ const ICalTimezone *zone);
+void e_cell_date_edit_value_take_zone(ECellDateEditValue *value,
+ ICalTimezone *zone);
+
typedef struct _ECellDateEditText ECellDateEditText;
typedef struct _ECellDateEditTextClass ECellDateEditTextClass;
typedef struct _ECellDateEditTextPrivate ECellDateEditTextPrivate;
-typedef struct _ECellDateEditValue ECellDateEditValue;
-
-struct _ECellDateEditValue {
- struct icaltimetype tt;
- icaltimezone *zone;
-};
struct _ECellDateEditText {
ECellText parent;
@@ -69,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);
+ const 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-event.c b/src/calendar/gui/e-comp-editor-event.c
index 361c1e3d3d..95ba9d4c11 100644
--- a/src/calendar/gui/e-comp-editor-event.c
+++ b/src/calendar/gui/e-comp-editor-event.c
@@ -431,7 +431,7 @@ ece_event_client_needs_all_day_as_time (ECompEditor *comp_editor)
client = e_comp_editor_get_target_client (comp_editor);
- return client && e_client_check_capability (E_CLIENT (client),
CAL_STATIC_CAPABILITY_ALL_DAY_EVENT_AS_TIME);
+ return client && e_client_check_capability (E_CLIENT (client),
E_CAL_STATIC_CAPABILITY_ALL_DAY_EVENT_AS_TIME);
}
static gboolean
diff --git a/src/calendar/gui/e-comp-editor-memo.c b/src/calendar/gui/e-comp-editor-memo.c
index b68d378dbe..a025c44e44 100644
--- a/src/calendar/gui/e-comp-editor-memo.c
+++ b/src/calendar/gui/e-comp-editor-memo.c
@@ -56,7 +56,7 @@ ece_memo_notify_target_client_cb (GObject *object,
comp_editor = E_COMP_EDITOR (memo_editor);
cal_client = e_comp_editor_get_target_client (comp_editor);
- supports_date = !cal_client || !e_client_check_capability (E_CLIENT (cal_client),
CAL_STATIC_CAPABILITY_NO_MEMO_START_DATE);
+ supports_date = !cal_client || !e_client_check_capability (E_CLIENT (cal_client),
E_CAL_STATIC_CAPABILITY_NO_MEMO_START_DATE);
e_comp_editor_property_part_set_visible (memo_editor->priv->dtstart, supports_date);
}
diff --git a/src/calendar/gui/e-comp-editor-page-attachments.c
b/src/calendar/gui/e-comp-editor-page-attachments.c
index 5fe0fd3ee9..def5ccbfc5 100644
--- a/src/calendar/gui/e-comp-editor-page-attachments.c
+++ b/src/calendar/gui/e-comp-editor-page-attachments.c
@@ -281,7 +281,6 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
if (!attach)
continue;
- #ifdef HAVE_ICAL_FILENAME_PARAMETER
param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
if (param) {
filename = g_strdup (icalparameter_get_filename (param));
@@ -290,7 +289,6 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
filename = NULL;
}
}
- #endif
if (icalattach_get_is_url (attach)) {
const gchar *data;
@@ -424,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)) {
@@ -433,9 +431,7 @@ ecep_attachments_fill_component (ECompEditorPage *page,
gsize buf_size;
gchar *buf, *uri, *description;
GFile *file;
- #ifdef HAVE_ICAL_FILENAME_PARAMETER
GFileInfo *file_info;
- #endif
if (!attachment)
continue;
@@ -487,7 +483,6 @@ ecep_attachments_fill_component (ECompEditorPage *page,
attach = icalattach_new_from_url (buf);
prop = icalproperty_new_attach (attach);
- #ifdef HAVE_ICAL_FILENAME_PARAMETER
file_info = e_attachment_ref_file_info (attachment);
if (file_info) {
const gchar *display_name = g_file_info_get_display_name (file_info);
@@ -501,7 +496,6 @@ ecep_attachments_fill_component (ECompEditorPage *page,
g_object_unref (file_info);
}
- #endif
icalcomponent_add_property (component, prop);
diff --git a/src/calendar/gui/e-comp-editor-page-general.c b/src/calendar/gui/e-comp-editor-page-general.c
index 90e881f519..0f291fcdf3 100644
--- a/src/calendar/gui/e-comp-editor-page-general.c
+++ b/src/calendar/gui/e-comp-editor-page-general.c
@@ -466,7 +466,7 @@ ecep_general_attendee_added_cb (EMeetingListView *meeting_list_view,
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s",
page_general->priv->user_delegator ? page_general->priv->user_delegator : ""));
- if (client && !e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY))
{
+ if (client && !e_client_check_capability (E_CLIENT (client),
E_CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) {
EMeetingAttendee *delegator;
delegator = e_meeting_store_find_attendee (page_general->priv->meeting_store,
@@ -610,7 +610,7 @@ ecep_general_target_client_notify_cb (ECompEditor *comp_editor,
target_client = e_comp_editor_get_target_client (comp_editor);
if (target_client)
- supports_color = e_client_check_capability (E_CLIENT (target_client),
CAL_STATIC_CAPABILITY_COMPONENT_COLOR);
+ supports_color = e_client_check_capability (E_CLIENT (target_client),
E_CAL_STATIC_CAPABILITY_COMPONENT_COLOR);
e_comp_editor_property_part_set_visible (page_general->priv->comp_color, supports_color);
}
@@ -837,7 +837,7 @@ ecep_general_sensitize_widgets (ECompEditorPage *page,
EClient *cl = E_CLIENT (client);
read_only = e_client_is_readonly (cl);
- delegate_to_many = e_client_check_capability (cl, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY);
+ delegate_to_many = e_client_check_capability (cl, E_CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY);
} else {
force_insensitive = TRUE;
}
@@ -1063,7 +1063,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;
@@ -1231,7 +1231,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);
@@ -1434,31 +1434,29 @@ ecep_general_constructed (GObject *object)
/* Returns NULL when not supported by libical */
part = e_comp_editor_property_part_color_new ();
- if (part) {
- widget = e_comp_editor_property_part_get_edit_widget (part);
+ widget = e_comp_editor_property_part_get_edit_widget (part);
- if (widget) {
- const gchar *tooltip;
+ if (widget) {
+ const gchar *tooltip;
- gtk_box_pack_start (GTK_BOX (page_general->priv->source_and_color_hbox), widget,
FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (page_general->priv->source_and_color_hbox), widget, FALSE,
FALSE, 0);
- if (g_strcmp0 (page_general->priv->source_extension_name,
E_SOURCE_EXTENSION_CALENDAR) == 0) {
- tooltip = _("Override color of the event. If not set, then color of the
calendar is used.");
- } else if (g_strcmp0 (page_general->priv->source_extension_name,
E_SOURCE_EXTENSION_MEMO_LIST) == 0) {
- tooltip = _("Override color of the memo. If not set, then color of the memo
list is used.");
- } else { /* E_SOURCE_EXTENSION_TASK_LIST */
- tooltip = _("Override color of the task. If not set, then color of the task
list is used.");
- }
-
- gtk_widget_set_tooltip_text (widget, tooltip);
+ if (g_strcmp0 (page_general->priv->source_extension_name, E_SOURCE_EXTENSION_CALENDAR) == 0) {
+ tooltip = _("Override color of the event. If not set, then color of the calendar is
used.");
+ } else if (g_strcmp0 (page_general->priv->source_extension_name,
E_SOURCE_EXTENSION_MEMO_LIST) == 0) {
+ tooltip = _("Override color of the memo. If not set, then color of the memo list is
used.");
+ } else { /* E_SOURCE_EXTENSION_TASK_LIST */
+ tooltip = _("Override color of the task. If not set, then color of the task list is
used.");
}
- page_general->priv->comp_color_changed_handler_id = g_signal_connect_swapped (part, "changed",
- G_CALLBACK (e_comp_editor_page_emit_changed), page_general);
-
- page_general->priv->comp_color = part;
+ gtk_widget_set_tooltip_text (widget, tooltip);
}
+ page_general->priv->comp_color_changed_handler_id = g_signal_connect_swapped (part, "changed",
+ G_CALLBACK (e_comp_editor_page_emit_changed), page_general);
+
+ page_general->priv->comp_color = part;
+
widget = gtk_button_new_with_mnemonic (C_("ECompEditor", "Atte_ndees..."));
g_object_set (G_OBJECT (widget),
"hexpand", FALSE,
diff --git a/src/calendar/gui/e-comp-editor-page-recurrence.c
b/src/calendar/gui/e-comp-editor-page-recurrence.c
index c6111cf625..bdc72c4332 100644
--- a/src/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/src/calendar/gui/e-comp-editor-page-recurrence.c
@@ -440,7 +440,7 @@ ecep_recurrence_get_current_time_cb (ECalendarItem *calitem,
today = icaltime_today ();
- return icaltimetype_to_tm (&today);
+ return e_cal_util_icaltime_to_tm (&today);
}
static GtkWidget *
@@ -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-reminders.c b/src/calendar/gui/e-comp-editor-page-reminders.c
index 47a21457c7..dfe378ca4c 100644
--- a/src/calendar/gui/e-comp-editor-page-reminders.c
+++ b/src/calendar/gui/e-comp-editor-page-reminders.c
@@ -90,10 +90,10 @@ static const gint action_map[] = {
};
static const gchar *action_map_cap[] = {
- CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS,
- CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS,
- CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS,
- CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS
+ E_CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS,
+ E_CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS,
+ E_CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS,
+ E_CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS
};
static const gint value_map[] = {
@@ -963,7 +963,7 @@ ecep_reminders_set_alarm_email (ECompEditorPageReminders *page_reminders)
target_client = e_comp_editor_get_target_client (comp_editor);
if (target_client &&
- !e_client_check_capability (E_CLIENT (target_client), CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)) {
+ !e_client_check_capability (E_CLIENT (target_client), E_CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)) {
ENameSelectorModel *selector_model;
EDestinationStore *destination_store = NULL;
const gchar *alarm_email;
@@ -1269,7 +1269,7 @@ ecep_reminders_sensitize_relative_time_combo_items (GtkWidget *combobox,
gboolean alarm_after_start;
gint ii;
- alarm_after_start = !e_client_check_capability (client, CAL_STATIC_CAPABILITY_NO_ALARM_AFTER_START);
+ alarm_after_start = !e_client_check_capability (client, E_CAL_STATIC_CAPABILITY_NO_ALARM_AFTER_START);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
valid = gtk_tree_model_get_iter_first (model, &iter);
@@ -1312,7 +1312,7 @@ ecep_reminders_sensitize_widgets_by_client (ECompEditorPageReminders *page_remin
target_client, time_map, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END);
/* If the client doesn't support set alarm description, disable the related widgets */
- if (e_client_check_capability (target_client, CAL_STATIC_CAPABILITY_ALARM_DESCRIPTION)) {
+ if (e_client_check_capability (target_client, E_CAL_STATIC_CAPABILITY_ALARM_DESCRIPTION)) {
gtk_widget_show (page_reminders->priv->custom_message_check);
gtk_widget_show (page_reminders->priv->custom_message_text_view);
} else {
@@ -1325,7 +1325,7 @@ ecep_reminders_sensitize_widgets_by_client (ECompEditorPageReminders *page_remin
/* If we can repeat */
gtk_widget_set_sensitive (page_reminders->priv->repeat_check,
- !e_client_check_capability (target_client, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT));
+ !e_client_check_capability (target_client, E_CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT));
}
static void
@@ -1386,7 +1386,7 @@ ecep_reminders_fill_widgets (ECompEditorPage *page,
comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (component));
if (comp && e_cal_component_has_alarms (comp)) {
- GList *alarms, *link;
+ GSList *alarms, *link;
gint alarm_type;
alarms = e_cal_component_get_alarm_uids (comp);
@@ -1399,7 +1399,7 @@ ecep_reminders_fill_widgets (ECompEditorPage *page,
e_alarm_list_clear (page_reminders->priv->alarm_list);
- for (link = alarms; link; link = g_list_next (link)) {
+ for (link = alarms; link; link = g_slist_next (link)) {
ECalComponentAlarm *ca;
const gchar *uid = link->data;
@@ -1408,7 +1408,7 @@ ecep_reminders_fill_widgets (ECompEditorPage *page,
e_cal_component_alarm_free (ca);
}
- cal_obj_uid_list_free (alarms);
+ g_slist_free_full (alarms, g_free);
if (e_dialog_combo_box_get (page_reminders->priv->alarms_combo,
page_reminders->priv->alarm_map) == ALARM_CUSTOM) {
GtkTreeSelection *selection;
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..6c26560dea 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) (ICalTime *value);
+ void (* i_cal_set_func) (ICalProperty *prop,
+ ICalTime *value);
+ ICalTime * (* 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 ICalTime *value);
+ICalTime * 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-property-parts.c b/src/calendar/gui/e-comp-editor-property-parts.c
index 967651f20f..05ee33be32 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.c
+++ b/src/calendar/gui/e-comp-editor-property-parts.c
@@ -1664,7 +1664,6 @@ static void
ecepp_color_fill_widget (ECompEditorPropertyPart *property_part,
icalcomponent *component)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
GtkWidget *edit_widget;
icalproperty *prop;
gboolean color_set = FALSE;
@@ -1695,14 +1694,12 @@ ecepp_color_fill_widget (ECompEditorPropertyPart *property_part,
e_color_combo_set_current_color (E_COLOR_COMBO (edit_widget), &rgba);
}
- #endif
}
static void
ecepp_color_fill_component (ECompEditorPropertyPart *property_part,
icalcomponent *component)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
GtkWidget *edit_widget;
icalproperty *prop;
GdkRGBA rgba;
@@ -1743,7 +1740,6 @@ ecepp_color_fill_component (ECompEditorPropertyPart *property_part,
g_warning ("%s: Failed to convert RGBA (%f,%f,%f,%f) to string", G_STRFUNC, rgba.red,
rgba.green, rgba.blue, rgba.alpha);
}
}
- #endif
}
static void
@@ -1765,9 +1761,5 @@ e_comp_editor_property_part_color_class_init (ECompEditorPropertyPartColorClass
ECompEditorPropertyPart *
e_comp_editor_property_part_color_new (void)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
return g_object_new (E_TYPE_COMP_EDITOR_PROPERTY_PART_COLOR, NULL);
- #else
- return NULL;
- #endif
}
diff --git a/src/calendar/gui/e-comp-editor-task.c b/src/calendar/gui/e-comp-editor-task.c
index 0493cecb0e..05990ef9cd 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -189,7 +189,7 @@ ece_task_notify_target_client_cb (GObject *object,
action = e_comp_editor_get_action (comp_editor, "all-day-task");
was_allday = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- date_only = !cal_client || e_client_check_capability (E_CLIENT (cal_client),
CAL_STATIC_CAPABILITY_TASK_DATE_ONLY);
+ date_only = !cal_client || e_client_check_capability (E_CLIENT (cal_client),
E_CAL_STATIC_CAPABILITY_TASK_DATE_ONLY);
e_comp_editor_property_part_datetime_set_date_only (E_COMP_EDITOR_PROPERTY_PART_DATETIME
(task_editor->priv->dtstart), date_only);
e_comp_editor_property_part_datetime_set_date_only (E_COMP_EDITOR_PROPERTY_PART_DATETIME
(task_editor->priv->due_date), date_only);
@@ -209,10 +209,10 @@ ece_task_notify_target_client_cb (GObject *object,
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
- can_reminders = !cal_client || !e_client_check_capability (E_CLIENT (cal_client),
CAL_STATIC_CAPABILITY_TASK_NO_ALARM);
+ can_reminders = !cal_client || !e_client_check_capability (E_CLIENT (cal_client),
E_CAL_STATIC_CAPABILITY_TASK_NO_ALARM);
gtk_widget_set_visible (GTK_WIDGET (task_editor->priv->reminders_page), can_reminders);
- can_recur = !cal_client || e_client_check_capability (E_CLIENT (cal_client),
CAL_STATIC_CAPABILITY_TASK_CAN_RECUR);
+ can_recur = !cal_client || e_client_check_capability (E_CLIENT (cal_client),
E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR);
gtk_widget_set_visible (GTK_WIDGET (task_editor->priv->recurrence_page), can_recur);
}
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index 455a897eaa..ef877dfb2d 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -371,7 +371,7 @@ ece_send_process_method (SaveData *sd,
g_return_val_if_fail (send_method != E_CAL_COMPONENT_METHOD_NONE, FALSE);
if (e_cal_component_has_attachments (send_comp) &&
- e_client_check_capability (E_CLIENT (sd->target_client), CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
+ e_client_check_capability (E_CLIENT (sd->target_client),
E_CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
/* Clone the component with attachments set to CID:... */
GSList *attach_list = NULL;
GSList *attach;
@@ -1098,14 +1098,14 @@ comp_editor_open_target_client_thread (EAlertSinkThreadJobData *job_data,
if (!g_cancellable_is_cancelled (cancellable)) {
e_client_get_backend_property_sync (otc->client,
- CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
+ E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
&otc->cal_email_address,
cancellable, error);
}
if (!g_cancellable_is_cancelled (cancellable)) {
e_client_get_backend_property_sync (otc->client,
- CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS,
+ E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS,
&otc->alarm_email_address,
cancellable, error);
}
@@ -1339,7 +1339,7 @@ e_comp_editor_prompt_and_save_changes (ECompEditor *comp_editor,
if (comp_editor->priv->component &&
e_comp_editor_page_general_get_show_attendees (comp_editor->priv->page_general) &&
icalcomponent_isa (comp_editor->priv->component) == ICAL_VTODO_COMPONENT
- && e_client_check_capability (E_CLIENT (comp_editor->priv->target_client),
CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) {
+ && e_client_check_capability (E_CLIENT (comp_editor->priv->target_client),
E_CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) {
e_alert_submit (
E_ALERT_SINK (comp_editor),
"calendar:prompt-no-task-assignment-editor",
@@ -1471,7 +1471,7 @@ ece_organizer_email_address_is_user (ECompEditor *comp_editor,
return TRUE;
}
- if (is_organizer && e_client_check_capability (client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
+ if (is_organizer && e_client_check_capability (client,
E_CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
return FALSE;
registry = e_shell_get_registry (e_comp_editor_get_shell (comp_editor));
@@ -1492,7 +1492,7 @@ ece_organizer_is_user (ECompEditor *comp_editor,
g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
prop = icalcomponent_get_first_property (component, ICAL_ORGANIZER_PROPERTY);
- if (!prop || e_client_check_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER))
+ if (!prop || e_client_check_capability (client, E_CAL_STATIC_CAPABILITY_NO_ORGANIZER))
return FALSE;
organizer = itip_strip_mailto (icalproperty_get_organizer (prop));
@@ -1516,7 +1516,7 @@ ece_sentby_is_user (ECompEditor *comp_editor,
g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
prop = icalcomponent_get_first_property (component, ICAL_ORGANIZER_PROPERTY);
- if (!prop || e_client_check_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER))
+ if (!prop || e_client_check_capability (client, E_CAL_STATIC_CAPABILITY_NO_ORGANIZER))
return FALSE;
param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
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.c b/src/calendar/gui/e-date-time-list.c
index 681e0a2bcf..33adfddb47 100644
--- a/src/calendar/gui/e-date-time-list.c
+++ b/src/calendar/gui/e-date-time-list.c
@@ -45,7 +45,7 @@ struct _EDateTimeListPrivate {
guint columns_dirty : 1;
gboolean use_24_hour_format;
- icaltimezone *zone;
+ ICalTimezone *zone;
};
enum {
@@ -63,28 +63,11 @@ G_DEFINE_TYPE_WITH_CODE (
G_IMPLEMENT_INTERFACE (
GTK_TYPE_TREE_MODEL, e_date_time_list_tree_model_init))
-static void
-free_datetime (struct icaltimetype *itt)
-{
- g_free (itt);
-}
-
-static struct icaltimetype *
-copy_datetime (const struct icaltimetype itt)
-{
- struct icaltimetype *itt_copy;
-
- itt_copy = g_new0 (struct icaltimetype, 1);
- *itt_copy = itt;
-
- return itt_copy;
-}
-
static gint
-compare_datetime (const struct icaltimetype *itt1,
- const struct icaltimetype *itt2)
+compare_datetime (const ICalTime *itt1,
+ const ICalTime *itt2)
{
- return icaltime_compare (*itt1, *itt2);
+ return i_cal_time_compare ((ICalTime *) itt1, (ICalTime *) itt2);
}
static void
@@ -155,39 +138,30 @@ row_updated (EDateTimeList *date_time_list,
/* Builds a static string out of an exception date */
static gchar *
get_exception_string (EDateTimeList *date_time_list,
- struct icaltimetype *itt)
+ ICalTime *itt)
{
static gchar buf[256];
- struct icaltimetype tt;
struct tm tmp_tm;
- icaltimezone *zone;
+ ICalTime *tt;
+ ICalTimezone *zone;
gboolean use_24_hour_format;
use_24_hour_format = e_date_time_list_get_use_24_hour_format (date_time_list);
zone = e_date_time_list_get_timezone (date_time_list);
- tt = *itt;
-
if (zone)
- tt = icaltime_convert_to_zone (tt, zone);
-
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
+ tt = i_cal_time_convert_to_zone (itt, zone);
+ else
+ tt = g_object_ref (itt);
- tmp_tm.tm_wday = time_day_of_week (
- tt.day,
- tt.month - 1,
- tt.year);
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
e_time_format_date_and_time (
&tmp_tm, use_24_hour_format,
FALSE, FALSE, buf, sizeof (buf));
+ g_clear_object (&tt);
+
return buf;
}
@@ -238,6 +212,22 @@ date_time_list_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
+static void
+date_time_list_finalize (GObject *object)
+{
+ EDateTimeList *date_time_list = E_DATE_TIME_LIST (object);
+
+ g_clear_object (&date_time_list->priv->zone);
+
+ g_warn_if_fail (date_time_list->priv->list == NULL);
+
+ g_list_free_full (date_time_list->priv->list, g_object_unref);
+ date_time_list->priv->list = NULL;
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (e_date_time_list_parent_class)->finalize (object);
+}
+
static GtkTreeModelFlags
date_time_list_get_flags (GtkTreeModel *tree_model)
{
@@ -321,10 +311,10 @@ date_time_list_get_value (GtkTreeModel *tree_model,
gint column,
GValue *value)
{
- EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
- struct icaltimetype *itt;
- GList *l;
- const gchar *str;
+ EDateTimeList *date_time_list = E_DATE_TIME_LIST (tree_model);
+ ICalTime *itt;
+ GList *link;
+ const gchar *str;
g_return_if_fail (E_IS_DATE_TIME_LIST (tree_model));
g_return_if_fail (column < E_DATE_TIME_LIST_NUM_COLUMNS);
@@ -336,8 +326,8 @@ date_time_list_get_value (GtkTreeModel *tree_model,
if (!date_time_list->priv->list)
return;
- l = iter->user_data;
- itt = l->data;
+ link = iter->user_data;
+ itt = link->data;
if (!itt)
return;
@@ -463,6 +453,7 @@ e_date_time_list_class_init (EDateTimeListClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = date_time_list_set_property;
object_class->get_property = date_time_list_get_property;
+ object_class->finalize = date_time_list_finalize;
g_object_class_install_property (
object_class,
@@ -519,7 +510,7 @@ e_date_time_list_new (void)
return g_object_new (E_TYPE_DATE_TIME_LIST, NULL);
}
-struct icaltimetype *
+ICalTime *
e_date_time_list_get_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter)
{
@@ -531,15 +522,15 @@ e_date_time_list_get_date_time (EDateTimeList *date_time_list,
void
e_date_time_list_set_date_time (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const struct icaltimetype itt)
+ const ICalTime *itt)
{
- struct icaltimetype *itt_old;
+ ICalTime *itt_old;
g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
itt_old = G_LIST (iter->user_data)->data;
- free_datetime (itt_old);
- G_LIST (iter->user_data)->data = copy_datetime (itt);
+ g_clear_object (&itt_old);
+ G_LIST (iter->user_data)->data = i_cal_time_new_clone (itt);
row_updated (date_time_list,
g_list_position (date_time_list->priv->list, G_LIST (iter->user_data)));
}
@@ -566,7 +557,7 @@ e_date_time_list_set_use_24_hour_format (EDateTimeList *date_time_list,
g_object_notify (G_OBJECT (date_time_list), "use-24-hour-format");
}
-icaltimezone *
+ICalTimezone *
e_date_time_list_get_timezone (EDateTimeList *date_time_list)
{
g_return_val_if_fail (E_IS_DATE_TIME_LIST (date_time_list), NULL);
@@ -576,14 +567,16 @@ 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)
{
g_return_if_fail (E_IS_DATE_TIME_LIST (date_time_list));
if (date_time_list->priv->zone == zone)
return;
- date_time_list->priv->zone = zone;
+ g_clear_object (&date_time_list->priv->zone);
+ if (zone)
+ date_time_list->priv->zone = g_object_ref ((ICalTimezone *) zone);
g_object_notify (G_OBJECT (date_time_list), "timezone");
}
@@ -591,12 +584,13 @@ e_date_time_list_set_timezone (EDateTimeList *date_time_list,
void
e_date_time_list_append (EDateTimeList *date_time_list,
GtkTreeIter *iter,
- const struct icaltimetype itt)
+ const ICalTime *itt)
{
- g_return_if_fail (icaltime_is_valid_time (itt));
+ g_return_if_fail (itt != NULL);
+ g_return_if_fail (i_cal_time_is_valid_time ((ICalTime *) itt));
- if (g_list_find_custom (date_time_list->priv->list, &itt, (GCompareFunc) compare_datetime) == NULL) {
- date_time_list->priv->list = g_list_append (date_time_list->priv->list, copy_datetime (itt));
+ if (g_list_find_custom (date_time_list->priv->list, itt, (GCompareFunc) compare_datetime) == NULL) {
+ date_time_list->priv->list = g_list_append (date_time_list->priv->list, i_cal_time_new_clone
(itt));
row_added (date_time_list, g_list_length (date_time_list->priv->list) - 1);
}
@@ -610,12 +604,14 @@ void
e_date_time_list_remove (EDateTimeList *date_time_list,
GtkTreeIter *iter)
{
+ ICalTime *itt;
gint n;
g_return_if_fail (IS_VALID_ITER (date_time_list, iter));
n = g_list_position (date_time_list->priv->list, G_LIST (iter->user_data));
- free_datetime (G_LIST (iter->user_data)->data);
+ itt = G_LIST (iter->user_data)->data;
+ g_clear_object (&itt);
date_time_list->priv->list = g_list_delete_link (
date_time_list->priv->list, G_LIST (iter->user_data));
row_deleted (date_time_list, n);
@@ -624,14 +620,8 @@ e_date_time_list_remove (EDateTimeList *date_time_list,
void
e_date_time_list_clear (EDateTimeList *date_time_list)
{
- GList *l;
-
all_rows_deleted (date_time_list);
- for (l = date_time_list->priv->list; l; l = g_list_next (l)) {
- free_datetime (l->data);
- }
-
- g_list_free (date_time_list->priv->list);
+ g_list_free_full (date_time_list->priv->list, g_object_unref);
date_time_list->priv->list = NULL;
}
diff --git a/src/calendar/gui/e-date-time-list.h b/src/calendar/gui/e-date-time-list.h
index d9178cdf9b..c9eea14ce5 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,
+ICalTime * 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 ICalTime *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 ICalTime *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-main-item.c b/src/calendar/gui/e-day-view-main-item.c
index 05f9f2e795..712f070773 100644
--- a/src/calendar/gui/e-day-view-main-item.c
+++ b/src/calendar/gui/e-day-view-main-item.c
@@ -72,18 +72,20 @@ can_draw_in_region (cairo_region_t *draw_region,
}
static gboolean
-icalcomp_is_transparent (icalcomponent *icalcomp)
+icomp_is_transparent (ICalComponent *icomp)
{
- icalproperty *transp_prop;
- icalproperty_transp ical_transp = ICAL_TRANSP_NONE;
+ ICalProperty *transp_prop;
+ ICalPropertyTransp transp = I_CAL_TRANSP_NONE;
- g_return_val_if_fail (icalcomp != NULL, TRUE);
+ g_return_val_if_fail (icomp != NULL, TRUE);
- transp_prop = icalcomponent_get_first_property (icalcomp, ICAL_TRANSP_PROPERTY);
- if (transp_prop)
- ical_transp = icalproperty_get_transp (transp_prop);
+ transp_prop = i_cal_component_get_first_property (icomp, I_CAL_TRANSP_PROPERTY);
+ if (transp_prop) {
+ transp = i_cal_property_get_transp (transp_prop);
+ g_object_unref (transp_prop);
+ }
- return transp_prop && (ical_transp == ICAL_TRANSP_TRANSPARENT || ical_transp ==
ICAL_TRANSP_TRANSPARENTNOCONFLICT);
+ return transp_prop && (transp == I_CAL_TRANSP_TRANSPARENT || transp ==
I_CAL_TRANSP_TRANSPARENTNOCONFLICT);
}
static void
@@ -114,7 +116,7 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
continue;
/* If the event is TRANSPARENT, skip it. */
- if (icalcomp_is_transparent (event->comp_data->icalcomp)) {
+ if (icomp_is_transparent (event->comp_data->icalcomp)) {
continue;
}
@@ -198,14 +200,12 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
gdouble date_fraction;
gboolean short_event = FALSE, resize_flag = FALSE, is_editing;
const gchar *end_resize_suffix;
- gchar *end_regsizeime;
gint start_hour, start_display_hour, start_minute, start_suffix_width;
gint end_hour, end_display_hour, end_minute, end_suffix_width;
gboolean show_span = FALSE, format_time;
gint offset, interval;
const gchar *start_suffix;
const gchar *end_suffix;
- gchar *text = NULL;
gint scroll_flag = 0;
gint row_y;
PangoLayout *layout;
@@ -547,6 +547,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE) {
GdkRGBA fg_rgba;
+ gchar *end_regsizeime;
bar_y2 = item_y + item_h - 1;
@@ -590,6 +591,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
pango_cairo_update_layout (cr, layout);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
+ g_free (end_regsizeime);
cairo_close_path (cr);
cairo_restore (cr);
@@ -599,11 +601,12 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
else if (bar_y2 < scroll_flag)
event->end_minute -= time_divisions;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
/* Only fill it in if the event isn't TRANSPARENT. */
- e_cal_component_get_transparency (comp, &transparency);
+ transparency = e_cal_component_get_transparency (comp);
if (transparency != E_CAL_COMPONENT_TRANSP_TRANSPARENT) {
cairo_save (cr);
pat = cairo_pattern_create_linear (
@@ -745,6 +748,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
if (!short_event) {
GdkRGBA fg_rgba;
+ gchar *text;
if (event->start_minute % time_divisions != 0
|| (day_view->show_event_end_times
@@ -833,12 +837,12 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
pango_cairo_update_layout (cr, layout);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
+ g_free (text);
cairo_close_path (cr);
cairo_restore (cr);
}
- g_free (text);
g_object_unref (comp);
}
@@ -912,7 +916,7 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
}
/* If the event is TRANSPARENT, skip it. */
- if (icalcomp_is_transparent (event->comp_data->icalcomp)) {
+ if (icomp_is_transparent (event->comp_data->icalcomp)) {
continue;
}
@@ -1019,7 +1023,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
gint day_x, day_w;
gint start_row, end_row, rect_x, rect_y, rect_width, rect_height;
gint days_shown;
- struct icaltimetype day_start_tt, today_tt;
+ ICalTime *day_start_tt, *today_tt;
gboolean today = FALSE;
cairo_region_t *draw_region;
GdkRectangle rect;
@@ -1050,18 +1054,18 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
/* Paint the background colors. */
- today_tt = icaltime_from_timet_with_zone (
+ today_tt = i_cal_time_from_timet_with_zone (
time (NULL), FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
for (day = 0; day < days_shown; day++) {
GDateWeekday weekday;
- day_start_tt = icaltime_from_timet_with_zone (
+ day_start_tt = i_cal_time_from_timet_with_zone (
day_view->day_starts[day], FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- switch (icaltime_day_of_week (day_start_tt)) {
+ switch (i_cal_time_day_of_week (day_start_tt)) {
case 1:
weekday = G_DATE_SUNDAY;
break;
@@ -1118,9 +1122,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
if (days_shown > 1) {
/* Check if we are drawing today */
- today = day_start_tt.year == today_tt.year
- && day_start_tt.month == today_tt.month
- && day_start_tt.day == today_tt.day;
+ today = i_cal_time_compare_date_only (day_start_tt, today_tt) == 0;
} else {
today = FALSE;
}
@@ -1147,8 +1149,12 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
cairo_fill (cr);
cairo_restore (cr);
}
+
+ g_clear_object (&day_start_tt);
}
+ g_clear_object (&today_tt);
+
/* Paint the selection background. */
if (day_view->selection_start_day != -1
&& !day_view->selection_in_top_canvas) {
@@ -1257,8 +1263,8 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
width, height, day, draw_region);
if (e_day_view_marcus_bains_get_show_line (day_view)) {
- icaltimezone *zone;
- struct icaltimetype time_now, day_start;
+ ICalTimezone *zone;
+ ICalTime *time_now, *day_start;
const gchar *marcus_bains_day_view_color;
gint marcus_bains_y;
GdkColor mb_color;
@@ -1277,25 +1283,26 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
gdk_cairo_set_source_color (cr, &mb_color);
zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
- time_now = icaltime_current_time_with_zone (zone);
+ time_now = i_cal_time_current_time_with_zone (zone);
for (day = 0; day < days_shown; day++) {
- day_start = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, zone);
-
- if ((day_start.year == time_now.year) &&
- (day_start.month == time_now.month) &&
- (day_start.day == time_now.day)) {
+ day_start = i_cal_time_from_timet_with_zone (day_view->day_starts[day], FALSE, zone);
+ if (i_cal_time_compare_date_only (day_start, time_now) == 0) {
grid_x1 = day_view->day_offsets[day] - x + E_DAY_VIEW_BAR_WIDTH;
grid_x2 = day_view->day_offsets[day + 1] - x - 1;
- marcus_bains_y = (time_now.hour * 60 + time_now.minute) *
day_view->row_height / time_divisions - y;
+ marcus_bains_y = (i_cal_time_get_hour (time_now) * 60 + i_cal_time_get_minute
(time_now)) * day_view->row_height / time_divisions - y;
cairo_set_line_width (cr, 1.5);
cairo_move_to (cr, grid_x1, marcus_bains_y);
cairo_line_to (cr, grid_x2, marcus_bains_y);
cairo_stroke (cr);
}
+
+ g_clear_object (&day_start);
}
cairo_restore (cr);
+
+ g_clear_object (&time_now);
}
cairo_region_destroy (draw_region);
}
diff --git a/src/calendar/gui/e-day-view-time-item.c b/src/calendar/gui/e-day-view-time-item.c
index 91758968d8..849b0c1958 100644
--- a/src/calendar/gui/e-day-view-time-item.c
+++ b/src/calendar/gui/e-day-view-time-item.c
@@ -64,7 +64,7 @@ struct _EDayViewTimeItemPrivate {
gboolean dragging_selection;
/* The second timezone if shown, or else NULL. */
- icaltimezone *second_zone;
+ ICalTimezone *second_zone;
};
static void e_day_view_time_item_update (GnomeCanvasItem *item,
@@ -229,7 +229,7 @@ e_day_view_time_item_init (EDayViewTimeItem *time_item)
if (last) {
if (*last)
time_item->priv->second_zone =
- icaltimezone_get_builtin_timezone (last);
+ i_cal_timezone_get_builtin_timezone (last);
g_free (last);
}
@@ -258,13 +258,13 @@ e_day_view_time_item_update (GnomeCanvasItem *item,
*/
static void
edvti_draw_zone (GnomeCanvasItem *canvas_item,
- cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height,
- gint x_offset,
- icaltimezone *use_zone)
+ cairo_t *cr,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint x_offset,
+ ICalTimezone *use_zone)
{
EDayView *day_view;
EDayViewTimeItem *time_item;
@@ -351,31 +351,35 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
if (use_zone) {
/* shift time with a difference between
* local time and the other timezone */
- icaltimezone *cal_zone;
- struct icaltimetype tt;
+ ICalTimezone *cal_zone;
+ ICalTime *tt;
gint diff;
struct tm mn;
cal_zone = e_calendar_view_get_timezone (
E_CALENDAR_VIEW (day_view));
- tt = icaltime_from_timet_with_zone (
+ tt = i_cal_time_from_timet_with_zone (
day_view->day_starts[0], 0, cal_zone);
/* diff is number of minutes */
- diff =(icaltimezone_get_utc_offset (use_zone, &tt, NULL) -
- icaltimezone_get_utc_offset (cal_zone, &tt, NULL)) / 60;
+ diff = (i_cal_timezone_get_utc_offset (use_zone, tt, NULL) -
+ i_cal_timezone_get_utc_offset (cal_zone, tt, NULL)) / 60;
- tt = icaltime_from_timet_with_zone (day_view->day_starts[0], 0, cal_zone);
- tt.is_date = FALSE;
- icaltime_set_timezone (&tt, cal_zone);
- tt = icaltime_convert_to_zone (tt, use_zone);
+ g_clear_object (&tt);
+
+ tt = i_cal_time_from_timet_with_zone (day_view->day_starts[0], 0, cal_zone);
+ i_cal_time_set_is_date (tt, FALSE);
+ i_cal_time_set_timezone (tt, cal_zone);
+ i_cal_time_convert_to_zone_inplace (tt, use_zone);
if (diff != 0) {
/* shows the next midnight */
- icaltime_adjust (&tt, 1, 0, 0, 0);
+ i_cal_time_adjust (tt, 1, 0, 0, 0);
}
- mn = icaltimetype_to_tm (&tt);
+ mn = e_cal_util_icaltime_to_tm (tt);
+
+ g_clear_object (&tt);
/* up to two characters/numbers */
e_utf8_strftime (buffer, sizeof (buffer), "%d", &mn);
@@ -412,7 +416,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
/* Draw the Marcus Bains Line first, so it appears under other elements. */
if (e_day_view_marcus_bains_get_show_line (day_view)) {
- struct icaltimetype time_now;
+ ICalTime *time_now;
const gchar *marcus_bains_time_bar_color;
gint marcus_bains_y;
@@ -431,11 +435,11 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
mb_color = day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE];
}
- time_now = icaltime_current_time_with_zone (
+ time_now = i_cal_time_current_time_with_zone (
e_calendar_view_get_timezone (
E_CALENDAR_VIEW (day_view)));
marcus_bains_y =
- (time_now.hour * 60 + time_now.minute) *
+ (i_cal_time_get_hour (time_now) * 60 + i_cal_time_get_minute (time_now)) *
day_view->row_height / time_divisions - y;
cairo_set_line_width (cr, 1.5);
cairo_move_to (
@@ -445,6 +449,8 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item,
cairo_line_to (cr, long_line_x2, marcus_bains_y);
cairo_stroke (cr);
cairo_restore (cr);
+
+ g_clear_object (&time_now);
} else {
const gchar *marcus_bains_time_bar_color;
@@ -724,14 +730,14 @@ edvti_second_zone_changed_cb (GSettings *settings,
{
EDayViewTimeItem *time_item = user_data;
EDayView *day_view;
- icaltimezone *second_zone;
+ ICalTimezone *second_zone;
gchar *location;
g_return_if_fail (user_data != NULL);
g_return_if_fail (E_IS_DAY_VIEW_TIME_ITEM (time_item));
location = calendar_config_get_day_second_zone ();
- second_zone = location ? icaltimezone_get_builtin_timezone (location) : NULL;
+ second_zone = location ? i_cal_timezone_get_builtin_timezone (location) : NULL;
g_free (location);
if (second_zone == time_item->priv->second_zone)
@@ -777,7 +783,7 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
gchar buffer[256];
GSList *group = NULL, *recent_zones, *s;
gint current_divisions, i;
- icaltimezone *zone;
+ ICalTimezone *zone;
day_view = e_day_view_time_item_get_day_view (time_item);
g_return_if_fail (day_view != NULL);
@@ -833,7 +839,7 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
if (zone)
- item = gtk_menu_item_new_with_label (icaltimezone_get_display_name (zone));
+ item = gtk_menu_item_new_with_label (i_cal_timezone_get_display_name (zone));
else
item = gtk_menu_item_new_with_label ("---");
gtk_widget_set_sensitive (item, FALSE);
@@ -854,12 +860,12 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
recent_zones = calendar_config_get_day_second_zones ();
for (s = recent_zones; s != NULL; s = s->next) {
- zone = icaltimezone_get_builtin_timezone (s->data);
+ zone = i_cal_timezone_get_builtin_timezone (s->data);
if (!zone)
continue;
item = gtk_radio_menu_item_new_with_label (
- group, icaltimezone_get_display_name (zone));
+ group, i_cal_timezone_get_display_name (zone));
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
/* both comes from builtin, thus no problem to compare pointers */
if (zone == time_item->priv->second_zone)
@@ -1128,7 +1134,7 @@ e_day_view_time_item_get_column_width (EDayViewTimeItem *time_item)
return time_item->priv->column_width;
}
-icaltimezone *
+ICalTimezone *
e_day_view_time_item_get_second_zone (EDayViewTimeItem *time_item)
{
g_return_val_if_fail (E_IS_DAY_VIEW_TIME_ITEM (time_item), NULL);
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-top-item.c b/src/calendar/gui/e-day-view-top-item.c
index 0586681335..9e080166ec 100644
--- a/src/calendar/gui/e-day-view-top-item.c
+++ b/src/calendar/gui/e-day-view-top-item.c
@@ -178,9 +178,9 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
if (!is_comp_data_valid (event))
return;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (!e_cal_model_get_rgba_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
event->comp_data, &bg_rgba)) {
bg_rgba.red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red / 65535.0;
@@ -453,7 +453,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
}
/* draw categories icons */
- 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) {
gchar *category;
gchar *file;
@@ -483,7 +483,7 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
}
}
- e_cal_component_free_categories_list (categories_list);
+ g_slist_free_full (categories_list, g_free);
g_object_unref (comp);
}
@@ -831,25 +831,18 @@ e_day_view_top_item_get_day_label (EDayView *day_view,
gint buffer_len)
{
ECalendarView *view;
- struct icaltimetype day_start_tt;
- const icaltimezone *zone;
- struct tm day_start = { 0 };
+ ICalTime *day_start_tt;
+ ICalTimezone *zone;
+ struct tm day_start;
const gchar *format;
view = E_CALENDAR_VIEW (day_view);
zone = e_calendar_view_get_timezone (view);
- day_start_tt = icaltime_from_timet_with_zone (
+ day_start_tt = i_cal_time_from_timet_with_zone (
day_view->day_starts[day], FALSE, zone);
- day_start.tm_year = day_start_tt.year - 1900;
- day_start.tm_mon = day_start_tt.month - 1;
- day_start.tm_mday = day_start_tt.day;
- day_start.tm_isdst = -1;
-
- day_start.tm_wday = time_day_of_week (
- day_start_tt.day,
- day_start_tt.month - 1,
- day_start_tt.year);
+ day_start = e_cal_util_icaltime_to_tm (day_start_tt);
+ g_clear_object (&day_start_tt);
if (day_view->date_format == E_DAY_VIEW_DATE_FULL)
/* strftime format %A = full weekday name, %d = day of month,
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index aaedadd79c..dd24033191 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -575,12 +575,12 @@ e_day_view_get_work_day_range_for_day (EDayView *day_view,
if (day >= 0 && day < e_day_view_get_days_shown (day_view)) {
GDateWeekday weekday;
- struct icaltimetype tt;
+ ICalTime *tt;
- tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE,
+ tt = i_cal_time_from_timet_with_zone (day_view->day_starts[day], FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- switch (icaltime_day_of_week (tt)) {
+ switch (i_cal_time_day_of_week (tt)) {
case 1:
weekday = G_DATE_SUNDAY;
break;
@@ -607,6 +607,8 @@ e_day_view_get_work_day_range_for_day (EDayView *day_view,
break;
}
+ g_clear_object (&tt);
+
e_cal_model_get_work_day_range_for (model, weekday,
start_hour, start_minute,
end_hour, end_minute);
@@ -750,18 +752,18 @@ new_event_in_rage_data_free (gpointer ptr)
static void
day_view_new_event_in_selected_range_cb (ECalModel *model,
ECalClient *client,
- icalcomponent *default_component,
+ ICalComponent *default_component,
gpointer user_data)
{
NewEventInRangeData *ned = user_data;
ECalComponent *comp = NULL;
gint day, event_num;
- ECalComponentDateTime start_dt, end_dt;
- struct icaltimetype start_tt, end_tt;
- const gchar *uid;
+ ECalComponentDateTime *start_dt, *end_dt;
+ ICalTime *start_tt, *end_tt;
+ const gchar *uid, *use_tzid;
AddEventData add_event_data;
ESourceRegistry *registry;
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (ned != NULL);
g_return_if_fail (E_IS_CAL_MODEL (model));
@@ -774,33 +776,36 @@ day_view_new_event_in_selected_range_cb (ECalModel *model,
registry = e_cal_model_get_registry (model);
zone = e_cal_model_get_timezone (model);
- uid = icalcomponent_get_uid (default_component);
+ uid = i_cal_component_get_uid (default_component);
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (default_component));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (default_component));
g_return_if_fail (comp != NULL);
- start_tt = icaltime_from_timet_with_zone (ned->dtstart, FALSE, zone);
- end_tt = icaltime_from_timet_with_zone (ned->dtend, FALSE, zone);
+ start_tt = i_cal_time_from_timet_with_zone (ned->dtstart, FALSE, zone);
+ end_tt = i_cal_time_from_timet_with_zone (ned->dtend, FALSE, zone);
if (ned->in_top_canvas) {
- start_dt.tzid = NULL;
- start_tt.is_date = 1;
- end_tt.is_date = 1;
+ use_tzid = NULL;
+ i_cal_time_set_is_date (start_tt, 1);
+ i_cal_time_set_is_date (end_tt, 1);
/* Editor default in day/work-week view - top canvas */
e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_TRANSPARENT);
} else {
- start_dt.tzid = icaltimezone_get_tzid (zone);
+ use_tzid = i_cal_timezone_get_tzid (zone);
/* Editor default in day/work-week view - main canvas */
e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
}
- start_dt.value = &start_tt;
- end_dt.value = &end_tt;
- end_dt.tzid = start_dt.tzid;
- e_cal_component_set_dtstart (comp, &start_dt);
- e_cal_component_set_dtend (comp, &end_dt);
+ start_dt = e_cal_component_datetime_new_take (start_tt, g_strdup (use_tzid));
+ end_dt = e_cal_component_datetime_new_take (end_tt, g_strdup (use_tzid));
+
+ e_cal_component_set_dtstart (comp, start_dt);
+ e_cal_component_set_dtend (comp, end_dt);
+
+ e_cal_component_datetime_free (start_dt);
+ e_cal_component_datetime_free (end_dt);
/* We add the event locally and start editing it. We don't send it
* to the server until the user finishes editing it. */
@@ -2534,7 +2539,7 @@ e_day_view_precalc_visible_time_range (ECalendarView *cal_view,
EDayView *day_view;
gint days_shown;
time_t lower;
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (E_IS_DAY_VIEW (cal_view));
g_return_if_fail (out_start_time != NULL);
@@ -2622,8 +2627,6 @@ static void
process_component (EDayView *day_view,
ECalModelComponent *comp_data)
{
- const gchar *uid;
- gchar *rid = NULL;
ECalModel *model;
ECalComponent *comp;
ESourceRegistry *registry;
@@ -2636,21 +2639,12 @@ process_component (EDayView *day_view,
if (day_view->lower == 0 && day_view->upper == 0)
return;
- comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) {
- g_object_unref (comp);
-
- g_message (G_STRLOC ": Could not set icalcomponent on ECalComponent");
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
+ if (!comp) {
+ g_message (G_STRLOC ": Could not set ICalComponent on ECalComponent");
return;
}
- e_cal_component_get_uid (comp, &uid);
- if (e_cal_component_is_instance (comp))
- rid = e_cal_component_get_recurid_as_string (comp);
- else
- rid = NULL;
- /* rid is never used below here, why? */
-
/* Add the object */
add_event_data.day_view = day_view;
add_event_data.comp_data = comp_data;
@@ -2659,7 +2653,6 @@ process_component (EDayView *day_view,
comp_data->instance_end, &add_event_data);
g_object_unref (comp);
- g_free (rid);
}
static void
@@ -2670,8 +2663,8 @@ update_row (EDayView *day_view,
ECalModelComponent *comp_data;
ECalModel *model;
gint day, event_num;
- const gchar *uid = NULL;
- gchar *rid = NULL;
+ const gchar *uid;
+ gchar *rid;
if (do_cancel_editing)
cancel_editing (day_view);
@@ -2682,14 +2675,8 @@ update_row (EDayView *day_view,
comp_data = e_cal_model_get_component_at (model, row);
g_return_if_fail (comp_data != NULL);
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
- icalproperty *prop;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_RECURRENCEID_PROPERTY);
- if (prop)
- rid = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(comp_data->icalcomp));
- }
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (e_day_view_find_event_from_uid (day_view, comp_data->client, uid, rid, &day, &event_num))
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
@@ -2791,17 +2778,11 @@ model_comps_deleted_cb (ETableModel *etm,
for (l = list; l != NULL; l = g_slist_next (l)) {
ECalModelComponent *comp_data = l->data;
gint day, event_num;
- const gchar *uid = NULL;
- gchar *rid = NULL;
-
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
- icalproperty *prop;
+ const gchar *uid;
+ gchar *rid;
- prop = icalcomponent_get_first_property (comp_data->icalcomp,
ICAL_RECURRENCEID_PROPERTY);
- if (prop)
- rid = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(comp_data->icalcomp));
- }
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (e_day_view_find_event_from_uid (day_view, comp_data->client, uid, rid, &day, &event_num))
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
@@ -2816,11 +2797,11 @@ model_comps_deleted_cb (ETableModel *etm,
static void
timezone_changed_cb (ECalModel *cal_model,
- icaltimezone *old_zone,
- icaltimezone *new_zone,
- gpointer user_data)
+ ICalTimezone *old_zone,
+ ICalTimezone *new_zone,
+ gpointer user_data)
{
- struct icaltimetype tt;
+ ICalTime *tt;
time_t lower;
EDayView *day_view = (EDayView *) user_data;
ECalendarView *cal_view = (ECalendarView *) day_view;
@@ -2839,11 +2820,13 @@ timezone_changed_cb (ECalModel *cal_model,
/* Recalculate the new start of the first day. We just use exactly
* the same time, but with the new timezone. */
- tt = icaltime_from_timet_with_zone (
+ tt = i_cal_time_from_timet_with_zone (
day_view->lower, FALSE,
old_zone);
- lower = icaltime_as_timet_with_zone (tt, new_zone);
+ lower = i_cal_time_as_timet_with_zone (tt, new_zone);
+
+ g_clear_object (&tt);
e_day_view_recalc_day_starts (day_view, lower);
e_day_view_update_query (day_view);
@@ -3167,7 +3150,7 @@ e_day_view_foreach_event_with_uid (EDayView *day_view,
if (!is_comp_data_valid (event))
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (!(*callback) (day_view, day, event_num, data))
return;
@@ -3184,7 +3167,7 @@ e_day_view_foreach_event_with_uid (EDayView *day_view,
if (!is_comp_data_valid (event))
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (!(*callback) (day_view, E_DAY_VIEW_LONG_EVENT, event_num, data))
return;
@@ -3308,42 +3291,52 @@ set_style_from_attendee (EDayViewEvent *event,
ECalComponent *comp;
GSList *attendees = NULL, *l;
gchar *address;
- ECalComponentAttendee *at = NULL;
+ ICalParameterPartstat partstat = I_CAL_PARTSTAT_NONE;
if (!is_comp_data_valid (event))
return;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- address = itip_get_comp_attendee (
- registry, comp, event->comp_data->client);
- e_cal_component_get_attendee_list (comp, &attendees);
- for (l = attendees; l; l = l->next) {
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
+
+ address = itip_get_comp_attendee (registry, comp, event->comp_data->client);
+ attendees = e_cal_component_get_attendees (comp);
+ for (l = attendees; l && address; l = l->next) {
ECalComponentAttendee *attendee = l->data;
+ const gchar *value, *sentby;
+
+ value = e_cal_component_attendee_get_value (attendee);
+ if (value)
+ value = itip_strip_mailto (value);
+
+ sentby = e_cal_component_attendee_get_sentby (attendee);
+ if (sentby)
+ value = itip_strip_mailto (sentby);
- if ((attendee->value && g_strcmp0 (itip_strip_mailto (attendee->value), address) == 0)
- || (attendee->sentby && g_strcmp0 (itip_strip_mailto (attendee->sentby), address) == 0)) {
- at = attendee;
+ if ((value && g_ascii_strcasecmp (value, address) == 0) ||
+ (sentby && g_ascii_strcasecmp (sentby, address) == 0)) {
+ partstat = e_cal_component_attendee_get_partstat (attendee);
break;
}
}
- if (icalcomponent_get_status (event->comp_data->icalcomp) == ICAL_STATUS_CANCELLED)
+ if (i_cal_component_get_status (event->comp_data->icalcomp) == I_CAL_STATUS_CANCELLED)
gnome_canvas_item_set (event->canvas_item, "strikeout", TRUE, NULL);
/* The attendee has not yet accepted the meeting, display the summary as bolded.
* If the attendee is not present, it might have come through a mailing list.
* In that case, we never show the meeting as bold even if it is unaccepted. */
- if (at && (at->status == ICAL_PARTSTAT_NEEDSACTION))
+ if (partstat == I_CAL_PARTSTAT_NEEDSACTION)
gnome_canvas_item_set (event->canvas_item, "bold", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_DECLINED)
+ else if (partstat == I_CAL_PARTSTAT_DECLINED)
gnome_canvas_item_set (event->canvas_item, "strikeout", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_TENTATIVE)
+ else if (partstat == I_CAL_PARTSTAT_TENTATIVE)
gnome_canvas_item_set (event->canvas_item, "italic", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_DELEGATED)
+ else if (partstat == I_CAL_PARTSTAT_DELEGATED)
gnome_canvas_item_set (event->canvas_item, "italic", TRUE, "strikeout", TRUE, NULL);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
g_free (address);
g_object_unref (comp);
}
@@ -3374,7 +3367,7 @@ e_day_view_update_event_label (EDayView *day_view,
if (!event->canvas_item || !is_comp_data_valid (event))
return;
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
text = summary ? (gchar *) summary : (gchar *) "";
if (day_view->editing_event_day == day
@@ -3405,8 +3398,8 @@ e_day_view_update_event_label (EDayView *day_view,
gint days_shown;
days_shown = e_day_view_get_days_shown (day_view);
- description = icalcomponent_get_description (event->comp_data->icalcomp);
- location = icalcomponent_get_location (event->comp_data->icalcomp);
+ description = i_cal_component_get_description (event->comp_data->icalcomp);
+ location = i_cal_component_get_location (event->comp_data->icalcomp);
if (description && *description) {
if (location && *location)
@@ -3429,7 +3422,7 @@ e_day_view_update_event_label (EDayView *day_view,
if (e_cal_util_component_has_attendee (event->comp_data->icalcomp))
set_style_from_attendee (event, registry);
- else if (icalcomponent_get_status (event->comp_data->icalcomp) == ICAL_STATUS_CANCELLED)
+ else if (i_cal_component_get_status (event->comp_data->icalcomp) == I_CAL_STATUS_CANCELLED)
gnome_canvas_item_set (event->canvas_item, "strikeout", TRUE, NULL);
if (free_text)
@@ -3444,8 +3437,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,19 +3454,18 @@ 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->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);
- else if (icalcomponent_get_status (event->comp_data->icalcomp) == ICAL_STATUS_CANCELLED)
+ else if (i_cal_component_get_status (event->comp_data->icalcomp) == I_CAL_STATUS_CANCELLED)
gnome_canvas_item_set (event->canvas_item, "strikeout", TRUE, NULL);
}
@@ -3558,16 +3549,16 @@ e_day_view_find_event_from_uid (EDayView *day_view,
if (event->comp_data->client != client)
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (rid && *rid) {
- r = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(event->comp_data->icalcomp));
- if (!r || !*r)
- continue;
- if (strcmp (rid, r) != 0) {
+ r = e_cal_util_component_get_recurid_as_string
(event->comp_data->icalcomp);
+
+ if (!r || !*r || strcmp (rid, r) != 0) {
g_free (r);
continue;
}
+
g_free (r);
}
@@ -3589,7 +3580,7 @@ e_day_view_find_event_from_uid (EDayView *day_view,
if (event->comp_data->client != client)
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
*day_return = E_DAY_VIEW_LONG_EVENT;
*event_num_return = event_num;
@@ -3726,8 +3717,9 @@ e_day_view_find_work_week_start (EDayView *day_view,
guint offset;
GDateWeekday weekday;
GDateWeekday first_work_day;
- struct icaltimetype tt = icaltime_null_time ();
- icaltimezone *zone;
+ ICalTime *tt = NULL;
+ ICalTimezone *zone;
+ time_t res;
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
zone = e_cal_model_get_timezone (model);
@@ -3754,11 +3746,18 @@ e_day_view_find_work_week_start (EDayView *day_view,
if (offset > 0)
g_date_subtract_days (&date, offset);
- tt.year = g_date_get_year (&date);
- tt.month = g_date_get_month (&date);
- tt.day = g_date_get_day (&date);
+ tt = i_cal_time_null_time ();
+
+ i_cal_time_set_date (tt,
+ g_date_get_year (&date),
+ g_date_get_month (&date),
+ g_date_get_day (&date));
- return icaltime_as_timet_with_zone (tt, zone);
+ res = i_cal_time_as_timet_with_zone (tt, zone);
+
+ g_clear_object (&tt);
+
+ return res;
}
static void
@@ -3768,7 +3767,7 @@ e_day_view_recalc_day_starts (EDayView *day_view,
gint day;
gchar *str;
gint days_shown;
- struct icaltimetype tt;
+ ICalTime *tt;
GDate dt;
days_shown = e_day_view_get_days_shown (day_view);
@@ -3783,15 +3782,17 @@ e_day_view_recalc_day_starts (EDayView *day_view,
day_view->lower = start_time;
day_view->upper = day_view->day_starts[days_shown];
- tt = icaltime_from_timet_with_zone (day_view->day_starts[0], FALSE, e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
+ tt = i_cal_time_from_timet_with_zone (day_view->day_starts[0], FALSE, e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
g_date_clear (&dt, 1);
- g_date_set_dmy (&dt, tt.day, tt.month, tt.year);
+ g_date_set_dmy (&dt, i_cal_time_get_day (tt), i_cal_time_get_month (tt), i_cal_time_get_year (tt));
/* To Translators: the %d stands for a week number, it's value between 1 and 52/53 */
str = g_strdup_printf (_("Week %d"), g_date_get_iso8601_week_of_year (&dt));
gtk_label_set_text (GTK_LABEL (day_view->week_number_label), str);
g_free (str);
e_day_view_recalc_work_week (day_view);
+
+ g_clear_object (&tt);
}
/* Whether we are displaying a work-week, in which case the display always
@@ -5408,13 +5409,13 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
EDayViewEvent *event;
gint event_num;
ECalComponent *comp;
- ECalComponentDateTime date;
- struct icaltimetype itt;
+ ECalComponentDateTime *date = NULL;
time_t dt;
ECalModel *model;
ECalClient *client;
ESourceRegistry *registry;
ECalObjModType mod = E_CAL_OBJ_MOD_ALL;
+ ICalTimezone *zone;
gint is_date;
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
@@ -5436,8 +5437,9 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
/* We use a temporary copy of the comp since we don't want to
* change the original comp here. Otherwise we would not detect that
* the event's time had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (e_cal_component_has_attendees (comp) &&
!itip_organizer_is_user (registry, comp, client)) {
@@ -5446,35 +5448,42 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
return;
}
- date.value = &itt;
- date.tzid = NULL;
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_LEFT_EDGE) {
- ECalComponentDateTime ecdt;
+ ECalComponentDateTime *ecdt;
+
+ ecdt = e_cal_component_get_dtstart (comp);
+ is_date = ecdt && e_cal_component_datetime_get_value (ecdt) &&
+ i_cal_time_is_date (e_cal_component_datetime_get_value (ecdt));
- e_cal_component_get_dtstart (comp, &ecdt);
- is_date = ecdt.value && ecdt.value->is_date;
- if (!is_date)
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
dt = day_view->day_starts[day_view->resize_start_row];
- *date.value = icaltime_from_timet_with_zone (dt, is_date,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
- e_cal_component_free_datetime (&ecdt);
- date.tzid = NULL; /* do not reuse it later */
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, is_date, zone),
+ (zone && !is_date) ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
+
+ e_cal_component_datetime_free (ecdt);
+
+ /* do not reuse it later */
+ e_cal_component_datetime_set_tzid (date, NULL);
} else {
- ECalComponentDateTime ecdt;
+ ECalComponentDateTime *ecdt;
+
+ ecdt = e_cal_component_get_dtend (comp);
+ is_date = ecdt && e_cal_component_datetime_get_value (ecdt) &&
+ i_cal_time_is_date (e_cal_component_datetime_get_value (ecdt));
- e_cal_component_get_dtend (comp, &ecdt);
- is_date = ecdt.value && ecdt.value->is_date;
- if (!is_date)
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
dt = day_view->day_starts[day_view->resize_end_row + 1];
- *date.value = icaltime_from_timet_with_zone (dt, is_date,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
- e_cal_component_free_datetime (&ecdt);
- date.tzid = NULL; /* do not reuse it later */
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, is_date, zone),
+ (zone && !is_date) ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
+
+ e_cal_component_datetime_free (ecdt);
+
+ /* do not reuse it later */
+ e_cal_component_datetime_set_tzid (date, NULL);
}
e_cal_component_commit_sequence (comp);
@@ -5487,24 +5496,23 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
if (mod == E_CAL_OBJ_MOD_THIS) {
/* set the correct DTSTART/DTEND on the individual recurrence */
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE) {
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_end, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ e_cal_component_datetime_take_value (date,
+ i_cal_time_from_timet_with_zone (event->comp_data->instance_end,
FALSE, zone));
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
} else {
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_start, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
+ e_cal_component_datetime_take_value (date,
+ i_cal_time_from_timet_with_zone (event->comp_data->instance_start,
FALSE, zone));
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
}
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
- } else if (e_cal_component_is_instance (comp))
+ } else if (e_cal_component_is_instance (comp)) {
mod = E_CAL_OBJ_MOD_THIS;
+ }
e_cal_component_commit_sequence (comp);
@@ -5514,6 +5522,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
out:
day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE;
+ e_cal_component_datetime_free (date);
g_object_unref (comp);
}
@@ -5525,8 +5534,8 @@ e_day_view_finish_resize (EDayView *day_view)
EDayViewEvent *event;
gint day, event_num;
ECalComponent *comp;
- ECalComponentDateTime date;
- struct icaltimetype itt;
+ ECalComponentDateTime *date = NULL;
+ ICalTimezone *zone;
time_t dt;
ECalModel *model;
ECalClient *client;
@@ -5560,8 +5569,9 @@ e_day_view_finish_resize (EDayView *day_view)
/* We use a temporary shallow copy of the ico since we don't want to
* change the original ico here. Otherwise we would not detect that
* the event's time had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (e_cal_component_has_attendees (comp) &&
!itip_organizer_is_user (registry, comp, client)) {
@@ -5583,19 +5593,20 @@ e_day_view_finish_resize (EDayView *day_view)
goto out;
}
- date.value = &itt;
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE) {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_start_row);
- *date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
} else {
dt = e_day_view_convert_grid_position_to_time (day_view, day, day_view->resize_end_row + 1);
- *date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
}
e_cal_component_commit_sequence (comp);
@@ -5622,24 +5633,23 @@ e_day_view_finish_resize (EDayView *day_view)
if (mod == E_CAL_OBJ_MOD_THIS) {
/* set the correct DTSTART/DTEND on the individual recurrence */
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE) {
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_end, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ e_cal_component_datetime_take_value (date,
+ i_cal_time_from_timet_with_zone (event->comp_data->instance_end,
FALSE, zone));
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
} else {
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_start, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
+ e_cal_component_datetime_take_value (date,
+ i_cal_time_from_timet_with_zone (event->comp_data->instance_start,
FALSE, zone));
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
}
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
- } else if (e_cal_component_is_instance (comp))
+ } else if (e_cal_component_is_instance (comp)) {
mod = E_CAL_OBJ_MOD_THIS;
+ }
e_cal_component_commit_sequence (comp);
@@ -5650,6 +5660,7 @@ e_day_view_finish_resize (EDayView *day_view)
out:
g_object_unref (comp);
+ g_clear_object (&date);
}
static void
@@ -5748,9 +5759,9 @@ e_day_view_add_event (ESourceRegistry *registry,
EDayViewEvent event;
gint day, offset;
gint days_shown;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
+ ICalTimezone *zone;
AddEventData *add_event_data;
- icaltimezone *zone;
add_event_data = data;
@@ -5770,8 +5781,8 @@ e_day_view_add_event (ESourceRegistry *registry,
g_return_if_fail (end > add_event_data->day_view->lower);
zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view));
- start_tt = icaltime_from_timet_with_zone (start, FALSE, zone);
- end_tt = icaltime_from_timet_with_zone (end, FALSE, zone);
+ start_tt = i_cal_time_from_timet_with_zone (start, FALSE, zone);
+ end_tt = i_cal_time_from_timet_with_zone (end, FALSE, zone);
if (add_event_data->comp_data) {
event.comp_data = g_object_ref (add_event_data->comp_data);
@@ -5780,7 +5791,7 @@ e_day_view_add_event (ESourceRegistry *registry,
event.comp_data->is_new_component = TRUE;
event.comp_data->client = g_object_ref (client);
e_cal_component_abort_sequence (comp);
- event.comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent
(comp));
+ event.comp_data->icalcomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent
(comp));
}
event.start = start;
@@ -5796,8 +5807,11 @@ e_day_view_add_event (ESourceRegistry *registry,
* display. */
offset = add_event_data->day_view->first_hour_shown * 60
+ add_event_data->day_view->first_minute_shown;
- event.start_minute = start_tt.hour * 60 + start_tt.minute - offset;
- event.end_minute = end_tt.hour * 60 + end_tt.minute - offset;
+ event.start_minute = i_cal_time_get_hour (start_tt) * 60 + i_cal_time_get_minute (start_tt) - offset;
+ event.end_minute = i_cal_time_get_hour (end_tt) * 60 + i_cal_time_get_minute (end_tt) - offset;
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
event.start_row_or_col = 0;
event.num_columns = 0;
@@ -6015,8 +6029,9 @@ e_day_view_reshape_long_event (EDayView *day_view,
/* We don't show the icons while resizing, since we'd have to
* draw them on top of the resize rect. Nor when editing. */
num_icons = 0;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
/* Set up Pango prerequisites */
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (day_view));
@@ -6166,7 +6181,7 @@ e_day_view_reshape_day_events (EDayView *day_view,
if (!is_comp_data_valid (event))
continue;
- current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
+ current_comp_string = i_cal_component_as_ical_string_r (event->comp_data->icalcomp);
if (day_view->last_edited_comp_string == NULL) {
g_free (current_comp_string);
continue;
@@ -6221,22 +6236,22 @@ e_day_view_reshape_day_event (EDayView *day_view,
|| day_view->resize_event_num != event_num)) {
ECalComponent *comp;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone
(event->comp_data->icalcomp));
-
- if (e_cal_component_has_alarms (comp))
- num_icons++;
- if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance (comp))
- num_icons++;
- if (e_cal_component_has_attachments (comp))
- num_icons++;
- if (event->different_timezone)
- num_icons++;
- if (e_cal_component_has_attendees (comp))
- num_icons++;
-
- num_icons += cal_comp_util_get_n_icons (comp, NULL);
- g_object_unref (comp);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (comp) {
+ if (e_cal_component_has_alarms (comp))
+ num_icons++;
+ if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance
(comp))
+ num_icons++;
+ if (e_cal_component_has_attachments (comp))
+ num_icons++;
+ if (event->different_timezone)
+ num_icons++;
+ if (e_cal_component_has_attendees (comp))
+ num_icons++;
+
+ num_icons += cal_comp_util_get_n_icons (comp, NULL);
+ g_object_unref (comp);
+ }
}
if (num_icons > 0) {
@@ -7332,7 +7347,7 @@ cancel_editing (EDayView *day_view)
/* Reset the text to what was in the component */
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
g_object_set (
event->canvas_item,
"text", summary ? summary : "",
@@ -7593,7 +7608,7 @@ e_day_view_event_move (ECalendarView *cal_view,
gint time_divisions;
gint day, event_num, resize_start_row, resize_end_row;
time_t start_dt, end_dt;
- struct icaltimetype start_time, end_time;
+ ICalTime *start_time, *end_time;
day_view = E_DAY_VIEW (cal_view);
day = day_view->editing_event_day;
@@ -7640,24 +7655,28 @@ e_day_view_event_move (ECalendarView *cal_view,
return TRUE;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
end_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_end_row + 1);
- start_time = icaltime_from_timet_with_zone (start_dt, 0, NULL);
- end_time = icaltime_from_timet_with_zone (end_dt, 0, NULL);
- icaltime_adjust (&start_time ,-1,0,0,0);
- icaltime_adjust (&end_time ,-1,0,0,0);
- start_dt = icaltime_as_timet (start_time);
- end_dt = icaltime_as_timet (end_time);
+ start_time = i_cal_time_from_timet_with_zone (start_dt, 0, NULL);
+ end_time = i_cal_time_from_timet_with_zone (end_dt, 0, NULL);
+ i_cal_time_adjust (start_time, -1, 0, 0, 0);
+ i_cal_time_adjust (end_time, -1, 0, 0, 0);
+ start_dt = i_cal_time_as_timet (start_time);
+ end_dt = i_cal_time_as_timet (end_time);
+ g_clear_object (&start_time);
+ g_clear_object (&end_time);
break;
case E_CAL_VIEW_MOVE_RIGHT:
if (day + 1 >= e_day_view_get_days_shown (day_view))
return TRUE;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
end_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_end_row + 1);
- start_time = icaltime_from_timet_with_zone (start_dt, 0, NULL);
- end_time = icaltime_from_timet_with_zone (end_dt, 0, NULL);
- icaltime_adjust (&start_time ,1,0,0,0);
- icaltime_adjust (&end_time ,1,0,0,0);
- start_dt = icaltime_as_timet (start_time);
- end_dt = icaltime_as_timet (end_time);
+ start_time = i_cal_time_from_timet_with_zone (start_dt, 0, NULL);
+ end_time = i_cal_time_from_timet_with_zone (end_dt, 0, NULL);
+ i_cal_time_adjust (start_time ,1,0,0,0);
+ i_cal_time_adjust (end_time ,1,0,0,0);
+ start_dt = i_cal_time_as_timet (start_time);
+ end_dt = i_cal_time_as_timet (end_time);
+ g_clear_object (&start_time);
+ g_clear_object (&end_time);
break;
default:
return FALSE;
@@ -7677,8 +7696,8 @@ e_day_view_change_event_time (EDayView *day_view,
EDayViewEvent *event;
gint day, event_num;
ECalComponent *comp;
- ECalComponentDateTime date;
- struct icaltimetype itt;
+ ECalComponentDateTime *date;
+ ICalTimezone *zone;
ECalModel *model;
ECalClient *client;
ESourceRegistry *registry;
@@ -7704,8 +7723,7 @@ e_day_view_change_event_time (EDayView *day_view,
/* We use a temporary shallow copy of the ico since we don't want to
* change the original ico here. Otherwise we would not detect that
* the event's time had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
if (e_cal_component_has_attendees (comp) &&
!itip_organizer_is_user (registry, comp, client)) {
@@ -7713,17 +7731,18 @@ e_day_view_change_event_time (EDayView *day_view,
return;
}
- date.value = &itt;
- /* FIXME: Should probably keep the timezone of the original start
- * and end times. */
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
+
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (start_dt, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
- *date.value = icaltime_from_timet_with_zone (start_dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
- *date.value = icaltime_from_timet_with_zone (end_dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ e_cal_component_datetime_take_value (date,
+ i_cal_time_from_timet_with_zone (end_dt, FALSE, zone));
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
+
+ e_cal_component_datetime_free (date);
e_cal_component_commit_sequence (comp);
@@ -7743,10 +7762,10 @@ e_day_view_change_event_time (EDayView *day_view,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
} else if (e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_THIS;
@@ -7903,7 +7922,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
gint day, event_num;
EDayViewEvent *event;
gchar *text = NULL;
- ECalComponentText summary;
+ ECalComponentText *summary = NULL;
ECalComponent *comp;
ECalClient *client;
gboolean on_server;
@@ -7950,8 +7969,11 @@ e_day_view_on_editing_stopped (EDayView *day_view,
NULL);
g_return_if_fail (text != NULL);
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (comp) {
+ g_free (text);
+ return;
+ }
client = event->comp_data->client;
on_server = !event->comp_data->is_new_component;
@@ -7959,7 +7981,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (string_is_empty (text) && !on_server) {
const gchar *uid;
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
e_day_view_foreach_event_with_uid (day_view, uid,
e_day_view_remove_event_cb, NULL);
@@ -7970,24 +7992,25 @@ e_day_view_on_editing_stopped (EDayView *day_view,
}
/* Only update the summary if necessary. */
- e_cal_component_get_summary (comp, &summary);
- if (summary.value && !strcmp (text, summary.value)) {
+ summary = e_cal_component_get_summary (comp);
+ if (summary && !g_strcmp0 (text, e_cal_component_text_get_value (summary))) {
if (day == E_DAY_VIEW_LONG_EVENT)
e_day_view_reshape_long_event (day_view, event_num);
else
e_day_view_update_event_label (
day_view, day,
event_num);
- } else if (summary.value || !string_is_empty (text)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+ } else if ((summary && e_cal_component_text_get_value (summary)) || !string_is_empty (text)) {
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (comp);
- summary.value = text;
- summary.altrep = NULL;
- e_cal_component_set_summary (comp, &summary);
+ if (summary)
+ e_cal_component_text_free (summary);
+ summary = e_cal_component_text_new (text, NULL);
+ e_cal_component_set_summary (comp, summary);
e_cal_component_commit_sequence (comp);
if (!on_server) {
- e_cal_ops_create_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
client, icalcomp,
+ e_cal_ops_create_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
client, icomp,
e_calendar_view_component_created_cb, g_object_ref (day_view),
g_object_unref);
/* we remove the object since we either got the update from the server or failed */
@@ -8001,49 +8024,70 @@ e_day_view_on_editing_stopped (EDayView *day_view,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- ECalComponentDateTime olddt, dt;
- icaltimetype itt;
+ ECalComponentDateTime *olddt, *dt;
+
+ olddt = e_cal_component_get_dtstart (comp);
+
+ if (olddt && e_cal_component_datetime_get_value (olddt) &&
+ i_cal_time_get_timezone (e_cal_component_datetime_get_value
(olddt))) {
+ ICalTime *itt;
- dt.value = &itt;
+ itt = e_cal_component_datetime_get_value (olddt);
- e_cal_component_get_dtstart (comp, &olddt);
- if (olddt.value->zone) {
- *dt.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_start,
- olddt.value->is_date,
- olddt.value->zone);
+ dt = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone
(event->comp_data->instance_start,
+ i_cal_time_is_date (itt),
i_cal_time_get_timezone (itt)),
+ g_strdup (e_cal_component_datetime_get_tzid (olddt)));
} else {
- *dt.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_start,
- olddt.value->is_date,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
+ ICalTime *itt;
+ ICalTimezone *zone;
+
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view));
+ itt = olddt ? e_cal_component_datetime_get_value (olddt) :
NULL;
+
+ dt = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone
(event->comp_data->instance_start,
+ itt ? i_cal_time_is_date (itt) : FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) :
NULL);
}
- dt.tzid = olddt.tzid;
- e_cal_component_set_dtstart (comp, &dt);
- dt.tzid = NULL;
- e_cal_component_free_datetime (&olddt);
-
- e_cal_component_get_dtend (comp, &olddt);
- if (olddt.value->zone) {
- *dt.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_end,
- olddt.value->is_date,
- olddt.value->zone);
+ e_cal_component_set_dtstart (comp, dt);
+
+ e_cal_component_datetime_free (olddt);
+ e_cal_component_datetime_free (dt);
+
+ olddt = e_cal_component_get_dtend (comp);
+
+ if (olddt && e_cal_component_datetime_get_value (olddt) &&
+ i_cal_time_get_timezone (e_cal_component_datetime_get_value
(olddt))) {
+ ICalTime *itt;
+
+ itt = e_cal_component_datetime_get_value (olddt);
+
+ dt = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone
(event->comp_data->instance_end,
+ i_cal_time_is_date (itt),
i_cal_time_get_timezone (itt)),
+ g_strdup (e_cal_component_datetime_get_tzid (olddt)));
} else {
- *dt.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_end,
- olddt.value->is_date,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
+ ICalTime *itt;
+ ICalTimezone *zone;
+
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view));
+ itt = olddt ? e_cal_component_datetime_get_value (olddt) :
NULL;
+
+ dt = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone
(event->comp_data->instance_end,
+ itt ? i_cal_time_is_date (itt) : FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) :
NULL);
}
- dt.tzid = olddt.tzid;
- e_cal_component_set_dtend (comp, &dt);
- dt.tzid = NULL;
- e_cal_component_free_datetime (&olddt);
+ e_cal_component_set_dtend (comp, dt);
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_datetime_free (olddt);
+ e_cal_component_datetime_free (dt);
+
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
e_cal_component_commit_sequence (comp);
}
@@ -8059,6 +8103,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
out:
+ e_cal_component_text_free (summary);
g_object_unref (comp);
g_free (text);
@@ -8077,7 +8122,7 @@ e_day_view_convert_grid_position_to_time (EDayView *day_view,
{
ECalendarView *cal_view;
gint time_divisions;
- struct icaltimetype tt;
+ ICalTime *tt;
time_t val;
gint minutes;
@@ -8094,15 +8139,18 @@ e_day_view_convert_grid_position_to_time (EDayView *day_view,
if (minutes == 60 * 24)
return day_view->day_starts[col + 1];
- /* Create an icaltimetype and convert to a time_t. */
- tt = icaltime_from_timet_with_zone (
+ /* Create an ICalTime and convert to a time_t. */
+ tt = i_cal_time_from_timet_with_zone (
day_view->day_starts[col],
FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
- tt.hour = minutes / 60;
- tt.minute = minutes % 60;
- tt.second = 0;
+ i_cal_time_set_hour (tt, minutes / 60);
+ i_cal_time_set_minute (tt, minutes % 60);
+ i_cal_time_set_second (tt, 0);
+
+ val = i_cal_time_as_timet_with_zone (tt, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+
+ g_clear_object (&tt);
- val = icaltime_as_timet_with_zone (tt, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
return val;
}
@@ -8113,7 +8161,7 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
gint *row)
{
ECalendarView *cal_view;
- struct icaltimetype tt;
+ ICalTime *tt;
gint time_divisions;
gint day, minutes;
gint days_shown;
@@ -8136,14 +8184,16 @@ e_day_view_convert_time_to_grid_position (EDayView *day_view,
}
}
- /* To find the row we need to convert the time to an icaltimetype,
+ /* To find the row we need to convert the time to an ICalTime,
* calculate the offset in minutes from the top of the display and
* divide it by the mins per row setting. */
- tt = icaltime_from_timet_with_zone (time, FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
+ tt = i_cal_time_from_timet_with_zone (time, FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
- minutes = tt.hour * 60 + tt.minute;
+ minutes = i_cal_time_get_hour (tt) * 60 + i_cal_time_get_minute (tt);
minutes -= day_view->first_hour_shown * 60 + day_view->first_minute_shown;
+ g_clear_object (&tt);
+
*row = minutes / time_divisions;
if (*row < 0 || *row >= day_view->rows)
@@ -8737,7 +8787,7 @@ e_day_view_update_top_canvas_drag (EDayView *day_view,
const gchar *summary;
if (event && is_comp_data_valid (event)) {
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
text = g_strdup (summary);
} else {
text = NULL;
@@ -8914,7 +8964,7 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
const gchar *summary;
if (event && is_comp_data_valid (event)) {
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
text = g_strdup (summary);
} else {
text = NULL;
@@ -9050,7 +9100,7 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
EDayView *day_view)
{
EDayViewEvent *event;
- icalcomponent *vcal;
+ ICalComponent *vcal;
gint day, event_num;
gchar *comp_str;
@@ -9085,10 +9135,10 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
vcal = e_cal_util_new_top_level ();
e_cal_util_add_timezones_from_component (
vcal, event->comp_data->icalcomp);
- icalcomponent_add_component (
- vcal, icalcomponent_new_clone (event->comp_data->icalcomp));
+ i_cal_component_take_component (
+ vcal, i_cal_component_new_clone (event->comp_data->icalcomp));
- comp_str = icalcomponent_as_ical_string_r (vcal);
+ comp_str = i_cal_component_as_ical_string_r (vcal);
if (comp_str) {
ESource *source;
const gchar *source_uid;
@@ -9107,7 +9157,7 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
g_free (tmp);
}
- icalcomponent_free (vcal);
+ g_clear_object (&vcal);
g_free (comp_str);
}
@@ -9126,9 +9176,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
gint day, start_day, end_day, num_days;
gint start_offset, end_offset;
ECalComponent *comp;
- ECalComponentDateTime date;
ESourceRegistry *registry;
- struct icaltimetype itt;
time_t dt;
gboolean all_day_event;
ECalModel *model;
@@ -9166,9 +9214,12 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
x, y, &day,
NULL);
if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
+ ECalComponentDateTime *date;
ECalObjModType mod = E_CAL_OBJ_MOD_ALL;
ECalClient *client;
GtkWindow *toplevel;
+ ICalTime *itt;
+ ICalTimezone *zone;
num_days = 1;
start_offset = 0;
@@ -9218,8 +9269,9 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
* Otherwise we would not detect that the event's time
* had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone
(event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (e_cal_component_has_attendees (comp) &&
!itip_organizer_is_user (registry, comp, client)) {
@@ -9246,38 +9298,32 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
else
all_day_event = FALSE;
- date.value = &itt;
-
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
dt = day_view->day_starts[day] + start_offset * 60;
- itt = icaltime_from_timet_with_zone (
- dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ itt = i_cal_time_from_timet_with_zone (dt, FALSE, zone);
if (all_day_event) {
- itt.is_date = TRUE;
- date.tzid = NULL;
+ i_cal_time_set_is_date (itt, TRUE);
+ date = e_cal_component_datetime_new_take (itt, NULL);
} else {
- /* FIXME: Should probably keep the timezone of
- * the original start and end times. */
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
+ date = e_cal_component_datetime_new_take (itt,
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
}
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
+ e_cal_component_datetime_free (date);
if (end_offset == 0)
dt = day_view->day_starts[day + num_days];
else
dt = day_view->day_starts[day + num_days - 1] + end_offset * 60;
- itt = icaltime_from_timet_with_zone (
- dt, FALSE,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)));
+ itt = i_cal_time_from_timet_with_zone (dt, FALSE, zone);
if (all_day_event) {
- itt.is_date = TRUE;
- date.tzid = NULL;
+ i_cal_time_set_is_date (itt, TRUE);
+ date = e_cal_component_datetime_new_take (itt, NULL);
} else {
- /* FIXME: Should probably keep the timezone of
- * the original start and end times. */
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
+ date = e_cal_component_datetime_new_take (itt,
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
}
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -9299,10 +9345,10 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
} else if (e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_THIS;
@@ -9322,8 +9368,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (length >= 0 && format == 8 && !drag_from_same_window) {
/* We are dragging between different window */
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
pos = e_day_view_convert_position_in_top_canvas (
day_view,
@@ -9332,15 +9378,15 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
- icalcomp = icalparser_parse_string ((const gchar *) data);
- if (!icalcomp)
+ icomp = i_cal_parser_parse_string ((const gchar *) data);
+ if (!icomp)
goto error;
/* check the type of the component */
- kind = icalcomponent_isa (icalcomp);
- icalcomponent_free (icalcomp);
+ kind = i_cal_component_isa (icomp);
+ g_clear_object (&icomp);
- if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
+ if (kind != I_CAL_VCALENDAR_COMPONENT && kind != I_CAL_VEVENT_COMPONENT)
goto error;
e_cal_ops_paste_components (model, (const gchar *) data);
@@ -9371,9 +9417,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
gint start_offset, end_offset;
ECalModel *model;
ECalComponent *comp;
- ECalComponentDateTime date;
ESourceRegistry *registry;
- struct icaltimetype itt;
time_t dt;
gboolean drag_from_same_window;
const guchar *data;
@@ -9412,9 +9456,11 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
x, y, &day,
&row, NULL);
if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
+ ECalComponentDateTime *date;
ECalObjModType mod = E_CAL_OBJ_MOD_ALL;
ECalClient *client;
GtkWindow *toplevel;
+ ICalTimezone *zone;
num_rows = 1;
start_offset = 0;
@@ -9462,8 +9508,9 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
* don't want to change the original comp here.
* Otherwise we would not detect that the event's time
* had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone
(event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (e_cal_component_has_attendees (comp) &&
!itip_organizer_is_user (registry, comp, client)) {
@@ -9485,17 +9532,22 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
return;
}
- date.value = &itt;
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW
(day_view)));
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
dt = e_day_view_convert_grid_position_to_time (day_view, day, row) + start_offset *
60;
- *date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
+ e_cal_component_datetime_free (date);
+
dt = e_day_view_convert_grid_position_to_time (day_view, day, row + num_rows) -
end_offset * 60;
- *date.value = icaltime_from_timet_with_zone (dt, FALSE,
- e_calendar_view_get_timezone
(E_CALENDAR_VIEW (day_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ date = e_cal_component_datetime_new_take (
+ i_cal_time_from_timet_with_zone (dt, FALSE, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
+ e_cal_component_datetime_free (date);
+
e_cal_component_abort_sequence (comp);
gtk_drag_finish (context, TRUE, TRUE, time);
@@ -9518,10 +9570,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
} else if (e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_THIS;
@@ -9541,8 +9593,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (length >= 0 && format == 8 && !drag_from_same_window) {
/* We are dragging between different window */
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
pos = e_day_view_convert_position_in_main_canvas (
day_view,
@@ -9551,15 +9603,15 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
- icalcomp = icalparser_parse_string ((const gchar *) data);
- if (!icalcomp)
+ icomp = i_cal_parser_parse_string ((const gchar *) data);
+ if (!icomp)
goto error;
/* check the type of the component */
- kind = icalcomponent_isa (icalcomp);
- icalcomponent_free (icalcomp);
+ kind = i_cal_component_isa (icomp);
+ g_object_unref (&icomp);
- if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
+ if (kind != I_CAL_VCALENDAR_COMPONENT && kind != I_CAL_VEVENT_COMPONENT)
goto error;
e_cal_ops_paste_components (model, (const gchar *) data);
@@ -9677,7 +9729,7 @@ e_day_view_is_editing (EDayView *day_view)
static void
day_view_update_timezone_name_label (GtkWidget *label,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
const gchar *location, *dash;
gchar *markup;
@@ -9687,11 +9739,11 @@ day_view_update_timezone_name_label (GtkWidget *label,
if (!zone) {
location = NULL;
} else {
- location = icaltimezone_get_location (zone);
+ location = i_cal_timezone_get_location (zone);
if (location && *location)
location = _(location);
if (!location || !*location)
- location = icaltimezone_get_tzid (zone);
+ location = i_cal_timezone_get_tzid (zone);
}
if (!location)
@@ -9711,7 +9763,7 @@ day_view_update_timezone_name_label (GtkWidget *label,
void
e_day_view_update_timezone_name_labels (EDayView *day_view)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (E_IS_DAY_VIEW (day_view));
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..f42a824eac 100644
--- a/src/calendar/gui/e-memo-table.c
+++ b/src/calendar/gui/e-memo-table.c
@@ -39,6 +39,7 @@
#include "e-cal-ops.h"
#include "e-calendar-view.h"
#include "e-cell-date-edit-text.h"
+#include "itip-utils.h"
#include "print.h"
#include "misc.h"
@@ -50,6 +51,9 @@ struct _EMemoTablePrivate {
gpointer shell_view; /* weak pointer */
ECalModel *model;
+ /* Fields used for cut/copy/paste */
+ ICalComponent *tmp_vcal;
+
GtkTargetList *copy_target_list;
GtkTargetList *paste_target_list;
};
@@ -115,24 +119,20 @@ memo_table_get_current_time (ECellDateEdit *ecde,
{
EMemoTable *memo_table = user_data;
ECalModel *model;
- icaltimezone *zone;
- struct tm tmp_tm = { 0 };
- struct icaltimetype tt;
+ ICalTimezone *zone;
+ ICalTime *tt;
+ struct tm tmp_tm;
/* Get the current timezone. */
model = e_memo_table_get_model (memo_table);
zone = e_cal_model_get_timezone (model);
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, zone);
/* Now copy it to the struct tm and return it. */
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
+
+ g_clear_object (&tt);
return tmp_tm;
}
@@ -323,7 +323,6 @@ memo_table_constructed (GObject *object)
e_table_extras_add_cell (extras, "dateedit", popup_cell);
g_object_unref (popup_cell);
- memo_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
e_cell_date_edit_set_get_time_callback (
E_CELL_DATE_EDIT (popup_cell),
@@ -401,15 +400,12 @@ 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;
- icalcomponent *clone;
- icaltimezone *zone, *default_zone;
+ ECalComponentOrganizer *organizer;
+ ECalComponentDateTime *dtstart, *dtdue;
+ ICalTimezone *zone, *default_zone;
GSList *desc, *p;
gint len;
ESelectionModel *esm;
@@ -438,12 +434,9 @@ memo_table_query_tooltip (GtkWidget *widget,
if (!comp_data || !comp_data->icalcomp)
return FALSE;
- new_comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- if (!e_cal_component_set_icalcomponent (new_comp, clone)) {
- g_object_unref (new_comp);
+ new_comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
+ if (!new_comp)
return FALSE;
- }
e_utils_get_theme_color (widget, "theme_selected_bg_color", E_UTILS_DEFAULT_THEME_SELECTED_BG_COLOR,
&sel_bg);
e_utils_get_theme_color (widget, "theme_selected_fg_color", E_UTILS_DEFAULT_THEME_SELECTED_FG_COLOR,
&sel_fg);
@@ -452,17 +445,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->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 +464,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);
@@ -486,22 +474,22 @@ memo_table_query_tooltip (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
w = l;
- e_cal_component_get_organizer (new_comp, &organizer);
- if (organizer.cn) {
- gchar *ptr;
- ptr = strchr (organizer.value, ':');
+ organizer = e_cal_component_get_organizer (new_comp);
+ if (organizer && e_cal_component_organizer_get_cn (organizer)) {
+ const gchar *email;
+
+ email = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
- if (ptr) {
- ptr++;
+ if (email) {
tmp = g_strdup_printf (
/* Translators: It will display
* "Organizer: NameOfTheUser <email ofuser com>" */
- _("Organizer: %s <%s>"), organizer.cn, ptr);
+ _("Organizer: %s <%s>"), e_cal_component_organizer_get_cn (organizer), email);
} else {
/* With SunOne accounts, there may be no ':' in
* organizer.value */
tmp = g_strdup_printf (
- _("Organizer: %s"), organizer.cn);
+ _("Organizer: %s"), e_cal_component_organizer_get_cn (organizer));
}
l = gtk_label_new (tmp);
@@ -513,18 +501,20 @@ memo_table_query_tooltip (GtkWidget *widget,
gtk_widget_override_color (l, GTK_STATE_FLAG_NORMAL, &norm_text);
}
- e_cal_component_get_dtstart (new_comp, &dtstart);
- e_cal_component_get_due (new_comp, &dtdue);
+ e_cal_component_organizer_free (organizer);
+
+ dtstart = e_cal_component_get_dtstart (new_comp);
+ dtdue = e_cal_component_get_due (new_comp);
default_zone = e_cal_model_get_timezone (model);
- if (dtstart.tzid) {
- zone = icalcomponent_get_timezone (
+ if (dtstart && e_cal_component_datetime_get_tzid (dtstart)) {
+ zone = i_cal_component_get_timezone (
e_cal_component_get_icalcomponent (new_comp),
- dtstart.tzid);
+ e_cal_component_datetime_get_tzid (dtstart));
if (!zone)
e_cal_client_get_timezone_sync (
- comp_data->client, dtstart.tzid, &zone, NULL, NULL);
+ comp_data->client, e_cal_component_datetime_get_tzid (dtstart), &zone, NULL,
NULL);
if (!zone)
zone = default_zone;
} else {
@@ -533,12 +523,12 @@ memo_table_query_tooltip (GtkWidget *widget,
tmp2 = g_string_new ("");
- if (dtstart.value) {
+ if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
gchar *str;
- tmp_tm = icaltimetype_to_tm_with_zone (dtstart.value, zone, default_zone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (e_cal_component_datetime_get_value (dtstart),
zone, default_zone);
str = e_datetime_format_format_tm ("calendar", "table",
- dtstart.value->is_date ? DTFormatKindDate : DTFormatKindDateTime,
+ i_cal_time_is_date (e_cal_component_datetime_get_value (dtstart)) ? DTFormatKindDate
: DTFormatKindDateTime,
&tmp_tm);
if (str && *str) {
@@ -550,12 +540,12 @@ memo_table_query_tooltip (GtkWidget *widget,
g_free (str);
}
- if (dtdue.value) {
+ if (dtdue && e_cal_component_datetime_get_value (dtdue)) {
gchar *str;
- tmp_tm = icaltimetype_to_tm_with_zone (dtdue.value, zone, default_zone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (e_cal_component_datetime_get_value (dtdue),
zone, default_zone);
str = e_datetime_format_format_tm ("calendar", "table",
- dtdue.value->is_date ? DTFormatKindDate : DTFormatKindDateTime,
+ i_cal_time_is_date (e_cal_component_datetime_get_value (dtdue)) ? DTFormatKindDate :
DTFormatKindDateTime,
&tmp_tm);
if (str && *str) {
@@ -580,25 +570,26 @@ memo_table_query_tooltip (GtkWidget *widget,
g_string_free (tmp2, TRUE);
- e_cal_component_free_datetime (&dtstart);
- e_cal_component_free_datetime (&dtdue);
+ e_cal_component_datetime_free (dtstart);
+ e_cal_component_datetime_free (dtdue);
tmp2 = g_string_new ("");
- e_cal_component_get_description_list (new_comp, &desc);
+ desc = e_cal_component_get_descriptions (new_comp);
for (len = 0, p = desc; p != NULL; p = p->next) {
ECalComponentText *text = p->data;
- if (text->value != NULL) {
- len += strlen (text->value);
- g_string_append (tmp2, text->value);
+ if (text && e_cal_component_text_get_value (text)) {
+ const gchar *value = e_cal_component_text_get_value (text);
+ len += strlen (value);
+ g_string_append (tmp2, value);
if (len > 1024) {
g_string_set_size (tmp2, 1020);
- g_string_append (tmp2, "...");
+ g_string_append (tmp2, "…");
break;
}
}
}
- e_cal_component_free_text_list (desc);
+ g_slist_free_full (desc, e_cal_component_text_free);
if (tmp2->len) {
l = gtk_label_new (tmp2->str);
@@ -820,12 +811,11 @@ copy_row_cb (gint model_row,
EMemoTable *memo_table;
ECalModelComponent *comp_data;
ECalModel *model;
- gchar *comp_str;
- icalcomponent *child;
+ ICalComponent *child;
memo_table = E_MEMO_TABLE (data);
- g_return_if_fail (memo_table->tmp_vcal != NULL);
+ g_return_if_fail (memo_table->priv->tmp_vcal != NULL);
model = e_memo_table_get_model (memo_table);
comp_data = e_cal_model_get_component_at (model, model_row);
@@ -834,18 +824,12 @@ copy_row_cb (gint model_row,
/* Add timezones to the VCALENDAR component. */
e_cal_util_add_timezones_from_component (
- memo_table->tmp_vcal, comp_data->icalcomp);
+ memo_table->priv->tmp_vcal, comp_data->icalcomp);
/* Add the new component to the VCALENDAR component. */
- comp_str = icalcomponent_as_ical_string_r (comp_data->icalcomp);
- child = icalparser_parse_string (comp_str);
- if (child) {
- icalcomponent_add_component (
- memo_table->tmp_vcal,
- icalcomponent_new_clone (child));
- icalcomponent_free (child);
- }
- g_free (comp_str);
+ child = i_cal_component_new_clone (comp_data->icalcomp);
+ if (child)
+ i_cal_component_take_component (memo_table->priv->tmp_vcal, child);
}
static void
@@ -858,11 +842,11 @@ memo_table_copy_clipboard (ESelectable *selectable)
memo_table = E_MEMO_TABLE (selectable);
/* Create a temporary VCALENDAR object. */
- memo_table->tmp_vcal = e_cal_util_new_top_level ();
+ memo_table->priv->tmp_vcal = e_cal_util_new_top_level ();
e_table_selected_row_foreach (
E_TABLE (memo_table), copy_row_cb, memo_table);
- comp_str = icalcomponent_as_ical_string_r (memo_table->tmp_vcal);
+ comp_str = i_cal_component_as_ical_string_r (memo_table->priv->tmp_vcal);
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
e_clipboard_set_calendar (clipboard, comp_str, -1);
@@ -870,8 +854,7 @@ memo_table_copy_clipboard (ESelectable *selectable)
g_free (comp_str);
- icalcomponent_free (memo_table->tmp_vcal);
- memo_table->tmp_vcal = NULL;
+ g_clear_object (&memo_table->priv->tmp_vcal);
}
static void
@@ -978,9 +961,8 @@ memo_table_delete_selection (ESelectable *selectable)
/* FIXME: this may be something other than a TODO component */
if (comp_data) {
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (
+ i_cal_component_new_clone (comp_data->icalcomp));
}
if (e_cal_model_get_confirm_delete (model))
@@ -992,9 +974,7 @@ memo_table_delete_selection (ESelectable *selectable)
if (delete)
delete_selected_components (memo_table);
- /* free memory */
- if (comp)
- g_object_unref (comp);
+ g_clear_object (&comp);
}
static void
diff --git a/src/calendar/gui/e-memo-table.h b/src/calendar/gui/e-memo-table.h
index 8bbdf363b0..3e8b7d1786 100644
--- a/src/calendar/gui/e-memo-table.h
+++ b/src/calendar/gui/e-memo-table.h
@@ -64,12 +64,6 @@ typedef struct _EMemoTablePrivate EMemoTablePrivate;
struct _EMemoTable {
ETable parent;
- /* The ECell used to view & edit dates. */
- ECellDateEdit *dates_cell;
-
- /* Fields used for cut/copy/paste */
- icalcomponent *tmp_vcal;
-
EMemoTablePrivate *priv;
};
@@ -88,9 +82,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.c b/src/calendar/gui/e-send-options-utils.c
index 122af980d8..bb3cc5157f 100644
--- a/src/calendar/gui/e-send-options-utils.c
+++ b/src/calendar/gui/e-send-options-utils.c
@@ -87,8 +87,14 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
if (!strcmp (value, "none"))
gopts->delay_enabled = FALSE;
else {
+ ICalTime *itt;
+
+ itt = i_cal_time_from_string (value);
+
gopts->delay_enabled = TRUE;
- gopts->delay_until = icaltime_as_timet (icaltime_from_string (value));
+ gopts->delay_until = i_cal_time_as_timet (itt);
+
+ g_clear_object (&itt);
}
}
g_free (value);
@@ -165,78 +171,95 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod,
g_free (value);
}
+static ICalProperty *
+esnd_opts_new_property_take_value (gchar *value)
+{
+ ICalProperty *prop;
+
+ prop = i_cal_property_new_x (value);
+
+ g_free (value);
+
+ return prop;
+}
+
void
e_send_options_utils_fill_component (ESendOptionsDialog *sod,
- ECalComponent *comp,
- icaltimezone *zone)
+ ECalComponent *comp,
+ ICalTimezone *zone)
{
- gint i = 1;
- icalproperty *prop;
- icalcomponent *icalcomp;
+ gint ii;
+ ICalProperty *prop;
+ ICalComponent *icomp;
ESendOptionsGeneral *gopts;
ESendOptionsStatusTracking *sopts;
gopts = sod->data->gopts;
sopts = sod->data->sopts;
- e_cal_component_set_sequence (comp, &i);
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ ii = e_cal_component_get_sequence (comp);
+ if (ii < 1)
+ ii = 1;
+
+ icomp = e_cal_component_get_icalcomponent (comp);
if (e_send_options_get_need_general_options (sod)) {
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", gopts->priority));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-PRIORITY");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", gopts->priority));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-PRIORITY");
+ i_cal_component_take_property (icomp, prop);
if (gopts->reply_enabled) {
if (gopts->reply_convenient)
- prop = icalproperty_new_x ("convenient");
+ prop = i_cal_property_new_x ("convenient");
else
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d",
gopts->reply_within));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-REPLY");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d",
gopts->reply_within));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-REPLY");
+ i_cal_component_take_property (icomp, prop);
}
if (gopts->expiration_enabled && gopts->expire_after) {
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d",
gopts->expire_after));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-EXPIRE");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d",
gopts->expire_after));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-EXPIRE");
+ i_cal_component_take_property (icomp, prop);
}
if (gopts->delay_enabled) {
- struct icaltimetype temp;
+ ICalTime *temp;
gchar *str;
- temp = icaltime_from_timet_with_zone (gopts->delay_until, FALSE, zone);
+ temp = i_cal_time_from_timet_with_zone (gopts->delay_until, FALSE, zone);
- str = icaltime_as_ical_string_r (temp);
- prop = icalproperty_new_x (str);
+ str = i_cal_time_as_ical_string_r (temp);
+ prop = i_cal_property_new_x (str);
g_free (str);
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DELAY");
- icalcomponent_add_property (icalcomp, prop);
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-DELAY");
+ i_cal_component_take_property (icomp, prop);
+
+ g_clear_object (&temp);
}
}
if (sopts->tracking_enabled)
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->track_when));
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", sopts->track_when));
else
- prop = icalproperty_new_x ("0");
+ prop = i_cal_property_new_x ("0");
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-TRACKINFO");
- icalcomponent_add_property (icalcomp, prop);
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-TRACKINFO");
+ i_cal_component_take_property (icomp, prop);
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->opened));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-OPENED");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", sopts->opened));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-OPENED");
+ i_cal_component_take_property (icomp, prop);
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->accepted));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-ACCEPTED");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", sopts->accepted));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-ACCEPTED");
+ i_cal_component_take_property (icomp, prop);
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->declined));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DECLINED");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", sopts->declined));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-DECLINED");
+ i_cal_component_take_property (icomp, prop);
- prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->completed));
- icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-COMPLETED");
- icalcomponent_add_property (icalcomp, prop);
+ prop = esnd_opts_new_property_take_value (g_strdup_printf ("%d", sopts->completed));
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-OPTIONS-COMPLETED");
+ i_cal_component_take_property (icomp, prop);
}
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..b63b2b03cb 100644
--- a/src/calendar/gui/e-task-table.c
+++ b/src/calendar/gui/e-task-table.c
@@ -55,6 +55,9 @@ struct _ETaskTablePrivate {
ECalModel *model;
GCancellable *completed_cancellable; /* when processing completed tasks */
+ /* Fields used for cut/copy/paste */
+ ICalComponent *tmp_vcal;
+
GtkTargetList *copy_target_list;
GtkTargetList *paste_target_list;
@@ -270,7 +273,7 @@ task_table_dates_cell_before_popup_cb (ECellDateEdit *dates_cell,
model = e_task_table_get_model (task_table);
comp_data = e_cal_model_get_component_at (model, row);
- date_only = comp_data && comp_data->client && e_client_check_capability (E_CLIENT
(comp_data->client), CAL_STATIC_CAPABILITY_TASK_DATE_ONLY);
+ date_only = comp_data && comp_data->client && e_client_check_capability (E_CLIENT
(comp_data->client), E_CAL_STATIC_CAPABILITY_TASK_DATE_ONLY);
g_object_set (G_OBJECT (dates_cell), "show-time", !date_only, NULL);
}
@@ -490,13 +493,12 @@ task_table_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
e_table_extras_add_cell (extras, "dateedit", popup_cell);
- g_object_unref (popup_cell);
-
- task_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
- g_signal_connect (task_table->dates_cell, "before-popup",
+ g_signal_connect (popup_cell, "before-popup",
G_CALLBACK (task_table_dates_cell_before_popup_cb), task_table);
+ g_object_unref (popup_cell);
+
e_cell_date_edit_set_get_time_callback (
E_CELL_DATE_EDIT (popup_cell),
e_task_table_get_current_time, task_table, NULL);
@@ -713,10 +715,10 @@ task_table_popup_menu (GtkWidget *widget)
static gboolean
task_table_query_tooltip (GtkWidget *widget,
- gint x,
- gint y,
- gboolean keyboard_mode,
- GtkTooltip *tooltip)
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip)
{
ETaskTable *task_table;
ECalModel *model;
@@ -724,15 +726,12 @@ 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;
- const gchar *str;
+ gchar *tmp, *summary, *str;
GString *tmp2;
- gboolean free_text = FALSE;
ECalComponent *new_comp;
- ECalComponentOrganizer organizer;
- ECalComponentDateTime dtstart, dtdue;
- icalcomponent *clone;
- icaltimezone *zone, *default_zone;
+ ECalComponentOrganizer *organizer;
+ ECalComponentDateTime *dtstart, *dtdue;
+ ICalTimezone *zone, *default_zone;
GSList *desc, *p;
gint len;
ESelectionModel *esm;
@@ -759,12 +758,9 @@ task_table_query_tooltip (GtkWidget *widget,
if (!comp_data || !comp_data->icalcomp)
return FALSE;
- new_comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- if (!e_cal_component_set_icalcomponent (new_comp, clone)) {
- g_object_unref (new_comp);
+ new_comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
+ if (!new_comp)
return FALSE;
- }
e_utils_get_theme_color (widget, "theme_selected_bg_color", E_UTILS_DEFAULT_THEME_SELECTED_BG_COLOR,
&sel_bg);
e_utils_get_theme_color (widget, "theme_selected_fg_color", E_UTILS_DEFAULT_THEME_SELECTED_FG_COLOR,
&sel_fg);
@@ -773,17 +769,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->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 +788,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);
@@ -807,20 +798,20 @@ task_table_query_tooltip (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
w = l;
- e_cal_component_get_organizer (new_comp, &organizer);
- if (organizer.cn) {
- gchar *ptr;
- ptr = strchr (organizer.value, ':');
+ organizer = e_cal_component_get_organizer (new_comp);
+ if (organizer && e_cal_component_organizer_get_cn (organizer)) {
+ const gchar *email;
+
+ email = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
- if (ptr) {
- ptr++;
+ if (email) {
/* To Translators: It will display
* "Organizer: NameOfTheUser <email ofuser com>" */
- tmp = g_strdup_printf (_("Organizer: %s <%s>"), organizer.cn, ptr);
+ tmp = g_strdup_printf (_("Organizer: %s <%s>"), e_cal_component_organizer_get_cn
(organizer), email);
} else {
/* With SunOne accounts, there may be no ':' in
* organizer.value. */
- tmp = g_strdup_printf (_("Organizer: %s"), organizer.cn);
+ tmp = g_strdup_printf (_("Organizer: %s"), e_cal_component_organizer_get_cn
(organizer));
}
l = gtk_label_new (tmp);
@@ -832,7 +823,9 @@ task_table_query_tooltip (GtkWidget *widget,
gtk_widget_override_color (l, GTK_STATE_FLAG_NORMAL, &norm_text);
}
- e_cal_component_get_location (new_comp, &str);
+ e_cal_component_organizer_free (organizer);
+
+ str = e_cal_component_get_location (new_comp);
if (str) {
/* Translators: It will display "Location: PlaceOfTheMeeting" */
@@ -845,20 +838,21 @@ task_table_query_tooltip (GtkWidget *widget,
gtk_label_set_max_width_chars ((GtkLabel *) l, 80);
gtk_box_pack_start (GTK_BOX (w), l, FALSE, FALSE, 0);
g_free (tmp);
+ g_free (str);
}
- e_cal_component_get_dtstart (new_comp, &dtstart);
- e_cal_component_get_due (new_comp, &dtdue);
+ dtstart = e_cal_component_get_dtstart (new_comp);
+ dtdue = e_cal_component_get_due (new_comp);
default_zone = e_cal_model_get_timezone (model);
- if (dtstart.tzid) {
- zone = icalcomponent_get_timezone (
+ if (dtstart && e_cal_component_datetime_get_tzid (dtstart)) {
+ zone = i_cal_component_get_timezone (
e_cal_component_get_icalcomponent (new_comp),
- dtstart.tzid);
+ e_cal_component_datetime_get_tzid (dtstart));
if (!zone)
e_cal_client_get_timezone_sync (
- comp_data->client, dtstart.tzid, &zone, NULL, NULL);
+ comp_data->client, e_cal_component_datetime_get_tzid (dtstart), &zone, NULL,
NULL);
if (!zone)
zone = default_zone;
} else {
@@ -867,12 +861,12 @@ task_table_query_tooltip (GtkWidget *widget,
tmp2 = g_string_new ("");
- if (dtstart.value) {
+ if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
gchar *str;
- tmp_tm = icaltimetype_to_tm_with_zone (dtstart.value, zone, default_zone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (e_cal_component_datetime_get_value (dtstart),
zone, default_zone);
str = e_datetime_format_format_tm ("calendar", "table",
- dtstart.value->is_date ? DTFormatKindDate : DTFormatKindDateTime,
+ i_cal_time_is_date (e_cal_component_datetime_get_value (dtstart)) ? DTFormatKindDate
: DTFormatKindDateTime,
&tmp_tm);
if (str && *str) {
@@ -883,12 +877,12 @@ task_table_query_tooltip (GtkWidget *widget,
g_free (str);
}
- if (dtdue.value) {
+ if (dtdue && e_cal_component_datetime_get_value (dtdue)) {
gchar *str;
- tmp_tm = icaltimetype_to_tm_with_zone (dtdue.value, zone, default_zone);
+ tmp_tm = e_cal_util_icaltime_to_tm_with_zone (e_cal_component_datetime_get_value (dtdue),
zone, default_zone);
str = e_datetime_format_format_tm ("calendar", "table",
- dtdue.value->is_date ? DTFormatKindDate : DTFormatKindDateTime,
+ i_cal_time_is_date (e_cal_component_datetime_get_value (dtdue)) ? DTFormatKindDate :
DTFormatKindDateTime,
&tmp_tm);
if (str && *str) {
@@ -912,8 +906,8 @@ task_table_query_tooltip (GtkWidget *widget,
g_string_free (tmp2, TRUE);
- e_cal_component_free_datetime (&dtstart);
- e_cal_component_free_datetime (&dtdue);
+ e_cal_component_datetime_free (dtstart);
+ e_cal_component_datetime_free (dtdue);
tmp = e_cal_model_get_attendees_status_info (
model, new_comp, comp_data->client);
@@ -940,13 +934,13 @@ task_table_query_tooltip (GtkWidget *widget,
}
tmp2 = g_string_new ("");
- e_cal_component_get_description_list (new_comp, &desc);
+ desc = e_cal_component_get_descriptions (new_comp);
for (len = 0, p = desc; p != NULL; p = p->next) {
ECalComponentText *text = p->data;
- if (text->value != NULL) {
- len += strlen (text->value);
- g_string_append (tmp2, text->value);
+ if (text && e_cal_component_text_get_value (text)) {
+ len += strlen (e_cal_component_text_get_value (text));
+ g_string_append (tmp2, e_cal_component_text_get_value (text));
if (len > 1024) {
g_string_set_size (tmp2, 1020);
g_string_append (tmp2, "...");
@@ -954,7 +948,7 @@ task_table_query_tooltip (GtkWidget *widget,
}
}
}
- e_cal_component_free_text_list (desc);
+ g_slist_free_full (desc, e_cal_component_text_free);
if (tmp2->len) {
l = gtk_label_new (tmp2->str);
@@ -1180,12 +1174,11 @@ copy_row_cb (gint model_row,
ETaskTable *task_table;
ECalModelComponent *comp_data;
ECalModel *model;
- gchar *comp_str;
- icalcomponent *child;
+ ICalComponent *child;
task_table = E_TASK_TABLE (data);
- g_return_if_fail (task_table->tmp_vcal != NULL);
+ g_return_if_fail (task_table->priv->tmp_vcal != NULL);
model = e_task_table_get_model (task_table);
comp_data = e_cal_model_get_component_at (model, model_row);
@@ -1194,18 +1187,13 @@ copy_row_cb (gint model_row,
/* Add timezones to the VCALENDAR component. */
e_cal_util_add_timezones_from_component (
- task_table->tmp_vcal, comp_data->icalcomp);
+ task_table->priv->tmp_vcal, comp_data->icalcomp);
/* Add the new component to the VCALENDAR component. */
- comp_str = icalcomponent_as_ical_string_r (comp_data->icalcomp);
- child = icalparser_parse_string (comp_str);
+ child = i_cal_component_new_clone (comp_data->icalcomp);
if (child) {
- icalcomponent_add_component (
- task_table->tmp_vcal,
- icalcomponent_new_clone (child));
- icalcomponent_free (child);
+ i_cal_component_take_component (task_table->priv->tmp_vcal, child);
}
- g_free (comp_str);
}
static void
@@ -1218,11 +1206,11 @@ task_table_copy_clipboard (ESelectable *selectable)
task_table = E_TASK_TABLE (selectable);
/* Create a temporary VCALENDAR object. */
- task_table->tmp_vcal = e_cal_util_new_top_level ();
+ task_table->priv->tmp_vcal = e_cal_util_new_top_level ();
e_table_selected_row_foreach (
E_TABLE (task_table), copy_row_cb, task_table);
- comp_str = icalcomponent_as_ical_string_r (task_table->tmp_vcal);
+ comp_str = i_cal_component_as_ical_string_r (task_table->priv->tmp_vcal);
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
e_clipboard_set_calendar (clipboard, comp_str, -1);
@@ -1230,8 +1218,7 @@ task_table_copy_clipboard (ESelectable *selectable)
g_free (comp_str);
- icalcomponent_free (task_table->tmp_vcal);
- task_table->tmp_vcal = NULL;
+ g_clear_object (&task_table->priv->tmp_vcal);
}
/* Helper for calenable_table_paste_clipboard() */
@@ -1327,23 +1314,23 @@ static void
add_retract_data (ECalComponent *comp,
const gchar *retract_comment)
{
- icalcomponent *icalcomp = NULL;
- icalproperty *icalprop = NULL;
+ ICalComponent *icomp = NULL;
+ ICalProperty *prop = NULL;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
if (retract_comment && *retract_comment)
- icalprop = icalproperty_new_x (retract_comment);
+ prop = i_cal_property_new_x (retract_comment);
else
- icalprop = icalproperty_new_x ("0");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
- icalcomponent_add_property (icalcomp, icalprop);
+ prop = i_cal_property_new_x ("0");
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-RETRACT-COMMENT");
+ i_cal_component_take_property (icomp, prop);
}
static gboolean
check_for_retract (ECalComponent *comp,
ECalClient *client)
{
- ECalComponentOrganizer org;
+ ECalComponentOrganizer *org;
gchar *email = NULL;
const gchar *strip = NULL;
gboolean ret_val;
@@ -1354,15 +1341,21 @@ check_for_retract (ECalComponent *comp,
if (!e_cal_client_check_save_schedules (client))
return FALSE;
- e_cal_component_get_organizer (comp, &org);
- strip = itip_strip_mailto (org.value);
+ org = e_cal_component_get_organizer (comp);
+ strip = org ? itip_strip_mailto (e_cal_component_organizer_get_value (org)) : NULL;
+
+ if (!strip || !*strip) {
+ e_cal_component_organizer_free (org);
+ return FALSE;
+ }
ret_val = e_client_get_backend_property_sync (
E_CLIENT (client),
- CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
+ E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
&email, NULL, NULL) && email != NULL &&
g_ascii_strcasecmp (email, strip) == 0;
+ e_cal_component_organizer_free (org);
g_free (email);
return ret_val;
@@ -1393,9 +1386,8 @@ task_table_delete_selection (ESelectable *selectable)
/* FIXME: this may be something other than a TODO component */
if (comp_data) {
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (
+ i_cal_component_new_clone (comp_data->icalcomp));
}
if ((n_selected == 1) && comp && check_for_retract (comp, comp_data->client)) {
@@ -1404,13 +1396,13 @@ task_table_delete_selection (ESelectable *selectable)
delete = e_cal_dialogs_prompt_retract (GTK_WIDGET (task_table), comp, &retract_comment,
&retract);
if (retract) {
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp;
add_retract_data (comp, retract_comment);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ i_cal_component_set_method (icomp, I_CAL_METHOD_CANCEL);
- e_cal_ops_send_component (model, comp_data->client, icalcomp);
+ e_cal_ops_send_component (model, comp_data->client, icomp);
}
g_free (retract_comment);
@@ -1423,9 +1415,7 @@ task_table_delete_selection (ESelectable *selectable)
if (delete)
delete_selected_components (task_table);
- /* free memory */
- if (comp)
- g_object_unref (comp);
+ g_clear_object (&comp);
}
static void
@@ -1710,7 +1700,7 @@ hide_completed_rows_ready (GObject *source_object,
ECalComponent *comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (m->data));
+ comp, i_cal_component_new_clone (m->data));
id = e_cal_component_get_id (comp);
comp_data = e_cal_model_get_component_for_client_and_uid (model, cal_client, id);
@@ -1724,11 +1714,11 @@ hide_completed_rows_ready (GObject *source_object,
E_TABLE_MODEL (model), pos);
changed = TRUE;
}
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_object_unref (comp);
}
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
if (changed) {
/* To notify about changes, because in call of
@@ -1781,7 +1771,7 @@ show_completed_rows_ready (GObject *source_object,
ECalComponent *comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (m->data));
+ comp, i_cal_component_new_clone (m->data));
id = e_cal_component_get_id (comp);
if (!(e_cal_model_get_component_for_client_and_uid (model, cal_client, id))) {
@@ -1790,7 +1780,7 @@ show_completed_rows_ready (GObject *source_object,
E_TYPE_CAL_MODEL_COMPONENT, NULL);
comp_data->client = g_object_ref (cal_client);
comp_data->icalcomp =
- icalcomponent_new_clone (m->data);
+ i_cal_component_new_clone (m->data);
e_cal_model_set_instance_times (
comp_data,
e_cal_model_get_timezone (model));
@@ -1805,11 +1795,11 @@ show_completed_rows_ready (GObject *source_object,
E_TABLE_MODEL (model),
comp_objects->len - 1);
}
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_object_unref (comp);
}
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
}
/* Returns the current time, for the ECellDateEdit items.
@@ -1821,24 +1811,19 @@ e_task_table_get_current_time (ECellDateEdit *ecde,
{
ETaskTable *task_table = data;
ECalModel *model;
- icaltimezone *zone;
- struct tm tmp_tm = { 0 };
- struct icaltimetype tt;
+ ICalTimezone *zone;
+ ICalTime *tt;
+ struct tm tmp_tm;
/* Get the current timezone. */
model = e_task_table_get_model (task_table);
zone = e_cal_model_get_timezone (model);
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, zone);
+
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
- /* Now copy it to the struct tm and return it. */
- tmp_tm.tm_year = tt.year - 1900;
- tmp_tm.tm_mon = tt.month - 1;
- tmp_tm.tm_mday = tt.day;
- tmp_tm.tm_hour = tt.hour;
- tmp_tm.tm_min = tt.minute;
- tmp_tm.tm_sec = tt.second;
- tmp_tm.tm_isdst = -1;
+ g_clear_object (&tt);
return tmp_tm;
}
diff --git a/src/calendar/gui/e-task-table.h b/src/calendar/gui/e-task-table.h
index 09e68c1ec6..f87517183d 100644
--- a/src/calendar/gui/e-task-table.h
+++ b/src/calendar/gui/e-task-table.h
@@ -62,12 +62,6 @@ typedef struct _ETaskTablePrivate ETaskTablePrivate;
struct _ETaskTable {
ETable parent;
- /* The ECell used to view & edit dates. */
- ECellDateEdit *dates_cell;
-
- /* Fields used for cut/copy/paste */
- icalcomponent *tmp_vcal;
-
ETaskTablePrivate *priv;
};
diff --git a/src/calendar/gui/e-timezone-entry.c b/src/calendar/gui/e-timezone-entry.c
index 725780a1f3..6acdaea126 100644
--- a/src/calendar/gui/e-timezone-entry.c
+++ b/src/calendar/gui/e-timezone-entry.c
@@ -44,12 +44,7 @@ struct _ETimezoneEntryPrivate {
* or from the timezone dialog. Note that we don't copy it or
* use a ref count - we assume it is never destroyed for the
* lifetime of this widget. */
- icaltimezone *timezone;
-
- /* This can be set to the default timezone. If the current timezone
- * setting in the ETimezoneEntry matches this, then the entry field
- * is hidden. This makes the user interface simpler. */
- icaltimezone *default_zone;
+ ICalTimezone *timezone;
GtkWidget *entry;
GtkWidget *button;
@@ -80,17 +75,17 @@ timezone_entry_update_entry (ETimezoneEntry *timezone_entry)
{
const gchar *display_name;
gchar *name_buffer;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
timezone = e_timezone_entry_get_timezone (timezone_entry);
if (timezone != NULL) {
- display_name = icaltimezone_get_display_name (timezone);
+ display_name = i_cal_timezone_get_display_name (timezone);
/* We check if it is one of our builtin timezone
* names, in which case we call gettext to translate
* it. If it isn't a builtin timezone name, we don't. */
- if (icaltimezone_get_builtin_timezone (display_name))
+ if (i_cal_timezone_get_builtin_timezone (display_name))
display_name = _(display_name);
} else
display_name = "";
@@ -166,7 +161,7 @@ timezone_entry_button_clicked_cb (ETimezoneEntry *timezone_entry)
ETimezoneDialog *timezone_dialog;
GtkWidget *toplevel;
GtkWidget *dialog;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
timezone_dialog = e_timezone_dialog_new ();
@@ -200,7 +195,7 @@ timezone_entry_set_property (GObject *object,
case PROP_TIMEZONE:
e_timezone_entry_set_timezone (
E_TIMEZONE_ENTRY (object),
- g_value_get_pointer (value));
+ g_value_get_object (value));
return;
}
@@ -215,7 +210,7 @@ timezone_entry_get_property (GObject *object,
{
switch (property_id) {
case PROP_TIMEZONE:
- g_value_set_pointer (
+ g_value_set_object (
value, e_timezone_entry_get_timezone (
E_TIMEZONE_ENTRY (object)));
return;
@@ -224,6 +219,17 @@ timezone_entry_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
+static void
+timezone_entry_get_finalize (GObject *object)
+{
+ ETimezoneEntry *tzentry = E_TIMEZONE_ENTRY (object);
+
+ g_clear_object (&tzentry->priv->timezone);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (e_timezone_entry_parent_class)->finalize (object);
+}
+
static gboolean
timezone_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
@@ -285,6 +291,7 @@ e_timezone_entry_class_init (ETimezoneEntryClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = timezone_entry_set_property;
object_class->get_property = timezone_entry_get_property;
+ object_class->finalize = timezone_entry_get_finalize;
widget_class = GTK_WIDGET_CLASS (class);
widget_class->mnemonic_activate = timezone_entry_mnemonic_activate;
@@ -293,10 +300,11 @@ e_timezone_entry_class_init (ETimezoneEntryClass *class)
g_object_class_install_property (
object_class,
PROP_TIMEZONE,
- g_param_spec_pointer (
+ g_param_spec_object (
"timezone",
"Timezone",
NULL,
+ I_CAL_TYPE_TIMEZONE,
G_PARAM_READWRITE));
signals[CHANGED] = g_signal_new (
@@ -350,7 +358,7 @@ e_timezone_entry_new (void)
return g_object_new (E_TYPE_TIMEZONE_ENTRY, NULL);
}
-icaltimezone *
+ICalTimezone *
e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry)
{
g_return_val_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry), NULL);
@@ -360,31 +368,19 @@ e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry)
void
e_timezone_entry_set_timezone (ETimezoneEntry *timezone_entry,
- icaltimezone *timezone)
+ const ICalTimezone *timezone)
{
g_return_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry));
if (timezone_entry->priv->timezone == timezone)
return;
- timezone_entry->priv->timezone = timezone;
+ g_clear_object (&timezone_entry->priv->timezone);
+ if (timezone)
+ timezone_entry->priv->timezone = e_cal_util_copy_timezone (timezone);
timezone_entry_update_entry (timezone_entry);
timezone_entry_add_relation (timezone_entry);
g_object_notify (G_OBJECT (timezone_entry), "timezone");
}
-
-/* Sets the default timezone. If the current timezone matches this,
- * then the entry field is hidden. This is useful since most people
- * do not use timezones so it makes the user interface simpler. */
-void
-e_timezone_entry_set_default_timezone (ETimezoneEntry *timezone_entry,
- icaltimezone *timezone)
-{
- g_return_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry));
-
- timezone_entry->priv->default_zone = timezone;
-
- timezone_entry_update_entry (timezone_entry);
-}
diff --git a/src/calendar/gui/e-timezone-entry.h b/src/calendar/gui/e-timezone-entry.h
index e5de7492b4..be59c6f590 100644
--- a/src/calendar/gui/e-timezone-entry.h
+++ b/src/calendar/gui/e-timezone-entry.h
@@ -72,16 +72,9 @@ struct _ETimezoneEntryClass {
GType e_timezone_entry_get_type (void);
GtkWidget * e_timezone_entry_new (void);
-icaltimezone * e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry);
+ICalTimezone * e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry);
void e_timezone_entry_set_timezone (ETimezoneEntry *timezone_entry,
- icaltimezone *timezone);
-
-/* Sets the default timezone. If the current timezone matches this,
- * then the entry field is hidden. This is useful since most people
- * do not use timezones so it makes the user interface simpler. */
-void e_timezone_entry_set_default_timezone
- (ETimezoneEntry *timezone_entry,
- icaltimezone *timezone);
+ const ICalTimezone *timezone);
G_END_DECLS
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index fdf55c9e68..73ebd22915 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -170,70 +170,73 @@ etdp_free_component_refs (gpointer ptr)
}
static guint
-etdp_create_date_mark (const struct icaltimetype *itt)
+etdp_create_date_mark (/* const */ ICalTime *itt)
{
if (!itt)
return 0;
- return itt->year * 10000 + itt->month * 100 + itt->day;
+ return i_cal_time_get_year (itt) * 10000 +
+ i_cal_time_get_month (itt) * 100 +
+ i_cal_time_get_day (itt);
}
static void
-etdp_itt_to_zone (struct icaltimetype *itt,
+etdp_itt_to_zone (ICalTime *itt,
const gchar *itt_tzid,
ECalClient *client,
- icaltimezone *default_zone)
+ ICalTimezone *default_zone)
{
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
g_return_if_fail (itt != NULL);
if (itt_tzid) {
- e_cal_client_get_timezone_sync (client, itt_tzid, &zone, NULL, NULL);
- } else if (icaltime_is_utc (*itt)) {
- zone = icaltimezone_get_utc_timezone ();
+ if (!e_cal_client_get_timezone_sync (client, itt_tzid, &zone, NULL, NULL))
+ zone = NULL;
+ } else if (i_cal_time_is_utc (itt)) {
+ zone = i_cal_timezone_get_utc_timezone ();
}
if (zone)
- icaltimezone_convert_time (itt, zone, default_zone);
+ i_cal_timezone_convert_time (itt, zone, default_zone);
}
static gchar *
etdp_date_time_to_string (const ECalComponentDateTime *dt,
ECalClient *client,
- icaltimezone *default_zone,
+ ICalTimezone *default_zone,
guint today_date_mark,
gboolean is_task,
gboolean use_24hour_format,
- struct icaltimetype *out_itt)
+ ICalTime **out_itt)
{
gboolean is_overdue;
gchar *res;
g_return_val_if_fail (dt != NULL, NULL);
- g_return_val_if_fail (dt->value != NULL, NULL);
+ g_return_val_if_fail (e_cal_component_datetime_get_value (dt) != NULL, NULL);
g_return_val_if_fail (out_itt != NULL, NULL);
- *out_itt = *dt->value;
+ *out_itt = i_cal_time_new_clone (e_cal_component_datetime_get_value (dt));
- etdp_itt_to_zone (out_itt, dt->tzid, client, default_zone);
+ etdp_itt_to_zone (*out_itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);
- is_overdue = is_task && etdp_create_date_mark (out_itt) < today_date_mark;
+ is_overdue = is_task && etdp_create_date_mark (*out_itt) < today_date_mark;
- if (out_itt->is_date && !is_overdue)
+ if (i_cal_time_is_date (*out_itt) && !is_overdue)
return NULL;
if (is_overdue) {
struct tm tm;
- tm = icaltimetype_to_tm (out_itt);
+ tm = e_cal_util_icaltime_to_tm (*out_itt);
- res = e_datetime_format_format_tm ("calendar", "table", out_itt->is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
+ res = e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (*out_itt) ?
DTFormatKindDate : DTFormatKindDateTime, &tm);
} else {
if (use_24hour_format) {
- res = g_strdup_printf ("%d:%02d", out_itt->hour, out_itt->minute);
+ res = g_strdup_printf ("%d:%02d", i_cal_time_get_hour (*out_itt),
i_cal_time_get_minute (*out_itt));
} else {
- gint hour = out_itt->hour;
+ gint hour = i_cal_time_get_hour (*out_itt);
const gchar *suffix;
if (hour < 12) {
@@ -248,10 +251,10 @@ etdp_date_time_to_string (const ECalComponentDateTime *dt,
if (hour == 0)
hour = 12;
- if (!out_itt->minute)
+ if (!i_cal_time_get_minute (*out_itt))
res = g_strdup_printf ("%d %s", hour, suffix);
else
- res = g_strdup_printf ("%d:%02d %s", hour, out_itt->minute, suffix);
+ res = g_strdup_printf ("%d:%02d %s", hour, i_cal_time_get_minute (*out_itt),
suffix);
}
}
@@ -279,37 +282,42 @@ etdp_append_to_string_escaped (GString *str,
static gchar *
etdp_format_date_time (ECalClient *client,
- icaltimezone *default_zone,
- const struct icaltimetype *in_itt,
+ ICalTimezone *default_zone,
+ const ICalTime *in_itt,
const gchar *tzid)
{
- struct icaltimetype itt;
+ ICalTime *itt;
struct tm tm;
+ gchar *res;
if (!in_itt)
return NULL;
- itt = *in_itt;
+ itt = i_cal_time_new_clone ((ICalTime *) in_itt);
+
+ etdp_itt_to_zone (itt, tzid, client, default_zone);
- etdp_itt_to_zone (&itt, tzid, client, default_zone);
+ tm = e_cal_util_icaltime_to_tm (itt);
- tm = icaltimetype_to_tm (&itt);
+ res = e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (itt) ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
- return e_datetime_format_format_tm ("calendar", "table", itt.is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
+ g_clear_object (&itt);
+
+ return res;
}
-static const gchar *
-etdp_get_component_summary (icalcomponent *icalcomp)
+static gchar *
+etdp_dup_component_summary (ICalComponent *icomp)
{
- const gchar *summary;
+ gchar *summary;
- if (!icalcomp)
- return "";
+ if (!icomp)
+ return g_strdup ("");
- summary = icalcomponent_get_summary (icalcomp);
+ summary = e_calendar_view_dup_component_summary (icomp);
- if (!summary || !*summary)
- summary = "";
+ if (!summary)
+ summary = g_strdup ("");
return summary;
}
@@ -318,7 +326,7 @@ static gboolean
etdp_get_component_data (EToDoPane *to_do_pane,
ECalClient *client,
ECalComponent *comp,
- icaltimezone *default_zone,
+ ICalTimezone *default_zone,
guint today_date_mark,
gchar **out_summary,
gchar **out_tooltip,
@@ -327,13 +335,14 @@ etdp_get_component_data (EToDoPane *to_do_pane,
gchar **out_sort_key,
guint *out_date_mark)
{
- icalcomponent *icalcomp;
- ECalComponentDateTime dt = { 0 };
+ ICalComponent *icomp;
+ ECalComponentDateTime *dt;
ECalComponentId *id;
- struct icaltimetype itt = icaltime_null_time ();
- const gchar *prefix, *location, *description;
+ ICalTime *itt = NULL;
+ const gchar *prefix, *location, *description, *uid_str, *rid_str;
gboolean task_has_due_date = TRUE, is_cancelled = FALSE; /* ignored for events, thus like being set */
- icalproperty_status status = ICAL_STATUS_NONE;
+ ICalPropertyStatus status;
+ gchar *comp_summary;
GString *tooltip;
g_return_val_if_fail (E_IS_TO_DO_PANE (to_do_pane), FALSE);
@@ -346,16 +355,18 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_return_val_if_fail (out_sort_key, FALSE);
g_return_val_if_fail (out_date_mark, FALSE);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- g_return_val_if_fail (icalcomp != NULL, FALSE);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_val_if_fail (icomp != NULL, FALSE);
- location = icalcomponent_get_location (icalcomp);
+ location = i_cal_component_get_location (icomp);
if (location && !*location)
location = NULL;
tooltip = g_string_sized_new (512);
- etdp_append_to_string_escaped (tooltip, "<b>%s</b>", etdp_get_component_summary (icalcomp), NULL);
+ comp_summary = etdp_dup_component_summary (icomp);
+
+ etdp_append_to_string_escaped (tooltip, "<b>%s</b>", comp_summary, NULL);
if (location) {
g_string_append (tooltip, "\n");
@@ -366,24 +377,26 @@ etdp_get_component_data (EToDoPane *to_do_pane,
*out_is_task = e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO;
*out_is_completed = FALSE;
- e_cal_component_get_status (comp, &status);
- is_cancelled = status == ICAL_STATUS_CANCELLED;
+ status = e_cal_component_get_status (comp);
+ is_cancelled = status == I_CAL_STATUS_CANCELLED;
if (*out_is_task) {
- ECalComponentDateTime dtstart = { 0 };
- struct icaltimetype *completed = NULL;
+ ECalComponentDateTime *dtstart;
+ ICalTime *completed;
/* Tasks after events */
prefix = "1";
- e_cal_component_get_dtstart (comp, &dtstart);
- e_cal_component_get_due (comp, &dt);
- e_cal_component_get_completed (comp, &completed);
+ dtstart = e_cal_component_get_dtstart (comp);
+ dt = e_cal_component_get_due (comp);
+ completed = e_cal_component_get_completed (comp);
- if (dtstart.value) {
+ if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
gchar *tmp;
- tmp = etdp_format_date_time (client, default_zone, dtstart.value, dtstart.tzid);
+ tmp = etdp_format_date_time (client, default_zone,
+ e_cal_component_datetime_get_value (dtstart),
+ e_cal_component_datetime_get_tzid (dtstart));
g_string_append (tooltip, "\n");
/* Translators: It will display "Start: StartDateAndTime" */
@@ -391,19 +404,21 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (tmp);
- if (!dt.value) {
+ if (!dt || !e_cal_component_datetime_get_value (dt)) {
/* Fill the itt structure in case the task has no Due date */
- itt = *dtstart.value;
- etdp_itt_to_zone (&itt, dtstart.tzid, client, default_zone);
+ itt = i_cal_time_new_clone (e_cal_component_datetime_get_value (dtstart));
+ etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dtstart), client,
default_zone);
}
-
- e_cal_component_free_datetime (&dtstart);
}
- if (dt.value) {
+ e_cal_component_datetime_free (dtstart);
+
+ if (dt && e_cal_component_datetime_get_value (dt)) {
gchar *tmp;
- tmp = etdp_format_date_time (client, default_zone, dt.value, dt.tzid);
+ tmp = etdp_format_date_time (client, default_zone,
+ e_cal_component_datetime_get_value (dt),
+ e_cal_component_datetime_get_tzid (dt));
g_string_append (tooltip, "\n");
/* Translators: It will display "Due: DueDateAndTime" */
@@ -426,34 +441,36 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (tmp);
*out_is_completed = TRUE;
- e_cal_component_free_icaltimetype (completed);
} else {
- *out_is_completed = *out_is_completed || status == ICAL_STATUS_COMPLETED;
+ *out_is_completed = *out_is_completed || status == I_CAL_STATUS_COMPLETED;
}
+
+ g_clear_object (&completed);
} else {
/* Events first */
prefix = "0";
- e_cal_component_get_dtstart (comp, &dt);
+ dt = e_cal_component_get_dtstart (comp);
- if (dt.value) {
- ECalComponentDateTime dtend = { 0 };
- struct icaltimetype ittstart, ittend;
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ ECalComponentDateTime *dtend;
+ ICalTime *ittstart, *ittend;
gchar *strstart, *strduration;
- e_cal_component_get_dtend (comp, &dtend);
+ dtend = e_cal_component_get_dtend (comp);
- ittstart = *dt.value;
- if (dtend.value)
- ittend = *dtend.value;
+ ittstart = i_cal_time_new_clone (e_cal_component_datetime_get_value (dt));
+ if (dtend && e_cal_component_datetime_get_value (dtend))
+ ittend = i_cal_time_new_clone (e_cal_component_datetime_get_value (dtend));
else
- ittend = ittstart;
+ ittend = i_cal_time_new_clone (ittstart);
- etdp_itt_to_zone (&ittstart, dt.tzid, client, default_zone);
- etdp_itt_to_zone (&ittend, dtend.value ? dtend.tzid : dt.tzid, client, default_zone);
+ etdp_itt_to_zone (ittstart, e_cal_component_datetime_get_tzid (dt), client,
default_zone);
+ etdp_itt_to_zone (ittend, (dtend && e_cal_component_datetime_get_value (dtend)) ?
+ e_cal_component_datetime_get_tzid (dtend) : e_cal_component_datetime_get_tzid
(dt), client, default_zone);
- strstart = etdp_format_date_time (client, default_zone, &ittstart, NULL);
- strduration = calculate_time (icaltime_as_timet (ittstart), icaltime_as_timet
(ittend));
+ strstart = etdp_format_date_time (client, default_zone, ittstart, NULL);
+ strduration = calculate_time (i_cal_time_as_timet (ittstart), i_cal_time_as_timet
(ittend));
g_string_append (tooltip, "\n");
/* Translators: It will display "Time: StartDateAndTime (Duration)" */
@@ -462,21 +479,25 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (strduration);
g_free (strstart);
- e_cal_component_free_datetime (&dtend);
+ e_cal_component_datetime_free (dtend);
+ g_clear_object (&ittstart);
+ g_clear_object (&ittend);
}
}
*out_summary = NULL;
- if (dt.value) {
+ if (dt && e_cal_component_datetime_get_value (dt)) {
gchar *time_str;
- time_str = etdp_date_time_to_string (&dt, client, default_zone, today_date_mark, *out_is_task,
+ g_clear_object (&itt);
+
+ time_str = etdp_date_time_to_string (dt, client, default_zone, today_date_mark, *out_is_task,
to_do_pane->priv->use_24hour_format, &itt);
if (time_str) {
*out_summary = g_markup_printf_escaped ("<span size=\"xx-small\">%s</span> %s%s%s%s",
- time_str, etdp_get_component_summary (icalcomp), location ? " (" : "",
+ time_str, comp_summary, location ? " (" : "",
location ? location : "", location ? ")" : "");
}
@@ -484,7 +505,7 @@ etdp_get_component_data (EToDoPane *to_do_pane,
}
if (!*out_summary) {
- *out_summary = g_markup_printf_escaped ("%s%s%s%s", etdp_get_component_summary (icalcomp),
+ *out_summary = g_markup_printf_escaped ("%s%s%s%s", comp_summary,
location ? " (" : "", location ? location : "", location ? ")" : "");
}
@@ -504,32 +525,44 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (tmp);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
id = e_cal_component_get_id (comp);
+ uid_str = (id && e_cal_component_id_get_uid (id)) ? e_cal_component_id_get_uid (id) : "";
+ rid_str = (id && e_cal_component_id_get_rid (id)) ? e_cal_component_id_get_rid (id) : "";
if (!task_has_due_date) {
- if (icaltime_is_null_time (itt)) {
+ if (!itt || i_cal_time_is_null_time (itt)) {
/* Sort those without Start date after those with it */
*out_sort_key = g_strdup_printf ("%s-Z-%s-%s-%s",
- prefix, etdp_get_component_summary (icalcomp),
- (id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid : "");
+ prefix, comp_summary,
+ uid_str, rid_str);
} else {
*out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d%02d-%s-%s-%s",
- prefix, itt.year, itt.month, itt.day, itt.hour, itt.minute, itt.second,
- etdp_get_component_summary (icalcomp),
- (id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid : "");
+ prefix,
+ i_cal_time_get_year (itt),
+ i_cal_time_get_month (itt),
+ i_cal_time_get_day (itt),
+ i_cal_time_get_hour (itt),
+ i_cal_time_get_minute (itt),
+ i_cal_time_get_second (itt),
+ comp_summary, uid_str, rid_str);
}
} else {
*out_sort_key = g_strdup_printf ("%s-%04d%02d%02d%02d%02d%02d-%s-%s",
- prefix, itt.year, itt.month, itt.day, itt.hour, itt.minute, itt.second,
- (id && id->uid) ? id->uid : "", (id && id->rid) ? id->rid : "");
+ prefix,
+ itt ? i_cal_time_get_year (itt) : 0,
+ itt ? i_cal_time_get_month (itt) : 0,
+ itt ? i_cal_time_get_day (itt) : 0,
+ itt ? i_cal_time_get_hour (itt) : 0,
+ itt ? i_cal_time_get_minute (itt) : 0,
+ itt ? i_cal_time_get_second (itt) : 0,
+ uid_str, rid_str);
}
- if (id)
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
- description = icalcomponent_get_description (icalcomp);
+ description = i_cal_component_get_description (icomp);
if (description && *description && g_utf8_validate (description, -1, NULL)) {
gchar *tmp = NULL;
glong len;
@@ -552,9 +585,12 @@ etdp_get_component_data (EToDoPane *to_do_pane,
g_free (tmp);
}
- *out_date_mark = etdp_create_date_mark (&itt);
+ *out_date_mark = etdp_create_date_mark (itt);
*out_tooltip = g_string_free (tooltip, FALSE);
+ g_clear_object (&itt);
+ g_free (comp_summary);
+
return TRUE;
}
@@ -573,10 +609,10 @@ static GSList * /* GtkTreePath * */
etdp_get_component_root_paths (EToDoPane *to_do_pane,
ECalClient *client,
ECalComponent *comp,
- icaltimezone *default_zone)
+ ICalTimezone *default_zone)
{
- ECalComponentDateTime dt;
- struct icaltimetype itt;
+ ECalComponentDateTime *dt;
+ ICalTime *itt;
GtkTreePath *first_root_path = NULL;
GtkTreeModel *model;
GSList *roots = NULL;
@@ -588,46 +624,46 @@ etdp_get_component_root_paths (EToDoPane *to_do_pane,
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO) {
- e_cal_component_get_due (comp, &dt);
+ dt = e_cal_component_get_due (comp);
- if (dt.value) {
- itt = *dt.value;
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ itt = e_cal_component_datetime_get_value (dt);
- etdp_itt_to_zone (&itt, dt.tzid, client, default_zone);
- start_date_mark = etdp_create_date_mark (&itt);
+ etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);
+ start_date_mark = etdp_create_date_mark (itt);
} else {
start_date_mark = 0;
}
end_date_mark = start_date_mark;
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
} else {
- e_cal_component_get_dtstart (comp, &dt);
+ dt = e_cal_component_get_dtstart (comp);
- if (dt.value) {
- itt = *dt.value;
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ itt = e_cal_component_datetime_get_value (dt);
- etdp_itt_to_zone (&itt, dt.tzid, client, default_zone);
- start_date_mark = etdp_create_date_mark (&itt);
+ etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);
+ start_date_mark = etdp_create_date_mark (itt);
} else {
start_date_mark = 0;
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
- e_cal_component_get_dtend (comp, &dt);
+ dt = e_cal_component_get_dtend (comp);
- if (dt.value) {
- itt = *dt.value;
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ itt = e_cal_component_datetime_get_value (dt);
- etdp_itt_to_zone (&itt, dt.tzid, client, default_zone);
- end_date_mark = etdp_create_date_mark (&itt);
+ etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);
+ end_date_mark = etdp_create_date_mark (itt);
} else {
end_date_mark = start_date_mark;
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
}
model = GTK_TREE_MODEL (to_do_pane->priv->tree_store);
@@ -783,10 +819,8 @@ etdp_get_comp_colors (EToDoPane *to_do_pane,
time_t *out_nearest_due)
{
GdkRGBA *bgcolor = NULL, fgcolor;
- #ifdef HAVE_ICAL_COLOR_PROPERTY
GdkRGBA stack_bgcolor;
- icalproperty *prop;
- #endif
+ ICalProperty *prop;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
g_return_if_fail (out_bgcolor);
@@ -800,17 +834,17 @@ etdp_get_comp_colors (EToDoPane *to_do_pane,
g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- #ifdef HAVE_ICAL_COLOR_PROPERTY
- prop = icalcomponent_get_first_property (e_cal_component_get_icalcomponent (comp),
ICAL_COLOR_PROPERTY);
+ prop = i_cal_component_get_first_property (e_cal_component_get_icalcomponent (comp),
I_CAL_COLOR_PROPERTY);
if (prop) {
const gchar *color_spec;
- color_spec = icalproperty_get_color (prop);
+ color_spec = i_cal_property_get_color (prop);
if (color_spec && gdk_rgba_parse (&stack_bgcolor, color_spec)) {
bgcolor = &stack_bgcolor;
}
+
+ g_clear_object (&prop);
}
- #endif
if (!bgcolor)
bgcolor = g_hash_table_lookup (to_do_pane->priv->client_colors, e_client_get_source (E_CLIENT
(client)));
@@ -818,35 +852,39 @@ etdp_get_comp_colors (EToDoPane *to_do_pane,
if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_TODO &&
to_do_pane->priv->highlight_overdue &&
to_do_pane->priv->overdue_color) {
- ECalComponentDateTime dt = { 0 };
+ ECalComponentDateTime *dt;
- e_cal_component_get_due (comp, &dt);
+ dt = e_cal_component_get_due (comp);
- if (dt.value) {
- icaltimezone *default_zone;
- struct icaltimetype itt, now;
+ if (dt && e_cal_component_datetime_get_value (dt)) {
+ ICalTimezone *default_zone;
+ ICalTime *itt, *now;
+ gboolean is_date;
default_zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model);
- itt = *dt.value;
- etdp_itt_to_zone (&itt, dt.tzid, client, default_zone);
+ itt = e_cal_component_datetime_get_value (dt);
+ is_date = i_cal_time_is_date (itt);
+ etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);
- now = icaltime_current_time_with_zone (default_zone);
+ now = i_cal_time_current_time_with_zone (default_zone);
- if ((dt.value->is_date && icaltime_compare_date_only (itt, now) < 0) ||
- (!dt.value->is_date && icaltime_compare (itt, now) <= 0)) {
+ if ((is_date && i_cal_time_compare_date_only (itt, now) < 0) ||
+ (!is_date && i_cal_time_compare (itt, now) <= 0)) {
bgcolor = to_do_pane->priv->overdue_color;
} else if (out_nearest_due) {
time_t due_tt;
- due_tt = icaltime_as_timet_with_zone (itt, default_zone);
+ due_tt = i_cal_time_as_timet_with_zone (itt, default_zone);
if (*out_nearest_due == (time_t) -1 ||
*out_nearest_due > due_tt)
*out_nearest_due = due_tt;
}
+
+ g_clear_object (&now);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
}
fgcolor = etdp_get_fgcolor_for_bgcolor (bgcolor);
@@ -866,7 +904,7 @@ etdp_add_component (EToDoPane *to_do_pane,
{
ECalComponentId *id;
ComponentIdent *ident;
- icaltimezone *default_zone;
+ ICalTimezone *default_zone;
GSList *new_root_paths, *new_references, *link;
GtkTreeModel *model;
GtkTreeIter iter = { 0 };
@@ -888,12 +926,12 @@ etdp_add_component (EToDoPane *to_do_pane,
if (!etdp_get_component_data (to_do_pane, client, comp, default_zone, to_do_pane->priv->last_today,
&summary, &tooltip, &is_task, &is_completed, &sort_key, &date_mark)) {
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
return;
}
model = GTK_TREE_MODEL (to_do_pane->priv->tree_store);
- ident = component_ident_new (client, id->uid, id->rid);
+ ident = component_ident_new (client, e_cal_component_id_get_uid (id), e_cal_component_id_get_rid
(id));
new_root_paths = etdp_get_component_root_paths (to_do_pane, client, comp, default_zone);
@@ -946,7 +984,7 @@ etdp_add_component (EToDoPane *to_do_pane,
g_hash_table_insert (to_do_pane->priv->component_refs, component_ident_copy (ident), new_references);
component_ident_free (ident);
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_free (summary);
g_free (tooltip);
g_free (sort_key);
@@ -1349,15 +1387,15 @@ static void
etdp_check_time_changed (EToDoPane *to_do_pane,
gboolean force_update)
{
- icaltimetype itt;
- icaltimezone *zone;
+ ICalTime *itt;
+ ICalTimezone *zone;
guint new_today;
g_return_if_fail (E_IS_TO_DO_PANE (to_do_pane));
zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model);
- itt = icaltime_current_time_with_zone (zone);
- new_today = etdp_create_date_mark (&itt);
+ itt = i_cal_time_current_time_with_zone (zone);
+ new_today = etdp_create_date_mark (itt);
if (force_update || new_today != to_do_pane->priv->last_today) {
gchar *tasks_filter;
@@ -1367,7 +1405,7 @@ etdp_check_time_changed (EToDoPane *to_do_pane,
to_do_pane->priv->last_today = new_today;
- tt_begin = icaltime_as_timet_with_zone (itt, zone);
+ tt_begin = i_cal_time_as_timet_with_zone (itt, zone);
tt_begin = time_day_begin_with_zone (tt_begin, zone);
tt_end = time_add_week_with_zone (tt_begin, 1, zone) + (3600 * 24) - 1;
@@ -1450,11 +1488,11 @@ etdp_check_time_changed (EToDoPane *to_do_pane,
gchar *markup;
guint date_mark;
- tm = icaltimetype_to_tm (&itt);
+ tm = e_cal_util_icaltime_to_tm (itt);
- icaltime_adjust (&itt, 1, 0, 0, 0);
+ i_cal_time_adjust (itt, 1, 0, 0, 0);
- date_mark = etdp_create_date_mark (&itt);
+ date_mark = etdp_create_date_mark (itt);
if (ii == 0) {
markup = g_markup_printf_escaped ("<b>%s</b>", _("Today"));
@@ -1485,7 +1523,7 @@ etdp_check_time_changed (EToDoPane *to_do_pane,
g_free (markup);
} else {
- icaltime_adjust (&itt, 1, 0, 0, 0);
+ i_cal_time_adjust (itt, 1, 0, 0, 0);
}
gtk_tree_path_free (path);
@@ -1507,12 +1545,14 @@ etdp_check_time_changed (EToDoPane *to_do_pane,
etdp_update_all (to_do_pane);
} else {
- time_t now_tt = icaltime_as_timet_with_zone (itt, zone);
+ time_t now_tt = i_cal_time_as_timet_with_zone (itt, zone);
if (to_do_pane->priv->nearest_due != (time_t) -1 &&
to_do_pane->priv->nearest_due <= now_tt)
etdp_update_colors (to_do_pane, TRUE);
}
+
+ g_clear_object (&itt);
}
static gboolean
@@ -1554,7 +1594,7 @@ etdp_settings_map_string_to_icaltimezone (GValue *value,
{
GSettings *settings;
const gchar *location = NULL;
- icaltimezone *timezone = NULL;
+ ICalTimezone *timezone = NULL;
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
@@ -1564,12 +1604,12 @@ etdp_settings_map_string_to_icaltimezone (GValue *value,
location = g_variant_get_string (variant, NULL);
if (location != NULL && *location != '\0')
- timezone = icaltimezone_get_builtin_timezone (location);
+ timezone = i_cal_timezone_get_builtin_timezone (location);
if (timezone == NULL)
- timezone = icaltimezone_get_utc_timezone ();
+ timezone = i_cal_timezone_get_utc_timezone ();
- g_value_set_pointer (value, timezone);
+ g_value_set_object (value, timezone);
g_object_unref (settings);
@@ -1783,28 +1823,30 @@ etdp_new_common (EToDoPane *to_do_pane,
gtk_tree_model_get (model, &iter, COLUMN_DATE_MARK, &date_mark, -1);
if (date_mark > 0) {
- struct icaltimetype now;
+ ICalTime *now;
+ ICalTimezone *zone;
gint time_divisions_secs;
- icaltimezone *zone;
time_divisions_secs = g_settings_get_int (settings, "time-divisions") * 60;
zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model);
- now = icaltime_current_time_with_zone (zone);
+ now = i_cal_time_current_time_with_zone (zone);
- now.year = date_mark / 10000;
- now.month = (date_mark / 100) % 100;
- now.day = date_mark % 100;
+ i_cal_time_set_year (now, date_mark / 10000);
+ i_cal_time_set_month (now, (date_mark / 100) % 100);
+ i_cal_time_set_day (now, date_mark % 100);
/* The date_mark is the next day, not the day it belongs to */
- icaltime_adjust (&now, -1, 0, 0, 0);
+ i_cal_time_adjust (now, -1, 0, 0, 0);
- dtstart = icaltime_as_timet_with_zone (now, zone);
+ dtstart = i_cal_time_as_timet_with_zone (now, zone);
if (dtstart > 0 && time_divisions_secs > 0) {
dtstart = dtstart + time_divisions_secs - (dtstart %
time_divisions_secs);
dtend = dtstart + time_divisions_secs;
} else {
dtstart = 0;
}
+
+ g_clear_object (&now);
}
}
@@ -1918,7 +1960,7 @@ etdp_remove_component_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (rod != NULL);
- e_cal_client_remove_object_sync (rod->client, rod->uid, rod->rid, rod->mod, cancellable, error);
+ e_cal_client_remove_object_sync (rod->client, rod->uid, rod->rid, rod->mod,
E_CAL_OPERATION_FLAG_NONE, cancellable, error);
}
static void
@@ -1943,7 +1985,7 @@ etdp_delete_common (EToDoPane *to_do_pane,
g_return_if_fail (id != NULL);
if (!e_cal_dialogs_delete_component (comp, FALSE, 1, e_cal_component_get_vtype (comp),
GTK_WIDGET (to_do_pane))) {
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_clear_object (&client);
g_clear_object (&comp);
return;
@@ -1972,8 +2014,8 @@ etdp_delete_common (EToDoPane *to_do_pane,
rod = g_new0 (RemoveOperationData,1);
rod->client = g_object_ref (client);
- rod->uid = g_strdup (id->uid);
- rod->rid = g_strdup (id->rid);
+ rod->uid = g_strdup (e_cal_component_id_get_uid (id));
+ rod->rid = g_strdup (e_cal_component_id_get_rid (id));
rod->mod = mod;
source = e_client_get_source (E_CLIENT (client));
@@ -1984,7 +2026,7 @@ etdp_delete_common (EToDoPane *to_do_pane,
cancellable = e_cal_data_model_submit_thread_job (to_do_pane->priv->events_data_model,
description, alert_ident,
display_name, etdp_remove_component_thread, rod, remove_operation_data_free);
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_clear_object (&cancellable);
g_free (display_name);
}
diff --git a/src/calendar/gui/e-week-view-event-item.c b/src/calendar/gui/e-week-view-event-item.c
index b651b8a278..4193a3b25e 100644
--- a/src/calendar/gui/e-week-view-event-item.c
+++ b/src/calendar/gui/e-week-view-event-item.c
@@ -446,9 +446,9 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
if (!is_comp_data_valid (event))
return;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
if (e_cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
diff --git a/src/calendar/gui/e-week-view-main-item.c b/src/calendar/gui/e-week-view-main-item.c
index e09606735c..3c051766ca 100644
--- a/src/calendar/gui/e-week-view-main-item.c
+++ b/src/calendar/gui/e-week-view-main-item.c
@@ -94,18 +94,18 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
if (!today) {
ECalendarView *view;
- struct icaltimetype tt;
- const icaltimezone *zone;
+ ICalTime *tt;
+ ICalTimezone *zone;
view = E_CALENDAR_VIEW (week_view);
zone = e_calendar_view_get_timezone (view);
/* Check if we are drawing today */
- tt = icaltime_from_timet_with_zone (
- time (NULL), FALSE, zone);
- today = g_date_get_year (date) == tt.year
- && g_date_get_month (date) == tt.month
- && g_date_get_day (date) == tt.day;
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, zone);
+ today = g_date_get_year (date) == i_cal_time_get_year (tt) &&
+ g_date_get_month (date) == i_cal_time_get_month (tt) &&
+ g_date_get_day (date) == i_cal_time_get_day (tt);
+ g_clear_object (&tt);
}
/* Draw the background of the day. In the month view odd months are
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index 40fad7aade..0a0e8399d5 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -214,35 +214,23 @@ week_view_process_component (EWeekView *week_view,
{
ECalComponent *comp = NULL;
AddEventData add_event_data;
- /* rid is never used in this function? */
- const gchar *uid;
- gchar *rid = NULL;
/* If we don't have a valid date set yet, just return. */
if (!g_date_valid (&week_view->priv->first_day_shown))
return;
- comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) {
- g_object_unref (comp);
-
- g_message (G_STRLOC ": Could not set icalcomponent on ECalComponent");
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
+ if (!comp) {
+ g_message (G_STRLOC ": Could not set ICalComponent on ECalComponent");
return;
}
- e_cal_component_get_uid (comp, &uid);
- if (e_cal_component_is_instance (comp))
- rid = e_cal_component_get_recurid_as_string (comp);
- else
- rid = NULL;
-
/* Add the object */
add_event_data.week_view = week_view;
add_event_data.comp_data = comp_data;
e_week_view_add_event (comp_data->client, comp, comp_data->instance_start, comp_data->instance_end,
FALSE, &add_event_data);
g_object_unref (comp);
- g_free (rid);
}
static void
@@ -253,20 +241,14 @@ week_view_update_row (EWeekView *week_view,
ECalModel *model;
gint event_num;
const gchar *uid;
- gchar *rid = NULL;
+ gchar *rid;
model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view));
comp_data = e_cal_model_get_component_at (model, row);
g_return_if_fail (comp_data != NULL);
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
- icalproperty *prop;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_RECURRENCEID_PROPERTY);
- if (prop)
- rid = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(comp_data->icalcomp));
- }
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (e_week_view_find_event_from_uid (week_view, comp_data->client, uid, rid, &event_num))
e_week_view_remove_event_cb (week_view, event_num, NULL);
@@ -309,20 +291,15 @@ week_view_model_comps_deleted_cb (EWeekView *week_view,
for (l = list; l != NULL; l = g_slist_next (l)) {
gint event_num;
const gchar *uid;
- gchar *rid = NULL;
+ gchar *rid;
ECalModelComponent *comp_data = l->data;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
- if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
- icalproperty *prop;
-
- prop = icalcomponent_get_first_property (comp_data->icalcomp,
ICAL_RECURRENCEID_PROPERTY);
- if (prop)
- rid = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(comp_data->icalcomp));
- }
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (e_week_view_find_event_from_uid (week_view, comp_data->client, uid, rid, &event_num))
e_week_view_remove_event_cb (week_view, event_num, NULL);
+
g_free (rid);
}
@@ -387,7 +364,7 @@ e_week_view_precalc_visible_time_range (ECalendarView *cal_view,
GDateWeekday display_start_day;
guint day_offset, week_start_offset;
gint num_days;
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (E_IS_WEEK_VIEW (cal_view));
g_return_if_fail (out_start_time != NULL);
@@ -396,7 +373,7 @@ e_week_view_precalc_visible_time_range (ECalendarView *cal_view,
week_view = E_WEEK_VIEW (cal_view);
zone = e_calendar_view_get_timezone (cal_view);
- time_to_gdate_with_zone (&date, in_start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW
(week_view)));
+ time_to_gdate_with_zone (&date, in_start_time, zone);
weekday = g_date_get_weekday (&date);
display_start_day = e_week_view_get_display_start_day (week_view);
@@ -425,7 +402,7 @@ e_week_view_precalc_visible_time_range (ECalendarView *cal_view,
g_date_add_days (&end_date, num_days);
g_date_subtract_days (&end_date, day_offset);
- time_to_gdate_with_zone (&in_end_date, in_end_time, e_calendar_view_get_timezone
(E_CALENDAR_VIEW (week_view)));
+ time_to_gdate_with_zone (&in_end_date, in_end_time, zone);
while (g_date_days_between (&end_date, &in_end_date) >= 6) {
g_date_add_days (&end_date, 7);
@@ -532,13 +509,13 @@ week_view_time_range_changed_cb (EWeekView *week_view,
static void
timezone_changed_cb (ECalModel *cal_model,
- icaltimezone *old_zone,
- icaltimezone *new_zone,
- gpointer user_data)
+ ICalTimezone *old_zone,
+ ICalTimezone *new_zone,
+ gpointer user_data)
{
ECalendarView *cal_view = (ECalendarView *) user_data;
GDate *first_day_shown;
- struct icaltimetype tt = icaltime_null_time ();
+ ICalTime *tt = NULL;
time_t lower;
EWeekView *week_view = (EWeekView *) cal_view;
@@ -556,13 +533,18 @@ timezone_changed_cb (ECalModel *cal_model,
if (!g_date_valid (first_day_shown))
return;
+ tt = i_cal_time_null_time ();
+
/* Recalculate the new start of the first week. We just use exactly
* the same time, but with the new timezone. */
- tt.year = g_date_get_year (first_day_shown);
- tt.month = g_date_get_month (first_day_shown);
- tt.day = g_date_get_day (first_day_shown);
+ i_cal_time_set_date (tt,
+ g_date_get_year (first_day_shown),
+ g_date_get_month (first_day_shown),
+ g_date_get_day (first_day_shown));
+
+ lower = i_cal_time_as_timet_with_zone (tt, new_zone);
- lower = icaltime_as_timet_with_zone (tt, new_zone);
+ g_clear_object (&tt);
e_week_view_recalc_day_starts (week_view, lower);
e_week_view_update_query (week_view);
@@ -659,43 +641,41 @@ new_event_in_rage_data_free (gpointer ptr)
static void
week_view_new_event_in_selected_range_cb (ECalModel *model,
ECalClient *client,
- icalcomponent *default_component,
+ ICalComponent *default_component,
gpointer user_data)
{
NewEventInRangeData *ned = user_data;
ECalComponent *comp = NULL;
gint event_num;
- ECalComponentDateTime date;
- struct icaltimetype itt;
+ ECalComponentDateTime *date;
const gchar *uid;
AddEventData add_event_data;
EWeekViewEvent *wvevent;
EWeekViewEventSpan *span;
- icaltimezone *zone;
+ ICalTimezone *zone;
/* Check if the client is read only */
if (e_client_is_readonly (E_CLIENT (client)))
goto exit;
/* Add a new event covering the selected range. */
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (default_component));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (default_component));
g_return_if_fail (comp != NULL);
- uid = icalcomponent_get_uid (default_component);
-
- date.value = &itt;
- date.tzid = NULL;
+ uid = i_cal_component_get_uid (default_component);
zone = e_cal_model_get_timezone (model);
/* We use DATE values now, so we don't need the timezone. */
/*date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));*/
- *date.value = icaltime_from_timet_with_zone (ned->dtstart, TRUE, zone);
- e_cal_component_set_dtstart (comp, &date);
+ date = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone (ned->dtstart, TRUE, zone),
NULL);
+ e_cal_component_set_dtstart (comp, date);
+ e_cal_component_datetime_free (date);
- *date.value = icaltime_from_timet_with_zone (ned->dtend, TRUE, zone);
- e_cal_component_set_dtend (comp, &date);
+ date = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone (ned->dtend, TRUE, zone),
NULL);
+ e_cal_component_set_dtend (comp, date);
+ e_cal_component_datetime_free (date);
/* Editor default in week/month view */
e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_TRANSPARENT);
@@ -2225,8 +2205,6 @@ e_week_view_set_first_day_shown (EWeekView *week_view,
gint num_days;
gboolean update_adjustment_value = FALSE;
guint32 old_selection_start_julian = 0, old_selection_end_julian = 0;
- struct icaltimetype start_tt = icaltime_null_time ();
- time_t start_time;
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
@@ -2261,16 +2239,23 @@ e_week_view_set_first_day_shown (EWeekView *week_view,
/* See if we need to update the first day shown. */
if (!g_date_valid (&week_view->priv->first_day_shown)
|| g_date_compare (&week_view->priv->first_day_shown, &base_date)) {
+ ICalTime *start_tt;
+ time_t start_time;
+
week_view->priv->first_day_shown = base_date;
- start_tt.year = g_date_get_year (&base_date);
- start_tt.month = g_date_get_month (&base_date);
- start_tt.day = g_date_get_day (&base_date);
+ start_tt = i_cal_time_null_time ();
+ i_cal_time_set_date (start_tt,
+ g_date_get_year (&base_date),
+ g_date_get_month (&base_date),
+ g_date_get_day (&base_date));
- start_time = icaltime_as_timet_with_zone (
+ start_time = i_cal_time_as_timet_with_zone (
start_tt,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
+ g_clear_object (&start_tt);
+
e_week_view_recalc_day_starts (week_view, start_time);
e_week_view_update_query (week_view);
}
@@ -2672,42 +2657,54 @@ set_style_from_attendee (EWeekViewEvent *event,
ECalComponent *comp;
GSList *attendees = NULL, *l;
gchar *address;
- ECalComponentAttendee *at = NULL;
+ ICalParameterPartstat partstat = I_CAL_PARTSTAT_NONE;
if (!is_comp_data_valid (event))
return;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
+
address = itip_get_comp_attendee (
registry, comp, event->comp_data->client);
- e_cal_component_get_attendee_list (comp, &attendees);
- for (l = attendees; l; l = l->next) {
+ attendees = e_cal_component_get_attendees (comp);
+ for (l = attendees; l && address; l = l->next) {
ECalComponentAttendee *attendee = l->data;
+ const gchar *value, *sentby;
+
+ if (!attendee)
+ continue;
- if ((attendee->value && g_strcmp0 (itip_strip_mailto (attendee->value), address) == 0)
- || (attendee->sentby && g_strcmp0 (itip_strip_mailto (attendee->sentby), address) == 0)) {
- at = attendee;
+ value = e_cal_component_attendee_get_value (attendee);
+ if (value)
+ value = itip_strip_mailto (value);
+ sentby = e_cal_component_attendee_get_sentby (attendee);
+ if (sentby)
+ sentby = itip_strip_mailto (sentby);
+ if ((value && g_ascii_strcasecmp (value, address) == 0) ||
+ (sentby && g_ascii_strcasecmp (sentby, address) == 0)) {
+ partstat = e_cal_component_attendee_get_partstat (attendee);
break;
}
}
- if (icalcomponent_get_status (event->comp_data->icalcomp) == ICAL_STATUS_CANCELLED)
+ if (i_cal_component_get_status (event->comp_data->icalcomp) == I_CAL_STATUS_CANCELLED)
gnome_canvas_item_set (span->text_item, "strikeout", TRUE, NULL);
/* The attendee has not yet accepted the meeting, display the summary as bolded.
* If the attendee is not present, it might have come through a mailing list.
* In that case, we never show the meeting as bold even if it is unaccepted. */
- if (at && at->status == ICAL_PARTSTAT_NEEDSACTION)
+ if (partstat == I_CAL_PARTSTAT_NEEDSACTION)
gnome_canvas_item_set (span->text_item, "bold", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_DECLINED)
+ else if (partstat == I_CAL_PARTSTAT_DECLINED)
gnome_canvas_item_set (span->text_item, "strikeout", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_TENTATIVE)
+ else if (partstat == I_CAL_PARTSTAT_TENTATIVE)
gnome_canvas_item_set (span->text_item, "italic", TRUE, NULL);
- else if (at && at->status == ICAL_PARTSTAT_DELEGATED)
+ else if (partstat == I_CAL_PARTSTAT_DELEGATED)
gnome_canvas_item_set (span->text_item, "italic", TRUE, "strikeout", TRUE, NULL);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
g_free (address);
g_object_unref (comp);
}
@@ -2735,7 +2732,7 @@ e_week_view_foreach_event_with_uid (EWeekView *week_view,
if (!is_comp_data_valid (event))
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (!(*callback) (week_view, event_num, data))
return;
@@ -3344,7 +3341,7 @@ e_week_view_add_event (ECalClient *client,
AddEventData *add_event_data;
EWeekViewEvent event;
gint num_days;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
add_event_data = data;
@@ -3357,10 +3354,10 @@ e_week_view_add_event (ECalClient *client,
if (end != start || end < add_event_data->week_view->day_starts[0])
g_return_if_fail (end > add_event_data->week_view->day_starts[0]);
- start_tt = icaltime_from_timet_with_zone (
+ start_tt = i_cal_time_from_timet_with_zone (
start, FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view)));
- end_tt = icaltime_from_timet_with_zone (
+ end_tt = i_cal_time_from_timet_with_zone (
end, FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->week_view)));
@@ -3371,8 +3368,9 @@ e_week_view_add_event (ECalClient *client,
event.comp_data->is_new_component = TRUE;
event.comp_data->client = g_object_ref (client);
e_cal_component_abort_sequence (comp);
- event.comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent
(comp));
+ event.comp_data->icalcomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent
(comp));
}
+
event.start = start;
event.end = end;
event.tooltip = NULL;
@@ -3383,8 +3381,8 @@ e_week_view_add_event (ECalClient *client,
event.comp_data->instance_start = start;
event.comp_data->instance_end = end;
- event.start_minute = start_tt.hour * 60 + start_tt.minute;
- event.end_minute = end_tt.hour * 60 + end_tt.minute;
+ event.start_minute = i_cal_time_get_hour (start_tt) * 60 + i_cal_time_get_minute (start_tt);
+ event.end_minute = i_cal_time_get_hour (end_tt) * 60 + i_cal_time_get_minute (end_tt);
if (event.end_minute == 0 && start != end)
event.end_minute = 24 * 60;
@@ -3401,6 +3399,9 @@ e_week_view_add_event (ECalClient *client,
g_array_append_val (add_event_data->week_view->events, event);
add_event_data->week_view->events_sorted = FALSE;
add_event_data->week_view->events_need_layout = TRUE;
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
}
/* This lays out the events, or reshapes them, as necessary. */
@@ -3492,8 +3493,8 @@ e_week_view_reshape_events (EWeekView *week_view)
week_view, event_num, span_num);
if (week_view->last_edited_comp_string == NULL)
continue;
- current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
- if (strncmp (current_comp_string, week_view->last_edited_comp_string,50) == 0) {
+ current_comp_string = i_cal_component_as_ical_string_r (event->comp_data->icalcomp);
+ if (strncmp (current_comp_string, week_view->last_edited_comp_string, 50) == 0) {
EWeekViewEventSpan *span;
if (!is_array_index_in_bounds (week_view->spans, event->spans_index +
span_num)) {
@@ -3685,28 +3686,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 (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;
}
@@ -3769,8 +3769,9 @@ e_week_view_reshape_event_span (EWeekView *week_view,
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp)
+ return;
one_day_event = e_week_view_is_one_day_event (week_view, event_num);
@@ -3844,12 +3845,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,12 +3864,11 @@ 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);
- else if (icalcomponent_get_status (event->comp_data->icalcomp) == ICAL_STATUS_CANCELLED)
+ else if (i_cal_component_get_status (event->comp_data->icalcomp) == I_CAL_STATUS_CANCELLED)
gnome_canvas_item_set (span->text_item, "strikeout", TRUE, NULL);
g_signal_connect (
@@ -4096,7 +4095,7 @@ e_week_view_start_editing_event (EWeekView *week_view,
return FALSE;
}
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
if (!summary)
summary = "";
@@ -4192,7 +4191,7 @@ cancel_editing (EWeekView *week_view)
/* Reset the text to what was in the component */
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
g_object_set (span->text_item, "text", summary ? summary : "", NULL);
/* Stop editing */
@@ -4426,7 +4425,7 @@ e_week_view_event_move (ECalendarView *cal_view,
EWeekViewEvent *event;
gint event_num, adjust_days, current_start_day, current_end_day;
time_t start_dt, end_dt;
- struct icaltimetype start_time,end_time;
+ ICalTime *start_time, *end_time;
EWeekView *week_view = E_WEEK_VIEW (cal_view);
gboolean is_all_day = FALSE;
@@ -4446,10 +4445,10 @@ e_week_view_event_move (ECalendarView *cal_view,
return FALSE;
end_dt = event->end;
- start_time = icalcomponent_get_dtstart (event->comp_data->icalcomp);
- end_time = icalcomponent_get_dtend (event->comp_data->icalcomp);
+ start_time = i_cal_component_get_dtstart (event->comp_data->icalcomp);
+ end_time = i_cal_component_get_dtend (event->comp_data->icalcomp);
- if (start_time.is_date && end_time.is_date)
+ if (i_cal_time_is_date (start_time) && i_cal_time_is_date (end_time))
is_all_day = TRUE;
current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt);
@@ -4471,15 +4470,18 @@ e_week_view_event_move (ECalendarView *cal_view,
break;
}
- icaltime_adjust (&start_time ,adjust_days,0,0,0);
- icaltime_adjust (&end_time ,adjust_days,0,0,0);
- start_dt = icaltime_as_timet_with_zone (
+ i_cal_time_adjust (start_time, adjust_days, 0, 0, 0);
+ i_cal_time_adjust (end_time, adjust_days, 0, 0, 0);
+ start_dt = i_cal_time_as_timet_with_zone (
start_time,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
- end_dt = icaltime_as_timet_with_zone (
+ end_dt = i_cal_time_as_timet_with_zone (
end_time,
e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
+ g_clear_object (&start_time);
+ g_clear_object (&end_time);
+
current_start_day = e_week_view_get_day_offset_of_event (week_view,start_dt);
current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt);
if (is_all_day)
@@ -4560,10 +4562,10 @@ e_week_view_change_event_time (EWeekView *week_view,
EWeekViewEvent *event;
gint event_num;
ECalComponent *comp;
- ECalComponentDateTime date;
- struct icaltimetype itt;
+ ECalComponentDateTime *date;
ECalClient *client;
ECalObjModType mod = E_CAL_OBJ_MOD_ALL;
+ ICalTimezone *zone;
event_num = week_view->editing_event_num;
@@ -4584,19 +4586,19 @@ e_week_view_change_event_time (EWeekView *week_view,
/* We use a temporary shallow copy of the ico since we don't want to
* change the original ico here. Otherwise we would not detect that
* the event's time had changed in the "update_event" callback. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- date.value = &itt;
- /* FIXME: Should probably keep the timezone of the original start
- * and end times. */
- date.tzid = icaltimezone_get_tzid (e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view)));
-
- *date.value = icaltime_from_timet_with_zone (start_dt, is_all_day,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(week_view)));
- cal_comp_set_dtstart_with_oldzone (client, comp, &date);
- *date.value = icaltime_from_timet_with_zone (end_dt, is_all_day,
- e_calendar_view_get_timezone (E_CALENDAR_VIEW
(week_view)));
- cal_comp_set_dtend_with_oldzone (client, comp, &date);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+
+ zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view));
+
+ date = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone (start_dt, is_all_day,
zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, comp, date);
+ e_cal_component_datetime_free (date);
+
+ date = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone (end_dt, is_all_day, zone),
+ zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
+ cal_comp_set_dtend_with_oldzone (client, comp, date);
+ e_cal_component_datetime_free (date);
e_cal_component_commit_sequence (comp);
@@ -4614,10 +4616,10 @@ e_week_view_change_event_time (EWeekView *week_view,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
} else if (e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_THIS;
@@ -4666,7 +4668,7 @@ e_week_view_on_editing_started (EWeekView *week_view,
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
gnome_canvas_item_set (
span->text_item,
@@ -4690,7 +4692,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
EWeekViewEventSpan *span;
gchar *text = NULL;
ECalComponent *comp;
- ECalComponentText summary;
+ ECalComponentText *summary = NULL;
ECalClient *client;
const gchar *uid;
gboolean on_server;
@@ -4723,7 +4725,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
week_view->editing_event_num = -1;
/* Check that the event is still valid. */
- uid = icalcomponent_get_uid (event->comp_data->icalcomp);
+ uid = i_cal_component_get_uid (event->comp_data->icalcomp);
if (!uid) {
g_object_notify (G_OBJECT (week_view), "is-editing");
return;
@@ -4733,14 +4735,18 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
g_object_set (span->text_item, "handle_popup", FALSE, NULL);
g_object_get (span->text_item, "text", &text, NULL);
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(event->comp_data->icalcomp));
+ if (!comp) {
+ g_free (text);
+ g_object_notify (G_OBJECT (week_view), "is-editing");
+ return;
+ }
client = event->comp_data->client;
on_server = !event->comp_data->is_new_component;
if (string_is_empty (text) && !on_server) {
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
g_signal_handlers_disconnect_by_func (item, e_week_view_on_text_item_event, week_view);
e_week_view_foreach_event_with_uid (week_view, uid,
e_week_view_remove_event_cb, NULL);
@@ -4751,29 +4757,31 @@ 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;
+ summary = e_cal_component_get_summary (comp);
+ if (summary && !g_strcmp0 (e_cal_component_text_get_value (summary), text)) {
+ gchar *summary_txt;
- summary = get_comp_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text);
- g_object_set (span->text_item, "text", summary ? summary : "", NULL);
+ summary_txt = dup_comp_summary (event->comp_data->client, event->comp_data->icalcomp);
+ g_object_set (span->text_item, "text", summary_txt ? summary_txt : "", NULL);
- if (free_text)
- g_free ((gchar *) summary);
+ g_free (summary_txt);
if (!e_week_view_is_one_day_event (week_view, event_num))
e_week_view_reshape_event_span (week_view, event_num, span_num);
- } else if (summary.value || !string_is_empty (text)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+ } else if ((summary && e_cal_component_text_get_value (summary)) || !string_is_empty (text)) {
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (comp);
- summary.value = text;
- summary.altrep = NULL;
- e_cal_component_set_summary (comp, &summary);
+ e_cal_component_text_free (summary);
+ summary = e_cal_component_text_new (text, NULL);
+
+ e_cal_component_set_summary (comp, summary);
e_cal_component_commit_sequence (comp);
+ e_cal_component_text_free (summary);
+ summary = NULL;
+
if (!on_server) {
- e_cal_ops_create_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)),
client, icalcomp,
+ e_cal_ops_create_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)),
client, icomp,
e_calendar_view_component_created_cb, g_object_ref (week_view),
g_object_unref);
/* we remove the object since we either got the update from the server or failed */
@@ -4787,52 +4795,56 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
}
if (mod == E_CAL_OBJ_MOD_THIS) {
- ECalComponentDateTime dt;
- struct icaltimetype tt;
+ ECalComponentDateTime *dt;
+ ICalTime *tt = NULL;
gchar *tzid;
- e_cal_component_get_dtstart (comp, &dt);
- if (dt.value->zone) {
- tt = icaltime_from_timet_with_zone (
+ dt = e_cal_component_get_dtstart (comp);
+ if (dt)
+ tt = e_cal_component_datetime_get_value (dt);
+ if (dt && tt && i_cal_time_get_timezone (tt)) {
+ tt = i_cal_time_from_timet_with_zone (
event->comp_data->instance_start,
- dt.value->is_date,
- dt.value->zone);
+ i_cal_time_is_date (tt),
+ i_cal_time_get_timezone (tt));
} else {
- tt = icaltime_from_timet_with_zone (
+ tt = i_cal_time_from_timet_with_zone (
event->comp_data->instance_start,
- dt.value->is_date,
+ (dt && tt) ? i_cal_time_is_date (tt) : FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW
(week_view)));
}
- tzid = g_strdup (dt.tzid);
- e_cal_component_free_datetime (&dt);
- dt.value = &tt;
- dt.tzid = tzid;
- e_cal_component_set_dtstart (comp, &dt);
- g_free (tzid);
-
- e_cal_component_get_dtend (comp, &dt);
- if (dt.value->zone) {
- tt = icaltime_from_timet_with_zone (
+ tzid = dt ? g_strdup (e_cal_component_datetime_get_tzid (dt)) : NULL;
+ e_cal_component_datetime_free (dt);
+
+ dt = e_cal_component_datetime_new_take (tt, tzid);
+ e_cal_component_set_dtstart (comp, dt);
+ e_cal_component_datetime_free (dt);
+
+ dt = e_cal_component_get_dtend (comp);
+ if (dt)
+ tt = e_cal_component_datetime_get_value (dt);
+ if (dt && tt && i_cal_time_get_timezone (tt)) {
+ tt = i_cal_time_from_timet_with_zone (
event->comp_data->instance_end,
- dt.value->is_date,
- dt.value->zone);
+ i_cal_time_is_date (tt),
+ i_cal_time_get_timezone (tt));
} else {
- tt = icaltime_from_timet_with_zone (
+ tt = i_cal_time_from_timet_with_zone (
event->comp_data->instance_end,
- dt.value->is_date,
+ (dt && tt) ? i_cal_time_is_date (tt) : FALSE,
e_calendar_view_get_timezone (E_CALENDAR_VIEW
(week_view)));
}
- tzid = g_strdup (dt.tzid);
- e_cal_component_free_datetime (&dt);
- dt.value = &tt;
- dt.tzid = tzid;
- e_cal_component_set_dtend (comp, &dt);
- g_free (tzid);
-
- e_cal_component_set_rdate_list (comp, NULL);
- e_cal_component_set_rrule_list (comp, NULL);
- e_cal_component_set_exdate_list (comp, NULL);
- e_cal_component_set_exrule_list (comp, NULL);
+ tzid = dt ? g_strdup (e_cal_component_datetime_get_tzid (dt)) : NULL;
+ e_cal_component_datetime_free (dt);
+
+ dt = e_cal_component_datetime_new_take (tt, tzid);
+ e_cal_component_set_dtend (comp, dt);
+ e_cal_component_datetime_free (dt);
+
+ e_cal_component_set_rdates (comp, NULL);
+ e_cal_component_set_rrules (comp, NULL);
+ e_cal_component_set_exdates (comp, NULL);
+ e_cal_component_set_exrules (comp, NULL);
}
} else if (e_cal_component_is_instance (comp))
mod = E_CAL_OBJ_MOD_THIS;
@@ -4845,6 +4857,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
out:
+ e_cal_component_text_free (summary);
g_free (text);
g_object_unref (comp);
@@ -4919,16 +4932,15 @@ e_week_view_find_event_from_uid (EWeekView *week_view,
if (event->comp_data->client != client)
continue;
- u = icalcomponent_get_uid (event->comp_data->icalcomp);
+ u = i_cal_component_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (rid && *rid) {
- r = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid
(event->comp_data->icalcomp));
- if (!r || !*r)
- continue;
- if (strcmp (rid, r) != 0) {
+ r = e_cal_util_component_get_recurid_as_string (event->comp_data->icalcomp);
+ if (!r || !*r || strcmp (rid, r) != 0) {
g_free (r);
continue;
}
+
g_free (r);
}
diff --git a/src/calendar/gui/ea-cal-view-event.c b/src/calendar/gui/ea-cal-view-event.c
index 70fc590544..29529b949e 100644
--- a/src/calendar/gui/ea-cal-view-event.c
+++ b/src/calendar/gui/ea-cal-view-event.c
@@ -237,7 +237,7 @@ ea_cal_view_event_get_name (AtkObject *accessible)
if (e_cal_util_component_has_organizer (event->comp_data->icalcomp))
meeting_string = _("It is a meeting.");
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
+ summary = i_cal_component_get_summary (event->comp_data->icalcomp);
if (summary)
summary_string = g_strdup_printf (_("Calendar Event: Summary is %s."), summary);
}
diff --git a/src/calendar/gui/itip-utils.c b/src/calendar/gui/itip-utils.c
index 23d1769ada..dbbb155053 100644
--- a/src/calendar/gui/itip-utils.c
+++ b/src/calendar/gui/itip-utils.c
@@ -23,7 +23,11 @@
#include <time.h>
#include <glib/gi18n-lib.h>
-#include <libical/ical.h>
+
+#define LIBICAL_GLIB_UNSTABLE_API 1
+#include <libical-glib/libical-glib.h>
+#undef LIBICAL_GLIB_UNSTABLE_API
+
#include <libsoup/soup.h>
#include <composer/e-msg-composer.h>
@@ -47,15 +51,15 @@ static const gchar *itip_methods[] = {
"DECLINECOUNTER"
};
-static icalproperty_method itip_methods_enum[] = {
- ICAL_METHOD_PUBLISH,
- ICAL_METHOD_REQUEST,
- ICAL_METHOD_REPLY,
- ICAL_METHOD_ADD,
- ICAL_METHOD_CANCEL,
- ICAL_METHOD_REFRESH,
- ICAL_METHOD_COUNTER,
- ICAL_METHOD_DECLINECOUNTER,
+static ICalPropertyMethod itip_methods_enum[] = {
+ I_CAL_METHOD_PUBLISH,
+ I_CAL_METHOD_REQUEST,
+ I_CAL_METHOD_REPLY,
+ I_CAL_METHOD_ADD,
+ I_CAL_METHOD_CANCEL,
+ I_CAL_METHOD_REFRESH,
+ I_CAL_METHOD_COUNTER,
+ I_CAL_METHOD_DECLINECOUNTER
};
/**
@@ -334,7 +338,7 @@ itip_organizer_is_user_ex (ESourceRegistry *registry,
ECalClient *cal_client,
gboolean skip_cap_test)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
const gchar *strip;
gboolean user_org = FALSE;
@@ -342,19 +346,20 @@ itip_organizer_is_user_ex (ESourceRegistry *registry,
if (!e_cal_component_has_organizer (comp) ||
(!skip_cap_test && e_client_check_capability (
- E_CLIENT (cal_client), CAL_STATIC_CAPABILITY_NO_ORGANIZER)))
+ E_CLIENT (cal_client), E_CAL_STATIC_CAPABILITY_NO_ORGANIZER)))
return FALSE;
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value != NULL) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_value (organizer)) {
gchar *email = NULL;
- strip = itip_strip_mailto (organizer.value);
+ strip = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
if (e_client_get_backend_property_sync (E_CLIENT (cal_client),
- CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
+ E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
&email, NULL, NULL) &&
email && g_ascii_strcasecmp (email, strip) == 0) {
+ e_cal_component_organizer_free (organizer);
g_free (email);
return TRUE;
@@ -362,13 +367,16 @@ itip_organizer_is_user_ex (ESourceRegistry *registry,
g_free (email);
- if (e_client_check_capability (E_CLIENT (cal_client),
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) {
+ if (e_client_check_capability (E_CLIENT (cal_client),
E_CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) {
+ e_cal_component_organizer_free (organizer);
return FALSE;
}
user_org = itip_address_is_user (registry, strip);
}
+ e_cal_component_organizer_free (organizer);
+
return user_org;
}
@@ -377,7 +385,7 @@ itip_sentby_is_user (ESourceRegistry *registry,
ECalComponent *comp,
ECalClient *cal_client)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
const gchar *strip;
gboolean user_sentby = FALSE;
@@ -385,22 +393,24 @@ itip_sentby_is_user (ESourceRegistry *registry,
if (!e_cal_component_has_organizer (comp) ||
e_client_check_capability (
- E_CLIENT (cal_client), CAL_STATIC_CAPABILITY_NO_ORGANIZER))
+ E_CLIENT (cal_client), E_CAL_STATIC_CAPABILITY_NO_ORGANIZER))
return FALSE;
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.sentby != NULL) {
- strip = itip_strip_mailto (organizer.sentby);
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_sentby (organizer)) {
+ strip = itip_strip_mailto (e_cal_component_organizer_get_sentby (organizer));
user_sentby = itip_address_is_user (registry, strip);
}
+ e_cal_component_organizer_free (organizer);
+
return user_sentby;
}
gboolean
itip_has_any_attendees (ECalComponent *comp)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
ECalComponentAttendee *attendee;
GSList *attendees = NULL;
gboolean res;
@@ -410,7 +420,7 @@ itip_has_any_attendees (ECalComponent *comp)
if (!e_cal_component_has_attendees (comp))
return FALSE;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
/* No attendee */
if (!attendees)
@@ -418,7 +428,7 @@ itip_has_any_attendees (ECalComponent *comp)
/* More than one attendee */
if (attendees->next) {
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return TRUE;
}
@@ -428,16 +438,17 @@ itip_has_any_attendees (ECalComponent *comp)
g_return_val_if_fail (attendee != NULL, FALSE);
if (!e_cal_component_has_organizer (comp)) {
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return FALSE;
}
- e_cal_component_get_organizer (comp, &organizer);
+ organizer = e_cal_component_get_organizer (comp);
- res = attendee->value && (!organizer.value ||
- g_ascii_strcasecmp (itip_strip_mailto (attendee->value), itip_strip_mailto (organizer.value))
!= 0);
+ res = e_cal_component_attendee_get_value (attendee) && (!organizer ||
!e_cal_component_organizer_get_value (organizer) ||
+ g_ascii_strcasecmp (itip_strip_mailto (e_cal_component_attendee_get_value (attendee)),
+ itip_strip_mailto (e_cal_component_organizer_get_value (organizer))) != 0);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return res;
}
@@ -456,7 +467,7 @@ get_attendee (GSList *attendees,
ECalComponentAttendee *attendee = l->data;
const gchar *nomailto;
- nomailto = itip_strip_mailto (attendee->value);
+ nomailto = itip_strip_mailto (e_cal_component_attendee_get_value (attendee));
if (!nomailto || !*nomailto)
continue;
@@ -480,7 +491,7 @@ get_attendee_if_attendee_sentby_is_user (GSList *attendees,
ECalComponentAttendee *attendee = l->data;
const gchar *nomailto;
- nomailto = itip_strip_mailto (attendee->sentby);
+ nomailto = itip_strip_mailto (e_cal_component_attendee_get_sentby (attendee));
if (!nomailto || !*nomailto)
continue;
@@ -518,12 +529,12 @@ itip_get_comp_attendee (ESourceRegistry *registry,
const gchar *extension_name;
gchar *address = NULL;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
if (cal_client)
e_client_get_backend_property_sync (
E_CLIENT (cal_client),
- CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
+ E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS,
&address, NULL, NULL);
if (address != NULL && *address != '\0') {
@@ -532,9 +543,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
if (attendee) {
gchar *user_email;
- user_email = g_strdup (
- itip_strip_mailto (attendee->value));
- e_cal_component_free_attendee_list (attendees);
+ user_email = g_strdup (itip_strip_mailto (e_cal_component_attendee_get_value
(attendee)));
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
g_free (address);
return user_email;
@@ -545,9 +555,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
if (attendee != NULL) {
gchar *user_email;
- user_email = g_strdup (
- itip_strip_mailto (attendee->sentby));
- e_cal_component_free_attendee_list (attendees);
+ user_email = g_strdup (itip_strip_mailto (e_cal_component_attendee_get_sentby
(attendee)));
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
g_free (address);
return user_email;
@@ -577,8 +586,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
if (attendee != NULL) {
gchar *user_email;
- user_email = g_strdup (itip_strip_mailto (attendee->value));
- e_cal_component_free_attendee_list (attendees);
+ user_email = g_strdup (itip_strip_mailto (e_cal_component_attendee_get_value
(attendee)));
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
if (aliases)
g_hash_table_destroy (aliases);
@@ -596,8 +605,8 @@ itip_get_comp_attendee (ESourceRegistry *registry,
if (attendee) {
gchar *user_email;
- user_email = g_strdup (itip_strip_mailto (attendee->sentby));
- e_cal_component_free_attendee_list (attendees);
+ user_email = g_strdup (itip_strip_mailto (e_cal_component_attendee_get_sentby
(attendee)));
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
if (aliases)
g_hash_table_destroy (aliases);
@@ -621,7 +630,7 @@ itip_get_comp_attendee (ESourceRegistry *registry,
/* FIXME do we have a better way ? */
itip_get_default_name_and_address (registry, NULL, &address);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
if (address == NULL)
address = g_strdup ("");
@@ -642,13 +651,13 @@ itip_strip_mailto (const gchar *address)
}
static gchar *
-get_label (struct icaltimetype *tt,
+get_label (ICalTime *tt,
gboolean use_24_hour_format)
{
gchar buffer[1000];
struct tm tmp_tm;
- tmp_tm = icaltimetype_to_tm (tt);
+ tmp_tm = e_cal_util_icaltime_to_tm (tt);
e_time_format_date_and_time (
&tmp_tm, use_24_hour_format, FALSE, FALSE, buffer, 1000);
@@ -658,76 +667,75 @@ get_label (struct icaltimetype *tt,
typedef struct {
GHashTable *tzids;
- icalcomponent *icomp;
+ ICalComponent *icomp;
ECalClient *client;
- icalcomponent *zones;
+ ICalComponent *zones;
} ItipUtilTZData;
static void
-foreach_tzid_callback (icalparameter *param,
+foreach_tzid_callback (ICalParameter *param,
gpointer data)
{
ItipUtilTZData *tz_data = data;
const gchar *tzid;
- icaltimezone *zone = NULL;
- icalcomponent *vtimezone_comp;
+ ICalTimezone *zone = NULL;
+ ICalComponent *vtimezone_comp;
/* Get the TZID string from the parameter. */
- tzid = icalparameter_get_tzid (param);
- if (!tzid || g_hash_table_lookup (tz_data->tzids, tzid))
+ tzid = i_cal_parameter_get_tzid (param);
+ if (!tzid || g_hash_table_contains (tz_data->tzids, tzid))
return;
/* Look for the timezone */
if (tz_data->zones != NULL)
- zone = icalcomponent_get_timezone (tz_data->zones, tzid);
+ zone = i_cal_component_get_timezone (tz_data->zones, tzid);
if (zone == NULL)
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (zone == NULL && tz_data->client != NULL)
- e_cal_client_get_timezone_sync (tz_data->client, tzid, &zone, NULL, NULL);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
+ if (zone == NULL && tz_data->client != NULL &&
+ !e_cal_client_get_timezone_sync (tz_data->client, tzid, &zone, NULL, NULL))
+ zone = NULL;
if (zone == NULL)
return;
/* Convert it to a string and add it to the hash. */
- vtimezone_comp = icaltimezone_get_component (zone);
+ vtimezone_comp = i_cal_timezone_get_component (zone);
if (!vtimezone_comp)
return;
- icalcomponent_add_component (
- tz_data->icomp, icalcomponent_new_clone (vtimezone_comp));
- g_hash_table_insert (tz_data->tzids, (gchar *) tzid, (gchar *) tzid);
+ i_cal_component_take_component (
+ tz_data->icomp, i_cal_component_new_clone (vtimezone_comp));
+ g_hash_table_insert (tz_data->tzids, g_strdup (tzid), GINT_TO_POINTER (1));
+ g_object_unref (vtimezone_comp);
}
-static icalcomponent *
+static ICalComponent *
comp_toplevel_with_zones (ECalComponentItipMethod method,
- const GSList *ecomps,
- ECalClient *cal_client,
- icalcomponent *zones)
+ const GSList *ecomps,
+ ECalClient *cal_client,
+ ICalComponent *zones)
{
- icalcomponent *top_level, *icomp;
- icalproperty *prop;
- icalvalue *value;
+ ICalComponent *top_level, *icomp;
+ ICalProperty *prop;
ItipUtilTZData tz_data;
GSList *link;
top_level = e_cal_util_new_top_level ();
- prop = icalproperty_new (ICAL_METHOD_PROPERTY);
- value = icalvalue_new_method (itip_methods_enum[method]);
- icalproperty_set_value (prop, value);
- icalcomponent_add_property (top_level, prop);
+ prop = i_cal_property_new_method (itip_methods_enum[method]);
+ i_cal_component_take_property (top_level, prop);
- tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal);
+ tz_data.tzids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
tz_data.icomp = top_level;
tz_data.client = cal_client;
tz_data.zones = zones;
for (link = (GSList *) ecomps; link; link = g_slist_next (link)) {
icomp = e_cal_component_get_icalcomponent (link->data);
- icomp = icalcomponent_new_clone (icomp);
+ icomp = i_cal_component_new_clone (icomp);
- icalcomponent_foreach_tzid (icomp, foreach_tzid_callback, &tz_data);
+ i_cal_component_foreach_tzid (icomp, foreach_tzid_callback, &tz_data);
- icalcomponent_add_component (top_level, icomp);
+ i_cal_component_take_component (top_level, icomp);
}
g_hash_table_destroy (tz_data.tzids);
@@ -755,7 +763,7 @@ comp_from (ECalComponentItipMethod method,
ESourceRegistry *registry,
gchar **from_name)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
ECalComponentAttendee *attendee;
GSList *attendees;
gchar *from;
@@ -779,30 +787,33 @@ comp_from (ECalComponentItipMethod method,
case E_CAL_COMPONENT_METHOD_ADD:
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value == NULL) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (!organizer || !e_cal_component_organizer_get_value (organizer)) {
+ e_cal_component_organizer_free (organizer);
e_notice (
NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
return NULL;
}
if (from_name)
- *from_name = g_strdup (organizer.cn);
- return g_strdup (itip_strip_mailto (organizer.value));
+ *from_name = g_strdup (e_cal_component_organizer_get_cn (organizer));
+ from = g_strdup (itip_strip_mailto (e_cal_component_organizer_get_value (organizer)));
+ e_cal_component_organizer_free (organizer);
+ return from;
default:
- if (!e_cal_component_has_attendees (comp))
+ attendees = e_cal_component_get_attendees (comp);
+ if (!attendees)
return NULL;
- e_cal_component_get_attendee_list (comp, &attendees);
attendee = attendees->data;
- if (attendee->value != NULL) {
- from = g_strdup (itip_strip_mailto (attendee->value));
+ if (e_cal_component_attendee_get_value (attendee)) {
+ from = g_strdup (itip_strip_mailto (e_cal_component_attendee_get_value (attendee)));
if (from_name)
- *from_name = g_strdup (attendee->cn);
+ *from_name = g_strdup (e_cal_component_attendee_get_cn (attendee));
} else
from = NULL;
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return from;
}
@@ -816,7 +827,7 @@ comp_to_list (ESourceRegistry *registry,
gboolean reply_all,
const GSList *only_attendees)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
GSList *attendees, *l;
GPtrArray *array = NULL;
EDestination *destination;
@@ -831,18 +842,20 @@ comp_to_list (ESourceRegistry *registry,
switch (method) {
case E_CAL_COMPONENT_METHOD_REQUEST:
case E_CAL_COMPONENT_METHOD_CANCEL:
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
len = g_slist_length (attendees);
if (len <= 0) {
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
e_notice (
NULL, GTK_MESSAGE_ERROR,
_("At least one attendee is necessary"));
- e_cal_component_free_attendee_list (attendees);
return NULL;
}
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value == NULL) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (!organizer || !e_cal_component_organizer_get_value (organizer)) {
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
e_notice (
NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
@@ -855,6 +868,12 @@ comp_to_list (ESourceRegistry *registry,
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
+ ICalParameterCutype cutype;
+
+ if (!e_cal_component_attendee_get_value (att))
+ continue;
+
+ cutype = e_cal_component_attendee_get_cutype (att);
/* Bugfix: 688711 - Varadhan
* Resource is also considered as a "attendee". If the respective backend
@@ -862,49 +881,51 @@ comp_to_list (ESourceRegistry *registry,
* in the users list and thereby won't get added to the list of destinations
* to send the meeting invite, otherwise, as a safety measure, a meeting
* invite will be sent to the resources as well. */
- if (att->cutype != ICAL_CUTYPE_INDIVIDUAL &&
- att->cutype != ICAL_CUTYPE_GROUP &&
- att->cutype != ICAL_CUTYPE_RESOURCE &&
- att->cutype != ICAL_CUTYPE_UNKNOWN)
- continue;
- else if (users_has_attendee (users, att->value))
+ if (cutype != I_CAL_CUTYPE_INDIVIDUAL &&
+ cutype != I_CAL_CUTYPE_GROUP &&
+ cutype != I_CAL_CUTYPE_RESOURCE &&
+ cutype != I_CAL_CUTYPE_UNKNOWN)
continue;
- else if (att->sentby &&
- users_has_attendee (users, att->sentby))
+ else if (users_has_attendee (users, e_cal_component_attendee_get_value (att)))
continue;
- else if (!g_ascii_strcasecmp (
- att->value, organizer.value))
+ else if (e_cal_component_attendee_get_sentby (att) &&
+ users_has_attendee (users, e_cal_component_attendee_get_sentby (att)))
continue;
- else if (att->sentby && !g_ascii_strcasecmp (
- att->sentby, organizer.sentby))
+ else if (!g_ascii_strcasecmp (e_cal_component_attendee_get_value (att),
e_cal_component_organizer_get_value (organizer)))
continue;
- else if (!g_ascii_strcasecmp (
- itip_strip_mailto (att->value), sender))
+ else if (e_cal_component_attendee_get_sentby (att) &&
+ e_cal_component_organizer_get_sentby (organizer) &&
+ !g_ascii_strcasecmp (e_cal_component_attendee_get_sentby (att),
e_cal_component_organizer_get_sentby (organizer)))
continue;
- else if (att->status == ICAL_PARTSTAT_DELEGATED &&
- (att->delto && *att->delto) && !(att->rsvp) &&
- method == E_CAL_COMPONENT_METHOD_REQUEST)
+ else if (!g_ascii_strcasecmp (itip_strip_mailto (e_cal_component_attendee_get_value
(att)), sender))
continue;
- else if (only_attendees &&
- !cal_comp_util_have_in_new_attendees (
- only_attendees, itip_strip_mailto (att->value)))
+ else if (e_cal_component_attendee_get_partstat (att) == I_CAL_PARTSTAT_DELEGATED &&
+ !e_cal_component_attendee_get_rsvp (att) &&
+ method == E_CAL_COMPONENT_METHOD_REQUEST) {
+ const gchar *delegatedto;
+
+ delegatedto = e_cal_component_attendee_get_delegatedto (att);
+ if (delegatedto && *delegatedto)
+ continue;
+ } else if (only_attendees &&
+ !cal_comp_util_have_in_new_attendees (only_attendees, itip_strip_mailto
(e_cal_component_attendee_get_value (att))))
continue;
destination = e_destination_new ();
- if (att->cn != NULL)
- e_destination_set_name (destination, att->cn);
- e_destination_set_email (
- destination, itip_strip_mailto (att->value));
+ if (e_cal_component_attendee_get_cn (att))
+ e_destination_set_name (destination, e_cal_component_attendee_get_cn (att));
+ e_destination_set_email (destination, itip_strip_mailto
(e_cal_component_attendee_get_value (att)));
g_ptr_array_add (array, destination);
}
g_free (sender);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
break;
case E_CAL_COMPONENT_METHOD_REPLY:
if (reply_all) {
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
len = g_slist_length (attendees);
if (len <= 0)
@@ -914,60 +935,66 @@ comp_to_list (ESourceRegistry *registry,
sender = itip_get_comp_attendee (registry, comp, NULL);
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value && (!sender || g_ascii_strcasecmp (
- itip_strip_mailto (organizer.value), sender) != 0)) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_value (organizer) &&
+ (!sender || g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_organizer_get_value (organizer)), sender) != 0)) {
destination = e_destination_new ();
e_destination_set_email (
destination,
- itip_strip_mailto (organizer.value));
- if (organizer.cn)
- e_destination_set_name (destination, organizer.cn);
+ itip_strip_mailto (e_cal_component_organizer_get_value (organizer)));
+ if (e_cal_component_organizer_get_cn (organizer))
+ e_destination_set_name (destination, e_cal_component_organizer_get_cn
(organizer));
g_ptr_array_add (array, destination);
}
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
+ ICalParameterCutype cutype;
- if (!att->value)
+ if (!e_cal_component_attendee_get_value (att))
continue;
- else if (att->cutype != ICAL_CUTYPE_INDIVIDUAL &&
- att->cutype != ICAL_CUTYPE_GROUP &&
- att->cutype != ICAL_CUTYPE_UNKNOWN)
+
+ cutype = e_cal_component_attendee_get_cutype (att);
+
+ if (cutype != I_CAL_CUTYPE_INDIVIDUAL &&
+ cutype != I_CAL_CUTYPE_GROUP &&
+ cutype != I_CAL_CUTYPE_UNKNOWN)
continue;
else if (only_attendees &&
- !cal_comp_util_have_in_new_attendees (
- only_attendees, itip_strip_mailto (att->value)))
+ !cal_comp_util_have_in_new_attendees (only_attendees,
+ itip_strip_mailto (e_cal_component_attendee_get_value (att))))
continue;
- else if (organizer.value &&
- g_ascii_strcasecmp (att->value, organizer.value) == 0)
+ else if (e_cal_component_organizer_get_value (organizer) &&
+ g_ascii_strcasecmp (e_cal_component_attendee_get_value (att),
e_cal_component_organizer_get_value (organizer)) == 0)
continue;
- else if (sender && g_ascii_strcasecmp (
- itip_strip_mailto (att->value), sender) == 0)
+ else if (sender && g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_attendee_get_value (att)), sender) == 0)
continue;
destination = e_destination_new ();
- if (att->cn != NULL)
- e_destination_set_name (destination, att->cn);
+ if (e_cal_component_attendee_get_cn (att))
+ e_destination_set_name (destination, e_cal_component_attendee_get_cn
(att));
e_destination_set_email (
- destination, itip_strip_mailto (att->value));
+ destination, itip_strip_mailto (e_cal_component_attendee_get_value
(att)));
g_ptr_array_add (array, destination);
}
g_free (sender);
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
} else {
array = g_ptr_array_new ();
destination = e_destination_new ();
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.cn)
- e_destination_set_name (destination, organizer.cn);
- if (organizer.value)
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_cn (organizer))
+ e_destination_set_name (destination, e_cal_component_organizer_get_cn
(organizer));
+ if (e_cal_component_organizer_get_value (organizer))
e_destination_set_email (
- destination, itip_strip_mailto (organizer.value));
+ destination, itip_strip_mailto (e_cal_component_organizer_get_value
(organizer)));
g_ptr_array_add (array, destination);
+
+ e_cal_component_organizer_free (organizer);
}
break;
@@ -975,8 +1002,9 @@ comp_to_list (ESourceRegistry *registry,
case E_CAL_COMPONENT_METHOD_REFRESH:
case E_CAL_COMPONENT_METHOD_COUNTER:
case E_CAL_COMPONENT_METHOD_DECLINECOUNTER:
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value == NULL) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (!organizer || !e_cal_component_organizer_get_value (organizer)) {
+ e_cal_component_organizer_free (organizer);
e_notice (
NULL, GTK_MESSAGE_ERROR,
_("An organizer must be set."));
@@ -986,40 +1014,50 @@ comp_to_list (ESourceRegistry *registry,
array = g_ptr_array_new ();
destination = e_destination_new ();
- if (organizer.cn != NULL)
- e_destination_set_name (destination, organizer.cn);
+ if (e_cal_component_organizer_get_cn (organizer))
+ e_destination_set_name (destination, e_cal_component_organizer_get_cn (organizer));
e_destination_set_email (
- destination, itip_strip_mailto (organizer.value));
+ destination, itip_strip_mailto (e_cal_component_organizer_get_value (organizer)));
g_ptr_array_add (array, destination);
/* send the status to delegatee to the delegate also*/
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
sender = itip_get_comp_attendee (registry, comp, NULL);
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *att = l->data;
+ ICalParameterCutype cutype;
+
+ if (!e_cal_component_attendee_get_value (att))
+ continue;
+
+ cutype = e_cal_component_attendee_get_cutype (att);
- if (att->cutype != ICAL_CUTYPE_INDIVIDUAL &&
- att->cutype != ICAL_CUTYPE_GROUP &&
- att->cutype != ICAL_CUTYPE_UNKNOWN)
+ if (cutype != I_CAL_CUTYPE_INDIVIDUAL &&
+ cutype != I_CAL_CUTYPE_GROUP &&
+ cutype != I_CAL_CUTYPE_UNKNOWN)
continue;
- if (!g_ascii_strcasecmp (
- itip_strip_mailto (att->value), sender) ||
- (att->sentby && !g_ascii_strcasecmp (
- itip_strip_mailto (att->sentby), sender))) {
+ if (sender && (
+ !g_ascii_strcasecmp (itip_strip_mailto (e_cal_component_attendee_get_value
(att)), sender) ||
+ (e_cal_component_attendee_get_sentby (att) &&
+ !g_ascii_strcasecmp (itip_strip_mailto (e_cal_component_attendee_get_sentby
(att)), sender)))) {
+ const gchar *delegatedfrom;
- if (!(att->delfrom && *att->delfrom))
+ delegatedfrom = e_cal_component_attendee_get_delegatedfrom (att);
+
+ if (!delegatedfrom || !*delegatedfrom)
break;
destination = e_destination_new ();
e_destination_set_email (
- destination, itip_strip_mailto (att->delfrom));
+ destination, itip_strip_mailto (delegatedfrom));
g_ptr_array_add (array, destination);
}
}
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
break;
case E_CAL_COMPONENT_METHOD_PUBLISH:
@@ -1054,17 +1092,17 @@ comp_subject (ESourceRegistry *registry,
ECalComponentItipMethod method,
ECalComponent *comp)
{
- ECalComponentText caltext;
+ ECalComponentText *caltext;
const gchar *description, *prefix = NULL;
GSList *alist, *l;
gchar *subject;
gchar *sender;
ECalComponentAttendee *a = NULL;
- e_cal_component_get_summary (comp, &caltext);
- if (caltext.value != NULL)
- description = caltext.value;
- else {
+ caltext = e_cal_component_get_summary (comp);
+ if (caltext && e_cal_component_text_get_value (caltext)) {
+ description = e_cal_component_text_get_value (caltext);
+ } else {
switch (e_cal_component_get_vtype (comp)) {
case E_CAL_COMPONENT_EVENT:
description = _("Event information");
@@ -1093,16 +1131,19 @@ comp_subject (ESourceRegistry *registry,
break;
case E_CAL_COMPONENT_METHOD_REPLY:
- e_cal_component_get_attendee_list (comp, &alist);
+ alist = e_cal_component_get_attendees (comp);
sender = itip_get_comp_attendee (registry, comp, NULL);
if (sender) {
-
for (l = alist; l != NULL; l = l->next) {
+ const gchar *value, *sentby;
+
a = l->data;
- if ((sender && *sender) && (g_ascii_strcasecmp (
- itip_strip_mailto (a->value), sender) ||
- (a->sentby && g_ascii_strcasecmp (
- itip_strip_mailto (a->sentby), sender))))
+ value = e_cal_component_attendee_get_value (a);
+ sentby = e_cal_component_attendee_get_sentby (a);
+
+ if ((sender && *sender) && (
+ (value && g_ascii_strcasecmp (itip_strip_mailto (value), sender)) ||
+ (sentby && g_ascii_strcasecmp (itip_strip_mailto (sentby), sender))))
break;
}
g_free (sender);
@@ -1110,29 +1151,29 @@ comp_subject (ESourceRegistry *registry,
if (a != NULL) {
- switch (a->status) {
- case ICAL_PARTSTAT_ACCEPTED:
+ switch (e_cal_component_attendee_get_partstat (a)) {
+ case I_CAL_PARTSTAT_ACCEPTED:
/* Translators: This is part of the subject
* line of a meeting request or update email.
* The full subject line would be:
* "Accepted: Meeting Name". */
prefix = C_("Meeting", "Accepted");
break;
- case ICAL_PARTSTAT_TENTATIVE:
+ case I_CAL_PARTSTAT_TENTATIVE:
/* Translators: This is part of the subject
* line of a meeting request or update email.
* The full subject line would be:
* "Tentatively Accepted: Meeting Name". */
prefix = C_("Meeting", "Tentatively Accepted");
break;
- case ICAL_PARTSTAT_DECLINED:
+ case I_CAL_PARTSTAT_DECLINED:
/* Translators: This is part of the subject
* line of a meeting request or update email.
* The full subject line would be:
* "Declined: Meeting Name". */
prefix = C_("Meeting", "Declined");
break;
- case ICAL_PARTSTAT_DELEGATED:
+ case I_CAL_PARTSTAT_DELEGATED:
/* Translators: This is part of the subject
* line of a meeting request or update email.
* The full subject line would be:
@@ -1142,7 +1183,7 @@ comp_subject (ESourceRegistry *registry,
default:
break;
}
- e_cal_component_free_attendee_list (alist);
+ g_slist_free_full (alist, e_cal_component_attendee_free);
}
break;
@@ -1190,6 +1231,8 @@ comp_subject (ESourceRegistry *registry,
else
subject = g_strdup (description);
+ e_cal_component_text_free (caltext);
+
return subject;
}
@@ -1223,7 +1266,7 @@ comp_description (ECalComponent *comp,
gboolean use_24_hour_format)
{
gchar *description;
- ECalComponentDateTime dt;
+ ECalComponentDateTime *dt;
gchar *start = NULL, *end = NULL;
switch (e_cal_component_get_vtype (comp)) {
@@ -1237,15 +1280,15 @@ comp_description (ECalComponent *comp,
description = g_strdup (_("Memo information"));
break;
case E_CAL_COMPONENT_FREEBUSY:
- e_cal_component_get_dtstart (comp, &dt);
- if (dt.value)
- start = get_label (dt.value, use_24_hour_format);
- e_cal_component_free_datetime (&dt);
+ dt = e_cal_component_get_dtstart (comp);
+ if (dt && e_cal_component_datetime_get_value (dt))
+ start = get_label (e_cal_component_datetime_get_value (dt), use_24_hour_format);
+ e_cal_component_datetime_free (dt);
- e_cal_component_get_dtend (comp, &dt);
- if (dt.value)
- end = get_label (dt.value, use_24_hour_format);
- e_cal_component_free_datetime (&dt);
+ dt = e_cal_component_get_dtend (comp);
+ if (dt && e_cal_component_datetime_get_value (dt))
+ end = get_label (e_cal_component_datetime_get_value (dt), use_24_hour_format);
+ e_cal_component_datetime_free (dt);
if (start != NULL && end != NULL)
description = g_strdup_printf (
@@ -1268,12 +1311,12 @@ static gboolean
comp_server_send_sync (ECalComponentItipMethod method,
const GSList *ecomps,
ECalClient *cal_client,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList **users,
GCancellable *cancellable,
GError **error)
{
- icalcomponent *top_level, *returned_icalcomp = NULL;
+ ICalComponent *top_level, *returned_icomp = NULL;
gboolean retval = TRUE;
GError *local_error = NULL;
@@ -1281,8 +1324,8 @@ comp_server_send_sync (ECalComponentItipMethod method,
d (printf ("itip-utils.c: comp_server_send_sync: calling e_cal_send_objects... \n"));
e_cal_client_send_objects_sync (
- cal_client, top_level, users,
- &returned_icalcomp, cancellable, &local_error);
+ cal_client, top_level, E_CAL_OPERATION_FLAG_NONE, users,
+ &returned_icomp, cancellable, &local_error);
if (g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS)) {
g_propagate_error (error, g_error_new (local_error->domain, local_error->code,
@@ -1296,9 +1339,8 @@ comp_server_send_sync (ECalComponentItipMethod method,
retval = FALSE;
}
- if (returned_icalcomp != NULL)
- icalcomponent_free (returned_icalcomp);
- icalcomponent_free (top_level);
+ g_clear_object (&returned_icomp);
+ g_clear_object (&top_level);
return retval;
}
@@ -1307,30 +1349,26 @@ static gboolean
comp_limit_attendees (ESourceRegistry *registry,
ECalComponent *comp)
{
- icalcomponent *icomp;
- icalproperty *prop;
+ ICalComponent *icomp;
+ ICalProperty *prop;
gboolean found = FALSE, match = FALSE;
GSList *l, *list = NULL;
icomp = e_cal_component_get_icalcomponent (comp);
- for (prop = icalcomponent_get_first_property (icomp, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PROPERTY);
prop != NULL;
- prop = icalcomponent_get_next_property (icomp, ICAL_ATTENDEE_PROPERTY))
- {
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_ATTENDEE_PROPERTY)) {
gchar *attendee;
gchar *attendee_text;
- icalparameter *param;
- const gchar *attendee_sentby;
- gchar *attendee_sentby_text = NULL;
/* If we've already found something, just erase the rest */
if (found) {
- list = g_slist_prepend (list, prop);
+ list = g_slist_prepend (list, g_object_ref (prop));
continue;
}
- attendee = icalproperty_get_value_as_string_r (prop);
+ attendee = i_cal_property_get_value_as_string_r (prop);
if (!attendee)
continue;
@@ -1340,31 +1378,35 @@ comp_limit_attendees (ESourceRegistry *registry,
found = match = itip_address_is_user (registry, attendee_text);
if (!found) {
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
+ ICalParameter *param;
+
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
if (param) {
- attendee_sentby =
- icalparameter_get_sentby (param);
- attendee_sentby =
- itip_strip_mailto (attendee_sentby);
- attendee_sentby_text =
- g_strstrip (g_strdup (attendee_sentby));
+ const gchar *attendee_sentby;
+ gchar *attendee_sentby_text;
+
+ attendee_sentby = i_cal_parameter_get_sentby (param);
+ attendee_sentby = itip_strip_mailto (attendee_sentby);
+ attendee_sentby_text = g_strstrip (g_strdup (attendee_sentby));
found = match = itip_address_is_user (
registry, attendee_sentby_text);
+
+ g_free (attendee_sentby_text);
+ g_object_unref (param);
}
}
g_free (attendee_text);
- g_free (attendee_sentby_text);
if (!match)
- list = g_slist_prepend (list, prop);
+ list = g_slist_prepend (list, g_object_ref (prop));
}
for (l = list; l != NULL; l = l->next) {
prop = l->data;
- icalcomponent_remove_property (icomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (icomp, prop);
+ g_object_unref (prop);
}
g_slist_free (list);
@@ -1376,64 +1418,85 @@ comp_sentby (ECalComponent *comp,
ECalClient *cal_client,
ESourceRegistry *registry)
{
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
GSList * attendees, *l;
- gchar *name;
- gchar *address;
- gchar *user = NULL;
+ gchar *name = NULL;
+ gchar *address = NULL;
+ gchar *user;
itip_get_default_name_and_address (registry, &name, &address);
- e_cal_component_get_organizer (comp, &organizer);
- if (!organizer.value && name != NULL && address != NULL) {
- organizer.value = g_strdup_printf ("MAILTO:%s", address);
- organizer.sentby = NULL;
- organizer.cn = name;
- organizer.language = NULL;
+ organizer = e_cal_component_get_organizer (comp);
+ if ((!organizer || !e_cal_component_organizer_get_value (organizer)) && name != NULL && address !=
NULL) {
+ gchar *tmp;
+
+ e_cal_component_organizer_free (organizer);
- e_cal_component_set_organizer (comp, &organizer);
- g_free ((gchar *) organizer.value);
+ tmp = g_strdup_printf ("MAILTO:%s", address);
+ organizer = e_cal_component_organizer_new_full (tmp, NULL, name, NULL);
+ e_cal_component_set_organizer (comp, organizer);
+
+ e_cal_component_organizer_free (organizer);
+
+ g_free (tmp);
g_free (name);
g_free (address);
return;
}
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
user = itip_get_comp_attendee (registry, comp, cal_client);
- for (l = attendees; l; l = l->next) {
+ for (l = attendees; l && user; l = l->next) {
ECalComponentAttendee *a = l->data;
+ const gchar *value, *sentby;
- if (!g_ascii_strcasecmp (
- itip_strip_mailto (a->value), user) ||
- (a->sentby && !g_ascii_strcasecmp (
- itip_strip_mailto (a->sentby), user))) {
- g_free (user);
+ if (!a)
+ continue;
+ value = e_cal_component_attendee_get_value (a);
+ if (value)
+ value = itip_strip_mailto (value);
+ sentby = e_cal_component_attendee_get_sentby (a);
+ if (sentby)
+ sentby = itip_strip_mailto (sentby);
+
+ if ((value && !g_ascii_strcasecmp (value, user)) ||
+ (sentby && !g_ascii_strcasecmp (sentby, user))) {
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
+ g_free (user);
g_free (name);
g_free (address);
return;
}
}
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ g_free (user);
+
if (!itip_organizer_is_user (registry, comp, cal_client) &&
!itip_sentby_is_user (registry, comp, cal_client) &&
- address != NULL) {
- organizer.value = g_strdup (organizer.value);
- organizer.sentby = g_strdup_printf ("MAILTO:%s", address);
- organizer.cn = g_strdup (organizer.cn);
- organizer.language = g_strdup (organizer.language);
+ address && organizer) {
+ ECalComponentOrganizer *sentbyorg;
+ gchar *sentby;
- e_cal_component_set_organizer (comp, &organizer);
+ sentby = g_strdup_printf ("MAILTO:%s", address);
+ sentbyorg = e_cal_component_organizer_new_full (
+ e_cal_component_organizer_get_value (organizer),
+ sentby,
+ e_cal_component_organizer_get_cn (organizer),
+ e_cal_component_organizer_get_language (organizer));
- g_free ((gchar *) organizer.value);
- g_free ((gchar *) organizer.sentby);
- g_free ((gchar *) organizer.cn);
- g_free ((gchar *) organizer.language);
+ e_cal_component_set_organizer (comp, sentbyorg);
+
+ e_cal_component_organizer_free (sentbyorg);
+ g_free (sentby);
}
g_free (name);
g_free (address);
+ e_cal_component_organizer_free (organizer);
}
static ECalComponent *
@@ -1442,13 +1505,13 @@ comp_minimal (ESourceRegistry *registry,
gboolean attendee)
{
ECalComponent *clone;
- icalcomponent *icomp, *icomp_clone;
- icalproperty *prop;
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
+ ECalComponentRange *recur_id;
+ ICalComponent *icomp, *icomp_clone;
+ ICalProperty *prop;
+ ICalTime *itt;
const gchar *uid;
GSList *comments;
- struct icaltimetype itt;
- ECalComponentRange recur_id;
clone = e_cal_component_new ();
e_cal_component_set_new_vtype (clone, e_cal_component_get_vtype (comp));
@@ -1456,8 +1519,10 @@ comp_minimal (ESourceRegistry *registry,
if (attendee) {
GSList *attendees;
- e_cal_component_get_attendee_list (comp, &attendees);
- e_cal_component_set_attendee_list (clone, attendees);
+ attendees = e_cal_component_get_attendees (comp);
+ e_cal_component_set_attendees (clone, attendees);
+
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
if (!comp_limit_attendees (registry, clone)) {
e_notice (
@@ -1467,49 +1532,50 @@ comp_minimal (ESourceRegistry *registry,
}
}
- itt = icaltime_from_timet_with_zone (
- time (NULL), FALSE,
- icaltimezone_get_utc_timezone ());
- e_cal_component_set_dtstamp (clone, &itt);
+ itt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, i_cal_timezone_get_utc_timezone ());
+ e_cal_component_set_dtstamp (clone, itt);
+ g_clear_object (&itt);
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value == NULL)
+ organizer = e_cal_component_get_organizer (comp);
+ if (!organizer || !e_cal_component_organizer_get_value (organizer)) {
+ e_cal_component_organizer_free (organizer);
goto error;
- e_cal_component_set_organizer (clone, &organizer);
+ }
+ e_cal_component_set_organizer (clone, organizer);
+ e_cal_component_organizer_free (organizer);
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
e_cal_component_set_uid (clone, uid);
- e_cal_component_get_comment_list (comp, &comments);
+ comments = e_cal_component_get_comments (comp);
if (g_slist_length (comments) <= 1) {
- e_cal_component_set_comment_list (clone, comments);
+ e_cal_component_set_comments (clone, comments);
} else {
GSList *l = comments;
comments = g_slist_remove_link (comments, l);
- e_cal_component_set_comment_list (clone, l);
- e_cal_component_free_text_list (l);
+ e_cal_component_set_comments (clone, l);
+ g_slist_free_full (l, e_cal_component_text_free);
}
- e_cal_component_free_text_list (comments);
+ g_slist_free_full (comments, e_cal_component_text_free);
- e_cal_component_get_recurid (comp, &recur_id);
- if (recur_id.datetime.value != NULL)
- e_cal_component_set_recurid (clone, &recur_id);
+ recur_id = e_cal_component_get_recurid (comp);
+ if (recur_id)
+ e_cal_component_set_recurid (clone, recur_id);
+ e_cal_component_range_free (recur_id);
icomp = e_cal_component_get_icalcomponent (comp);
icomp_clone = e_cal_component_get_icalcomponent (clone);
- for (prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_X_PROPERTY);
prop != NULL;
- prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY))
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp, I_CAL_X_PROPERTY))
{
- icalproperty *p;
+ ICalProperty *p;
- p = icalproperty_new_clone (prop);
- icalcomponent_add_property (icomp_clone, p);
+ p = i_cal_property_new_clone (prop);
+ i_cal_component_take_property (icomp_clone, p);
}
- e_cal_component_rescan (clone);
-
return clone;
error:
@@ -1521,30 +1587,30 @@ static void
strip_x_microsoft_props (ECalComponent *comp)
{
GSList *lst = NULL, *l;
- icalcomponent *icalcomp;
- icalproperty *icalprop;
+ ICalComponent *icomp;
+ ICalProperty *prop;
g_return_if_fail (comp != NULL);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- g_return_if_fail (icalcomp != NULL);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_if_fail (icomp != NULL);
- for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- icalprop;
- icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
- const gchar *x_name = icalproperty_get_x_name (icalprop);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_X_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp, I_CAL_X_PROPERTY)) {
+ const gchar *x_name = i_cal_property_get_x_name (prop);
if (x_name && g_ascii_strncasecmp (x_name, "X-MICROSOFT-", 12) == 0)
- lst = g_slist_prepend (lst, icalprop);
+ lst = g_slist_prepend (lst, g_object_ref (prop));
}
for (l = lst; l != NULL; l = l->next) {
- icalprop = l->data;
- icalcomponent_remove_property (icalcomp, icalprop);
- icalproperty_free (icalprop);
+ prop = l->data;
+
+ i_cal_component_remove_property (icomp, prop);
}
- g_slist_free (lst);
+ g_slist_free_full (lst, g_object_unref);
}
static ECalComponent *
@@ -1552,66 +1618,71 @@ comp_compliant_one (ESourceRegistry *registry,
ECalComponentItipMethod method,
ECalComponent *comp,
ECalClient *client,
- icalcomponent *zones,
- icaltimezone *default_zone,
+ ICalComponent *zones,
+ ICalTimezone *default_zone,
gboolean strip_alarms)
{
ECalComponent *clone, *temp_clone;
- struct icaltimetype itt;
+ ICalTime *itt;
clone = e_cal_component_clone (comp);
- itt = icaltime_from_timet_with_zone (
- time (NULL), FALSE,
- icaltimezone_get_utc_timezone ());
- e_cal_component_set_dtstamp (clone, &itt);
+ itt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, i_cal_timezone_get_utc_timezone ());
+ e_cal_component_set_dtstamp (clone, itt);
+ g_clear_object (&itt);
/* Make UNTIL date a datetime in a simple recurrence */
- if (e_cal_component_has_recurrences (clone)
- && e_cal_component_has_simple_recurrence (clone)) {
+ if (e_cal_component_has_recurrences (clone) &&
+ e_cal_component_has_simple_recurrence (clone)) {
GSList *rrule_list;
- struct icalrecurrencetype *r;
+ ICalRecurrence *rt;
- e_cal_component_get_rrule_list (clone, &rrule_list);
- r = rrule_list->data;
+ rrule_list = e_cal_component_get_rrules (clone);
+ rt = rrule_list->data;
- if (!icaltime_is_null_time (r->until) && r->until.is_date) {
- ECalComponentDateTime dt;
- icaltimezone *from_zone = NULL, *to_zone;
+ itt = i_cal_recurrence_get_until (rt);
+ if (itt && !i_cal_time_is_null_time (itt) && i_cal_time_is_date (itt)) {
+ ECalComponentDateTime *dt;
+ ICalTime *dtvalue;
+ ICalTimezone *from_zone = NULL, *to_zone;
- e_cal_component_get_dtstart (clone, &dt);
+ dt = e_cal_component_get_dtstart (clone);
+ dtvalue = dt ? e_cal_component_datetime_get_value (dt) : NULL;
- if (dt.value->is_date) {
+ if (!dtvalue || i_cal_time_is_date (dtvalue)) {
from_zone = default_zone;
- } else if (dt.tzid == NULL) {
- from_zone = icaltimezone_get_utc_timezone ();
+ } else if (!e_cal_component_datetime_get_tzid (dt)) {
+ from_zone = i_cal_timezone_get_utc_timezone ();
} else {
if (zones != NULL)
- from_zone = icalcomponent_get_timezone (zones, dt.tzid);
+ from_zone = i_cal_component_get_timezone (zones,
e_cal_component_datetime_get_tzid (dt));
if (from_zone == NULL)
- from_zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid);
+ from_zone = i_cal_timezone_get_builtin_timezone_from_tzid
(e_cal_component_datetime_get_tzid (dt));
if (from_zone == NULL && client != NULL)
/* FIXME Error checking */
- e_cal_client_get_timezone_sync (
- client, dt.tzid,
- &from_zone, NULL, NULL);
+ if (!e_cal_client_get_timezone_sync (client,
e_cal_component_datetime_get_tzid (dt), &from_zone, NULL, NULL))
+ from_zone = NULL;
}
- to_zone = icaltimezone_get_utc_timezone ();
+ to_zone = i_cal_timezone_get_utc_timezone ();
+
+ i_cal_time_set_time (itt,
+ i_cal_time_get_hour (dtvalue),
+ i_cal_time_get_minute (dtvalue),
+ i_cal_time_get_second (dtvalue));
+ i_cal_time_set_is_date (itt, FALSE);
- r->until.hour = dt.value->hour;
- r->until.minute = dt.value->minute;
- r->until.second = dt.value->second;
- r->until.is_date = FALSE;
+ i_cal_timezone_convert_time (itt, from_zone, to_zone);
+ i_cal_time_set_timezone (itt, to_zone);
- icaltimezone_convert_time (&r->until, from_zone, to_zone);
- r->until.zone = to_zone;
+ i_cal_recurrence_set_until (rt, itt);
- e_cal_component_free_datetime (&dt);
- e_cal_component_set_rrule_list (clone, rrule_list);
+ e_cal_component_datetime_free (dt);
+ e_cal_component_set_rrules (clone, rrule_list);
e_cal_component_abort_sequence (clone);
}
- e_cal_component_free_recur_list (rrule_list);
+ g_slist_free_full (rrule_list, g_object_unref);
+ g_clear_object (&itt);
}
/* We delete incoming alarms if requested, even this helps with outlook */
@@ -1619,25 +1690,26 @@ comp_compliant_one (ESourceRegistry *registry,
e_cal_component_remove_all_alarms (clone);
} else {
/* Always strip procedure alarms, because of security */
- GList *uids, *l;
+ GSList *uids, *link;
uids = e_cal_component_get_alarm_uids (clone);
- for (l = uids; l; l = l->next) {
+ for (link = uids; link; link = g_slist_next (link)) {
ECalComponentAlarm *alarm;
- ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
- alarm = e_cal_component_get_alarm (clone, (const gchar *) l->data);
+ alarm = e_cal_component_get_alarm (clone, link->data);
if (alarm) {
- e_cal_component_alarm_get_action (alarm, &action);
+ ECalComponentAlarmAction action;
+
+ action = e_cal_component_alarm_get_action (alarm);
e_cal_component_alarm_free (alarm);
if (action == E_CAL_COMPONENT_ALARM_PROCEDURE)
- e_cal_component_remove_alarm (clone, (const gchar *) l->data);
+ e_cal_component_remove_alarm (clone, link->data);
}
}
- cal_obj_uid_list_free (uids);
+ g_slist_free_full (uids, g_free);
}
strip_x_microsoft_props (clone);
@@ -1649,7 +1721,7 @@ comp_compliant_one (ESourceRegistry *registry,
switch (method) {
case E_CAL_COMPONENT_METHOD_PUBLISH:
comp_sentby (clone, client, registry);
- e_cal_component_set_attendee_list (clone, NULL);
+ e_cal_component_set_attendees (clone, NULL);
break;
case E_CAL_COMPONENT_METHOD_REQUEST:
comp_sentby (clone, client, registry);
@@ -1688,8 +1760,8 @@ comp_compliant (ESourceRegistry *registry,
GSList *ecomps,
gboolean unref_orig_ecomp,
ECalClient *client,
- icalcomponent *zones,
- icaltimezone *default_zone,
+ ICalComponent *zones,
+ ICalTimezone *default_zone,
gboolean strip_alarms)
{
GSList *link;
@@ -1831,21 +1903,23 @@ get_identity_uid_for_from (EShell *shell,
/* always use organizer's email when user is an organizer */
if (itip_organizer_is_user (registry, comp, cal_client)) {
- ECalComponentOrganizer organizer = {0};
+ ECalComponentOrganizer *organizer;
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value != NULL) {
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_value (organizer)) {
source = find_enabled_identity (
registry,
- itip_strip_mailto (organizer.value));
+ itip_strip_mailto (e_cal_component_organizer_get_value (organizer)));
if (source) {
if (identity_name)
- *identity_name = g_strdup (organizer.cn);
+ *identity_name = g_strdup (e_cal_component_organizer_get_cn
(organizer));
if (identity_address)
- *identity_address = g_strdup (itip_strip_mailto (organizer.value));
+ *identity_address = g_strdup (itip_strip_mailto
(e_cal_component_organizer_get_value (organizer)));
}
}
+
+ e_cal_component_organizer_free (organizer);
}
if (source == NULL) {
@@ -1879,16 +1953,16 @@ master_first_cmp (gconstpointer ptr1,
{
ECalComponent *comp1 = (ECalComponent *) ptr1;
ECalComponent *comp2 = (ECalComponent *) ptr2;
- icalcomponent *icomp1 = comp1 ? e_cal_component_get_icalcomponent (comp1) : NULL;
- icalcomponent *icomp2 = comp2 ? e_cal_component_get_icalcomponent (comp2) : NULL;
+ ICalComponent *icomp1 = comp1 ? e_cal_component_get_icalcomponent (comp1) : NULL;
+ ICalComponent *icomp2 = comp2 ? e_cal_component_get_icalcomponent (comp2) : NULL;
gboolean has_rid1, has_rid2;
- has_rid1 = (icomp1 && icalcomponent_get_first_property (icomp1, ICAL_RECURRENCEID_PROPERTY)) ? 1 : 0;
- has_rid2 = (icomp2 && icalcomponent_get_first_property (icomp2, ICAL_RECURRENCEID_PROPERTY)) ? 1 : 0;
+ has_rid1 = (icomp1 && e_cal_util_component_has_property (icomp1, I_CAL_RECURRENCEID_PROPERTY)) ? 1 :
0;
+ has_rid2 = (icomp2 && e_cal_util_component_has_property (icomp2, I_CAL_RECURRENCEID_PROPERTY)) ? 1 :
0;
if (has_rid1 == has_rid2)
- return g_strcmp0 (icomp1 ? icalcomponent_get_uid (icomp1) : NULL,
- icomp2 ? icalcomponent_get_uid (icomp2) : NULL);
+ return g_strcmp0 (icomp1 ? i_cal_component_get_uid (icomp1) : NULL,
+ icomp2 ? i_cal_component_get_uid (icomp2) : NULL);
if (has_rid1)
return 1;
@@ -1901,7 +1975,7 @@ typedef struct {
ECalComponentItipMethod method;
GSList *send_comps; /* ECalComponent * */
ECalClient *cal_client;
- icalcomponent *zones;
+ ICalComponent *zones;
GSList *attachments_list;
GSList *users;
gboolean strip_alarms;
@@ -1923,9 +1997,8 @@ itip_send_component_data_free (gpointer ptr)
g_clear_object (&isc->registry);
g_slist_free_full (isc->send_comps, g_object_unref);
g_clear_object (&isc->cal_client);
+ g_clear_object (&isc->zones);
g_clear_error (&isc->async_error);
- if (isc->zones)
- icalcomponent_free (isc->zones);
g_slist_free_full (isc->attachments_list, itip_cal_mime_attach_free); /* CamelMimePart */
g_slist_free_full (isc->users, g_free);
g_free (isc);
@@ -1950,9 +2023,9 @@ itip_send_component_begin (ItipSendComponentData *isc,
if (isc->ensure_master_object && isc->send_comps) {
/* Ensure we send the master object with its detached instances, not the instance only */
GSList *ecalcomps = NULL;
- const gchar *uid = NULL;
+ const gchar *uid;
- e_cal_component_get_uid (isc->send_comps->data, &uid);
+ uid = e_cal_component_get_uid (isc->send_comps->data);
if (e_cal_client_get_objects_for_uid_sync (isc->cal_client, uid, &ecalcomps, cancellable,
NULL) && ecalcomps) {
GSList *old_send_comps = isc->send_comps;
@@ -1977,7 +2050,7 @@ itip_send_component_begin (ItipSendComponentData *isc,
/* check whether backend could handle sending requests/updates */
if (isc->method != E_CAL_COMPONENT_METHOD_PUBLISH &&
- e_client_check_capability (E_CLIENT (isc->cal_client), CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
+ e_client_check_capability (E_CLIENT (isc->cal_client), E_CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
isc->success = TRUE;
isc->completed = TRUE;
}
@@ -2089,8 +2162,8 @@ itip_send_component_complete (ItipSendComponentData *isc)
CreateComposerData *ccd;
EDestination **destinations;
EShell *shell;
- icalcomponent *top_level = NULL;
- icaltimezone *default_zone;
+ ICalComponent *top_level = NULL;
+ ICalTimezone *default_zone;
gchar *identity_uid, *identity_name = NULL, *identity_address = NULL;
g_return_if_fail (isc != NULL);
@@ -2138,7 +2211,7 @@ itip_send_component_complete (ItipSendComponentData *isc)
ccd->identity_address = identity_address;
ccd->destinations = destinations;
ccd->subject = comp_subject (isc->registry, isc->method, isc->send_comps->data);
- ccd->ical_string = icalcomponent_as_ical_string_r (top_level);
+ ccd->ical_string = i_cal_component_as_ical_string_r (top_level);
ccd->content_type = comp_content_type (isc->send_comps->data, isc->method);
ccd->event_body_text = NULL;
ccd->attachments_list = isc->attachments_list;
@@ -2153,8 +2226,7 @@ itip_send_component_complete (ItipSendComponentData *isc)
isc->success = TRUE;
cleanup:
- if (top_level != NULL)
- icalcomponent_free (top_level);
+ g_clear_object (&top_level);
}
static void
@@ -2186,7 +2258,7 @@ 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,
@@ -2233,7 +2305,7 @@ itip_send_component_with_model (ECalModel *model,
isc->send_comps = g_slist_prepend (NULL, g_object_ref (send_comp));
isc->cal_client = g_object_ref (cal_client);
if (zones) {
- isc->zones = icalcomponent_new_clone (zones);
+ isc->zones = i_cal_component_new_clone (zones);
}
isc->attachments_list = attachments_list;
if (users) {
@@ -2264,7 +2336,7 @@ 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,
@@ -2316,7 +2388,7 @@ 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,
@@ -2335,7 +2407,7 @@ itip_send_component (ESourceRegistry *registry,
isc->send_comps = g_slist_prepend (NULL, g_object_ref (send_comp));
isc->cal_client = g_object_ref (cal_client);
if (zones)
- isc->zones = icalcomponent_new_clone (zones);
+ isc->zones = i_cal_component_new_clone (zones);
isc->attachments_list = attachments_list;
if (users) {
GSList *link;
@@ -2386,12 +2458,12 @@ reply_to_calendar_comp (ESourceRegistry *registry,
ECalComponent *send_comp,
ECalClient *cal_client,
gboolean reply_all,
- icalcomponent *zones,
+ ICalComponent *zones,
GSList *attachments_list)
{
EShell *shell;
- icalcomponent *top_level = NULL;
- icaltimezone *default_zone;
+ ICalComponent *top_level = NULL;
+ ICalTimezone *default_zone;
gboolean retval = FALSE;
gchar *identity_uid, *identity_name = NULL, *identity_address = NULL;
GSList *ecomps;
@@ -2424,7 +2496,7 @@ reply_to_calendar_comp (ESourceRegistry *registry,
ccd->identity_address = identity_address;
ccd->destinations = comp_to_list (registry, method, ecomps->data, NULL, reply_all, NULL);
ccd->subject = comp_subject (registry, method, ecomps->data);
- ccd->ical_string = icalcomponent_as_ical_string_r (top_level);
+ ccd->ical_string = i_cal_component_as_ical_string_r (top_level);
ccd->send_comps = ecomps;
ccd->show_only = TRUE;
@@ -2432,70 +2504,78 @@ reply_to_calendar_comp (ESourceRegistry *registry,
ECalComponent *comp = ecomps->data;
GString *body;
gchar *orig_from = NULL;
- const gchar *description = NULL;
+ gchar *description = NULL;
gchar *subject = NULL;
- const gchar *location = NULL;
+ gchar *location;
gchar *time = NULL;
gchar *html_description = NULL;
- GSList *text_list = NULL;
- ECalComponentOrganizer organizer;
- ECalComponentText text;
- ECalComponentDateTime dtstart;
- icaltimezone *start_zone = NULL;
+ GSList *text_list;
+ ECalComponentOrganizer *organizer;
+ ECalComponentText *text;
+ ECalComponentDateTime *dtstart;
+ ICalTimezone *start_zone = NULL;
time_t start;
- e_cal_component_get_description_list (comp, &text_list);
+ text_list = e_cal_component_get_descriptions (comp);
if (text_list) {
- ECalComponentText text = *((ECalComponentText *) text_list->data);
- if (text.value)
- description = text.value;
- else
- description = "";
- } else {
- description = "";
+ text = text_list->data;
+ if (text && e_cal_component_text_get_value (text))
+ description = g_strdup (e_cal_component_text_get_value (text));
}
- e_cal_component_free_text_list (text_list);
+ g_slist_free_full (text_list, e_cal_component_text_free);
- e_cal_component_get_summary (comp, &text);
- if (text.value)
- subject = g_strdup (text.value);
+ text = e_cal_component_get_summary (comp);
+ if (text && e_cal_component_text_get_value (text))
+ subject = g_strdup (e_cal_component_text_get_value (text));
+ e_cal_component_text_free (text);
- e_cal_component_get_organizer (comp, &organizer);
- if (organizer.value)
- orig_from = g_strdup (itip_strip_mailto (organizer.value));
+ organizer = e_cal_component_get_organizer (comp);
+ if (organizer && e_cal_component_organizer_get_value (organizer))
+ orig_from = g_strdup (itip_strip_mailto (e_cal_component_organizer_get_value
(organizer)));
+ e_cal_component_organizer_free (organizer);
- e_cal_component_get_location (comp, &location);
- if (!location)
- location = "Unspecified";
+ location = e_cal_component_get_location (comp);
+ if (!location) {
+ /* Translator: This is used as a placeholder when an event doesn't have set a
location */
+ location = g_strdup (C_("Location", "Unspecified"));
+ }
+
+ dtstart = e_cal_component_get_dtstart (comp);
+ if (dtstart && e_cal_component_datetime_get_value (dtstart)) {
+ ICalTime *itt;
- e_cal_component_get_dtstart (comp, &dtstart);
- if (dtstart.value) {
- start_zone = icaltimezone_get_builtin_timezone_from_tzid (dtstart.tzid);
- if (!start_zone && dtstart.tzid) {
+ itt = e_cal_component_datetime_get_value (dtstart);
+
+ start_zone = e_cal_component_datetime_get_tzid (dtstart) ?
+ i_cal_timezone_get_builtin_timezone_from_tzid
(e_cal_component_datetime_get_tzid (dtstart)) : NULL;
+ if (!start_zone && e_cal_component_datetime_get_tzid (dtstart)) {
GError *error = NULL;
- e_cal_client_get_timezone_sync (
- cal_client, dtstart.tzid,
- &start_zone, NULL, &error);
+ if (!e_cal_client_get_timezone_sync (
+ cal_client, e_cal_component_datetime_get_tzid (dtstart),
+ &start_zone, NULL, &error))
+ start_zone = NULL;
if (error != NULL) {
g_warning (
"%s: Couldn't get timezone '%s' from server: %s",
G_STRFUNC,
- dtstart.tzid ? dtstart.tzid : "",
+ e_cal_component_datetime_get_tzid (dtstart) ?
+ e_cal_component_datetime_get_tzid (dtstart) : "",
error->message);
g_error_free (error);
}
}
- if (!start_zone || dtstart.value->is_date)
+ if (!start_zone || i_cal_time_is_date (itt))
start_zone = default_zone;
- start = icaltime_as_timet_with_zone (*dtstart.value, start_zone);
+ start = i_cal_time_as_timet_with_zone (itt, start_zone);
time = g_strdup (ctime (&start));
}
+ e_cal_component_datetime_free (dtstart);
body = g_string_new (
"<br><br><hr><br><b>"
@@ -2520,6 +2600,7 @@ reply_to_calendar_comp (ESourceRegistry *registry,
body,
"<tr><td><b>Location</b></td>"
"<td>:</td><td>%s</td></tr>", location);
+ g_free (location);
if (time)
g_string_append_printf (
@@ -2530,9 +2611,10 @@ reply_to_calendar_comp (ESourceRegistry *registry,
g_string_append_printf (body, "</table><br>");
- html_description = html_new_lines_for (description);
+ html_description = html_new_lines_for (description ? description : "");
g_string_append (body, html_description);
g_free (html_description);
+ g_free (description);
ccd->event_body_text = g_string_free (body, FALSE);
}
@@ -2543,8 +2625,7 @@ reply_to_calendar_comp (ESourceRegistry *registry,
cleanup:
- if (top_level != NULL)
- icalcomponent_free (top_level);
+ g_clear_object (&top_level);
return retval;
}
@@ -2555,28 +2636,23 @@ itip_publish_begin (ECalComponent *pub_comp,
gboolean cloned,
ECalComponent **clone)
{
- icalcomponent *icomp = NULL, *icomp_clone = NULL;
- icalproperty *prop;
+ ICalComponent *icomp = NULL, *icomp_clone = NULL;
+ ICalProperty *prop;
if (e_cal_component_get_vtype (pub_comp) == E_CAL_COMPONENT_FREEBUSY) {
- if (!cloned)
+ if (!cloned) {
*clone = e_cal_component_clone (pub_comp);
- else {
-
+ } else {
icomp = e_cal_component_get_icalcomponent (pub_comp);
icomp_clone = e_cal_component_get_icalcomponent (*clone);
- for (prop = icalcomponent_get_first_property (icomp,
- ICAL_FREEBUSY_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (
- icomp,
- ICAL_FREEBUSY_PROPERTY))
- {
- icalproperty *p;
-
- p = icalproperty_new_clone (prop);
- icalcomponent_add_property (icomp_clone, p);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_FREEBUSY_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_FREEBUSY_PROPERTY)) {
+ ICalProperty *p;
+
+ p = i_cal_property_new_clone (prop);
+ i_cal_component_take_property (icomp_clone, p);
}
}
}
@@ -2585,38 +2661,46 @@ itip_publish_begin (ECalComponent *pub_comp,
}
static gboolean
-check_time (const struct icaltimetype tmval,
+check_time (ICalTime *tmval,
gboolean can_null_time)
{
- if (icaltime_is_null_time (tmval))
+ gboolean valid;
+
+ if (!tmval || 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_get_month (tmval) >= 1 && i_cal_time_get_month (tmval) <= 12 &&
+ i_cal_time_get_day (tmval) >= 1 && i_cal_time_get_day (tmval) <= 31 &&
+ i_cal_time_get_hour (tmval) >= 0 && i_cal_time_get_hour (tmval) < 24 &&
+ i_cal_time_get_minute (tmval) >= 0 && i_cal_time_get_minute (tmval) < 60 &&
+ i_cal_time_get_second (tmval) >= 0 && i_cal_time_get_second (tmval) < 60;
- 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;
+ g_clear_object (&tmval);
+
+ return valid;
}
-/* Returns whether the passed-in icalcomponent is valid or not.
+/* 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;
}
@@ -2627,53 +2711,63 @@ is_icalcomp_valid (icalcomponent *icalcomp)
gboolean
itip_component_has_recipients (ECalComponent *comp)
{
- GSList *attendees = NULL;
+ GSList *attendees, *link;
ECalComponentAttendee *attendee;
- ECalComponentOrganizer organizer;
+ ECalComponentOrganizer *organizer;
gboolean res = FALSE;
g_return_val_if_fail (comp != NULL, FALSE);
- e_cal_component_get_organizer (comp, &organizer);
- e_cal_component_get_attendee_list (comp, &attendees);
+ organizer = e_cal_component_get_organizer (comp);
+ attendees = e_cal_component_get_attendees (comp);
if (!attendees) {
- if (organizer.value && e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
+ if (organizer && e_cal_component_organizer_get_value (organizer) &&
+ e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
/* memos store recipients in an extra property */
- icalcomponent *icalcomp;
- icalproperty *icalprop;
+ ICalComponent *icomp;
+ ICalProperty *prop;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
- for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- icalprop != NULL;
- icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_X_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_X_PROPERTY)) {
const gchar *x_name;
- x_name = icalproperty_get_x_name (icalprop);
+ x_name = i_cal_property_get_x_name (prop);
if (g_str_equal (x_name, "X-EVOLUTION-RECIPIENTS")) {
- const gchar *str_recipients = icalproperty_get_x (icalprop);
+ const gchar *str_recipients = i_cal_property_get_x (prop);
- res = str_recipients && g_ascii_strcasecmp (organizer.value,
str_recipients) != 0;
+ res = str_recipients && g_ascii_strcasecmp
(e_cal_component_organizer_get_value (organizer), str_recipients) != 0;
+ g_object_unref (prop);
break;
}
}
}
+ e_cal_component_organizer_free (organizer);
+
return res;
}
if (g_slist_length (attendees) > 1 || !e_cal_component_has_organizer (comp)) {
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
return TRUE;
}
- attendee = attendees->data;
+ for (link = attendees; link && !res; link = g_slist_next (link)) {
+ attendee = link->data;
- res = organizer.value && attendee && attendee->value && g_ascii_strcasecmp (organizer.value,
attendee->value) != 0;
+ res = organizer && e_cal_component_organizer_get_value (organizer) &&
+ attendee && e_cal_component_attendee_get_value (attendee) &&
+ g_ascii_strcasecmp (e_cal_component_organizer_get_value (organizer),
e_cal_component_attendee_get_value (attendee)) != 0;
+ }
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
+ e_cal_component_organizer_free (organizer);
return res;
}
diff --git a/src/calendar/gui/itip-utils.h b/src/calendar/gui/itip-utils.h
index 47b19fc437..b6b89664ac 100644
--- a/src/calendar/gui/itip-utils.h
+++ b/src/calendar/gui/itip-utils.h
@@ -19,7 +19,6 @@
#ifndef ITIP_UTILS_H
#define ITIP_UTILS_H
-#include <libical/ical.h>
#include <string.h>
#include <libecal/libecal.h>
#include <calendar/gui/e-cal-model.h>
@@ -77,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,
@@ -88,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,
@@ -98,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,
@@ -118,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..e1a3936988 100644
--- a/src/calendar/gui/tag-calendar.c
+++ b/src/calendar/gui/tag-calendar.c
@@ -147,7 +147,7 @@ object_info_free (gpointer ptr)
ObjectInfo *oinfo = ptr;
if (oinfo) {
- e_cal_component_free_id (oinfo->id);
+ e_cal_component_id_free (oinfo->id);
g_free (oinfo);
}
}
@@ -227,19 +227,28 @@ encode_ymd_to_julian (gint year,
static guint32
encode_timet_to_julian (time_t t,
gboolean is_date,
- const icaltimezone *zone)
+ const ICalTimezone *zone)
{
- struct icaltimetype tt;
+ ICalTime *tt;
+ guint32 res;
if (!t)
return 0;
- tt = icaltime_from_timet_with_zone (t, is_date, zone);
+ tt = i_cal_time_from_timet_with_zone (t, is_date, (ICalTimezone *) zone);
- if (!icaltime_is_valid_time (tt) || icaltime_is_null_time (tt))
+ if (!tt || !i_cal_time_is_valid_time (tt) || i_cal_time_is_null_time (tt)) {
+ g_clear_object (&tt);
return 0;
+ }
+
+ res = encode_ymd_to_julian (i_cal_time_get_year (tt),
+ i_cal_time_get_month (tt),
+ i_cal_time_get_day (tt));
- return encode_ymd_to_julian (tt.year, tt.month, tt.day);
+ g_clear_object (&tt);
+
+ return res;
}
static void
@@ -288,7 +297,7 @@ static time_t
e_tag_calendar_date_to_timet (gint year,
gint month,
gint day,
- const icaltimezone *with_zone)
+ const ICalTimezone *with_zone)
{
GDate *date;
time_t tt;
@@ -385,9 +394,9 @@ get_component_julian_range (ECalClient *client,
guint32 *start_julian,
guint32 *end_julian)
{
- time_t instance_start = 0, instance_end = 0;
- gboolean start_is_date = FALSE, end_is_date = FALSE;
- const icaltimezone *zone;
+ ICalTime *instance_start = NULL, *instance_end = NULL;
+ time_t start_tt, end_tt;
+ const ICalTimezone *zone;
g_return_if_fail (client != NULL);
g_return_if_fail (comp != NULL);
@@ -395,10 +404,16 @@ get_component_julian_range (ECalClient *client,
zone = calendar_config_get_icaltimezone ();
cal_comp_get_instance_times (client, e_cal_component_get_icalcomponent (comp),
- zone, &instance_start, &start_is_date, &instance_end, &end_is_date, NULL);
+ zone, &instance_start, &instance_end, NULL);
+
+ start_tt = i_cal_time_as_timet (instance_start);
+ end_tt = i_cal_time_as_timet (instance_end);
- *start_julian = encode_timet_to_julian (instance_start, start_is_date, zone);
- *end_julian = encode_timet_to_julian (instance_end - (instance_end == instance_start ? 0 : 1),
end_is_date, zone);
+ *start_julian = encode_timet_to_julian (start_tt, i_cal_time_is_date (instance_start), zone);
+ *end_julian = encode_timet_to_julian (end_tt - (end_tt == start_tt ? 0 : 1), i_cal_time_is_date
(instance_end), zone);
+
+ g_clear_object (&instance_start);
+ g_clear_object (&instance_end);
}
static void
@@ -484,7 +499,7 @@ e_tag_calendar_data_subscriber_component_added (ECalDataModelSubscriber *subscri
if (start_julian == 0 || end_julian == 0)
return;
- e_cal_component_get_transparency (comp, &transparency);
+ transparency = e_cal_component_get_transparency (comp);
oinfo = object_info_new (client, e_cal_component_get_id (comp),
transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT,
@@ -515,7 +530,7 @@ e_tag_calendar_data_subscriber_component_modified (ECalDataModelSubscriber *subs
if (start_julian == 0 || end_julian == 0)
return;
- e_cal_component_get_transparency (comp, &transparency);
+ transparency = e_cal_component_get_transparency (comp);
new_oinfo = object_info_new (client, e_cal_component_get_id (comp),
transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT,
@@ -547,7 +562,7 @@ e_tag_calendar_data_subscriber_component_removed (ECalDataModelSubscriber *subsc
const gchar *rid)
{
ETagCalendar *tag_calendar;
- ECalComponentId id;
+ ECalComponentId *id;
gpointer orig_key, orig_value;
ObjectInfo fake_oinfo, *old_oinfo;
@@ -555,21 +570,24 @@ e_tag_calendar_data_subscriber_component_removed (ECalDataModelSubscriber *subsc
tag_calendar = E_TAG_CALENDAR (subscriber);
- id.uid = (gchar *) uid;
- id.rid = (gchar *) rid;
+ id = e_cal_component_id_new (uid, rid);
/* only these two values are used for GHashTable compare */
fake_oinfo.client = client;
- fake_oinfo.id = &id;
+ fake_oinfo.id = id;
- if (!g_hash_table_lookup_extended (tag_calendar->priv->objects, &fake_oinfo, &orig_key, &orig_value))
+ if (!g_hash_table_lookup_extended (tag_calendar->priv->objects, &fake_oinfo, &orig_key, &orig_value))
{
+ e_cal_component_id_free (id);
return;
+ }
old_oinfo = orig_key;
e_tag_calendar_update_component_dates (tag_calendar, old_oinfo, NULL);
g_hash_table_remove (tag_calendar->priv->objects, old_oinfo);
+
+ e_cal_component_id_free (id);
}
static void
@@ -862,7 +880,7 @@ e_tag_calendar_unsubscribe (ETagCalendar *tag_calendar,
struct calendar_tag_closure {
ECalendarItem *calitem;
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t start_time;
time_t end_time;
@@ -875,14 +893,14 @@ struct calendar_tag_closure {
* the calendar has no dates shown. */
static gboolean
prepare_tag (ECalendar *ecal,
- struct calendar_tag_closure *closure,
- icaltimezone *zone,
- gboolean clear_first)
+ struct calendar_tag_closure *closure,
+ ICalTimezone *zone,
+ gboolean clear_first)
{
gint start_year, start_month, start_day;
gint end_year, end_month, end_day;
- struct icaltimetype start_tt = icaltime_null_time ();
- struct icaltimetype end_tt = icaltime_null_time ();
+ ICalTime *start_tt = NULL;
+ ICalTime *end_tt = NULL;
if (clear_first)
e_calendar_item_clear_marks (e_calendar_get_item (ecal));
@@ -893,15 +911,19 @@ prepare_tag (ECalendar *ecal,
&end_year, &end_month, &end_day))
return FALSE;
- start_tt.year = start_year;
- start_tt.month = start_month + 1;
- start_tt.day = start_day;
+ start_tt = i_cal_time_null_time ();
+ i_cal_time_set_date (start_tt,
+ start_year,
+ start_month + 1,
+ start_day);
- end_tt.year = end_year;
- end_tt.month = end_month + 1;
- end_tt.day = end_day;
+ end_tt = i_cal_time_null_time ();
+ i_cal_time_set_date (end_tt,
+ end_year,
+ end_month + 1,
+ end_day);
- icaltime_adjust (&end_tt, 1, 0, 0, 0);
+ i_cal_time_adjust (end_tt, 1, 0, 0, 0);
closure->calitem = e_calendar_get_item (ecal);
@@ -911,9 +933,12 @@ prepare_tag (ECalendar *ecal,
closure->zone = calendar_config_get_icaltimezone ();
closure->start_time =
- icaltime_as_timet_with_zone (start_tt, closure->zone);
+ i_cal_time_as_timet_with_zone (start_tt, closure->zone);
closure->end_time =
- icaltime_as_timet_with_zone (end_tt, closure->zone);
+ i_cal_time_as_timet_with_zone (end_tt, closure->zone);
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
return TRUE;
}
@@ -921,71 +946,51 @@ prepare_tag (ECalendar *ecal,
/* Marks the specified range in an ECalendar;
* called from e_cal_generate_instances() */
static gboolean
-tag_calendar_cb (ECalComponent *comp,
- time_t istart,
- time_t iend,
- struct calendar_tag_closure *closure)
+tag_calendar_cb (ICalComponent *comp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- struct icaltimetype start_tt, end_tt;
- ECalComponentTransparency transparency;
+ struct calendar_tag_closure *closure = user_data;
+ ICalPropertyTransp transp = I_CAL_TRANSP_NONE;
+ ICalProperty *prop;
guint8 style = 0;
/* If we are skipping TRANSPARENT events, return if the event is
* transparent. */
- e_cal_component_get_transparency (comp, &transparency);
- if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT) {
+ prop = i_cal_component_get_first_property (comp, I_CAL_TRANSP_PROPERTY);
+ if (prop) {
+ transp = i_cal_property_get_transp (prop);
+ g_object_unref (prop);
+ }
+
+ if (transp == I_CAL_TRANSP_TRANSPARENT ||
+ transp == I_CAL_TRANSP_TRANSPARENTNOCONFLICT) {
if (closure->skip_transparent_events)
return TRUE;
style = E_CALENDAR_ITEM_MARK_ITALIC;
- } else if (closure->recur_events_italic && e_cal_component_is_instance (comp)) {
+ } else if (closure->recur_events_italic && e_cal_util_component_is_instance (comp)) {
style = E_CALENDAR_ITEM_MARK_ITALIC;
} else {
style = E_CALENDAR_ITEM_MARK_BOLD;
}
- start_tt = icaltime_from_timet_with_zone (istart, FALSE, closure->zone);
- end_tt = icaltime_from_timet_with_zone (iend - 1, FALSE, closure->zone);
-
e_calendar_item_mark_days (
closure->calitem,
- start_tt.year, start_tt.month - 1, start_tt.day,
- end_tt.year, end_tt.month - 1, end_tt.day,
+ i_cal_time_get_year (instance_start),
+ i_cal_time_get_month (instance_start) - 1,
+ i_cal_time_get_day (instance_start),
+ i_cal_time_get_year (instance_end),
+ i_cal_time_get_month (instance_end) - 1,
+ i_cal_time_get_day (instance_end),
style, TRUE);
return TRUE;
}
-/* Resolves TZIDs for the recurrence generator, for when the comp is not on
- * the server. We need to try to use builtin timezones first, as they may not
- * be added to the server yet. */
-static icaltimezone *
-resolve_tzid_cb (const gchar *tzid,
- ECalClient *client)
-{
- icaltimezone *zone = NULL;
-
- /* Try to find the builtin timezone first. */
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
-
- if (!zone && tzid) {
- /* FIXME: Handle errors. */
- GError *error = NULL;
-
- e_cal_client_get_timezone_sync (
- client, tzid, &zone, NULL, &error);
-
- if (error != NULL) {
- g_warning (
- "%s: Failed to get timezone '%s': %s",
- G_STRFUNC, tzid, error->message);
- g_error_free (error);
- }
- }
-
- return zone;
-}
-
/**
* tag_calendar_by_comp:
* @ecal: Calendar widget to tag.
@@ -1004,7 +1009,7 @@ 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,
@@ -1042,13 +1047,20 @@ 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);
+ } else {
+ ICalTime *start, *end;
+
+ start = i_cal_time_from_timet_with_zone (closure.start_time, FALSE, display_zone);
+ end = i_cal_time_from_timet_with_zone (closure.end_time, FALSE, display_zone);
+
+ e_cal_recur_generate_instances_sync (e_cal_component_get_icalcomponent (comp),
+ start, end, tag_calendar_cb, &closure,
+ e_cal_client_tzlookup_cb, client,
+ display_zone, cancellable, NULL);
+
+ g_clear_object (&start);
+ g_clear_object (&end);
+ }
}
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..e2a0670835 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)
{
+ ICalTime *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_time_set_timezone (tt, NULL);
+ if (e_cal_component_datetime_get_tzid (dt)) {
+ const gchar *tzid = e_cal_component_datetime_get_tzid (dt);
+
+ i_cal_time_set_timezone (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_time_get_timezone (tt))
+ i_cal_time_set_timezone (tt, i_cal_timezone_get_builtin_timezone_from_tzid (tzid));
+
+ if (!i_cal_time_get_timezone (tt) && g_ascii_strcasecmp (tzid, "UTC") == 0)
+ i_cal_time_set_timezone (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_time_get_timezone (tt))
+ tm = e_cal_util_icaltime_to_tm_with_zone (tt, i_cal_time_get_timezone (tt), users_zone);
else
- tm = icaltimetype_to_tm (dt->value);
+ tm = e_cal_util_icaltime_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;
+ ICalTime *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/e-util/e-timezone-dialog.c b/src/e-util/e-timezone-dialog.c
index 3f613ae003..11dc9e8e2b 100644
--- a/src/e-util/e-timezone-dialog.c
+++ b/src/e-util/e-timezone-dialog.c
@@ -58,10 +58,10 @@
struct _ETimezoneDialogPrivate {
/* The selected timezone. May be NULL for a 'local time' (i.e. when
* the displayed name is ""). */
- icaltimezone *zone;
+ ICalTimezone *zone;
/* In case a non-builtin timezone is used. */
- GSList *custom_zones; /* icaltimezone * */
+ GSList *custom_zones; /* ICalTimezone * */
GtkBuilder *builder;
@@ -99,10 +99,10 @@ static gboolean on_map_button_pressed (GtkWidget *w,
GdkEvent *button_event,
gpointer data);
-static icaltimezone * get_zone_from_point (ETimezoneDialog *etd,
+static ICalTimezone * get_zone_from_point (ETimezoneDialog *etd,
EMapPoint *point);
static void set_map_timezone (ETimezoneDialog *etd,
- icaltimezone *zone);
+ const ICalTimezone *zone);
static void on_combo_changed (GtkComboBox *combo,
ETimezoneDialog *etd);
@@ -165,9 +165,11 @@ e_timezone_dialog_dispose (GObject *object)
priv->index = NULL;
}
- g_slist_free (priv->custom_zones);
+ g_slist_free_full (priv->custom_zones, g_object_unref);
priv->custom_zones = NULL;
+ g_clear_object (&priv->zone);
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_timezone_dialog_parent_class)->dispose (object);
}
@@ -225,7 +227,7 @@ static void
e_timezone_dialog_add_timezones (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
- icalarray *zones;
+ ICalArray *zones;
GtkComboBox *combo;
GList *l, *list_items = NULL;
GtkTreeStore *tree_store;
@@ -235,7 +237,7 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd)
GtkStyleContext *style_context;
GHashTable *parents;
const gchar *css;
- gint i;
+ gint ii, sz;
GError *error = NULL;
priv = etd->priv;
@@ -243,23 +245,28 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd)
g_hash_table_remove_all (priv->index);
/* Get the array of builtin timezones. */
- zones = icaltimezone_get_builtin_timezones ();
+ zones = i_cal_timezone_get_builtin_timezones ();
- for (i = 0; i < zones->num_elements; i++) {
- icaltimezone *zone;
+ sz = i_cal_array_size (zones);
+ for (ii = 0; ii < sz; ii++) {
+ ICalTimezone *zone;
gchar *location;
- zone = icalarray_element_at (zones, i);
+ zone = i_cal_timezone_array_element_at (zones, ii);
+ if (!zone)
+ continue;
- location = _(icaltimezone_get_location (zone));
+ location = _(i_cal_timezone_get_location (zone));
e_map_add_point (
priv->map, location,
- icaltimezone_get_longitude (zone),
- icaltimezone_get_latitude (zone),
+ i_cal_timezone_get_longitude (zone),
+ i_cal_timezone_get_latitude (zone),
E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
list_items = g_list_prepend (list_items, location);
+
+ g_clear_object (&zone);
}
list_items = g_list_sort (list_items, (GCompareFunc) g_utf8_collate);
@@ -286,7 +293,7 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd)
parents = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
tree_store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
- for (l = list_items, i = 0; l != NULL; l = l->next, ++i) {
+ for (l = list_items, ii = 0; l != NULL; l = l->next, ++ii) {
GtkTreeIter *piter, *parent = NULL;
const gchar *name = NULL;
const gchar *location = l->data;
@@ -415,19 +422,19 @@ get_local_offset (void)
}
#endif
-static icaltimezone *
+static ICalTimezone *
get_local_timezone (void)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
gchar *location;
tzset ();
location = e_cal_system_timezone_get_location ();
if (location)
- zone = icaltimezone_get_builtin_timezone (location);
+ zone = i_cal_timezone_get_builtin_timezone (location);
else
- zone = icaltimezone_get_utc_timezone ();
+ zone = i_cal_timezone_get_utc_timezone ();
g_free (location);
@@ -517,35 +524,36 @@ format_utc_offset (gint utc_offset,
}
static gchar *
-zone_display_name_with_offset (icaltimezone *zone)
+zone_display_name_with_offset (const ICalTimezone *zone)
{
const gchar *display_name;
struct tm local;
- struct icaltimetype tt;
+ ICalTime *tt;
gint offset;
gchar buffer[100];
time_t now = time (NULL);
gmtime_r ((const time_t *) &now, &local);
- tt = tm_to_icaltimetype (&local, TRUE);
- offset = icaltimezone_get_utc_offset (zone, &tt, NULL);
+ tt = e_cal_util_tm_to_icaltime (&local, TRUE);
+ offset = i_cal_timezone_get_utc_offset ((ICalTimezone *) zone, tt, NULL);
+ g_clear_object (&tt);
format_utc_offset (offset, buffer);
- display_name = icaltimezone_get_display_name (zone);
- if (icaltimezone_get_builtin_timezone (display_name))
+ display_name = i_cal_timezone_get_display_name (zone);
+ if (i_cal_timezone_get_builtin_timezone (display_name))
display_name = _(display_name);
return g_strdup_printf ("%s (%s)", display_name, buffer);
}
static const gchar *
-zone_display_name (icaltimezone *zone)
+zone_display_name (const ICalTimezone *zone)
{
const gchar *display_name;
- display_name = icaltimezone_get_display_name (zone);
- if (icaltimezone_get_builtin_timezone (display_name))
+ display_name = i_cal_timezone_get_display_name (zone);
+ if (i_cal_timezone_get_builtin_timezone (display_name))
display_name = _(display_name);
return display_name;
@@ -585,7 +593,7 @@ on_map_motion (GtkWidget *widget,
ETimezoneDialog *etd;
ETimezoneDialogPrivate *priv;
gdouble longitude, latitude;
- icaltimezone *new_zone;
+ ICalTimezone *new_zone;
gchar *display = NULL;
etd = E_TIMEZONE_DIALOG (data);
@@ -614,6 +622,7 @@ on_map_motion (GtkWidget *widget,
display = zone_display_name_with_offset (new_zone);
gtk_label_set_text (GTK_LABEL (priv->preview_label), display);
+ g_clear_object (&new_zone);
g_free (display);
return TRUE;
@@ -713,6 +722,7 @@ on_map_button_pressed (GtkWidget *w,
E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
priv->point_selected = priv->point_hover;
+ g_clear_object (&priv->zone);
priv->zone = get_zone_from_point (etd, priv->point_selected);
timezone_combo_set_active_text (etd, zone_display_name (priv->zone));
}
@@ -722,13 +732,13 @@ on_map_button_pressed (GtkWidget *w,
/* Returns the translated timezone location of the given EMapPoint,
* e.g. "Europe/London". */
-static icaltimezone *
+static ICalTimezone *
get_zone_from_point (ETimezoneDialog *etd,
EMapPoint *point)
{
- icalarray *zones;
+ ICalArray *zones;
gdouble longitude, latitude;
- gint i;
+ gint ii, sz;
if (point == NULL)
return NULL;
@@ -736,23 +746,27 @@ get_zone_from_point (ETimezoneDialog *etd,
e_map_point_get_location (point, &longitude, &latitude);
/* Get the array of builtin timezones. */
- zones = icaltimezone_get_builtin_timezones ();
+ zones = i_cal_timezone_get_builtin_timezones ();
+ sz = i_cal_array_size (zones);
- for (i = 0; i < zones->num_elements; i++) {
- icaltimezone *zone;
+ for (ii = 0; ii < sz; ii++) {
+ ICalTimezone *zone;
gdouble zone_longitude, zone_latitude;
- zone = icalarray_element_at (zones, i);
- zone_longitude = icaltimezone_get_longitude (zone);
- zone_latitude = icaltimezone_get_latitude (zone);
+ zone = i_cal_timezone_array_element_at (zones, ii);
+ zone_longitude = i_cal_timezone_get_longitude (zone);
+ zone_latitude = i_cal_timezone_get_latitude (zone);
if (zone_longitude - 0.005 <= longitude &&
zone_longitude + 0.005 >= longitude &&
zone_latitude - 0.005 <= latitude &&
zone_latitude + 0.005 >= latitude)
{
+ /* The caller owns the reference */
return zone;
}
+
+ g_clear_object (&zone);
}
g_return_val_if_reached (NULL);
@@ -762,10 +776,10 @@ get_zone_from_point (ETimezoneDialog *etd,
* e_timezone_dialog_get_timezone:
* @etd: the timezone dialog
*
- * Return value: the currently-selected timezone, or %NULL if no timezone
- * is selected.
+ * Returns: (transfer none): the currently-selected timezone as an #ICalTimezone obejct,
+ * or %NULL if no timezone is selected.
**/
-icaltimezone *
+ICalTimezone *
e_timezone_dialog_get_timezone (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
@@ -789,7 +803,7 @@ e_timezone_dialog_get_timezone (ETimezoneDialog *etd)
void
e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
- icaltimezone *zone)
+ const ICalTimezone *zone)
{
ETimezoneDialogPrivate *priv;
gchar *display = NULL;
@@ -803,13 +817,13 @@ e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
display = zone_display_name_with_offset (zone);
/* Add any unknown/custom timezone with defined location */
- if (zone && icaltimezone_get_location (zone) &&
- !g_hash_table_lookup (etd->priv->index, icaltimezone_get_location (zone))) {
+ if (zone && i_cal_timezone_get_location (zone) &&
+ !g_hash_table_lookup (etd->priv->index, i_cal_timezone_get_location (zone))) {
GtkTreeStore *tree_store;
GtkTreeIter *piter, iter;
const gchar *location;
- location = icaltimezone_get_location (zone);
+ location = i_cal_timezone_get_location (zone);
tree_store = GTK_TREE_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX
(etd->priv->timezone_combo)));
gtk_tree_store_prepend (tree_store, &iter, NULL);
@@ -820,12 +834,14 @@ e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
g_hash_table_insert (etd->priv->index, (gchar *) location, piter);
- etd->priv->custom_zones = g_slist_prepend (etd->priv->custom_zones, zone);
+ etd->priv->custom_zones = g_slist_prepend (etd->priv->custom_zones, e_cal_util_copy_timezone
(zone));
}
priv = etd->priv;
- priv->zone = zone;
+ g_clear_object (&priv->zone);
+
+ priv->zone = zone ? e_cal_util_copy_timezone (zone) : NULL;
gtk_label_set_text (
GTK_LABEL (priv->preview_label),
@@ -851,7 +867,7 @@ e_timezone_dialog_get_toplevel (ETimezoneDialog *etd)
static void
set_map_timezone (ETimezoneDialog *etd,
- icaltimezone *zone)
+ const ICalTimezone *zone)
{
ETimezoneDialogPrivate *priv;
EMapPoint *point;
@@ -860,8 +876,8 @@ set_map_timezone (ETimezoneDialog *etd,
priv = etd->priv;
if (zone) {
- zone_longitude = icaltimezone_get_longitude (zone);
- zone_latitude = icaltimezone_get_latitude (zone);
+ zone_longitude = i_cal_timezone_get_longitude (zone);
+ zone_latitude = i_cal_timezone_get_latitude (zone);
point = e_map_get_closest_point (
priv->map,
zone_longitude,
@@ -884,42 +900,48 @@ on_combo_changed (GtkComboBox *combo_box,
{
ETimezoneDialogPrivate *priv;
gchar *new_zone_name;
- icalarray *zones;
- icaltimezone *map_zone = NULL;
+ ICalArray *zones;
+ ICalTimezone *map_zone = NULL;
gchar *location;
- gint i;
+ gint ii, sz;
priv = etd->priv;
timezone_combo_get_active_text (
GTK_COMBO_BOX (priv->timezone_combo), &new_zone_name);
+ g_clear_object (&priv->zone);
+
if (!new_zone_name || !*new_zone_name)
priv->zone = NULL;
else if (!g_utf8_collate (new_zone_name, _("UTC")))
- priv->zone = icaltimezone_get_utc_timezone ();
+ priv->zone = e_cal_util_copy_timezone (i_cal_timezone_get_utc_timezone ());
else {
priv->zone = NULL;
- zones = icaltimezone_get_builtin_timezones ();
- for (i = 0; i < zones->num_elements; i++) {
- map_zone = icalarray_element_at (zones, i);
- location = _(icaltimezone_get_location (map_zone));
+ zones = i_cal_timezone_get_builtin_timezones ();
+ sz = i_cal_array_size (zones);
+
+ for (ii = 0; ii < sz; ii++) {
+ map_zone = i_cal_timezone_array_element_at (zones, ii);
+ location = _(i_cal_timezone_get_location (map_zone));
if (!g_utf8_collate (new_zone_name, location)) {
priv->zone = map_zone;
break;
}
+
+ g_clear_object (&map_zone);
}
if (!priv->zone) {
GSList *link;
for (link = priv->custom_zones; link; link = g_slist_next (link)) {
- icaltimezone *zone = link->data;
+ ICalTimezone *zone = link->data;
- if (zone && g_utf8_collate (new_zone_name, _(icaltimezone_get_location
(zone))) == 0) {
+ if (zone && g_utf8_collate (new_zone_name, _(i_cal_timezone_get_location
(zone))) == 0) {
map_zone = zone;
- priv->zone = zone;
+ priv->zone = e_cal_util_copy_timezone (zone);
break;
}
}
diff --git a/src/e-util/e-timezone-dialog.h b/src/e-util/e-timezone-dialog.h
index 0be885b1e5..43f6bb81e6 100644
--- a/src/e-util/e-timezone-dialog.h
+++ b/src/e-util/e-timezone-dialog.h
@@ -29,7 +29,10 @@
#define E_TIMEZONE_DIALOG_H
#include <gtk/gtk.h>
-#include <libical/ical.h>
+
+#define LIBICAL_GLIB_UNSTABLE_API 1
+#include <libical-glib/libical-glib.h>
+#undef LIBICAL_GLIB_UNSTABLE_API
/* Standard GObject macros */
#define E_TYPE_TIMEZONE_DIALOG \
@@ -68,9 +71,9 @@ ETimezoneDialog *
e_timezone_dialog_construct (ETimezoneDialog *etd);
ETimezoneDialog *
e_timezone_dialog_new (void);
-icaltimezone * e_timezone_dialog_get_timezone (ETimezoneDialog *etd);
+ICalTimezone * e_timezone_dialog_get_timezone (ETimezoneDialog *etd);
void e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
- icaltimezone *zone);
+ const ICalTimezone *zone);
GtkWidget * e_timezone_dialog_get_toplevel (ETimezoneDialog *etd);
#endif /* E_TIMEZONE_DIALOG_H */
diff --git a/src/e-util/test-source-selector.c b/src/e-util/test-source-selector.c
index 2d5df38c0b..f1bbb1197d 100644
--- a/src/e-util/test-source-selector.c
+++ b/src/e-util/test-source-selector.c
@@ -311,9 +311,13 @@ cal_view_objects_removed_cb (ECalClientView *client_view,
for (link = (GSList *) uids; link; link = g_slist_next (link)) {
ECalComponentId *id = link->data;
+ const gchar *uid, *rid;
+
+ uid = id ? e_cal_component_id_get_uid (id) : NULL;
+ rid = id ? e_cal_component_id_get_uid (id) : NULL;
if (id)
- g_print ("\tuid:%s%s%s\n", id->uid, id->rid ? " rid:" : "", id->rid ? id->rid : "");
+ g_print ("\tuid:%s%s%s\n", uid, rid ? " rid:" : "", rid ? rid : "");
else
g_print ("\tnull\n");
}
diff --git a/src/modules/alarm-notify/alarm-notify.c b/src/modules/alarm-notify/alarm-notify.c
index 5176357014..e3cdaba2ba 100644
--- a/src/modules/alarm-notify/alarm-notify.c
+++ b/src/modules/alarm-notify/alarm-notify.c
@@ -104,7 +104,7 @@ alarm_notify_module_format_time_cb (EReminderWatcher *watcher,
g_return_if_fail (*inout_buffer != NULL);
g_return_if_fail (buffer_size > 0);
- tm = icaltimetype_to_tm (itt);
+ tm = e_cal_util_icaltime_to_tm (itt);
text = e_datetime_format_format_tm ("calendar", "table", itt->is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
if (text) {
diff --git a/src/modules/calendar/e-cal-attachment-handler.c b/src/modules/calendar/e-cal-attachment-handler.c
index 5cf9cd755a..62112e3258 100644
--- a/src/modules/calendar/e-cal-attachment-handler.c
+++ b/src/modules/calendar/e-cal-attachment-handler.c
@@ -23,7 +23,6 @@
#include "e-cal-attachment-handler.h"
#include <glib/gi18n.h>
-#include <libical/ical.h>
#include <camel/camel.h>
#include <libecal/libecal.h>
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index 25b876d6d8..cf0f397054 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -1012,12 +1012,12 @@ cal_shell_content_check_state (EShellContent *shell_content)
e_cal_util_component_has_organizer (icalcomp) &&
itip_organizer_is_user (registry, comp, client);
- capability = CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED;
+ capability = E_CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED;
cap_delegate_supported =
e_client_check_capability (
E_CLIENT (client), capability);
- capability = CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY;
+ capability = E_CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY;
cap_delegate_to_many =
e_client_check_capability (
E_CLIENT (client), capability);
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-private.c b/src/modules/calendar/e-cal-shell-view-private.c
index 42a4b2712a..06c5a2c47a 100644
--- a/src/modules/calendar/e-cal-shell-view-private.c
+++ b/src/modules/calendar/e-cal-shell-view-private.c
@@ -60,7 +60,7 @@ cal_shell_view_get_current_time (ECalendarItem *calitem,
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone);
- return icaltimetype_to_tm (&tt);
+ return e_cal_util_icaltime_to_tm (&tt);
}
static void
@@ -717,9 +717,9 @@ cal_search_get_object_list_cb (GObject *source,
cal_searching_instances_done_cb);
}
- e_cal_client_free_icalcomp_slist (icalcomps);
+ e_util_free_nullable_object_slist (icalcomps);
} else {
- e_cal_client_free_icalcomp_slist (icalcomps);
+ e_util_free_nullable_object_slist (icalcomps);
}
}
diff --git a/src/modules/calendar/e-cal-shell-view-taskpad.c b/src/modules/calendar/e-cal-shell-view-taskpad.c
index 891bbb1917..8deada2f36 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);
@@ -437,11 +437,11 @@ e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
editable &= !read_only;
- cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ cap = E_CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
assignable = FALSE;
- cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ cap = E_CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
assignable = FALSE;
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-content.c b/src/modules/calendar/e-task-shell-content.c
index c425d8f74a..88d403c4c9 100644
--- a/src/modules/calendar/e-task-shell-content.c
+++ b/src/modules/calendar/e-task-shell-content.c
@@ -291,11 +291,11 @@ task_shell_content_check_state (EShellContent *shell_content)
read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
editable &= !read_only;
- cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ cap = E_CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
assignable = FALSE;
- cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ cap = E_CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
assignable = FALSE;
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..24e62cba44 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);
}
@@ -3731,7 +3735,7 @@ itip_view_cal_opened_cb (GObject *source_object,
needs_decline = e_client_check_capability (
client,
- CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING);
+ E_CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING);
itip_view_set_needs_decline (view, needs_decline);
itip_view_set_mode (view, ITIP_VIEW_MODE_PUBLISH);
}
@@ -3998,7 +4002,7 @@ find_cal_update_ui (FormatItipFindData *fd,
if (view->priv->type == E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
/* TODO The static capability should be made generic to convey that the calendar
contains unaccepted items */
- if (e_client_check_capability (E_CLIENT (view->priv->current_client),
CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+ if (e_client_check_capability (E_CLIENT (view->priv->current_client),
E_CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
itip_view_set_needs_decline (view, TRUE);
else
itip_view_set_needs_decline (view, FALSE);
@@ -4454,7 +4458,7 @@ find_server (ItipView *view,
fd->cancelled_id = g_cancellable_connect (
fd->itip_cancellable,
G_CALLBACK (itip_cancellable_cancelled), fd->cancellable, NULL);
- fd->conflicts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
(GDestroyNotify) e_cal_client_free_icalcomp_slist);
+ fd->conflicts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
(GDestroyNotify) e_util_free_nullable_object_slist);
fd->uid = g_strdup (uid);
fd->rid = rid;
/* avoid free this at the end */
@@ -4973,16 +4977,17 @@ update_item (ItipView *view,
if (itip_view_get_keep_alarm_check_state (view)) {
ECalComponent *real_comp;
- GList *alarms, *l;
- ECalComponentAlarm *alarm;
real_comp = get_real_item (view);
if (real_comp != NULL) {
+ GSList *alarms, *link;
+
alarms = e_cal_component_get_alarm_uids (real_comp);
for (l = alarms; l; l = l->next) {
- alarm = e_cal_component_get_alarm (
- real_comp, (const gchar *) l->data);
+ ECalComponentAlarm *alarm;
+
+ alarm = e_cal_component_get_alarm (real_comp, link->data);
if (alarm) {
ECalComponentAlarm *aclone = e_cal_component_alarm_clone (alarm);
@@ -4996,7 +5001,7 @@ update_item (ItipView *view,
}
}
- cal_obj_uid_list_free (alarms);
+ g_slist_free_full (alarms, g_free);
g_object_unref (real_comp);
}
}
@@ -6025,7 +6030,7 @@ view_response_cb (ItipView *view,
}
if (!view->priv->to_address && view->priv->current_client != NULL) {
- e_client_get_backend_property_sync (E_CLIENT (view->priv->current_client),
CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &view->priv->to_address, NULL, NULL);
+ e_client_get_backend_property_sync (E_CLIENT (view->priv->current_client),
E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &view->priv->to_address, NULL, NULL);
if (view->priv->to_address && !*view->priv->to_address) {
g_free (view->priv->to_address);
@@ -6517,7 +6522,7 @@ itip_view_init_view (ItipView *view)
} else
from_zone = NULL;
- start_tm = icaltimetype_to_tm_with_zone (datetime.value, from_zone, to_zone);
+ start_tm = e_cal_util_icaltime_to_tm_with_zone (datetime.value, from_zone, to_zone);
itip_view_set_start (view, &start_tm, datetime.value->is_date);
view->priv->start_time = icaltime_as_timet_with_zone (*datetime.value, from_zone);
@@ -6563,7 +6568,7 @@ itip_view_init_view (ItipView *view)
icaltime_adjust (datetime.value, -1, 0, 0, 0);
}
- end_tm = icaltimetype_to_tm_with_zone (datetime.value, from_zone, to_zone);
+ end_tm = e_cal_util_icaltime_to_tm_with_zone (datetime.value, from_zone, to_zone);
itip_view_set_end (view, &end_tm, datetime.value->is_date);
view->priv->end_time = icaltime_as_timet_with_zone (*datetime.value, from_zone);
diff --git a/src/plugins/mail-to-task/mail-to-task.c b/src/plugins/mail-to-task/mail-to-task.c
index bd954611bd..c6285176f8 100644
--- a/src/plugins/mail-to-task/mail-to-task.c
+++ b/src/plugins/mail-to-task/mail-to-task.c
@@ -895,9 +895,9 @@ do_mail_to_event (AsyncData *data)
}
/* precache backend properties, thus editor have them ready when needed */
- cache_backend_prop (CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS);
- cache_backend_prop (CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS);
- cache_backend_prop (CAL_BACKEND_PROPERTY_DEFAULT_OBJECT);
+ cache_backend_prop (E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS);
+ cache_backend_prop (E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS);
+ cache_backend_prop (E_CAL_BACKEND_PROPERTY_DEFAULT_OBJECT);
e_client_get_capabilities (E_CLIENT (client));
#undef cache_backend_prop
diff --git a/src/plugins/publish-calendar/publish-format-fb.c
b/src/plugins/publish-calendar/publish-format-fb.c
index 2640e92cae..7d6c264b6b 100644
--- a/src/plugins/publish-calendar/publish-format-fb.c
+++ b/src/plugins/publish-calendar/publish-format-fb.c
@@ -86,7 +86,7 @@ write_calendar (const gchar *uid,
if (client == NULL)
return FALSE;
- if (e_client_get_backend_property_sync (client, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email, NULL,
NULL)) {
+ if (e_client_get_backend_property_sync (client, E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, &email,
NULL, NULL)) {
if (email && *email)
users = g_slist_append (users, email);
}
@@ -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/publish-calendar/publish-format-ical.c
b/src/plugins/publish-calendar/publish-format-ical.c
index ade9e59e8b..ccaf374f3d 100644
--- a/src/plugins/publish-calendar/publish-format-ical.c
+++ b/src/plugins/publish-calendar/publish-format-ical.c
@@ -132,7 +132,7 @@ write_calendar (const gchar *uid,
ical_string = icalcomponent_as_ical_string_r (top_level);
res = g_output_stream_write_all (stream, ical_string, strlen (ical_string), NULL, NULL,
error);
g_free (ical_string);
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
}
g_object_unref (client);
diff --git a/src/plugins/save-calendar/csv-format.c b/src/plugins/save-calendar/csv-format.c
index 9e7d29ca9c..57b2013c63 100644
--- a/src/plugins/save-calendar/csv-format.c
+++ b/src/plugins/save-calendar/csv-format.c
@@ -149,7 +149,7 @@ add_time_to_csv (GString *line,
if (time) {
gboolean needquotes = FALSE;
- struct tm mytm = icaltimetype_to_tm (time);
+ struct tm mytm = e_cal_util_icaltime_to_tm (time);
gchar *str = (gchar *) g_malloc (sizeof (gchar) * 200);
/* Translators: the %F %T is the third argument for a
@@ -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/ical-format.c b/src/plugins/save-calendar/ical-format.c
index e42ae7f0f7..43171faf39 100644
--- a/src/plugins/save-calendar/ical-format.c
+++ b/src/plugins/save-calendar/ical-format.c
@@ -157,7 +157,7 @@ do_save_calendar_ical (FormatHandler *handler,
g_free (ical_str);
}
- e_cal_client_free_icalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
}
if (error != NULL) {
diff --git a/src/plugins/save-calendar/rdf-format.c b/src/plugins/save-calendar/rdf-format.c
index ee6760ae83..3be32efe6e 100644
--- a/src/plugins/save-calendar/rdf-format.c
+++ b/src/plugins/save-calendar/rdf-format.c
@@ -133,7 +133,7 @@ add_time_to_rdf (xmlNodePtr node,
{
if (time) {
xmlNodePtr cur_node = NULL;
- struct tm mytm = icaltimetype_to_tm (time);
+ struct tm mytm = e_cal_util_icaltime_to_tm (time);
gchar *str = (gchar *) g_malloc (sizeof (gchar) * 200);
gchar *tmp = NULL;
gchar *timezone;
@@ -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);
diff --git a/src/shell/main.c b/src/shell/main.c
index abc140d55f..f3aadd2f5d 100644
--- a/src/shell/main.c
+++ b/src/shell/main.c
@@ -486,13 +486,7 @@ main (gint argc,
exit (1);
}
-#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
- ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
-#endif
-
-#ifdef HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT
- icaltzutil_set_exact_vtimezones_support (0);
-#endif
+ i_cal_set_unknown_token_handling_setting (I_CAL_DISCARD_TOKEN);
#ifdef G_OS_WIN32
if (register_handlers || reinstall || show_icons) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]