[evolution/wip/mcrha/eds-libical-glib] Port to libecal-2.0
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/eds-libical-glib] Port to libecal-2.0
- Date: Thu, 25 Apr 2019 13:19:11 +0000 (UTC)
commit ebc835dec2cdae54daa9bb9272c7ce95882e00a1
Author: Milan Crha <mcrha redhat com>
Date: Thu Apr 25 15:10:51 2019 +0200
Port to libecal-2.0
CMakeLists.txt | 45 +-
config.h.in | 12 -
src/calendar/gui/CMakeLists.txt | 6 +-
src/calendar/gui/calendar-config.c | 31 +-
src/calendar/gui/calendar-config.h | 2 +-
src/calendar/gui/comp-util.c | 765 +++++------
src/calendar/gui/comp-util.h | 76 +-
src/calendar/gui/e-alarm-list.c | 69 +-
src/calendar/gui/e-cal-component-preview.c | 212 ++--
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 | 223 ++--
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 | 158 ++-
src/calendar/gui/e-cal-list-view.h | 30 +-
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 | 645 +++++-----
src/calendar/gui/e-cal-model.h | 33 +-
src/calendar/gui/e-cal-ops.c | 445 ++++---
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 | 237 ++--
src/calendar/gui/e-comp-editor-memo.c | 2 +-
src/calendar/gui/e-comp-editor-page-attachments.c | 106 +-
src/calendar/gui/e-comp-editor-page-general.c | 282 +++--
src/calendar/gui/e-comp-editor-page-recurrence.c | 529 ++++----
src/calendar/gui/e-comp-editor-page-reminders.c | 558 ++++----
src/calendar/gui/e-comp-editor-page-schedule.c | 144 ++-
src/calendar/gui/e-comp-editor-page.c | 16 +-
src/calendar/gui/e-comp-editor-page.h | 8 +-
src/calendar/gui/e-comp-editor-property-part.c | 393 +++---
src/calendar/gui/e-comp-editor-property-part.h | 70 +-
src/calendar/gui/e-comp-editor-property-parts.c | 259 ++--
src/calendar/gui/e-comp-editor-task.c | 136 +-
src/calendar/gui/e-comp-editor.c | 492 ++++----
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 | 77 +-
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.c | 658 ++++------
src/calendar/gui/e-meeting-attendee.h | 217 ++--
src/calendar/gui/e-meeting-list-view.c | 65 +-
src/calendar/gui/e-meeting-store.c | 477 ++++---
src/calendar/gui/e-meeting-store.h | 4 +-
src/calendar/gui/e-meeting-utils.c | 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 | 384 +++---
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.c | 461 +++----
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 | 38 +-
src/modules/alarm-notify/alarm-notify.c | 24 +-
src/modules/calendar/e-cal-attachment-handler.c | 114 +-
src/modules/calendar/e-cal-base-shell-backend.c | 121 +-
src/modules/calendar/e-cal-base-shell-sidebar.c | 25 +-
src/modules/calendar/e-cal-shell-content.c | 199 +--
src/modules/calendar/e-cal-shell-view-actions.c | 219 ++--
src/modules/calendar/e-cal-shell-view-memopad.c | 22 +-
src/modules/calendar/e-cal-shell-view-private.c | 106 +-
src/modules/calendar/e-cal-shell-view-taskpad.c | 30 +-
src/modules/calendar/e-cal-shell-view.c | 13 +-
src/modules/calendar/e-calendar-preferences.c | 34 +-
src/modules/calendar/e-memo-shell-content.c | 25 +-
src/modules/calendar/e-memo-shell-view-actions.c | 18 +-
src/modules/calendar/e-task-shell-content.c | 34 +-
src/modules/calendar/e-task-shell-view-actions.c | 18 +-
src/modules/calendar/e-task-shell-view.c | 9 +-
.../composer-to-meeting/e-composer-to-meeting.c | 65 +-
.../composer-to-meeting/e-meeting-to-composer.c | 64 +-
src/modules/itip-formatter/itip-view.c | 1327 +++++++++++---------
src/modules/settings/e-settings-cal-model.c | 8 +-
src/modules/settings/e-settings-client-cache.c | 8 +-
src/modules/settings/e-settings-meeting-store.c | 8 +-
.../e-mail-parser-tnef-attachment.c | 8 +-
src/plugins/mail-to-task/mail-to-task.c | 140 +--
src/plugins/pst-import/pst-importer.c | 183 +--
src/plugins/publish-calendar/publish-format-fb.c | 30 +-
src/plugins/publish-calendar/publish-format-ical.c | 34 +-
src/plugins/save-calendar/CMakeLists.txt | 1 +
src/plugins/save-calendar/csv-format.c | 122 +-
src/plugins/save-calendar/format-handler.h | 1 +
src/plugins/save-calendar/ical-format.c | 34 +-
src/plugins/save-calendar/rdf-format.c | 120 +-
src/shell/main.c | 8 +-
112 files changed, 8951 insertions(+), 8140 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10fb0ebb13..d72543fbca 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/CMakeLists.txt b/src/calendar/gui/CMakeLists.txt
index 09cf401d6c..dcf5fe171d 100644
--- a/src/calendar/gui/CMakeLists.txt
+++ b/src/calendar/gui/CMakeLists.txt
@@ -35,8 +35,8 @@ set(SOURCES
e-cal-dialogs.c
e-cal-event.c
e-cal-list-view.c
- e-cal-model-calendar.c
e-cal-model.c
+ e-cal-model-calendar.c
e-cal-model-memos.c
e-cal-model-tasks.c
e-cal-ops.c
@@ -55,11 +55,11 @@ set(SOURCES
e-comp-editor-property-parts.c
e-comp-editor-task.c
e-date-time-list.c
+ e-day-view.c
e-day-view-layout.c
e-day-view-main-item.c
e-day-view-time-item.c
e-day-view-top-item.c
- e-day-view.c
e-meeting-attendee.c
e-meeting-list-view.c
e-meeting-store.c
@@ -73,11 +73,11 @@ set(SOURCES
e-send-options-utils.c
e-task-table.c
e-to-do-pane.c
+ e-week-view.c
e-week-view-event-item.c
e-week-view-layout.c
e-week-view-main-item.c
e-week-view-titles-item.c
- e-week-view.c
e-weekday-chooser.c
e-timezone-entry.c
itip-utils.c
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..064e44aa71 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;
@@ -268,10 +272,10 @@ cal_comp_is_on_server_sync (ECalComponent *comp,
/**
* cal_comp_is_icalcomp_on_server_sync:
* The same as cal_comp_is_on_server_sync(), only the component parameter is
- * icalcomponent, not the ECalComponent.
+ * 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 417a08932e..ee7d890d46 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -49,12 +49,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;
};
@@ -79,25 +79,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;
@@ -115,32 +112,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);
@@ -151,7 +143,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;
}
@@ -161,26 +153,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
@@ -213,17 +208,18 @@ 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, *tmp;
- gint *priority_value;
+ ICalComponent *icomp;
+ ICalProperty *prop;
+ ICalPropertyStatus status;
+ const gchar *tmp;
+ gchar *location, *url;
+ gint priority;
gchar *markup;
client = preview->priv->client;
@@ -231,23 +227,24 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
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\">");
- markup = g_markup_escape_text (text.value ? text.value : _("Untitled"), -1);
- if (text.value)
+ markup = g_markup_escape_text (text && e_cal_component_text_get_value (text) ?
e_cal_component_text_get_value (text) : _("Untitled"), -1);
+ if (text && e_cal_component_text_get_value (text))
g_string_append_printf (buffer, "<h2>%s</h2>", markup);
else
g_string_append_printf (buffer, "<h2><i>%s</i></h2>", markup);
+ e_cal_component_text_free (text);
g_free (markup);
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) {
markup = g_markup_escape_text (_("Categories:"), -1);
g_string_append_printf (buffer, "<tr><th>%s</th><td>", markup);
@@ -281,43 +278,47 @@ 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);
cal_component_preview_add_table_line (buffer, _("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);
cal_component_preview_add_table_line (buffer, _("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);
cal_component_preview_add_table_line (buffer, _("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);
cal_component_preview_add_table_line (buffer, _("Due Date:"), str);
g_free (str);
}
- e_cal_component_free_datetime (&dt);
+ e_cal_component_datetime_free (dt);
+
+ icomp = e_cal_component_get_icalcomponent (comp);
- 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);
+ 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) {
cal_component_preview_add_table_line (buffer, _("Recurs:"), str);
@@ -326,36 +327,36 @@ 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) {
- e_cal_component_get_status (comp, &status);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_STATUS_PROPERTY);
+ if (prop) {
+ status = e_cal_component_get_status (comp);
switch (status) {
- case ICAL_STATUS_INPROCESS :
+ case I_CAL_STATUS_INPROCESS :
tmp = _("In Progress");
break;
- case ICAL_STATUS_COMPLETED :
+ case I_CAL_STATUS_COMPLETED :
tmp = _("Completed");
break;
- case ICAL_STATUS_CANCELLED :
+ case I_CAL_STATUS_CANCELLED :
tmp = _("Cancelled");
break;
- case ICAL_STATUS_NONE :
+ case I_CAL_STATUS_NONE :
default :
tmp = _("Not Started");
break;
}
cal_component_preview_add_table_line (buffer, _("Status:"), tmp);
+
+ g_object_unref (prop);
}
/* write priority */
- e_cal_component_get_priority (comp, &priority_value);
- if (priority_value && *priority_value != 0) {
- if (*priority_value <= 4)
+ priority = e_cal_component_get_priority (comp);
+ if (priority > 0) {
+ if (priority <= 4)
tmp = _("High");
- else if (*priority_value == 5)
+ else if (priority == 5)
tmp = _("Normal");
else
tmp = _("Low");
@@ -363,25 +364,22 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
cal_component_preview_add_table_line (buffer, _("Priority:"), tmp);
}
- if (priority_value)
- e_cal_component_free_priority (priority_value);
-
if (e_cal_component_has_organizer (comp)) {
- ECalComponentOrganizer organizer = { 0 };
+ ECalComponentOrganizer *organizer;
- e_cal_component_get_organizer (comp, &organizer);
+ organizer = e_cal_component_get_organizer (comp);
- if (organizer.value && *organizer.value) {
- const gchar *email = itip_strip_mailto (organizer.value);
+ if (organizer && e_cal_component_organizer_get_value (organizer) &&
e_cal_component_organizer_get_value (organizer)[0]) {
+ const gchar *email = itip_strip_mailto (e_cal_component_organizer_get_value
(organizer));
if (!email)
email = "";
markup = g_markup_escape_text (_("Organizer:"), -1);
g_string_append_printf (buffer, "<tr><th>%s</th>", markup);
g_free (markup);
- if (organizer.cn && *organizer.cn) {
+ if (e_cal_component_organizer_get_cn (organizer) && e_cal_component_organizer_get_cn
(organizer)[0]) {
gchar *html;
- str = g_strconcat (organizer.cn, " <", email, ">", NULL);
+ str = g_strconcat (e_cal_component_organizer_get_cn (organizer), " <", email,
">", NULL);
html = camel_text_to_html (str,
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
@@ -398,19 +396,21 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (str);
}
}
+
+ e_cal_component_organizer_free (organizer);
}
if (e_cal_component_has_attendees (comp)) {
GSList *attendees = NULL, *a;
gboolean have = FALSE;
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
for (a = attendees; a; a = a->next) {
ECalComponentAttendee *attnd = a->data;
const gchar *email;
- if (!attnd || !attnd->value || !*attnd->value)
+ if (!attnd || !e_cal_component_attendee_get_value (attnd) ||
!e_cal_component_attendee_get_value (attnd)[0])
continue;
if (!have) {
@@ -421,14 +421,14 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append (buffer, "<br>");
}
- email = itip_strip_mailto (attnd->value);
+ email = itip_strip_mailto (e_cal_component_attendee_get_value (attnd));
if (!email)
email = "";
- if (attnd->cn && *attnd->cn) {
+ if (e_cal_component_attendee_get_cn (attnd) && e_cal_component_attendee_get_cn
(attnd)[0]) {
gchar *html;
- str = g_strconcat (attnd->cn, " <", email, ">", NULL);
+ str = g_strconcat (e_cal_component_attendee_get_cn (attnd), " <", email, ">",
NULL);
html = camel_text_to_html (str,
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
@@ -451,13 +451,13 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
if (have)
g_string_append (buffer, "</td></tr>");
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
/* 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;
@@ -470,9 +470,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 |
@@ -486,11 +489,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, *header_markup;
const gchar *href = url;
@@ -522,6 +525,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (header_markup);
g_free (markup);
g_free (str);
+ g_free (url);
}
g_string_append (buffer, "</table>");
@@ -614,7 +618,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..9e5dcdb222 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,
+ e_cal_client_generate_instances_for_object_sync (client, icomp, range_start, range_end, NULL,
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..ee90c72ccc 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);
+
+ 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;
}
@@ -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->priv->cursor_event) {
+ g_free (cal_list_view->priv->cursor_event);
+ cal_list_view->priv->cursor_event = NULL;
}
- if (cal_list_view->cursor_event) {
- g_free (cal_list_view->cursor_event);
- cal_list_view->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) {
@@ -628,6 +648,14 @@ e_cal_list_view_get_visible_time_range (ECalendarView *cal_view,
return FALSE;
}
+ETable *
+e_cal_list_view_get_table (ECalListView *cal_list_view)
+{
+ g_return_val_if_fail (E_IS_CAL_LIST_VIEW (cal_list_view), NULL);
+
+ return cal_list_view->priv->table;
+}
+
gboolean
e_cal_list_view_get_range_shown (ECalListView *cal_list_view,
GDate *start_date,
@@ -636,6 +664,8 @@ e_cal_list_view_get_range_shown (ECalListView *cal_list_view,
time_t first, last;
GDate end_date;
+ g_return_val_if_fail (E_IS_CAL_LIST_VIEW (cal_list_view), FALSE);
+
if (!e_cal_list_view_get_visible_time_range (E_CALENDAR_VIEW (cal_list_view), &first, &last))
return FALSE;
@@ -651,5 +681,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..985955d4a0 100644
--- a/src/calendar/gui/e-cal-list-view.h
+++ b/src/calendar/gui/e-cal-list-view.h
@@ -55,38 +55,26 @@
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 {
ECalendarViewClass parent_class;
};
-GType e_cal_list_view_get_type (void);
-ECalendarView *e_cal_list_view_new (ECalModel *cal_model);
-
-gboolean e_cal_list_view_get_range_shown (ECalListView *cal_list_view, GDate *start_date,
+GType e_cal_list_view_get_type (void);
+ECalendarView * e_cal_list_view_new (ECalModel *cal_model);
+ETable * e_cal_list_view_get_table (ECalListView *cal_list_view);
+gboolean e_cal_list_view_get_range_shown (ECalListView *cal_list_view,
+ GDate *start_date,
gint *days_shown);
-
gboolean e_cal_list_view_is_editing (ECalListView *eclv);
G_END_DECLS
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..4f01a83a31 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 = NULL;
- 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 = 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) {
+ 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..d8d4cfdbdf 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;
+ ICalProperty *prop;
+ GString *str = NULL;
- 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)));
-
- 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 = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_SUMMARY_PROPERTY);
- if (prop && icalproperty_get_summary (prop))
- return g_strdup (icalproperty_get_summary (prop));
+ 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));
- return g_strdup ("");
+ g_clear_object (&prop);
+
+ 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
@@ -711,7 +695,7 @@ cal_model_set_property (GObject *object,
case PROP_TIMEZONE:
e_cal_model_set_timezone (
E_CAL_MODEL (object),
- g_value_get_pointer (value));
+ g_value_get_object (value));
return;
case PROP_USE_24_HOUR_FORMAT:
@@ -964,7 +948,7 @@ cal_model_get_property (GObject *object,
return;
case PROP_TIMEZONE:
- g_value_set_pointer (
+ g_value_set_object (
value,
e_cal_model_get_timezone (
E_CAL_MODEL (object)));
@@ -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;
@@ -2203,10 +2185,11 @@ e_cal_model_class_init (ECalModelClass *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 (
@@ -2577,10 +2560,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 +2623,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 +2649,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 +2813,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 +2840,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 +2851,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 +2860,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 +3625,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 +3735,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 +3743,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 +3757,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 +3770,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 +3803,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 +3830,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 +3871,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 +3981,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 +3992,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 +4003,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);
- return gid->cb (comp, instance_start, instance_end, &gid->mdata);
+ res = gid->cb (comp, changed_instance_start, changed_instance_end, &gid->mdata, cancellable, error);
+
+ g_clear_object (&changed_instance_start);
+ g_clear_object (&changed_instance_end);
+
+ return res;
}
/**
@@ -4059,7 +4043,8 @@ void
e_cal_model_generate_instances_sync (ECalModel *model,
time_t start,
time_t end,
- ECalRecurInstanceFn cb,
+ GCancellable *cancellable,
+ ECalRecurInstanceCb cb,
gpointer cb_data)
{
GenerateInstancesData gid;
@@ -4079,7 +4064,7 @@ e_cal_model_generate_instances_sync (ECalModel *model,
gid.mdata.comp_data = comp_data;
e_cal_client_generate_instances_for_object_sync (comp_data->client,
comp_data->icalcomp, start, end,
- ecm_generate_instances_cb, &gid);
+ cancellable, ecm_generate_instances_cb, &gid);
}
}
}
@@ -4099,35 +4084,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;
+
+ if (i_cal_component_isa (comp_data->icalcomp) == I_CAL_VEVENT_COMPONENT) {
+ ICalTime *start_time, *end_time;
- start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
- end_time = icalcomponent_get_dtend (comp_data->icalcomp);
+ start_time = i_cal_component_get_dtstart (comp_data->icalcomp);
+ end_time = i_cal_component_get_dtend (comp_data->icalcomp);
- if (start_time.is_date && icaltime_is_null_time (end_time)) {
+ 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 +4187,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..77ef0d5884 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,12 @@ void e_cal_model_generate_instances_sync
(ECalModel *model,
time_t start,
time_t end,
- ECalRecurInstanceFn cb,
+ GCancellable *cancellable,
+ 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 +387,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 +406,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..7b8bf79f7f 100644
--- a/src/calendar/gui/e-cal-ops.c
+++ b/src/calendar/gui/e-cal-ops.c
@@ -40,7 +40,7 @@
static void
cal_ops_manage_send_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalObjModType mod,
ECalOpsSendFlags send_flags)
{
@@ -49,12 +49,12 @@ cal_ops_manage_send_component (ECalModel *model,
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (icomp));
if ((send_flags & E_CAL_OPS_SEND_FLAG_DONT_SEND) != 0)
return;
- 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;
@@ -81,7 +81,7 @@ cal_ops_manage_send_component (ECalModel *model,
typedef struct {
ECalModel *model;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
ECalObjModType mod;
gchar *uid;
gchar *rid;
@@ -104,18 +104,18 @@ basic_operation_data_free (gpointer ptr)
if (bod) {
if (bod->success) {
- if (bod->create_cb && bod->uid && bod->icalcomp) {
- bod->create_cb (bod->model, bod->client, bod->icalcomp, bod->uid,
bod->user_data);
+ if (bod->create_cb && bod->uid && bod->icomp) {
+ bod->create_cb (bod->model, bod->client, bod->icomp, bod->uid,
bod->user_data);
if (bod->user_data_free)
bod->user_data_free (bod->user_data);
}
- if (bod->is_modify && bod->icalcomp && (bod->send_flags &
E_CAL_OPS_SEND_FLAG_DONT_SEND) == 0) {
- cal_ops_manage_send_component (bod->model, bod->client, bod->icalcomp,
bod->mod, bod->send_flags);
+ if (bod->is_modify && bod->icomp && (bod->send_flags & E_CAL_OPS_SEND_FLAG_DONT_SEND)
== 0) {
+ cal_ops_manage_send_component (bod->model, bod->client, bod->icomp, bod->mod,
bod->send_flags);
}
- if (bod->get_default_comp_cb && bod->icalcomp) {
- bod->get_default_comp_cb (bod->model, bod->client, bod->icalcomp,
bod->user_data);
+ if (bod->get_default_comp_cb && bod->icomp) {
+ bod->get_default_comp_cb (bod->model, bod->client, bod->icomp,
bod->user_data);
if (bod->user_data_free)
bod->user_data_free (bod->user_data);
}
@@ -123,8 +123,7 @@ basic_operation_data_free (gpointer ptr)
g_clear_object (&bod->model);
g_clear_object (&bod->client);
- if (bod->icalcomp)
- icalcomponent_free (bod->icalcomp);
+ g_clear_object (&bod->icomp);
g_free (bod->for_client_uid);
g_free (bod->uid);
g_free (bod->rid);
@@ -142,20 +141,20 @@ cal_ops_create_component_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (bod != NULL);
- bod->success = e_cal_client_create_object_sync (bod->client, bod->icalcomp, &bod->uid, cancellable,
error);
+ bod->success = e_cal_client_create_object_sync (bod->client, bod->icomp, E_CAL_OPERATION_FLAG_NONE,
&bod->uid, cancellable, error);
}
/**
* e_cal_ops_create_component:
* @model: an #ECalModel
* @client: an #ECalClient
- * @icalcomp: an #icalcomponent
+ * @icomp: an #ICalComponent
* @callback: (allow none): a callback to be called on success
* @user_data: user data to be passed to @callback; ignored when @callback is #NULL
* @user_data_free: a function to free @user_data; ignored when @callback is #NULL
*
- * Creates a new @icalcomp in the @client. The @callback, if not #NULL,
- * is called with a new uid of the @icalcomp on sucessful component save.
+ * Creates a new @icomp in the @client. The @callback, if not #NULL,
+ * is called with a new uid of the @icomp on sucessful component save.
* The @callback is called in the main thread.
*
* Since: 3.16
@@ -163,14 +162,14 @@ cal_ops_create_component_thread (EAlertSinkThreadJobData *job_data,
void
e_cal_ops_create_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalOpsCreateComponentFunc callback,
gpointer user_data,
GDestroyNotify user_data_free)
{
ECalDataModel *data_model;
ESource *source;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *description;
const gchar *alert_ident;
gchar *display_name;
@@ -179,7 +178,7 @@ e_cal_ops_create_component (ECalModel *model,
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (icomp));
switch (e_cal_client_get_source_type (client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -205,27 +204,28 @@ e_cal_ops_create_component (ECalModel *model,
bod = g_new0 (BasicOperationData, 1);
bod->model = g_object_ref (model);
bod->client = g_object_ref (client);
- bod->icalcomp = icalcomponent_new_clone (icalcomp);
+ bod->icomp = i_cal_component_new_clone (icomp);
bod->create_cb = callback;
bod->user_data = user_data;
bod->user_data_free = user_data_free;
- prop = icalcomponent_get_first_property (bod->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 (bod->icomp, 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 (bod->icalcomp, prop);
+ prop = i_cal_property_new_class (ical_class);
+ i_cal_component_add_property (bod->icomp, prop);
} else
- icalproperty_set_class (prop, ical_class);
+ i_cal_property_set_class (prop, ical_class);
}
+ g_clear_object (&prop);
display_name = e_util_get_source_full_name (e_cal_model_get_registry (model), source);
cancellable = e_cal_data_model_submit_thread_job (data_model, description, alert_ident,
@@ -249,33 +249,33 @@ cal_ops_modify_component_thread (EAlertSinkThreadJobData *job_data,
if (bod->mod == E_CAL_OBJ_MOD_ALL) {
ECalComponent *comp;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (bod->icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (bod->icomp));
if (comp && e_cal_component_has_recurrences (comp)) {
if (!comp_util_sanitize_recurrence_master_sync (comp, bod->client, cancellable,
error)) {
g_object_unref (comp);
return;
}
- icalcomponent_free (bod->icalcomp);
- bod->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+ g_clear_object (&bod->icomp);
+ bod->icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
}
g_clear_object (&comp);
}
- bod->success = e_cal_client_modify_object_sync (bod->client, bod->icalcomp, bod->mod, cancellable,
error);
+ bod->success = e_cal_client_modify_object_sync (bod->client, bod->icomp, bod->mod,
E_CAL_OPERATION_FLAG_NONE, cancellable, error);
}
/**
* e_cal_ops_modify_component:
* @model: an #ECalModel
* @client: an #ECalClient
- * @icalcomp: an #icalcomponent
+ * @icomp: an #ICalComponent
* @mod: a mode to use for modification of the component
* @send_flags: what to do when the modify succeeded and the component has attendees
*
- * Saves changes of the @icalcomp into the @client using the @mod. The @send_flags influences
- * what to do when the @icalcomp has attendees and the organizer is user. Only one of
+ * Saves changes of the @icomp into the @client using the @mod. The @send_flags influences
+ * what to do when the @icomp has attendees and the organizer is user. Only one of
* #E_CAL_OPS_SEND_FLAG_ASK, #E_CAL_OPS_SEND_FLAG_SEND, #E_CAL_OPS_SEND_FLAG_DONT_SEND
* can be used, while the ASK flag is the default.
*
@@ -284,7 +284,7 @@ cal_ops_modify_component_thread (EAlertSinkThreadJobData *job_data,
void
e_cal_ops_modify_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
ECalObjModType mod,
ECalOpsSendFlags send_flags)
{
@@ -298,7 +298,7 @@ e_cal_ops_modify_component (ECalModel *model,
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (icomp));
switch (e_cal_client_get_source_type (client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -324,7 +324,7 @@ e_cal_ops_modify_component (ECalModel *model,
bod = g_new0 (BasicOperationData, 1);
bod->model = g_object_ref (model);
bod->client = g_object_ref (client);
- bod->icalcomp = icalcomponent_new_clone (icalcomp);
+ bod->icomp = i_cal_component_new_clone (icomp);
bod->mod = mod;
bod->send_flags = send_flags;
bod->is_modify = TRUE;
@@ -351,10 +351,10 @@ cal_ops_remove_component_thread (EAlertSinkThreadJobData *job_data,
/* The check_detached_instance means to test whether the event is a detached instance,
then only that one is deleted, otherwise the master object is deleted */
if (bod->check_detached_instance && bod->mod == E_CAL_OBJ_MOD_THIS && bod->rid && *bod->rid) {
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *local_error = NULL;
- if (!e_cal_client_get_object_sync (bod->client, bod->uid, bod->rid, &icalcomp, cancellable,
&local_error) &&
+ if (!e_cal_client_get_object_sync (bod->client, bod->uid, bod->rid, &icomp, cancellable,
&local_error) &&
g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND)) {
g_free (bod->rid);
bod->rid = NULL;
@@ -362,11 +362,10 @@ cal_ops_remove_component_thread (EAlertSinkThreadJobData *job_data,
}
g_clear_error (&local_error);
- if (icalcomp)
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
}
- bod->success = e_cal_client_remove_object_sync (bod->client, bod->uid, bod->rid, bod->mod,
cancellable, error);
+ bod->success = e_cal_client_remove_object_sync (bod->client, bod->uid, bod->rid, bod->mod,
E_CAL_OPERATION_FLAG_NONE, cancellable, error);
}
/**
@@ -455,16 +454,13 @@ cal_ops_delete_components_thread (EAlertSinkThreadJobData *job_data,
for (link = objects; link && !g_cancellable_is_cancelled (cancellable); link = g_slist_next (link)) {
ECalModelComponent *comp_data = (ECalModelComponent *) link->data;
- struct icaltimetype tt;
- gchar *rid = NULL;
+ gchar *rid;
- tt = icalcomponent_get_recurrenceid (comp_data->icalcomp);
- if (icaltime_is_valid_time (tt) && !icaltime_is_null_time (tt))
- rid = icaltime_as_ical_string_r (tt);
+ rid = e_cal_util_component_get_recurid_as_string (comp_data->icalcomp);
if (!e_cal_client_remove_object_sync (
- comp_data->client, icalcomponent_get_uid (comp_data->icalcomp),
- rid, E_CAL_OBJ_MOD_THIS, cancellable, error)) {
+ comp_data->client, i_cal_component_get_uid (comp_data->icalcomp),
+ rid, E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, cancellable, error)) {
ESource *source = e_client_get_source (E_CLIENT (comp_data->client));
e_alert_sink_thread_job_set_alert_arg_0 (job_data, e_source_get_display_name
(source));
/* Stop on the first error */
@@ -507,15 +503,15 @@ e_cal_ops_delete_ecalmodel_components (ECalModel *model,
nobjects = g_slist_length (objects_copy);
switch (e_cal_model_get_component_kind (model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
description = g_strdup_printf (ngettext ("Deleting an event", "Deleting %d events",
nobjects), nobjects);
alert_ident = "calendar:failed-remove-event";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
description = g_strdup_printf (ngettext ("Deleting a memo", "Deleting %d memos",
nobjects), nobjects);
alert_ident = "calendar:failed-remove-memo";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
description = g_strdup_printf (ngettext ("Deleting a task", "Deleting %d tasks",
nobjects), nobjects);
alert_ident = "calendar:failed-remove-task";
break;
@@ -535,35 +531,34 @@ e_cal_ops_delete_ecalmodel_components (ECalModel *model,
static gboolean
cal_ops_create_comp_with_new_uid_sync (ECalClient *cal_client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
GCancellable *cancellable,
GError **error)
{
- icalcomponent *clone;
+ ICalComponent *clone;
gchar *uid;
gboolean success;
g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (icomp), FALSE);
- clone = icalcomponent_new_clone (icalcomp);
+ clone = i_cal_component_new_clone (icomp);
uid = e_util_generate_uid ();
- icalcomponent_set_uid (clone, uid);
+ i_cal_component_set_uid (clone, uid);
g_free (uid);
- success = e_cal_client_create_object_sync (cal_client, clone, NULL, cancellable, error);
+ success = e_cal_client_create_object_sync (cal_client, clone, E_CAL_OPERATION_FLAG_NONE, NULL,
cancellable, error);
- icalcomponent_free (clone);
+ g_clear_object (&clone);
return success;
}
typedef struct {
ECalModel *model;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
const gchar *extension_name;
gboolean success;
} PasteComponentsData;
@@ -578,7 +573,7 @@ paste_components_data_free (gpointer ptr)
g_signal_emit_by_name (pcd->model, "row-appended", 0);
g_clear_object (&pcd->model);
- icalcomponent_free (pcd->icalcomp);
+ g_clear_object (&pcd->icomp);
g_free (pcd);
}
}
@@ -630,29 +625,31 @@ cal_ops_update_components_thread (EAlertSinkThreadJobData *job_data,
cal_client = E_CAL_CLIENT (client);
- if (icalcomponent_isa (pcd->icalcomp) == ICAL_VCALENDAR_COMPONENT &&
- icalcomponent_get_first_component (pcd->icalcomp, pcd->kind) != NULL) {
- icalcomponent *subcomp;
+ if (i_cal_component_isa (pcd->icomp) == I_CAL_VCALENDAR_COMPONENT &&
+ i_cal_component_count_components (pcd->icomp, pcd->kind) > 0) {
+ ICalComponent *subcomp;
- for (subcomp = icalcomponent_get_first_component (pcd->icalcomp, ICAL_VTIMEZONE_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (pcd->icomp, I_CAL_VTIMEZONE_COMPONENT);
subcomp && !g_cancellable_is_cancelled (cancellable);
- subcomp = icalcomponent_get_next_component (pcd->icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
- icaltimezone *zone;
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (pcd->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, subcomp);
if (!e_cal_client_add_timezone_sync (cal_client, zone, cancellable, error)) {
- icaltimezone_free (zone, 1);
+ g_clear_object (&zone);
success = FALSE;
break;
}
- icaltimezone_free (zone, 1);
+ g_clear_object (&zone);
}
- for (subcomp = icalcomponent_get_first_component (pcd->icalcomp, pcd->kind);
+ g_clear_object (&subcomp);
+
+ for (subcomp = i_cal_component_get_first_component (pcd->icomp, pcd->kind);
subcomp && !g_cancellable_is_cancelled (cancellable) && success;
- subcomp = icalcomponent_get_next_component (pcd->icalcomp, pcd->kind)) {
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (pcd->icomp,
pcd->kind)) {
if (!cal_ops_create_comp_with_new_uid_sync (cal_client, subcomp, cancellable, error))
{
success = FALSE;
break;
@@ -660,8 +657,10 @@ cal_ops_update_components_thread (EAlertSinkThreadJobData *job_data,
any_copied = TRUE;
}
- } else if (icalcomponent_isa (pcd->icalcomp) == pcd->kind) {
- success = cal_ops_create_comp_with_new_uid_sync (cal_client, pcd->icalcomp, cancellable,
error);
+
+ g_clear_object (&subcomp);
+ } else if (i_cal_component_isa (pcd->icomp) == pcd->kind) {
+ success = cal_ops_create_comp_with_new_uid_sync (cal_client, pcd->icomp, cancellable, error);
any_copied = success;
}
@@ -673,7 +672,7 @@ cal_ops_update_components_thread (EAlertSinkThreadJobData *job_data,
/**
* e_cal_ops_paste_components:
* @model: an #ECalModel
- * @icalcompstr: a string representation of an iCalendar component
+ * @icompstr: a string representation of an iCalendar component
*
* Pastes components into the default source of the @model.
*
@@ -681,11 +680,11 @@ cal_ops_update_components_thread (EAlertSinkThreadJobData *job_data,
**/
void
e_cal_ops_paste_components (ECalModel *model,
- const gchar *icalcompstr)
+ const gchar *icompstr)
{
ECalDataModel *data_model;
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
gint ncomponents = 0;
GCancellable *cancellable;
const gchar *alert_ident;
@@ -694,25 +693,25 @@ e_cal_ops_paste_components (ECalModel *model,
PasteComponentsData *pcd;
g_return_if_fail (E_IS_CAL_MODEL (model));
- g_return_if_fail (icalcompstr != NULL);
+ g_return_if_fail (icompstr != NULL);
- icalcomp = icalparser_parse_string (icalcompstr);
- if (!icalcomp)
+ icomp = i_cal_parser_parse_string (icompstr);
+ if (!icomp)
return;
- kind = icalcomponent_isa (icalcomp);
- if (kind != ICAL_VCALENDAR_COMPONENT &&
+ kind = i_cal_component_isa (icomp);
+ if (kind != I_CAL_VCALENDAR_COMPONENT &&
kind != e_cal_model_get_component_kind (model)) {
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
return;
}
switch (e_cal_model_get_component_kind (model)) {
- case ICAL_VEVENT_COMPONENT:
- if (kind == ICAL_VCALENDAR_COMPONENT) {
- kind = ICAL_VEVENT_COMPONENT;
- ncomponents = icalcomponent_count_components (icalcomp, kind);
- } else if (kind == ICAL_VEVENT_COMPONENT) {
+ case I_CAL_VEVENT_COMPONENT:
+ if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ kind = I_CAL_VEVENT_COMPONENT;
+ ncomponents = i_cal_component_count_components (icomp, kind);
+ } else if (kind == I_CAL_VEVENT_COMPONENT) {
ncomponents = 1;
}
@@ -723,11 +722,11 @@ e_cal_ops_paste_components (ECalModel *model,
alert_ident = "calendar:failed-create-event";
extension_name = E_SOURCE_EXTENSION_CALENDAR;
break;
- case ICAL_VJOURNAL_COMPONENT:
- if (kind == ICAL_VCALENDAR_COMPONENT) {
- kind = ICAL_VJOURNAL_COMPONENT;
- ncomponents = icalcomponent_count_components (icalcomp, kind);
- } else if (kind == ICAL_VJOURNAL_COMPONENT) {
+ case I_CAL_VJOURNAL_COMPONENT:
+ if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ kind = I_CAL_VJOURNAL_COMPONENT;
+ ncomponents = i_cal_component_count_components (icomp, kind);
+ } else if (kind == I_CAL_VJOURNAL_COMPONENT) {
ncomponents = 1;
}
@@ -738,11 +737,11 @@ e_cal_ops_paste_components (ECalModel *model,
alert_ident = "calendar:failed-create-memo";
extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
break;
- case ICAL_VTODO_COMPONENT:
- if (kind == ICAL_VCALENDAR_COMPONENT) {
- kind = ICAL_VTODO_COMPONENT;
- ncomponents = icalcomponent_count_components (icalcomp, kind);
- } else if (kind == ICAL_VTODO_COMPONENT) {
+ case I_CAL_VTODO_COMPONENT:
+ if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ kind = I_CAL_VTODO_COMPONENT;
+ ncomponents = i_cal_component_count_components (icomp, kind);
+ } else if (kind == I_CAL_VTODO_COMPONENT) {
ncomponents = 1;
}
@@ -759,13 +758,13 @@ e_cal_ops_paste_components (ECalModel *model,
}
if (ncomponents == 0) {
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
return;
}
pcd = g_new0 (PasteComponentsData, 1);
pcd->model = g_object_ref (model);
- pcd->icalcomp = icalcomp;
+ pcd->icomp = icomp;
pcd->kind = kind;
pcd->extension_name = extension_name;
pcd->success = FALSE;
@@ -779,10 +778,9 @@ e_cal_ops_paste_components (ECalModel *model,
g_free (description);
}
-typedef struct
-{
+typedef struct {
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
} SendComponentData;
static void
@@ -792,7 +790,7 @@ send_component_data_free (gpointer ptr)
if (scd) {
g_clear_object (&scd->client);
- icalcomponent_free (scd->icalcomp);
+ g_clear_object (&scd->icomp);
g_free (scd);
}
}
@@ -804,17 +802,15 @@ cal_ops_send_component_thread (EAlertSinkThreadJobData *job_data,
GError **error)
{
SendComponentData *scd = user_data;
- icalcomponent *mod_comp = NULL;
+ ICalComponent *mod_comp = NULL;
GSList *users = NULL;
g_return_if_fail (scd != NULL);
- e_cal_client_send_objects_sync (scd->client, scd->icalcomp,
+ e_cal_client_send_objects_sync (scd->client, scd->icomp, E_CAL_OPERATION_FLAG_NONE,
&users, &mod_comp, cancellable, error);
- if (mod_comp)
- icalcomponent_free (mod_comp);
-
+ g_clear_object (&mod_comp);
g_slist_free_full (users, g_free);
}
@@ -822,17 +818,17 @@ cal_ops_send_component_thread (EAlertSinkThreadJobData *job_data,
* e_cal_ops_send_component:
* @model: an #ECalModel
* @client: an #ECalClient
- * @icalcomp: an #icalcomponent
+ * @icomp: an #ICalComponent
*
* Sends (calls e_cal_client_send_objects_sync()) on the given @client
- * with the given @icalcomp in a dedicated thread.
+ * with the given @icomp in a dedicated thread.
*
* Since: 3.16
**/
void
e_cal_ops_send_component (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
ECalDataModel *data_model;
ESource *source;
@@ -844,7 +840,7 @@ e_cal_ops_send_component (ECalModel *model,
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (icomp));
switch (e_cal_client_get_source_type (client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -866,7 +862,7 @@ e_cal_ops_send_component (ECalModel *model,
scd = g_new0 (SendComponentData, 1);
scd->client = g_object_ref (client);
- scd->icalcomp = icalcomponent_new_clone (icalcomp);
+ scd->icomp = i_cal_component_new_clone (icomp);
source = e_client_get_source (E_CLIENT (client));
data_model = e_cal_model_get_data_model (model);
@@ -883,7 +879,7 @@ e_cal_ops_send_component (ECalModel *model,
typedef struct {
ECalModel *model;
GList *clients;
- icalcomponent_kind kind;
+ ICalComponentKind kind;
time_t older_than;
} PurgeComponentsData;
@@ -906,14 +902,16 @@ struct purge_data {
};
static gboolean
-ca_ops_purge_check_instance_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+ca_ops_purge_check_instance_cb (ICalComponent *comp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- struct purge_data *pd = data;
+ struct purge_data *pd = user_data;
- if (instance_end >= pd->older_than)
+ if (i_cal_time_as_timet (instance_end) >= pd->older_than)
pd->remove = FALSE;
return pd->remove;
@@ -930,15 +928,18 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
gchar *sexp, *start, *end;
gboolean pushed_message = FALSE;
const gchar *tzloc = NULL;
- icaltimezone *zone;
- icalcomponent_kind model_kind;
+ ICalTimezone *zone;
+ ICalComponentKind model_kind;
g_return_if_fail (pcd != NULL);
model_kind = e_cal_model_get_component_kind (pcd->model);
zone = e_cal_model_get_timezone (pcd->model);
- if (zone && zone != icaltimezone_get_utc_timezone ())
- tzloc = icaltimezone_get_location (zone);
+ if (zone && zone != i_cal_timezone_get_utc_timezone ()) {
+ tzloc = i_cal_timezone_get_location (zone);
+ if (tzloc && g_ascii_strcasecmp (tzloc, "UTC") == 0)
+ tzloc = NULL;
+ }
start = isodate_from_time_t (0);
end = isodate_from_time_t (pcd->older_than);
@@ -962,15 +963,15 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
e_alert_sink_thread_job_set_alert_arg_0 (job_data, display_name);
switch (model_kind) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
camel_operation_push_message (cancellable,
_("Getting events to purge in the calendar “%s”"), display_name);
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
camel_operation_push_message (cancellable,
_("Getting memos to purge in the memo list “%s”"), display_name);
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
camel_operation_push_message (cancellable,
_("Getting tasks to purge in the task list “%s”"), display_name);
break;
@@ -996,15 +997,15 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
}
switch (model_kind) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
camel_operation_push_message (cancellable,
_("Purging events in the calendar “%s”"), display_name);
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
camel_operation_push_message (cancellable,
_("Purging memos in the memo list “%s”"), display_name);
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
camel_operation_push_message (cancellable,
_("Purging tasks in the task list “%s”"), display_name);
break;
@@ -1019,7 +1020,7 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
nobjects = g_slist_length (objects);
for (olink = objects, ii = 0; olink; olink = g_slist_next (olink), ii++) {
- icalcomponent *icalcomp = olink->data;
+ ICalComponent *icomp = olink->data;
gboolean remove = TRUE;
gint percent = 100 * (ii + 1) / nobjects;
@@ -1029,30 +1030,26 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
pd.remove = TRUE;
pd.older_than = pcd->older_than;
- e_cal_client_generate_instances_for_object_sync (client, icalcomp,
- pcd->older_than, G_MAXINT32, ca_ops_purge_check_instance_cb, &pd);
+ e_cal_client_generate_instances_for_object_sync (client, icomp,
+ pcd->older_than, G_MAXINT32, cancellable,
ca_ops_purge_check_instance_cb, &pd);
remove = pd.remove;
}
if (remove) {
- const gchar *uid = icalcomponent_get_uid (icalcomp);
+ const gchar *uid = i_cal_component_get_uid (icomp);
- if (e_cal_util_component_is_instance (icalcomp) ||
- e_cal_util_component_has_recurrences (icalcomp)) {
- gchar *rid = NULL;
- struct icaltimetype recur_id;
+ if (e_cal_util_component_is_instance (icomp) ||
+ e_cal_util_component_has_recurrences (icomp)) {
+ gchar *rid;
- recur_id = icalcomponent_get_recurrenceid (icalcomp);
+ rid = e_cal_util_component_get_recurid_as_string (icomp);
- if (!icaltime_is_null_time (recur_id))
- rid = icaltime_as_ical_string_r (recur_id);
-
- success = e_cal_client_remove_object_sync (client, uid, rid,
E_CAL_OBJ_MOD_ALL, cancellable, error);
+ success = e_cal_client_remove_object_sync (client, uid, rid,
E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE, cancellable, error);
g_free (rid);
} else {
- success = e_cal_client_remove_object_sync (client, uid, NULL,
E_CAL_OBJ_MOD_THIS, cancellable, error);
+ success = e_cal_client_remove_object_sync (client, uid, NULL,
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, cancellable, error);
}
if (!success)
@@ -1065,8 +1062,7 @@ cal_ops_purge_components_thread (EAlertSinkThreadJobData *job_data,
}
}
- g_slist_foreach (objects, (GFunc) icalcomponent_free, NULL);
- g_slist_free (objects);
+ g_slist_free_full (objects, g_object_unref);
camel_operation_progress (cancellable, 0);
camel_operation_pop_message (cancellable);
@@ -1105,15 +1101,15 @@ e_cal_ops_purge_components (ECalModel *model,
g_return_if_fail (E_IS_CAL_MODEL (model));
switch (e_cal_model_get_component_kind (model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
description = _("Purging events");
alert_ident = "calendar:failed-remove-event";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
description = _("Purging memos");
alert_ident = "calendar:failed-remove-memo";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
description = _("Purging tasks");
alert_ident = "calendar:failed-remove-task";
break;
@@ -1166,19 +1162,19 @@ cal_ops_delete_completed_thread (EAlertSinkThreadJobData *job_data,
}
for (olink = objects; olink != NULL; olink = g_slist_next (olink)) {
- icalcomponent *icalcomp = olink->data;
+ ICalComponent *icomp = olink->data;
const gchar *uid;
- uid = icalcomponent_get_uid (icalcomp);
+ uid = i_cal_component_get_uid (icomp);
- if (!e_cal_client_remove_object_sync (client, uid, NULL, E_CAL_OBJ_MOD_THIS,
cancellable, error)) {
+ if (!e_cal_client_remove_object_sync (client, uid, NULL, E_CAL_OBJ_MOD_THIS,
E_CAL_OPERATION_FLAG_NONE, cancellable, error)) {
ESource *source = e_client_get_source (E_CLIENT (client));
e_alert_sink_thread_job_set_alert_arg_0 (job_data, e_source_get_display_name
(source));
break;
}
}
- 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)
@@ -1277,13 +1273,13 @@ cal_ops_get_default_component_thread (EAlertSinkThreadJobData *job_data,
registry = e_cal_model_get_registry (bod->model);
switch (e_cal_model_get_component_kind (bod->model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
default_source = e_source_registry_ref_default_calendar (registry);
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
default_source = e_source_registry_ref_default_memo_list (registry);
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
default_source = e_source_registry_ref_default_task_list (registry);
break;
default:
@@ -1301,13 +1297,13 @@ cal_ops_get_default_component_thread (EAlertSinkThreadJobData *job_data,
const gchar *extension_name = NULL;
switch (e_cal_model_get_component_kind (bod->model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
extension_name = E_SOURCE_EXTENSION_CALENDAR;
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
break;
default:
@@ -1323,8 +1319,8 @@ cal_ops_get_default_component_thread (EAlertSinkThreadJobData *job_data,
error);
}
- bod->icalcomp = e_cal_model_create_component_with_defaults_sync (bod->model, bod->client,
bod->all_day_default_comp, cancellable, error);
- bod->success = bod->icalcomp != NULL && !g_cancellable_is_cancelled (cancellable);
+ bod->icomp = e_cal_model_create_component_with_defaults_sync (bod->model, bod->client,
bod->all_day_default_comp, cancellable, error);
+ bod->success = bod->icomp != NULL && !g_cancellable_is_cancelled (cancellable);
}
/**
@@ -1363,15 +1359,15 @@ e_cal_ops_get_default_component (ECalModel *model,
g_return_if_fail (callback != NULL);
switch (e_cal_model_get_component_kind (model)) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
description = _("Creating an event");
alert_ident = "calendar:failed-create-event";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
description = _("Creating a memo");
alert_ident = "calendar:failed-create-memo";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
description = _("Creating a task");
alert_ident = "calendar:failed-create-task";
break;
@@ -1393,7 +1389,7 @@ e_cal_ops_get_default_component (ECalModel *model,
bod = g_new0 (BasicOperationData, 1);
bod->model = g_object_ref (model);
bod->client = NULL;
- bod->icalcomp = NULL;
+ bod->icomp = NULL;
bod->for_client_uid = g_strdup (for_client_uid);
bod->all_day_default_comp = all_day;
bod->get_default_comp_cb = callback;
@@ -1468,39 +1464,42 @@ new_component_data_free (gpointer ptr)
if (ncd->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
if (ncd->is_new_component && ncd->dtstart > 0 && ncd->dtend > 0) {
- ECalComponentDateTime dt;
- struct icaltimetype itt;
- icaltimezone *zone;
+ ECalComponentDateTime *dt;
+ ICalTime *itt;
+ ICalTimezone *zone;
if (ncd->model)
zone = e_cal_model_get_timezone (ncd->model);
else
zone = calendar_config_get_icaltimezone ();
- dt.value = &itt;
- if (ncd->all_day)
- dt.tzid = NULL;
- else
- dt.tzid = icaltimezone_get_tzid (zone);
-
- itt = icaltime_from_timet_with_zone (ncd->dtstart, FALSE, zone);
+ itt = i_cal_time_from_timet_with_zone (ncd->dtstart, FALSE, zone);
if (ncd->all_day) {
- itt.hour = itt.minute = itt.second = 0;
- itt.is_date = TRUE;
+ i_cal_time_set_time (itt, 0, 0, 0);
+ i_cal_time_set_is_date (itt, TRUE);
}
- e_cal_component_set_dtstart (ncd->comp, &dt);
- itt = icaltime_from_timet_with_zone (ncd->dtend, FALSE, zone);
+ dt = e_cal_component_datetime_new_take (itt,
+ (ncd->all_day || !zone) ? NULL : g_strdup
(i_cal_timezone_get_tzid (zone)));
+ e_cal_component_set_dtstart (ncd->comp, dt);
+ e_cal_component_datetime_free (dt);
+
+ itt = i_cal_time_from_timet_with_zone (ncd->dtend, FALSE, zone);
if (ncd->all_day) {
/* We round it up to the end of the day, unless it is
* already set to midnight */
- if (itt.hour != 0 || itt.minute != 0 || itt.second != 0) {
- icaltime_adjust (&itt, 1, 0, 0, 0);
+ if (i_cal_time_get_hour (itt) != 0 ||
+ i_cal_time_get_minute (itt) != 0 ||
+ i_cal_time_get_second (itt) != 0) {
+ i_cal_time_adjust (itt, 1, 0, 0, 0);
}
- itt.hour = itt.minute = itt.second = 0;
- itt.is_date = TRUE;
+ i_cal_time_set_time (itt, 0, 0, 0);
+ i_cal_time_set_is_date (itt, TRUE);
}
- e_cal_component_set_dtend (ncd->comp, &dt);
+ dt = e_cal_component_datetime_new_take (itt,
+ (ncd->all_day || !zone) ? NULL : g_strdup
(i_cal_timezone_get_tzid (zone)));
+ e_cal_component_set_dtend (ncd->comp, dt);
+ e_cal_component_datetime_free (dt);
}
e_cal_component_commit_sequence (ncd->comp);
}
@@ -1834,10 +1833,10 @@ e_cal_ops_new_component_editor_from_model (ECalModel *model,
* e_cal_ops_open_component_in_editor_sync:
* @model: (nullable): an #ECalModel instance
* @client: an #ECalClient, to which the component belongs
- * @icalcomp: an #icalcomponent to open in an editor
+ * @icomp: an #ICalComponent to open in an editor
* @force_attendees: set to TRUE to force to show attendees, FALSE to auto-detect
*
- * Opens a component @icalcomp, which belongs to a @client, in
+ * Opens a component @icomp, which belongs to a @client, in
* a component editor. This is done synchronously.
*
* Since: 3.16
@@ -1845,7 +1844,7 @@ e_cal_ops_new_component_editor_from_model (ECalModel *model,
void
e_cal_ops_open_component_in_editor_sync (ECalModel *model,
ECalClient *client,
- icalcomponent *icalcomp,
+ ICalComponent *icomp,
gboolean force_attendees)
{
NewComponentData *ncd;
@@ -1855,15 +1854,15 @@ e_cal_ops_open_component_in_editor_sync (ECalModel *model,
if (model)
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (icomp));
- 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) {
gtk_window_present (GTK_WINDOW (comp_editor));
return;
}
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (icalcomp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
g_return_if_fail (comp != NULL);
ncd = g_new0 (NewComponentData, 1);
@@ -1882,24 +1881,23 @@ e_cal_ops_open_component_in_editor_sync (ECalModel *model,
new_component_data_free (ncd);
}
-typedef struct
-{
+typedef struct {
EShell *shell;
ECalModel *model;
ESource *destination;
ECalClient *destination_client;
ECalClientSourceType source_type;
- GHashTable *icalcomps_by_source;
+ GHashTable *icomps_by_source;
gboolean is_move;
gint nobjects;
} TransferComponentsData;
static void
-transfer_components_free_icalcomps_slist (gpointer ptr)
+transfer_components_free_icomps_slist (gpointer ptr)
{
- GSList *icalcomps = ptr;
+ GSList *icomps = ptr;
- g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
+ g_slist_free_full (icomps, g_object_unref);
}
static void
@@ -1915,7 +1913,7 @@ transfer_components_data_free (gpointer ptr)
g_clear_object (&tcd->model);
g_clear_object (&tcd->destination);
g_clear_object (&tcd->destination_client);
- g_hash_table_destroy (tcd->icalcomps_by_source);
+ g_hash_table_destroy (tcd->icomps_by_source);
g_free (tcd);
}
}
@@ -1969,10 +1967,10 @@ transfer_components_thread (EAlertSinkThreadJobData *job_data,
nobjects = tcd->nobjects;
- g_hash_table_iter_init (&iter, tcd->icalcomps_by_source);
+ g_hash_table_iter_init (&iter, tcd->icomps_by_source);
while (g_hash_table_iter_next (&iter, &key, &value)) {
ESource *source = key;
- GSList *icalcomps = value;
+ GSList *icomps = value;
from_client = e_util_open_client_sync (job_data, client_cache, extension_name, source, 30,
cancellable, error);
if (!from_client) {
@@ -1982,11 +1980,11 @@ transfer_components_thread (EAlertSinkThreadJobData *job_data,
from_cal_client = E_CAL_CLIENT (from_client);
- for (link = icalcomps; link && !g_cancellable_is_cancelled (cancellable); link = g_slist_next
(link), ii++) {
+ for (link = icomps; link && !g_cancellable_is_cancelled (cancellable); link = g_slist_next
(link), ii++) {
gint percent = 100 * (ii + 1) / nobjects;
- icalcomponent *icalcomp = link->data;
+ ICalComponent *icomp = link->data;
- if (!cal_comp_transfer_item_to_sync (from_cal_client, to_cal_client, icalcomp,
!tcd->is_move, cancellable, error)) {
+ if (!cal_comp_transfer_item_to_sync (from_cal_client, to_cal_client, icomp,
!tcd->is_move, cancellable, error)) {
success = FALSE;
break;
}
@@ -2013,13 +2011,12 @@ transfer_components_thread (EAlertSinkThreadJobData *job_data,
* @shell_view: an #EShellView
* @model: an #ECalModel, where to notify about created objects
* @source_type: a source type of the @destination and the sources
- * @icalcomps_by_source: a hash table of #ESource to #GSList of icalcomponent to transfer
+ * @icomps_by_source: a hash table of #ESource to #GSList of ICalComponent to transfer
* @destination: a destination #ESource
- * @icalcomps: a #GSList of icalcomponent-s to transfer
* @is_move: whether the transfer is move (%TRUE) or copy (%FALSE)
*
- * Transfers (copies or moves, as set by @is_move) all @icalcomps from the @source
- * to the @destination of type @source type (calendar/memo list/task list).
+ * Transfers (copies or moves, as set by @is_move) all @icomps_by_source from their source
+ * to the @destination of type source type (calendar/memo list/task list).
*
* Since: 3.16
**/
@@ -2027,7 +2024,7 @@ void
e_cal_ops_transfer_components (EShellView *shell_view,
ECalModel *model,
ECalClientSourceType source_type,
- GHashTable *icalcomps_by_source,
+ GHashTable *icomps_by_source,
ESource *destination,
gboolean is_move)
{
@@ -2041,17 +2038,17 @@ e_cal_ops_transfer_components (EShellView *shell_view,
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
g_return_if_fail (E_IS_CAL_MODEL (model));
- g_return_if_fail (icalcomps_by_source != NULL);
+ g_return_if_fail (icomps_by_source != NULL);
g_return_if_fail (E_IS_SOURCE (destination));
nobjects = 0;
- g_hash_table_iter_init (&iter, icalcomps_by_source);
+ g_hash_table_iter_init (&iter, icomps_by_source);
while (g_hash_table_iter_next (&iter, &key, &value)) {
ESource *source = key;
- GSList *icalcomps = value;
+ GSList *icomps = value;
if (!is_move || !e_source_equal (source, destination))
- nobjects += g_slist_length (icalcomps);
+ nobjects += g_slist_length (icomps);
}
switch (source_type) {
@@ -2084,28 +2081,28 @@ e_cal_ops_transfer_components (EShellView *shell_view,
tcd = g_new0 (TransferComponentsData, 1);
tcd->shell = g_object_ref (e_shell_window_get_shell (e_shell_view_get_shell_window (shell_view)));
tcd->model = g_object_ref (model);
- tcd->icalcomps_by_source = g_hash_table_new_full ((GHashFunc) e_source_hash, (GEqualFunc)
e_source_equal,
- g_object_unref, transfer_components_free_icalcomps_slist);
+ tcd->icomps_by_source = g_hash_table_new_full ((GHashFunc) e_source_hash, (GEqualFunc) e_source_equal,
+ g_object_unref, transfer_components_free_icomps_slist);
tcd->destination = g_object_ref (destination);
tcd->source_type = source_type;
tcd->is_move = is_move;
tcd->nobjects = nobjects;
tcd->destination_client = NULL;
- g_hash_table_iter_init (&iter, icalcomps_by_source);
+ g_hash_table_iter_init (&iter, icomps_by_source);
while (g_hash_table_iter_next (&iter, &key, &value)) {
ESource *source = key;
- GSList *icalcomps = value;
+ GSList *icomps = value;
if (!is_move || !e_source_equal (source, destination)) {
GSList *link;
- icalcomps = g_slist_copy (icalcomps);
- for (link = icalcomps; link; link = g_slist_next (link)) {
- link->data = icalcomponent_new_clone (link->data);
+ icomps = g_slist_copy (icomps);
+ for (link = icomps; link; link = g_slist_next (link)) {
+ link->data = i_cal_component_new_clone (link->data);
}
- g_hash_table_insert (tcd->icalcomps_by_source, g_object_ref (source), icalcomps);
+ g_hash_table_insert (tcd->icomps_by_source, g_object_ref (source), icomps);
}
}
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 f752bdd6c4..01aadaa9e6 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 *
@@ -1570,9 +1617,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;
@@ -1580,7 +1627,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;
@@ -1589,7 +1636,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",
@@ -1605,7 +1652,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
@@ -1613,9 +1660,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;
@@ -1623,15 +1670,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) ||
@@ -1640,7 +1686,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
@@ -1676,15 +1722,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
@@ -1758,11 +1804,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;
@@ -1771,12 +1815,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. */
@@ -1794,7 +1837,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))
@@ -1802,30 +1845,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);
@@ -1837,19 +1881,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);
@@ -1861,11 +1905,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);
@@ -1879,13 +1925,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;
@@ -1894,14 +1945,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)"*/
@@ -1910,8 +1961,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;
@@ -1921,8 +1972,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);
@@ -2028,85 +2079,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)
{
@@ -2117,7 +2162,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,
@@ -2263,8 +2307,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 };
@@ -2275,26 +2319,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 a5fa67c7f8..df8a993e3c 100644
--- a/src/calendar/gui/e-calendar-view.h
+++ b/src/calendar/gui/e-calendar-view.h
@@ -150,8 +150,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,
@@ -187,9 +187,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
@@ -227,7 +227,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,
@@ -236,15 +236,15 @@ 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 (ECalendarView *cal_view,
guint32 flags); /* bit-or of ENewAppointmentFlags */
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
@@ -258,15 +258,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..2dbe27ef43 100644
--- a/src/calendar/gui/e-comp-editor-event.c
+++ b/src/calendar/gui/e-comp-editor-event.c
@@ -87,7 +87,7 @@ ece_event_update_times (ECompEditorEvent *event_editor,
flags = e_comp_editor_get_flags (E_COMP_EDITOR (event_editor));
if ((flags & E_COMP_EDITOR_FLAG_IS_NEW) != 0) {
- struct icaltimetype start_tt;
+ ICalTime *start_tt;
start_tt = e_comp_editor_property_part_datetime_get_value (
E_COMP_EDITOR_PROPERTY_PART_DATETIME (event_editor->priv->dtstart));
@@ -109,6 +109,8 @@ ece_event_update_times (ECompEditorEvent *event_editor,
} else if (event_editor->priv->in_the_past_alert) {
e_alert_response (event_editor->priv->in_the_past_alert, GTK_RESPONSE_OK);
}
+
+ g_clear_object (&start_tt);
}
}
@@ -224,13 +226,13 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
}
}
-static icaltimezone *
+static ICalTimezone *
ece_event_get_timezone_from_property (ECompEditor *comp_editor,
- icalproperty *property)
+ ICalProperty *property)
{
ECalClient *client;
- icalparameter *param;
- icaltimezone *zone = NULL;
+ ICalParameter *param;
+ ICalTimezone *zone = NULL;
const gchar *tzid;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), NULL);
@@ -238,95 +240,109 @@ ece_event_get_timezone_from_property (ECompEditor *comp_editor,
if (!property)
return NULL;
- param = icalproperty_get_first_parameter (property, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (property, I_CAL_TZID_PARAMETER);
if (!param)
return NULL;
- tzid = icalparameter_get_tzid (param);
- if (!tzid || !*tzid)
+ tzid = i_cal_parameter_get_tzid (param);
+ if (!tzid || !*tzid) {
+ g_object_unref (param);
return NULL;
+ }
- if (g_ascii_strcasecmp (tzid, "UTC") == 0)
- return icaltimezone_get_utc_timezone ();
+ if (g_ascii_strcasecmp (tzid, "UTC") == 0) {
+ g_object_unref (param);
+ return i_cal_timezone_get_utc_timezone ();
+ }
client = e_comp_editor_get_source_client (comp_editor);
/* It should be already fetched for the UI, thus this should be non-blocking. */
- if (client && e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, NULL) && zone)
+ if (client && e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, NULL) && zone) {
+ g_object_unref (param);
return zone;
+ }
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!zone)
- zone = icaltimezone_get_builtin_timezone (tzid);
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
+
+ g_object_unref (param);
return zone;
}
static void
ece_event_update_timezone (ECompEditorEvent *event_editor,
- struct icaltimetype *out_dtstart,
- struct icaltimetype *out_dtend)
+ ICalTime **out_dtstart,
+ ICalTime **out_dtend)
{
ECompEditor *comp_editor;
- struct icaltimetype dtstart, dtend;
- icalcomponent *component;
- icaltimezone *zone = NULL;
+ ICalTime *dtstart = NULL, *dtend = NULL;
+ ICalComponent *component;
+ ICalProperty *prop;
+ ICalTimezone *zone = NULL;
g_return_if_fail (E_IS_COMP_EDITOR_EVENT (event_editor));
comp_editor = E_COMP_EDITOR (event_editor);
- dtstart = icaltime_null_time ();
- dtend = icaltime_null_time ();
-
component = e_comp_editor_get_component (comp_editor);
if (!component) {
if (out_dtstart)
- *out_dtstart = dtstart;
+ *out_dtstart = NULL;
if (out_dtend)
- *out_dtend = dtend;
+ *out_dtend = NULL;
return;
}
- if (icalcomponent_get_first_property (component, ICAL_DTSTART_PROPERTY)) {
- dtstart = icalcomponent_get_dtstart (component);
- if (icaltime_is_valid_time (dtstart)) {
- if (icaltime_is_utc (dtstart))
- zone = icaltimezone_get_utc_timezone ();
- else
- zone = ece_event_get_timezone_from_property (comp_editor,
- icalcomponent_get_first_property (component, ICAL_DTSTART_PROPERTY));
+ if (e_cal_util_component_has_property (component, I_CAL_DTSTART_PROPERTY)) {
+ dtstart = i_cal_component_get_dtstart (component);
+ if (dtstart && i_cal_time_is_valid_time (dtstart)) {
+ if (i_cal_time_is_utc (dtstart)) {
+ zone = i_cal_timezone_get_utc_timezone ();
+ } else {
+ prop = i_cal_component_get_first_property (component, I_CAL_DTSTART_PROPERTY);
+ zone = ece_event_get_timezone_from_property (comp_editor, prop);
+ g_clear_object (&prop);
+ }
}
}
- if (icalcomponent_get_first_property (component, ICAL_DTEND_PROPERTY)) {
- dtend = icalcomponent_get_dtend (component);
- if (!zone && icaltime_is_valid_time (dtend)) {
- if (icaltime_is_utc (dtend))
- zone = icaltimezone_get_utc_timezone ();
- else
- zone = ece_event_get_timezone_from_property (comp_editor,
- icalcomponent_get_first_property (component, ICAL_DTEND_PROPERTY));
+ if (e_cal_util_component_has_property (component, I_CAL_DTEND_PROPERTY)) {
+ dtend = i_cal_component_get_dtend (component);
+ if (!zone && i_cal_time_is_valid_time (dtend)) {
+ if (i_cal_time_is_utc (dtend)) {
+ zone = i_cal_timezone_get_utc_timezone ();
+ } else {
+ prop = i_cal_component_get_first_property (component, I_CAL_DTEND_PROPERTY);
+ zone = ece_event_get_timezone_from_property (comp_editor, prop);
+ g_clear_object (&prop);
+ }
}
}
if (!zone) {
- struct icaltimetype itt;
-
- itt = icalcomponent_get_due (component);
- if (icaltime_is_valid_time (itt)) {
- if (icaltime_is_utc (itt))
- zone = icaltimezone_get_utc_timezone ();
- else
- zone = ece_event_get_timezone_from_property (comp_editor,
- icalcomponent_get_first_property (component, ICAL_DUE_PROPERTY));
+ ICalTime *itt;
+
+ itt = i_cal_component_get_due (component);
+ if (itt && i_cal_time_is_valid_time (itt)) {
+ if (i_cal_time_is_utc (itt)) {
+ zone = i_cal_timezone_get_utc_timezone ();
+ } else {
+ prop = i_cal_component_get_first_property (component, I_CAL_DUE_PROPERTY);
+ zone = ece_event_get_timezone_from_property (comp_editor, prop);
+ g_clear_object (&prop);
+ }
}
+
+ g_clear_object (&itt);
}
if (zone) {
GtkWidget *edit_widget;
- icaltimezone *cfg_zone;
+ ICalTimezone *cfg_zone;
edit_widget = e_comp_editor_property_part_get_edit_widget (event_editor->priv->timezone);
@@ -335,8 +351,8 @@ ece_event_update_timezone (ECompEditorEvent *event_editor,
cfg_zone = calendar_config_get_icaltimezone ();
if (zone && cfg_zone && zone != cfg_zone &&
- (g_strcmp0 (icaltimezone_get_location (zone), icaltimezone_get_location (cfg_zone)) != 0
||
- g_strcmp0 (icaltimezone_get_tzid (zone), icaltimezone_get_tzid (cfg_zone)) != 0)) {
+ (g_strcmp0 (i_cal_timezone_get_location (zone), i_cal_timezone_get_location (cfg_zone))
!= 0 ||
+ g_strcmp0 (i_cal_timezone_get_tzid (zone), i_cal_timezone_get_tzid (cfg_zone)) != 0)) {
/* Show timezone part */
GtkAction *action;
@@ -347,18 +363,22 @@ ece_event_update_timezone (ECompEditorEvent *event_editor,
if (out_dtstart)
*out_dtstart = dtstart;
+ else
+ g_clear_object (&dtstart);
if (out_dtend)
*out_dtend = dtend;
+ else
+ g_clear_object (&dtend);
}
static void
ece_event_fill_widgets (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorEvent *event_editor;
- struct icaltimetype dtstart, dtend;
- icalproperty *prop;
+ ICalTime *dtstart, *dtend;
+ ICalProperty *prop;
gboolean all_day_event = FALSE;
GtkAction *action;
guint32 flags;
@@ -369,26 +389,27 @@ ece_event_fill_widgets (ECompEditor *comp_editor,
event_editor = E_COMP_EDITOR_EVENT (comp_editor);
flags = e_comp_editor_get_flags (comp_editor);
- dtstart = icaltime_null_time ();
- dtend = icaltime_null_time ();
+ dtstart = NULL;
+ dtend = NULL;
/* Set timezone before the times, because they are converted into this timezone */
ece_event_update_timezone (event_editor, &dtstart, &dtend);
E_COMP_EDITOR_CLASS (e_comp_editor_event_parent_class)->fill_widgets (comp_editor, component);
- if (icaltime_is_valid_time (dtstart) && !icaltime_is_null_time (dtstart) &&
- (!icaltime_is_valid_time (dtend) || icaltime_is_null_time (dtend))) {
- dtend = dtstart;
- if (dtstart.is_date)
- icaltime_adjust (&dtend, 1, 0, 0, 0);
+ if (dtstart && i_cal_time_is_valid_time (dtstart) && !i_cal_time_is_null_time (dtstart) &&
+ (!dtend || !i_cal_time_is_valid_time (dtend) || i_cal_time_is_null_time (dtend))) {
+ g_clear_object (&dtend);
+ dtend = i_cal_time_new_clone (dtstart);
+ if (i_cal_time_is_date (dtstart))
+ i_cal_time_adjust (dtend, 1, 0, 0, 0);
}
- if (icaltime_is_valid_time (dtend) && !icaltime_is_null_time (dtend)) {
- if (dtstart.is_date && dtend.is_date) {
+ if (dtend && i_cal_time_is_valid_time (dtend) && !i_cal_time_is_null_time (dtend)) {
+ if (i_cal_time_is_date (dtstart) && i_cal_time_is_date (dtend)) {
all_day_event = TRUE;
- if (icaltime_compare_date_only (dtend, dtstart) > 0) {
- icaltime_adjust (&dtend, -1, 0, 0, 0);
+ if (i_cal_time_compare_date_only (dtend, dtstart) > 0) {
+ i_cal_time_adjust (dtend, -1, 0, 0, 0);
}
}
@@ -398,10 +419,10 @@ ece_event_fill_widgets (ECompEditor *comp_editor,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (event_editor->priv->all_day_check), all_day_event);
- prop = icalcomponent_get_first_property (component, ICAL_CLASS_PROPERTY);
- if (prop && icalproperty_get_class (prop) == ICAL_CLASS_PRIVATE)
+ prop = i_cal_component_get_first_property (component, I_CAL_CLASS_PROPERTY);
+ if (prop && i_cal_property_get_class (prop) == I_CAL_CLASS_PRIVATE)
action = e_comp_editor_get_action (comp_editor, "classify-private");
- else if (prop && icalproperty_get_class (prop) == ICAL_CLASS_CONFIDENTIAL)
+ else if (prop && i_cal_property_get_class (prop) == I_CAL_CLASS_CONFIDENTIAL)
action = e_comp_editor_get_action (comp_editor, "classify-confidential");
else if (!(flags & E_COMP_EDITOR_FLAG_IS_NEW))
action = e_comp_editor_get_action (comp_editor, "classify-public");
@@ -420,6 +441,10 @@ ece_event_fill_widgets (ECompEditor *comp_editor,
}
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
+ g_clear_object (&dtstart);
+ g_clear_object (&dtend);
+ g_clear_object (&prop);
}
static gboolean
@@ -431,21 +456,21 @@ 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
ece_event_fill_component (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorEvent *event_editor;
gboolean date_valid, time_valid;
- icalproperty *dtstart_prop, *dtend_prop;
- icalproperty *prop;
- icalproperty_class class_value;
+ ICalProperty *dtstart_prop, *dtend_prop;
+ ICalProperty *prop;
+ ICalProperty_Class class_value;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
if (!E_COMP_EDITOR_CLASS (e_comp_editor_event_parent_class)->fill_component (comp_editor, component))
return FALSE;
@@ -484,42 +509,39 @@ ece_event_fill_component (ECompEditor *comp_editor,
return FALSE;
}
- dtstart_prop = icalcomponent_get_first_property (component, ICAL_DTSTART_PROPERTY);
- dtend_prop = icalcomponent_get_first_property (component, ICAL_DTEND_PROPERTY);
+ dtstart_prop = i_cal_component_get_first_property (component, I_CAL_DTSTART_PROPERTY);
+ dtend_prop = i_cal_component_get_first_property (component, I_CAL_DTEND_PROPERTY);
if (dtstart_prop && dtend_prop) {
- struct icaltimetype dtstart, dtend;
+ ICalTime *dtstart, *dtend;
gboolean set_dtstart = FALSE, set_dtend = FALSE;
- dtstart = icalproperty_get_dtstart (dtstart_prop);
- dtend = icalproperty_get_dtend (dtend_prop);
+ dtstart = i_cal_property_get_dtstart (dtstart_prop);
+ dtend = i_cal_property_get_dtend (dtend_prop);
- if (dtstart.is_date && dtend.is_date) {
+ if (dtstart && i_cal_time_is_date (dtstart) &&
+ dtend && i_cal_time_is_date (dtend)) {
/* Add 1 day to DTEND, as it is not inclusive. */
- icaltime_adjust (&dtend, 1, 0, 0, 0);
+ i_cal_time_adjust (dtend, 1, 0, 0, 0);
set_dtend = TRUE;
if (ece_event_client_needs_all_day_as_time (comp_editor)) {
ECompEditorEvent *event_editor = E_COMP_EDITOR_EVENT (comp_editor);
GtkWidget *timezone_entry;
- dtstart.is_date = FALSE;
- dtstart.hour = 0;
- dtstart.minute = 0;
- dtstart.second = 0;
+ i_cal_time_set_is_date (dtstart, FALSE);
+ i_cal_time_set_time (dtstart, 0, 0, 0);
- dtend.is_date = FALSE;
- dtend.hour = 0;
- dtend.minute = 0;
- dtend.second = 0;
+ i_cal_time_set_is_date (dtend, FALSE);
+ i_cal_time_set_time (dtend, 0, 0, 0);
timezone_entry = e_comp_editor_property_part_get_edit_widget
(event_editor->priv->timezone);
- dtstart.zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY
(timezone_entry));
- if (!dtstart.zone)
- dtstart.zone = icaltimezone_get_utc_timezone ();
+ i_cal_time_set_timezone (dtstart, e_timezone_entry_get_timezone
(E_TIMEZONE_ENTRY (timezone_entry)));
+ if (!i_cal_time_get_timezone (dtstart))
+ i_cal_time_set_timezone (dtstart, i_cal_timezone_get_utc_timezone ());
- dtend.zone = dtstart.zone;
+ i_cal_time_set_timezone (dtend, i_cal_time_get_timezone (dtstart));
set_dtstart = TRUE;
set_dtend = TRUE;
@@ -528,36 +550,43 @@ ece_event_fill_component (ECompEditor *comp_editor,
if (set_dtstart) {
/* Remove the VALUE parameter, to correspond to the actual value being set */
- icalproperty_remove_parameter_by_kind (dtstart_prop, ICAL_VALUE_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (dtstart_prop, I_CAL_VALUE_PARAMETER);
- icalproperty_set_dtstart (dtstart_prop, dtstart);
+ i_cal_property_set_dtstart (dtstart_prop, dtstart);
cal_comp_util_update_tzid_parameter (dtstart_prop, dtstart);
}
if (set_dtend) {
/* Remove the VALUE parameter, to correspond to the actual value being set */
- icalproperty_remove_parameter_by_kind (dtend_prop, ICAL_VALUE_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (dtend_prop, I_CAL_VALUE_PARAMETER);
- icalproperty_set_dtend (dtend_prop, dtend);
+ i_cal_property_set_dtend (dtend_prop, dtend);
cal_comp_util_update_tzid_parameter (dtend_prop, dtend);
}
+
+ g_clear_object (&dtstart);
+ g_clear_object (&dtend);
}
+ g_clear_object (&dtstart_prop);
+ g_clear_object (&dtend_prop);
+
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (
e_comp_editor_get_action (comp_editor, "classify-private"))))
- class_value = ICAL_CLASS_PRIVATE;
+ class_value = I_CAL_CLASS_PRIVATE;
else if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (
e_comp_editor_get_action (comp_editor, "classify-confidential"))))
- class_value = ICAL_CLASS_CONFIDENTIAL;
+ class_value = I_CAL_CLASS_CONFIDENTIAL;
else
- class_value = ICAL_CLASS_PUBLIC;
+ class_value = I_CAL_CLASS_PUBLIC;
- prop = icalcomponent_get_first_property (component, ICAL_CLASS_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_CLASS_PROPERTY);
if (prop) {
- icalproperty_set_class (prop, class_value);
+ i_cal_property_set_class (prop, class_value);
+ g_object_unref (prop);
} else {
- prop = icalproperty_new_class (class_value);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_class (class_value);
+ i_cal_component_take_property (component, prop);
}
return TRUE;
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..c371bf3a72 100644
--- a/src/calendar/gui/e-comp-editor-page-attachments.c
+++ b/src/calendar/gui/e-comp-editor-page-attachments.c
@@ -247,78 +247,74 @@ ecep_attachments_sensitize_widgets (ECompEditorPage *page,
static void
ecep_attachments_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageAttachments *page_attachments;
EAttachmentStore *store;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uid;
gint index;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_ATTACHMENTS (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_attachments_parent_class)->fill_widgets (page,
component);
page_attachments = E_COMP_EDITOR_PAGE_ATTACHMENTS (page);
store = E_ATTACHMENT_STORE (page_attachments->priv->store);
- uid = icalcomponent_get_uid (component);
+ uid = i_cal_component_get_uid (component);
g_slist_free_full (page_attachments->priv->temporary_files, temporary_file_free);
page_attachments->priv->temporary_files = NULL;
e_attachment_store_remove_all (store);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTACH_PROPERTY), index = 0;
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTACH_PROPERTY), index = 0;
prop;
- prop = icalcomponent_get_next_property (component, ICAL_ATTACH_PROPERTY), index++) {
- icalparameter *param;
- icalattach *attach;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTACH_PROPERTY), index++) {
+ ICalParameter *param;
+ ICalAttach *attach;
gchar *uri = NULL, *filename = NULL;
- attach = icalproperty_get_attach (prop);
+ attach = i_cal_property_get_attach (prop);
if (!attach)
continue;
- #ifdef HAVE_ICAL_FILENAME_PARAMETER
- param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
if (param) {
- filename = g_strdup (icalparameter_get_filename (param));
+ filename = g_strdup (i_cal_parameter_get_filename (param));
if (!filename || !*filename) {
g_free (filename);
filename = NULL;
}
+
+ g_clear_object (¶m);
}
- #endif
- if (icalattach_get_is_url (attach)) {
+ if (i_cal_attach_get_is_url (attach)) {
const gchar *data;
- gsize buf_size;
-
- data = icalattach_get_url (attach);
- buf_size = strlen (data);
- uri = g_malloc0 (buf_size + 1);
- icalvalue_decode_ical_string (data, uri, buf_size);
+ data = i_cal_attach_get_url (attach);
+ uri = i_cal_value_decode_ical_string (data);
} else {
gchar *temporary_filename = NULL;
- icalparameter *encoding_par = icalproperty_get_first_parameter (prop,
ICAL_ENCODING_PARAMETER);
+ ICalParameter *encoding_par = i_cal_property_get_first_parameter (prop,
I_CAL_ENCODING_PARAMETER);
if (encoding_par) {
- gchar *str_value = icalproperty_get_value_as_string_r (prop);
+ gchar *str_value = i_cal_property_get_value_as_string_r (prop);
if (str_value) {
- icalparameter_encoding encoding = icalparameter_get_encoding
(encoding_par);
+ ICalParameterEncoding encoding = i_cal_parameter_get_encoding
(encoding_par);
guint8 *data = NULL;
gsize data_len = 0;
switch (encoding) {
- case ICAL_ENCODING_8BIT:
+ case I_CAL_ENCODING_8BIT:
data = (guint8 *) str_value;
data_len = strlen (str_value);
str_value = NULL;
break;
- case ICAL_ENCODING_BASE64:
+ case I_CAL_ENCODING_BASE64:
data = g_base64_decode (str_value, &data_len);
break;
default:
@@ -327,14 +323,13 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
if (data) {
gchar *dir, *id_str;
- struct icaltimetype rid_tt;
gchar *rid;
- rid_tt = icalcomponent_get_recurrenceid (component);
- if (icaltime_is_null_time (rid_tt) || !icaltime_is_valid_time
(rid_tt))
+ rid = e_cal_util_component_get_recurid_as_string (component);
+ if (rid && !*rid) {
+ g_free (rid);
rid = NULL;
- else
- rid = icaltime_as_ical_string_r (rid_tt);
+ }
id_str = g_strconcat (uid, rid ? "-" : NULL, rid, NULL);
@@ -344,13 +339,13 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
g_free (id_str);
if (g_mkdir_with_parents (dir, 0700) >= 0) {
- for (param = icalproperty_get_first_parameter (prop,
ICAL_X_PARAMETER);
+ for (param = i_cal_property_get_first_parameter
(prop, I_CAL_X_PARAMETER);
param && !filename;
- param = icalproperty_get_next_parameter (prop,
ICAL_X_PARAMETER)) {
- if (e_util_strstrcase
(icalparameter_get_xname (param), "NAME") &&
- icalparameter_get_xvalue (param) &&
- *icalparameter_get_xvalue (param)) {
- filename = g_strdup
(icalparameter_get_xvalue (param));
+ g_object_unref (param), param =
i_cal_property_get_next_parameter (prop, I_CAL_X_PARAMETER)) {
+ if (e_util_strstrcase
(i_cal_parameter_get_xname (param), "NAME") &&
+ i_cal_parameter_get_xvalue (param) &&
+ *i_cal_parameter_get_xvalue (param)) {
+ filename = g_strdup
(i_cal_parameter_get_xvalue (param));
if (!filename || !*filename) {
g_free (filename);
filename = NULL;
@@ -358,6 +353,8 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
}
}
+ g_clear_object (¶m);
+
if (!filename)
filename = g_strdup_printf ("%d.dat", index);
@@ -374,6 +371,8 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
g_free (str_value);
g_free (data);
}
+
+ g_object_unref (encoding_par);
}
if (temporary_filename) {
@@ -396,6 +395,7 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
g_object_unref (attachment);
}
+ g_object_unref (attach);
g_free (filename);
g_free (uri);
}
@@ -403,16 +403,16 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
static gboolean
ecep_attachments_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageAttachments *page_attachments;
ECompEditor *comp_editor;
GList *attachments, *link;
- icalproperty *prop;
+ ICalProperty *prop;
gboolean success = TRUE;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE_ATTACHMENTS (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
comp_editor = e_comp_editor_page_ref_editor (page);
page_attachments = E_COMP_EDITOR_PAGE_ATTACHMENTS (page);
@@ -424,18 +424,15 @@ 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)) {
EAttachment *attachment = link->data;
- icalattach *attach;
- gsize buf_size;
+ ICalAttach *attach;
gchar *buf, *uri, *description;
GFile *file;
- #ifdef HAVE_ICAL_FILENAME_PARAMETER
GFileInfo *file_info;
- #endif
if (!attachment)
continue;
@@ -480,32 +477,27 @@ ecep_attachments_fill_component (ECompEditorPage *page,
g_object_unref (file);
g_free (description);
- buf_size = 2 * strlen (uri) + 1;
- buf = g_malloc0 (buf_size);
-
- icalvalue_encode_ical_string (uri, buf, buf_size);
- attach = icalattach_new_from_url (buf);
- prop = icalproperty_new_attach (attach);
+ buf = i_cal_value_encode_ical_string (uri);
+ attach = i_cal_attach_new_from_url (buf);
+ prop = i_cal_property_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);
if (display_name && *display_name) {
- icalparameter *param;
+ ICalParameter *param;
- param = icalparameter_new_filename (display_name);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_filename (display_name);
+ i_cal_property_take_parameter (prop, param);
}
g_object_unref (file_info);
}
- #endif
- icalcomponent_add_property (component, prop);
+ i_cal_component_take_property (component, prop);
- icalattach_unref (attach);
+ g_object_unref (attach);
g_free (buf);
g_free (uri);
}
diff --git a/src/calendar/gui/e-comp-editor-page-general.c b/src/calendar/gui/e-comp-editor-page-general.c
index 74d3d5cc2e..e481fd8c78 100644
--- a/src/calendar/gui/e-comp-editor-page-general.c
+++ b/src/calendar/gui/e-comp-editor-page-general.c
@@ -268,9 +268,14 @@ ecep_general_attendees_add_clicked_cb (GtkButton *button,
attendee = e_meeting_store_add_attendee_with_defaults (page_general->priv->meeting_store);
- if ((flags & E_COMP_EDITOR_FLAG_DELEGATE) != 0)
- e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("mailto:%s",
- page_general->priv->user_delegator ? page_general->priv->user_delegator : ""));
+ if ((flags & E_COMP_EDITOR_FLAG_DELEGATE) != 0) {
+ gchar *mailto;
+
+ mailto = g_strdup_printf ("mailto:%s",
+ page_general->priv->user_delegator ? page_general->priv->user_delegator : "");
+ e_meeting_attendee_set_delfrom (attendee, mailto);
+ g_free (mailto);
+ }
e_meeting_list_view_edit (E_MEETING_LIST_VIEW (page_general->priv->attendees_list_view), attendee);
@@ -449,6 +454,7 @@ ecep_general_attendee_added_cb (EMeetingListView *meeting_list_view,
ECompEditor *comp_editor;
ECompEditorFlags flags;
ECalClient *client;
+ gchar *mailto;
comp_editor = e_comp_editor_page_ref_editor (E_COMP_EDITOR_PAGE (page_general));
flags = e_comp_editor_get_flags (comp_editor);
@@ -463,17 +469,18 @@ ecep_general_attendee_added_cb (EMeetingListView *meeting_list_view,
client = e_comp_editor_get_target_client (comp_editor);
/* do not remove here, it did EMeetingListView already */
- e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("mailto:%s",
- page_general->priv->user_delegator ? page_general->priv->user_delegator : ""));
+ mailto = g_strdup_printf ("mailto:%s", page_general->priv->user_delegator ?
page_general->priv->user_delegator : "");
+ e_meeting_attendee_set_delfrom (attendee, mailto);
+ g_free (mailto);
- 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,
page_general->priv->user_delegator, NULL);
g_return_if_fail (delegator != NULL);
- e_meeting_attendee_set_delto (delegator, g_strdup (e_meeting_attendee_get_address
(attendee)));
+ e_meeting_attendee_set_delto (delegator, e_meeting_attendee_get_address (attendee));
}
ecep_general_sensitize_widgets (E_COMP_EDITOR_PAGE (page_general), FALSE);
@@ -610,7 +617,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);
}
@@ -637,7 +644,11 @@ ecep_general_list_view_event_cb (EMeetingListView *list_view,
flags = e_comp_editor_get_flags (comp_editor);
if ((flags & E_COMP_EDITOR_FLAG_DELEGATE) != 0) {
- e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("mailto:%s",
page_general->priv->user_delegator));
+ gchar *mailto;
+
+ mailto = g_strdup_printf ("mailto:%s", page_general->priv->user_delegator);
+ e_meeting_attendee_set_delfrom (attendee, mailto);
+ g_free (mailto);
}
g_clear_object (&comp_editor);
@@ -837,7 +848,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;
}
@@ -884,14 +895,14 @@ ecep_general_sensitize_widgets (ECompEditorPage *page,
static void
ecep_general_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageGeneral *page_general;
EMeetingListView *attendees_list_view;
- icalproperty *prop;
+ ICalProperty *prop;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_GENERAL (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_general_parent_class)->fill_widgets (page, component);
@@ -903,24 +914,24 @@ ecep_general_fill_widgets (ECompEditorPage *page,
g_slist_free_full (page_general->priv->orig_attendees, g_free);
page_general->priv->orig_attendees = NULL;
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTENDEE_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (component, ICAL_ATTENDEE_PROPERTY)) {
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTENDEE_PROPERTY)) {
const gchar *address;
- address = itip_strip_mailto (icalproperty_get_attendee (prop));
+ address = itip_strip_mailto (i_cal_property_get_attendee (prop));
if (address)
page_general->priv->orig_attendees = g_slist_prepend
(page_general->priv->orig_attendees, g_strdup (address));
}
page_general->priv->orig_attendees = g_slist_reverse (page_general->priv->orig_attendees);
- prop = icalcomponent_get_first_property (component, ICAL_ORGANIZER_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_ORGANIZER_PROPERTY);
if (prop) {
- icalparameter *param;
+ ICalParameter *param;
const gchar *organizer;
- organizer = icalproperty_get_organizer (prop);
+ organizer = i_cal_property_get_organizer (prop);
if (organizer && *organizer) {
ECompEditor *comp_editor;
@@ -937,27 +948,31 @@ ecep_general_fill_widgets (ECompEditorPage *page,
if (itip_address_is_user (registry, itip_strip_mailto (organizer))) {
flags = flags | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER;
} else {
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
if (param) {
- const gchar *sentby = icalparameter_get_sentby (param);
+ const gchar *sentby = i_cal_parameter_get_sentby (param);
if (sentby && *sentby &&
itip_address_is_user (registry, itip_strip_mailto (organizer))) {
flags = flags | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER;
}
+
+ g_object_unref (param);
}
}
e_comp_editor_page_general_set_show_attendees (page_general, TRUE);
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
if (param) {
const gchar *cn;
- cn = icalparameter_get_cn (param);
+ cn = i_cal_parameter_get_cn (param);
if (cn && *cn) {
value = camel_internet_address_format_address (cn, itip_strip_mailto
(organizer));
}
+
+ g_object_unref (param);
}
if (!value)
@@ -985,60 +1000,80 @@ ecep_general_fill_widgets (ECompEditorPage *page,
e_meeting_store_remove_all_attendees (page_general->priv->meeting_store);
e_meeting_list_view_remove_all_attendees_from_name_selector (attendees_list_view);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTENDEE_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (component, ICAL_ATTENDEE_PROPERTY)) {
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTENDEE_PROPERTY)) {
const gchar *address;
- address = itip_strip_mailto (icalproperty_get_attendee (prop));
+ address = itip_strip_mailto (i_cal_property_get_attendee (prop));
if (address) {
EMeetingAttendee *attendee;
- icalparameter *param;
+ ICalParameter *param;
attendee = E_MEETING_ATTENDEE (e_meeting_attendee_new ());
- /* It is supposed to be together with the MAILTO: protocol */
- e_meeting_attendee_set_address (attendee, g_strdup (icalproperty_get_attendee
(prop)));
+ /* It is supposed to be together with the "mailto:" protocol */
+ e_meeting_attendee_set_address (attendee, i_cal_property_get_attendee (prop));
- param = icalproperty_get_first_parameter (prop, ICAL_MEMBER_PARAMETER);
- if (param)
- e_meeting_attendee_set_member (attendee, g_strdup (icalparameter_get_member
(param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_MEMBER_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_member (attendee, i_cal_parameter_get_member (param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_CUTYPE_PARAMETER);
- if (param)
- e_meeting_attendee_set_cutype (attendee, icalparameter_get_cutype (param));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CUTYPE_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_cutype (attendee, i_cal_parameter_get_cutype (param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_ROLE_PARAMETER);
- if (param)
- e_meeting_attendee_set_role (attendee, icalparameter_get_role (param));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_ROLE_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_role (attendee, i_cal_parameter_get_role (param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER);
- if (param)
- e_meeting_attendee_set_rsvp (attendee, icalparameter_get_rsvp (param) ==
ICAL_RSVP_TRUE);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_RSVP_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_rsvp (attendee, i_cal_parameter_get_rsvp (param) ==
I_CAL_RSVP_TRUE);
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDTO_PARAMETER);
- if (param)
- e_meeting_attendee_set_delto (attendee, g_strdup
(icalparameter_get_delegatedto (param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDTO_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_delto (attendee, i_cal_parameter_get_delegatedto
(param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER);
- if (param)
- e_meeting_attendee_set_delfrom (attendee, g_strdup
(icalparameter_get_delegatedfrom (param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDFROM_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_delfrom (attendee, i_cal_parameter_get_delegatedfrom
(param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
- if (param)
- e_meeting_attendee_set_status (attendee, icalparameter_get_partstat (param));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_partstat (attendee, i_cal_parameter_get_partstat
(param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
- if (param)
- e_meeting_attendee_set_sentby (attendee, g_strdup (icalparameter_get_sentby
(param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_sentby (attendee, i_cal_parameter_get_sentby (param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
- if (param)
- e_meeting_attendee_set_cn (attendee, g_strdup (icalparameter_get_cn (param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_cn (attendee, i_cal_parameter_get_cn (param));
+ g_object_unref (param);
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_LANGUAGE_PARAMETER);
- if (param)
- e_meeting_attendee_set_language (attendee, g_strdup
(icalparameter_get_language (param)));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_LANGUAGE_PARAMETER);
+ if (param) {
+ e_meeting_attendee_set_language (attendee, i_cal_parameter_get_language
(param));
+ g_object_unref (param);
+ }
e_meeting_store_add_attendee (page_general->priv->meeting_store, attendee);
e_meeting_list_view_add_attendee_to_name_selector (attendees_list_view, attendee);
@@ -1050,20 +1085,20 @@ ecep_general_fill_widgets (ECompEditorPage *page,
static gboolean
ecep_general_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageGeneral *page_general;
- icalproperty *prop;
+ ICalProperty *prop;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE_GENERAL (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
page_general = E_COMP_EDITOR_PAGE_GENERAL (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;
@@ -1102,29 +1137,31 @@ ecep_general_fill_component (ECompEditorPage *page,
if ((flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0 &&
ecep_general_get_organizer (page_general, &organizer_name, &organizer_mailto, NULL)) {
const gchar *cal_email_address;
- icalparameter *param;
+ ICalParameter *param;
- prop = icalcomponent_get_first_property (component, ICAL_ORGANIZER_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_ORGANIZER_PROPERTY);
if (!prop) {
- prop = icalproperty_new_organizer (organizer_mailto ? organizer_mailto :
organizer_name);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_organizer (organizer_mailto ? organizer_mailto :
organizer_name);
+ i_cal_component_take_property (component, prop);
+ prop = i_cal_component_get_first_property (component,
I_CAL_ORGANIZER_PROPERTY);
} else {
- icalproperty_set_organizer (prop, organizer_mailto ? organizer_mailto :
organizer_name);
+ i_cal_property_set_organizer (prop, organizer_mailto ? organizer_mailto :
organizer_name);
}
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
if (organizer_name && *organizer_name) {
if (!param) {
- param = icalparameter_new_cn (organizer_name);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_cn (organizer_name);
+ i_cal_property_add_parameter (prop, param);
} else {
- icalparameter_set_cn (param, organizer_name);
+ i_cal_parameter_set_cn (param, organizer_name);
}
} else if (param) {
- icalproperty_remove_parameter_by_kind (prop, ICAL_CN_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_CN_PARAMETER);
}
+ g_clear_object (¶m);
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
cal_email_address = e_comp_editor_get_cal_email_address (comp_editor);
if (cal_email_address && *cal_email_address) {
gchar *sentby;
@@ -1135,19 +1172,22 @@ ecep_general_fill_component (ECompEditorPage *page,
if (differs) {
if (!param) {
- param = icalparameter_new_sentby (sentby);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_sentby (sentby);
+ i_cal_property_add_parameter (prop, param);
} else {
- icalparameter_set_sentby (param, sentby);
+ i_cal_parameter_set_sentby (param, sentby);
}
} else if (param) {
- icalproperty_remove_parameter_by_kind (prop, ICAL_SENTBY_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop,
I_CAL_SENTBY_PARAMETER);
}
g_free (sentby);
} else if (param) {
- icalproperty_remove_parameter_by_kind (prop, ICAL_SENTBY_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_SENTBY_PARAMETER);
}
+ g_clear_object (¶m);
+
+ g_object_unref (prop);
}
/* Attendees */
@@ -1160,7 +1200,7 @@ ecep_general_fill_component (ECompEditorPage *page,
address = itip_strip_mailto (e_meeting_attendee_get_address (attendee));
if (address) {
- icalparameter *param;
+ ICalParameter *param;
if ((flags & E_COMP_EDITOR_FLAG_DELEGATE) != 0 &&
(e_meeting_attendee_is_set_delfrom (attendee) ||
e_meeting_attendee_is_set_delto (attendee)) &&
@@ -1169,48 +1209,49 @@ ecep_general_fill_component (ECompEditorPage *page,
g_hash_table_insert (known_attendees, (gpointer) address, GINT_TO_POINTER
(1));
- prop = icalproperty_new_attendee (e_meeting_attendee_get_address (attendee));
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_attendee (e_meeting_attendee_get_address
(attendee));
added_attendees++;
if (e_meeting_attendee_is_set_member (attendee)) {
- param = icalparameter_new_member (e_meeting_attendee_get_member
(attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_member (e_meeting_attendee_get_member
(attendee));
+ i_cal_property_take_parameter (prop, param);
}
- param = icalparameter_new_cutype (e_meeting_attendee_get_cutype (attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_cutype (e_meeting_attendee_get_cutype (attendee));
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_role (e_meeting_attendee_get_role (attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_role (e_meeting_attendee_get_role (attendee));
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_partstat (e_meeting_attendee_get_status (attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_partstat (e_meeting_attendee_get_partstat
(attendee));
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_rsvp (e_meeting_attendee_get_rsvp (attendee) ?
ICAL_RSVP_TRUE : ICAL_RSVP_FALSE);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_rsvp (e_meeting_attendee_get_rsvp (attendee) ?
I_CAL_RSVP_TRUE : I_CAL_RSVP_FALSE);
+ i_cal_property_take_parameter (prop, param);
if (e_meeting_attendee_is_set_delfrom (attendee)) {
- param = icalparameter_new_delegatedfrom
(e_meeting_attendee_get_delfrom (attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_delegatedfrom
(e_meeting_attendee_get_delfrom (attendee));
+ i_cal_property_take_parameter (prop, param);
}
if (e_meeting_attendee_is_set_delto (attendee)) {
- param = icalparameter_new_delegatedto (e_meeting_attendee_get_delto
(attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_delegatedto (e_meeting_attendee_get_delto
(attendee));
+ i_cal_property_take_parameter (prop, param);
}
if (e_meeting_attendee_is_set_sentby (attendee)) {
- param = icalparameter_new_sentby (e_meeting_attendee_get_sentby
(attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_sentby (e_meeting_attendee_get_sentby
(attendee));
+ i_cal_property_take_parameter (prop, param);
}
if (e_meeting_attendee_is_set_cn (attendee)) {
- param = icalparameter_new_cn (e_meeting_attendee_get_cn (attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_cn (e_meeting_attendee_get_cn (attendee));
+ i_cal_property_take_parameter (prop, param);
}
if (e_meeting_attendee_is_set_language (attendee)) {
- param = icalparameter_new_language (e_meeting_attendee_get_language
(attendee));
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_language (e_meeting_attendee_get_language
(attendee));
+ i_cal_property_take_parameter (prop, param);
}
+
+ i_cal_component_take_property (component, prop);
}
}
@@ -1231,7 +1272,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);
@@ -1432,33 +1473,30 @@ ecep_general_constructed (GObject *object)
g_signal_connect (page_general->priv->source_combo_box, "changed",
G_CALLBACK (ecep_general_source_combo_box_changed_cb), page_general);
- /* 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);
-
- if (widget) {
- const gchar *tooltip;
+ widget = e_comp_editor_property_part_get_edit_widget (part);
- gtk_box_pack_start (GTK_BOX (page_general->priv->source_and_color_hbox), widget,
FALSE, FALSE, 0);
+ if (widget) {
+ const gchar *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.");
- }
+ gtk_box_pack_start (GTK_BOX (page_general->priv->source_and_color_hbox), widget, FALSE,
FALSE, 0);
- 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..aacbe60eb9 100644
--- a/src/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/src/calendar/gui/e-comp-editor-page-recurrence.c
@@ -92,10 +92,10 @@ enum recur_type {
};
static const gint freq_map[] = {
- ICAL_DAILY_RECURRENCE,
- ICAL_WEEKLY_RECURRENCE,
- ICAL_MONTHLY_RECURRENCE,
- ICAL_YEARLY_RECURRENCE,
+ I_CAL_DAILY_RECURRENCE,
+ I_CAL_WEEKLY_RECURRENCE,
+ I_CAL_MONTHLY_RECURRENCE,
+ I_CAL_YEARLY_RECURRENCE,
-1
};
@@ -148,7 +148,7 @@ struct _ECompEditorPageRecurrencePrivate {
/* For ending date, created by hand */
GtkWidget *ending_date_edit;
- struct icaltimetype ending_date_tt;
+ ICalTime *ending_date_tt;
/* For ending count of occurrences, created by hand */
GtkWidget *ending_count_spin;
@@ -163,8 +163,8 @@ ecep_recurrence_update_preview (ECompEditorPageRecurrence *page_recurrence)
ECompEditor *comp_editor;
ECalClient *client;
ECalComponent *comp;
- icalcomponent *icalcomp;
- const icalcomponent *editing_comp;
+ ICalComponent *icomp;
+ const ICalComponent *editing_comp;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page_recurrence));
g_return_if_fail (E_IS_CALENDAR (page_recurrence->priv->preview));
@@ -177,39 +177,38 @@ ecep_recurrence_update_preview (ECompEditorPageRecurrence *page_recurrence)
e_calendar_item_clear_marks (e_calendar_get_item (E_CALENDAR (page_recurrence->priv->preview)));
editing_comp = e_comp_editor_get_component (comp_editor);
- if (!editing_comp || e_cal_util_component_is_instance ((icalcomponent *) editing_comp)) {
+ if (!editing_comp || e_cal_util_component_is_instance ((ICalComponent *) editing_comp)) {
g_clear_object (&comp_editor);
return;
}
- icalcomp = icalcomponent_new_clone ((icalcomponent *) editing_comp);
+ icomp = i_cal_component_new_clone ((ICalComponent *) editing_comp);
e_comp_editor_set_updating (comp_editor, TRUE);
- e_comp_editor_fill_component (comp_editor, icalcomp);
+ e_comp_editor_fill_component (comp_editor, icomp);
e_comp_editor_set_updating (comp_editor, FALSE);
- comp = e_cal_component_new_from_icalcomponent (icalcomp);
+ comp = e_cal_component_new_from_icalcomponent (icomp);
if (comp) {
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
- if (icalcomponent_get_first_property (icalcomp, ICAL_DTSTART_PROPERTY)) {
- struct icaltimetype dt;
+ if (e_cal_util_component_has_property (icomp, I_CAL_DTSTART_PROPERTY)) {
+ ICalTime *dt;
- dt = icalcomponent_get_dtstart (icalcomp);
- zone = (icaltimezone *) dt.zone;
+ dt = i_cal_component_get_dtstart (icomp);
+ zone = i_cal_time_get_timezone (dt);
}
- e_cal_component_rescan (comp);
-
if (!zone)
zone = calendar_config_get_icaltimezone ();
tag_calendar_by_comp (
E_CALENDAR (page_recurrence->priv->preview), comp,
client, zone, TRUE, FALSE, FALSE, page_recurrence->priv->cancellable);
+
g_object_unref (comp);
}
@@ -234,7 +233,7 @@ ecep_recurrence_changed (ECompEditorPageRecurrence *page_recurrence)
static void
ecep_recurrence_append_exception (ECompEditorPageRecurrence *page_recurrence,
- const struct icaltimetype itt)
+ const ICalTime *itt)
{
GtkTreeView *view;
GtkTreeIter iter;
@@ -247,23 +246,27 @@ ecep_recurrence_append_exception (ECompEditorPageRecurrence *page_recurrence,
static void
ecep_recurrence_fill_exception_widgets (ECompEditorPageRecurrence *page_recurrence,
- icalcomponent *component)
+ ICalComponent *component)
{
- icalproperty *prop;
+ ICalProperty *prop;
e_date_time_list_clear (page_recurrence->priv->exceptions_store);
- for (prop = icalcomponent_get_first_property (component, ICAL_EXDATE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_EXDATE_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (component, ICAL_EXDATE_PROPERTY)) {
- struct icaltimetype itt;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_EXDATE_PROPERTY)) {
+ ICalTime *itt;
- itt = icalproperty_get_exdate (prop);
- if (!icaltime_is_valid_time (itt) ||
- icaltime_is_null_time (itt))
+ itt = i_cal_property_get_exdate (prop);
+ if (!itt || !i_cal_time_is_valid_time (itt) ||
+ i_cal_time_is_null_time (itt)) {
+ g_clear_object (&itt);
continue;
+ }
ecep_recurrence_append_exception (page_recurrence, itt);
+
+ g_clear_object (&itt);
}
}
@@ -325,18 +328,21 @@ ecep_recurrence_exceptions_add_clicked_cb (GtkButton *button,
dialog = ecep_recurrence_create_exception_dialog (page_recurrence, _("Add exception"), &date_edit);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- struct icaltimetype itt = icaltime_null_time ();
+ gint year, month, day;
- /* We use DATE values for exceptions, so we don't need a TZID. */
- itt.zone = NULL;
- itt.hour = 0;
- itt.minute = 0;
- itt.second = 0;
- itt.is_date = 1;
+ if (e_date_edit_get_date (E_DATE_EDIT (date_edit), &year, &month, &day)) {
+ ICalTime *itt = i_cal_time_null_time ();
+
+ /* We use DATE values for exceptions, so we don't need a TZID. */
+ i_cal_time_set_timezone (itt, NULL);
+ i_cal_time_set_date (itt, year, month, day);
+ i_cal_time_set_time (itt, 0, 0, 0);
+ i_cal_time_set_is_date (itt, TRUE);
- if (e_date_edit_get_date (E_DATE_EDIT (date_edit), &itt.year, &itt.month, &itt.day)) {
ecep_recurrence_append_exception (page_recurrence, itt);
ecep_recurrence_changed (page_recurrence);
+
+ g_clear_object (&itt);
}
}
@@ -348,7 +354,7 @@ ecep_recurrence_exceptions_edit_clicked_cb (GtkButton *button,
ECompEditorPageRecurrence *page_recurrence)
{
GtkWidget *dialog, *date_edit;
- const struct icaltimetype *current_itt;
+ const ICalTime *current_itt;
GtkTreeSelection *selection;
GtkTreeIter iter;
@@ -362,21 +368,24 @@ ecep_recurrence_exceptions_edit_clicked_cb (GtkButton *button,
dialog = ecep_recurrence_create_exception_dialog (page_recurrence, _("Modify exception"), &date_edit);
e_date_edit_set_date (E_DATE_EDIT (date_edit),
- current_itt->year, current_itt->month, current_itt->day);
+ i_cal_time_get_year (current_itt), i_cal_time_get_month (current_itt), i_cal_time_get_day
(current_itt));
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- struct icaltimetype itt = icaltime_null_time ();
+ gint year, month, day;
- /* We use DATE values for exceptions, so we don't need a TZID. */
- itt.zone = NULL;
- itt.hour = 0;
- itt.minute = 0;
- itt.second = 0;
- itt.is_date = 1;
+ if (e_date_edit_get_date (E_DATE_EDIT (date_edit), &year, &month, &day)) {
+ ICalTime *itt = i_cal_time_null_time ();
+
+ /* We use DATE values for exceptions, so we don't need a TZID. */
+ i_cal_time_set_timezone (itt, NULL);
+ i_cal_time_set_date (itt, year, month, day);
+ i_cal_time_set_time (itt, 0, 0, 0);
+ i_cal_time_set_is_date (itt, TRUE);
- if (e_date_edit_get_date (E_DATE_EDIT (date_edit), &itt.year, &itt.month, &itt.day)) {
e_date_time_list_set_date_time (page_recurrence->priv->exceptions_store, &iter, itt);
ecep_recurrence_changed (page_recurrence);
+
+ g_clear_object (&itt);
}
}
@@ -436,11 +445,16 @@ static struct tm
ecep_recurrence_get_current_time_cb (ECalendarItem *calitem,
gpointer user_data)
{
- struct icaltimetype today;
+ ICalTime *today;
+ struct tm tm;
- today = icaltime_today ();
+ today = i_cal_time_today ();
- return icaltimetype_to_tm (&today);
+ tm = e_cal_util_icaltime_to_tm (today);
+
+ g_clear_object (&today);
+
+ return tm;
}
static GtkWidget *
@@ -849,7 +863,7 @@ ecep_recurrence_make_monthly_special (ECompEditorPageRecurrence *page_recurrence
static void
ecep_recurrence_make_recurrence_special (ECompEditorPageRecurrence *page_recurrence)
{
- icalrecurrencetype_frequency frequency;
+ ICalRecurrenceFrequency frequency;
GtkWidget *child;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page_recurrence));
@@ -870,21 +884,21 @@ ecep_recurrence_make_recurrence_special (ECompEditorPageRecurrence *page_recurre
frequency = e_dialog_combo_box_get (page_recurrence->priv->recr_interval_unit_combo, freq_map);
switch (frequency) {
- case ICAL_DAILY_RECURRENCE:
+ case I_CAL_DAILY_RECURRENCE:
gtk_widget_hide (page_recurrence->priv->recr_interval_special_box);
break;
- case ICAL_WEEKLY_RECURRENCE:
+ case I_CAL_WEEKLY_RECURRENCE:
ecep_recurrence_make_weekly_special (page_recurrence);
gtk_widget_show (page_recurrence->priv->recr_interval_special_box);
break;
- case ICAL_MONTHLY_RECURRENCE:
+ case I_CAL_MONTHLY_RECURRENCE:
ecep_recurrence_make_monthly_special (page_recurrence);
gtk_widget_show (page_recurrence->priv->recr_interval_special_box);
break;
- case ICAL_YEARLY_RECURRENCE:
+ case I_CAL_YEARLY_RECURRENCE:
gtk_widget_hide (page_recurrence->priv->recr_interval_special_box);
break;
@@ -893,16 +907,21 @@ ecep_recurrence_make_recurrence_special (ECompEditorPageRecurrence *page_recurre
}
}
-/* Counts the elements in the by_xxx fields of an icalrecurrencetype */
+/* Counts the elements in the by_xxx fields of an ICalRecurrence */
static gint
-ecep_recurrence_count_by_xxx (gshort *field,
- gint max_elements)
+ecep_recurrence_count_by_xxx_and_free (GArray *array) /* gshort */
{
gint ii;
- for (ii = 0; ii < max_elements; ii++)
- if (field[ii] == ICAL_RECURRENCE_ARRAY_MAX)
+ if (!array)
+ return 0;
+
+ for (ii = 0; ii < array->len; ii++) {
+ if (g_array_index (array, gshort, ii) == I_CAL_RECURRENCE_ARRAY_MAX)
break;
+ }
+
+ g_array_unref (array);
return ii;
}
@@ -913,7 +932,7 @@ ecep_recurrence_make_ending_until_special (ECompEditorPageRecurrence *page_recur
{
ECompEditor *comp_editor;
guint32 flags;
- const icalcomponent *icomp;
+ const ICalComponent *icomp;
EDateEdit *date_edit;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page_recurrence));
@@ -939,18 +958,18 @@ ecep_recurrence_make_ending_until_special (ECompEditorPageRecurrence *page_recur
icomp = e_comp_editor_get_component (comp_editor);
if ((flags & E_COMP_EDITOR_FLAG_IS_NEW) != 0 && icomp) {
- struct icaltimetype itt;
+ ICalTime *itt;
- itt = icalcomponent_get_dtstart ((icalcomponent *) icomp);
+ itt = i_cal_component_get_dtstart ((ICalComponent *) icomp);
/* Setting the default until time to 2 weeks */
- icaltime_adjust (&itt, 14, 0, 0, 0);
+ i_cal_time_adjust (itt, 14, 0, 0, 0);
- e_date_edit_set_date (date_edit, itt.year, itt.month, itt.day);
+ e_date_edit_set_date (date_edit, i_cal_time_get_year (itt), i_cal_time_get_month (itt),
i_cal_time_get_day (itt));
} else {
e_date_edit_set_date (date_edit,
- page_recurrence->priv->ending_date_tt.year,
- page_recurrence->priv->ending_date_tt.month,
- page_recurrence->priv->ending_date_tt.day);
+ i_cal_time_get_year (page_recurrence->priv->ending_date_tt),
+ i_cal_time_get_month (page_recurrence->priv->ending_date_tt),
+ i_cal_time_get_day (page_recurrence->priv->ending_date_tt));
}
g_signal_connect_swapped (
@@ -1054,15 +1073,19 @@ ecep_recurrence_make_ending_special (ECompEditorPageRecurrence *page_recurrence)
*/
static void
ecep_recurrence_fill_ending_date (ECompEditorPageRecurrence *page_recurrence,
- struct icalrecurrencetype *rrule,
- icalcomponent *component)
+ ICalRecurrence *rrule,
+ ICalComponent *component)
{
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page_recurrence));
g_signal_handlers_block_matched (page_recurrence->priv->recr_ending_combo, G_SIGNAL_MATCH_DATA, 0, 0,
NULL, NULL, page_recurrence);
- if (rrule->count == 0) {
- if (rrule->until.year == 0) {
+ if (i_cal_recurrence_get_count (rrule) == 0) {
+ ICalTime *until;
+
+ until = i_cal_recurrence_get_until (rrule);
+
+ if (!until || i_cal_time_get_year (until) == 0) {
/* Forever */
e_dialog_combo_box_set (
@@ -1072,34 +1095,36 @@ ecep_recurrence_fill_ending_date (ECompEditorPageRecurrence *page_recurrence,
} else {
/* Ending date */
- if (!rrule->until.is_date) {
- icaltimezone *from_zone, *to_zone;
- struct icaltimetype dtstart;
+ if (!i_cal_time_is_date (until)) {
+ ICalTimezone *from_zone, *to_zone = NULL;
+ ICalTime *dtstart;
- dtstart = icalcomponent_get_dtstart (component);
+ dtstart = i_cal_component_get_dtstart (component);
- from_zone = icaltimezone_get_utc_timezone ();
- to_zone = (icaltimezone *) dtstart.zone;
+ from_zone = i_cal_timezone_get_utc_timezone ();
+ to_zone = dtstart ? i_cal_time_get_timezone (dtstart) : NULL;
if (to_zone)
- icaltimezone_convert_time (&rrule->until, from_zone, to_zone);
+ i_cal_timezone_convert_time (until, from_zone, to_zone);
- rrule->until.hour = 0;
- rrule->until.minute = 0;
- rrule->until.second = 0;
- rrule->until.is_date = TRUE;
+ i_cal_time_set_time (until, 0, 0, 0);
+ i_cal_time_set_is_date (until, TRUE);
+ i_cal_recurrence_set_until (rrule, until);
}
- page_recurrence->priv->ending_date_tt = rrule->until;
+ g_clear_object (&page_recurrence->priv->ending_date_tt);
+ page_recurrence->priv->ending_date_tt = i_cal_recurrence_get_until (rrule);
e_dialog_combo_box_set (
page_recurrence->priv->recr_ending_combo,
ENDING_UNTIL,
ending_types_map);
}
+
+ g_clear_object (&until);
} else {
/* Count of occurrences */
- page_recurrence->priv->ending_count = rrule->count;
+ page_recurrence->priv->ending_count = i_cal_recurrence_get_count (rrule);
e_dialog_combo_box_set (
page_recurrence->priv->recr_ending_combo,
ENDING_FOR,
@@ -1115,24 +1140,26 @@ ecep_recurrence_fill_ending_date (ECompEditorPageRecurrence *page_recurrence,
* for use in a WeekdayPicker widget.
*/
static guint8
-ecep_recurrence_get_start_weekday_mask (icalcomponent *component)
+ecep_recurrence_get_start_weekday_mask (ICalComponent *component)
{
- struct icaltimetype dtstart;
+ ICalTime *dtstart;
guint8 retval;
if (!component)
return 0;
- dtstart = icalcomponent_get_dtstart (component);
+ dtstart = i_cal_component_get_dtstart (component);
- if (icaltime_is_valid_time (dtstart)) {
+ if (dtstart && i_cal_time_is_valid_time (dtstart)) {
gshort weekday;
- weekday = icaltime_day_of_week (dtstart);
+ weekday = i_cal_time_day_of_week (dtstart);
retval = 0x1 << (weekday - 1);
} else
retval = 0;
+ g_clear_object (&dtstart);
+
return retval;
}
@@ -1141,7 +1168,7 @@ ecep_recurrence_get_start_weekday_mask (icalcomponent *component)
*/
static void
ecep_recurrence_set_special_defaults (ECompEditorPageRecurrence *page_recurrence,
- icalcomponent *component)
+ ICalComponent *component)
{
guint8 mask;
@@ -1181,7 +1208,8 @@ ecep_recurrence_clear_widgets (ECompEditorPageRecurrence *page_recurrence)
e_dialog_combo_box_set (page_recurrence->priv->recr_interval_unit_combo, ICAL_DAILY_RECURRENCE,
freq_map);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
- page_recurrence->priv->ending_date_tt = icaltime_today ();
+ g_clear_object (&page_recurrence->priv->ending_date_tt);
+ page_recurrence->priv->ending_date_tt = i_cal_time_today ();
page_recurrence->priv->ending_count = 2;
g_signal_handlers_block_matched (page_recurrence->priv->recr_ending_combo, G_SIGNAL_MATCH_DATA, 0, 0,
NULL, NULL, page_recurrence);
@@ -1199,43 +1227,45 @@ ecep_recurrence_clear_widgets (ECompEditorPageRecurrence *page_recurrence)
static void
ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence,
- icalcomponent *component)
+ ICalComponent *component)
{
- struct icalrecurrencetype r;
enum ending_type ending_type;
- icalproperty *prop;
+ ICalProperty *prop;
+ ICalRecurrence *recur;
+ ICalTime *until;
gboolean date_set;
+ gint year, month, day;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page_recurrence));
- icalrecurrencetype_clear (&r);
+ recur = i_cal_recurrence_new ();
/* Frequency, interval, week start */
- r.freq = e_dialog_combo_box_get (page_recurrence->priv->recr_interval_unit_combo, freq_map);
- r.interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
(page_recurrence->priv->recr_interval_value_spin));
+ i_cal_recurrence_set_freq (recur, e_dialog_combo_box_get
(page_recurrence->priv->recr_interval_unit_combo, freq_map));
+ i_cal_recurrence_set_interval (recur, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
(page_recurrence->priv->recr_interval_value_spin)));
switch (calendar_config_get_week_start_day ()) {
case G_DATE_MONDAY:
- r.week_start = ICAL_MONDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_MONDAY_WEEKDAY);
break;
case G_DATE_TUESDAY:
- r.week_start = ICAL_TUESDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_TUESDAY_WEEKDAY);
break;
case G_DATE_WEDNESDAY:
- r.week_start = ICAL_WEDNESDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_WEDNESDAY_WEEKDAY);
break;
case G_DATE_THURSDAY:
- r.week_start = ICAL_THURSDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_THURSDAY_WEEKDAY);
break;
case G_DATE_FRIDAY:
- r.week_start = ICAL_FRIDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_FRIDAY_WEEKDAY);
break;
case G_DATE_SATURDAY:
- r.week_start = ICAL_SATURDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_SATURDAY_WEEKDAY);
break;
case G_DATE_SUNDAY:
- r.week_start = ICAL_SUNDAY_WEEKDAY;
+ i_cal_recurrence_set_week_start (recur, I_CAL_SUNDAY_WEEKDAY);
break;
default:
g_warn_if_reached ();
@@ -1244,12 +1274,12 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
/* Frequency-specific data */
- switch (r.freq) {
- case ICAL_DAILY_RECURRENCE:
+ switch (i_cal_recurrence_get_freq (recur)) {
+ case I_CAL_DAILY_RECURRENCE:
/* Nothing else is required */
break;
- case ICAL_WEEKLY_RECURRENCE: {
+ case I_CAL_WEEKLY_RECURRENCE: {
EWeekdayChooser *chooser;
gint ii;
@@ -1261,25 +1291,27 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
ii = 0;
if (e_weekday_chooser_get_selected (chooser, G_DATE_SUNDAY))
- r.by_day[ii++] = ICAL_SUNDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_SUNDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_MONDAY))
- r.by_day[ii++] = ICAL_MONDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_MONDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_TUESDAY))
- r.by_day[ii++] = ICAL_TUESDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_TUESDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_WEDNESDAY))
- r.by_day[ii++] = ICAL_WEDNESDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_WEDNESDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_THURSDAY))
- r.by_day[ii++] = ICAL_THURSDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_THURSDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_FRIDAY))
- r.by_day[ii++] = ICAL_FRIDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_FRIDAY_WEEKDAY);
if (e_weekday_chooser_get_selected (chooser, G_DATE_SATURDAY))
- r.by_day[ii] = ICAL_SATURDAY_WEEKDAY;
+ i_cal_recurrence_set_by_day (recur, ii++, I_CAL_SATURDAY_WEEKDAY);
+
+ i_cal_recurrence_set_by_day (recur, ii, I_CAL_RECURRENCE_ARRAY_MAX);
break;
}
@@ -1307,47 +1339,47 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
switch (month_day) {
case MONTH_DAY_NTH:
if (month_num == MONTH_NUM_INVALID)
- r.by_month_day[0] = -1;
+ i_cal_recurrence_set_by_month_day (recur, 0, -1);
else
- r.by_month_day[0] = page_recurrence->priv->month_index;
+ i_cal_recurrence_set_by_month_day (recur, 0,
page_recurrence->priv->month_index);
break;
/* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not
* accept BYDAY=2TU. So we now use the same as Outlook
* by default. */
case MONTH_DAY_MON:
- r.by_day[0] = ICAL_MONDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_MONDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_TUE:
- r.by_day[0] = ICAL_TUESDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_TUESDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_WED:
- r.by_day[0] = ICAL_WEDNESDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_WEDNESDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_THU:
- r.by_day[0] = ICAL_THURSDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_THURSDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_FRI:
- r.by_day[0] = ICAL_FRIDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_FRIDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_SAT:
- r.by_day[0] = ICAL_SATURDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_SATURDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
case MONTH_DAY_SUN:
- r.by_day[0] = ICAL_SUNDAY_WEEKDAY;
- r.by_set_pos[0] = month_num;
+ i_cal_recurrence_set_by_day (recur, 0, I_CAL_SUNDAY_WEEKDAY);
+ i_cal_recurrence_set_by_set_pos (recur, 0, month_num);
break;
default:
@@ -1357,7 +1389,7 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
break;
}
- case ICAL_YEARLY_RECURRENCE:
+ case I_CAL_YEARLY_RECURRENCE:
/* Nothing else is required */
break;
@@ -1374,8 +1406,8 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
g_return_if_fail (page_recurrence->priv->ending_count_spin != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (page_recurrence->priv->ending_count_spin));
- r.count = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_recurrence->priv->ending_count_spin));
+ i_cal_recurrence_set_count (recur, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_recurrence->priv->ending_count_spin)));
break;
case ENDING_UNTIL:
@@ -1386,12 +1418,14 @@ ecep_recurrence_simple_recur_to_comp (ECompEditorPageRecurrence *page_recurrence
* since we don't support sub-day recurrences. */
date_set = e_date_edit_get_date (
E_DATE_EDIT (page_recurrence->priv->ending_date_edit),
- &r.until.year,
- &r.until.month,
- &r.until.day);
+ &year, &month, &day);
g_return_if_fail (date_set);
- r.until.is_date = 1;
+ until = i_cal_time_null_time ();
+ i_cal_time_set_date (until, year, month, day);
+ i_cal_time_set_is_date (until, 1);
+ i_cal_recurrence_set_until (recur, until);
+ g_clear_object (&until);
break;
@@ -1403,11 +1437,13 @@ 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);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_rrule (recur);
+ i_cal_component_take_property (component, prop);
+
+ g_clear_object (&recur);
}
static void
@@ -1460,35 +1496,35 @@ ecep_recurrence_sensitize_widgets (ECompEditorPage *page,
static void
ecep_recurrence_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageRecurrence *page_recurrence;
- struct icalrecurrencetype rrule;
- icalproperty *prop;
+ ICalRecurrence *rrule = NULL;
+ ICalProperty *prop;
GtkAdjustment *adj;
gint n_by_second, n_by_minute, n_by_hour;
gint n_by_day, n_by_month_day, n_by_year_day;
gint n_by_week_no, n_by_month, n_by_set_pos;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_recurrence_parent_class)->fill_widgets (page, component);
page_recurrence = E_COMP_EDITOR_PAGE_RECURRENCE (page);
- switch (icalcomponent_isa (component)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (component)) {
+ case I_CAL_VEVENT_COMPONENT:
gtk_button_set_label (GTK_BUTTON (page_recurrence->priv->recr_check_box),
/* Translators: Entire string is for example: 'This appointment
recurs/Every[x][day(s)][for][1]occurrences' (combobox options are in [square brackets]) */
C_("ECompEditorPageRecur", "This appointment rec_urs"));
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
gtk_button_set_label (GTK_BUTTON (page_recurrence->priv->recr_check_box),
/* Translators: Entire string is for example: 'This task
recurs/Every[x][day(s)][for][1]occurrences' (combobox options are in [square brackets]) */
C_("ECompEditorPageRecur", "This task rec_urs"));
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
gtk_button_set_label (GTK_BUTTON (page_recurrence->priv->recr_check_box),
/* Translators: Entire string is for example: 'This memo
recurs/Every[x][day(s)][for][1]occurrences' (combobox options are in [square brackets]) */
C_("ECompEditorPageRecur", "This memo rec_urs"));
@@ -1511,9 +1547,9 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
ecep_recurrence_set_special_defaults (page_recurrence, component);
/* No recurrences? */
- if (!icalcomponent_get_first_property (component, ICAL_RDATE_PROPERTY)
- && !icalcomponent_get_first_property (component, ICAL_RRULE_PROPERTY)
- && !icalcomponent_get_first_property (component, ICAL_EXRULE_PROPERTY)) {
+ if (!e_cal_util_component_has_property (component, I_CAL_RDATE_PROPERTY) &&
+ !e_cal_util_component_has_property (component, I_CAL_RRULE_PROPERTY) &&
+ !e_cal_util_component_has_property (component, I_CAL_EXRULE_PROPERTY)) {
g_signal_handlers_block_matched (page_recurrence->priv->recr_check_box, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, page_recurrence);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page_recurrence->priv->recr_check_box),
FALSE);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_check_box,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
@@ -1525,51 +1561,55 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
/* See if it is a custom set we don't support */
- if ((icalcomponent_get_first_property (component, ICAL_RRULE_PROPERTY) &&
- icalcomponent_get_next_property (component, ICAL_RRULE_PROPERTY)) ||
- icalcomponent_get_first_property (component, ICAL_RDATE_PROPERTY) ||
- icalcomponent_get_first_property (component, ICAL_EXRULE_PROPERTY))
+ if (i_cal_component_count_properties (component, I_CAL_RRULE_PROPERTY) > 1 ||
+ e_cal_util_component_has_property (component, I_CAL_RDATE_PROPERTY) ||
+ e_cal_util_component_has_property (component, I_CAL_EXRULE_PROPERTY))
goto custom;
/* Down to one rule, so test that one */
- prop = icalcomponent_get_first_property (component, ICAL_RRULE_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_RRULE_PROPERTY);
g_return_if_fail (prop != NULL);
- rrule = icalproperty_get_rrule (prop);
+ rrule = i_cal_property_get_rrule (prop);
+ if (!rrule) {
+ g_clear_object (&prop);
+
+ g_return_if_reached ();
+ }
+
+ g_clear_object (&prop);
/* Any lower frequency? */
- if (rrule.freq == ICAL_SECONDLY_RECURRENCE
- || rrule.freq == ICAL_MINUTELY_RECURRENCE
- || rrule.freq == ICAL_HOURLY_RECURRENCE)
+ if (i_cal_recurrence_get_freq (rrule) == I_CAL_SECONDLY_RECURRENCE ||
+ i_cal_recurrence_get_freq (rrule) == I_CAL_MINUTELY_RECURRENCE ||
+ i_cal_recurrence_get_freq (rrule) == I_CAL_HOURLY_RECURRENCE)
goto custom;
/* Any unusual values? */
-#define N_HAS_BY(field) (ecep_recurrence_count_by_xxx (field, G_N_ELEMENTS (field)))
-
- n_by_second = N_HAS_BY (rrule.by_second);
- n_by_minute = N_HAS_BY (rrule.by_minute);
- n_by_hour = N_HAS_BY (rrule.by_hour);
- n_by_day = N_HAS_BY (rrule.by_day);
- n_by_month_day = N_HAS_BY (rrule.by_month_day);
- n_by_year_day = N_HAS_BY (rrule.by_year_day);
- n_by_week_no = N_HAS_BY (rrule.by_week_no);
- n_by_month = N_HAS_BY (rrule.by_month);
- n_by_set_pos = N_HAS_BY (rrule.by_set_pos);
-
- if (n_by_second != 0
- || n_by_minute != 0
- || n_by_hour != 0)
+ n_by_second = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_second_array (rrule));
+ n_by_minute = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_minute_array (rrule));
+ n_by_hour = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_hour_array (rrule));
+ n_by_day = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_day_array (rrule));
+ n_by_month_day = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_month_day_array
(rrule));
+ n_by_year_day = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_year_day_array
(rrule));
+ n_by_week_no = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_week_no_array (rrule));
+ n_by_month = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_month_array (rrule));
+ n_by_set_pos = ecep_recurrence_count_by_xxx_and_free (i_cal_recurrence_get_by_set_pos_array (rrule));
+
+ if (n_by_second != 0 ||
+ n_by_minute != 0 ||
+ n_by_hour != 0)
goto custom;
/* Filter the funky shit based on the frequency; if there is nothing
* weird we can actually set the widgets.
*/
- switch (rrule.freq) {
- case ICAL_DAILY_RECURRENCE:
+ switch (i_cal_recurrence_get_freq (rrule)) {
+ case I_CAL_DAILY_RECURRENCE:
if (n_by_day != 0
|| n_by_month_day != 0
|| n_by_year_day != 0
@@ -1581,12 +1621,12 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
g_signal_handlers_block_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
e_dialog_combo_box_set (
page_recurrence->priv->recr_interval_unit_combo,
- ICAL_DAILY_RECURRENCE,
+ I_CAL_DAILY_RECURRENCE,
freq_map);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
break;
- case ICAL_WEEKLY_RECURRENCE: {
+ case I_CAL_WEEKLY_RECURRENCE: {
gint ii;
guint8 day_mask;
@@ -1599,42 +1639,42 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
day_mask = 0;
- for (ii = 0; ii < 8 && rrule.by_day[ii] != ICAL_RECURRENCE_ARRAY_MAX; ii++) {
- enum icalrecurrencetype_weekday weekday;
+ for (ii = 0; ii < 8 && i_cal_recurrence_get_by_day (rrule, ii) != I_CAL_RECURRENCE_ARRAY_MAX;
ii++) {
+ ICalRecurrenceWeekday weekday;
gint pos;
- weekday = icalrecurrencetype_day_day_of_week (rrule.by_day[ii]);
- pos = icalrecurrencetype_day_position (rrule.by_day[ii]);
+ weekday = i_cal_recurrence_day_day_of_week (i_cal_recurrence_get_by_day (rrule, ii));
+ pos = i_cal_recurrence_day_position (i_cal_recurrence_get_by_day (rrule, ii));
if (pos != 0)
goto custom;
switch (weekday) {
- case ICAL_SUNDAY_WEEKDAY:
+ case I_CAL_SUNDAY_WEEKDAY:
day_mask |= 1 << 0;
break;
- case ICAL_MONDAY_WEEKDAY:
+ case I_CAL_MONDAY_WEEKDAY:
day_mask |= 1 << 1;
break;
- case ICAL_TUESDAY_WEEKDAY:
+ case I_CAL_TUESDAY_WEEKDAY:
day_mask |= 1 << 2;
break;
- case ICAL_WEDNESDAY_WEEKDAY:
+ case I_CAL_WEDNESDAY_WEEKDAY:
day_mask |= 1 << 3;
break;
- case ICAL_THURSDAY_WEEKDAY:
+ case I_CAL_THURSDAY_WEEKDAY:
day_mask |= 1 << 4;
break;
- case ICAL_FRIDAY_WEEKDAY:
+ case I_CAL_FRIDAY_WEEKDAY:
day_mask |= 1 << 5;
break;
- case ICAL_SATURDAY_WEEKDAY:
+ case I_CAL_SATURDAY_WEEKDAY:
day_mask |= 1 << 6;
break;
@@ -1648,13 +1688,13 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
g_signal_handlers_block_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
e_dialog_combo_box_set (
page_recurrence->priv->recr_interval_unit_combo,
- ICAL_WEEKLY_RECURRENCE,
+ I_CAL_WEEKLY_RECURRENCE,
freq_map);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
break;
}
- case ICAL_MONTHLY_RECURRENCE:
+ case I_CAL_MONTHLY_RECURRENCE:
if (n_by_year_day != 0
|| n_by_week_no != 0
|| n_by_month != 0
@@ -1667,17 +1707,19 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
if (n_by_set_pos != 0)
goto custom;
- nth = rrule.by_month_day[0];
+ nth = i_cal_recurrence_get_by_month_day (rrule, 0);
if (nth < 1 && nth != -1)
goto custom;
if (nth == -1) {
- struct icaltimetype dtstart;
+ ICalTime *dtstart;
- dtstart = icalcomponent_get_dtstart (component);
+ dtstart = i_cal_component_get_dtstart (component);
- page_recurrence->priv->month_index = dtstart.day;
+ page_recurrence->priv->month_index = dtstart ? i_cal_time_get_day (dtstart) :
0;
page_recurrence->priv->month_num = MONTH_NUM_LAST;
+
+ g_clear_object (&dtstart);
} else {
page_recurrence->priv->month_index = nth;
page_recurrence->priv->month_num = MONTH_NUM_DAY;
@@ -1685,7 +1727,7 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
page_recurrence->priv->month_day = MONTH_DAY_NTH;
} else if (n_by_day == 1) {
- enum icalrecurrencetype_weekday weekday;
+ ICalRecurrenceWeekday weekday;
gint pos;
enum month_day_options month_day;
@@ -1693,43 +1735,43 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
* accept BYDAY=2TU. So we now use the same as Outlook
* by default. */
- weekday = icalrecurrencetype_day_day_of_week (rrule.by_day[0]);
- pos = icalrecurrencetype_day_position (rrule.by_day[0]);
+ weekday = i_cal_recurrence_day_day_of_week (i_cal_recurrence_get_by_day (rrule, 0));
+ pos = i_cal_recurrence_day_position (i_cal_recurrence_get_by_day (rrule, 0));
if (pos == 0) {
if (n_by_set_pos != 1)
goto custom;
- pos = rrule.by_set_pos[0];
+ pos = i_cal_recurrence_get_by_set_pos (rrule, 0);
} else if (pos < 0) {
goto custom;
}
switch (weekday) {
- case ICAL_MONDAY_WEEKDAY:
+ case I_CAL_MONDAY_WEEKDAY:
month_day = MONTH_DAY_MON;
break;
- case ICAL_TUESDAY_WEEKDAY:
+ case I_CAL_TUESDAY_WEEKDAY:
month_day = MONTH_DAY_TUE;
break;
- case ICAL_WEDNESDAY_WEEKDAY:
+ case I_CAL_WEDNESDAY_WEEKDAY:
month_day = MONTH_DAY_WED;
break;
- case ICAL_THURSDAY_WEEKDAY:
+ case I_CAL_THURSDAY_WEEKDAY:
month_day = MONTH_DAY_THU;
break;
- case ICAL_FRIDAY_WEEKDAY:
+ case I_CAL_FRIDAY_WEEKDAY:
month_day = MONTH_DAY_FRI;
break;
- case ICAL_SATURDAY_WEEKDAY:
+ case I_CAL_SATURDAY_WEEKDAY:
month_day = MONTH_DAY_SAT;
break;
- case ICAL_SUNDAY_WEEKDAY:
+ case I_CAL_SUNDAY_WEEKDAY:
month_day = MONTH_DAY_SUN;
break;
@@ -1748,7 +1790,7 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
g_signal_handlers_block_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
e_dialog_combo_box_set (
page_recurrence->priv->recr_interval_unit_combo,
- ICAL_MONTHLY_RECURRENCE,
+ I_CAL_MONTHLY_RECURRENCE,
freq_map);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
break;
@@ -1765,7 +1807,7 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
g_signal_handlers_block_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
e_dialog_combo_box_set (
page_recurrence->priv->recr_interval_unit_combo,
- ICAL_YEARLY_RECURRENCE,
+ I_CAL_YEARLY_RECURRENCE,
freq_map);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_interval_unit_combo,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
break;
@@ -1784,10 +1826,12 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON
(page_recurrence->priv->recr_interval_value_spin));
g_signal_handlers_block_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_recurrence->priv->recr_interval_value_spin),
rrule.interval);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_recurrence->priv->recr_interval_value_spin),
i_cal_recurrence_get_interval (rrule));
g_signal_handlers_unblock_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page_recurrence);
- ecep_recurrence_fill_ending_date (page_recurrence, &rrule, component);
+ ecep_recurrence_fill_ending_date (page_recurrence, rrule, component);
+
+ g_clear_object (&rrule);
return;
@@ -1797,22 +1841,24 @@ ecep_recurrence_fill_widgets (ECompEditorPage *page,
page_recurrence->priv->is_custom = TRUE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page_recurrence->priv->recr_check_box), TRUE);
g_signal_handlers_unblock_matched (page_recurrence->priv->recr_check_box, G_SIGNAL_MATCH_DATA, 0, 0,
NULL, NULL, page_recurrence);
+
+ g_clear_object (&rrule);
}
static gboolean
ecep_recurrence_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageRecurrence *page_recurrence;
ECompEditor *comp_editor;
GtkTreeModel *model;
GtkTreeIter iter;
- icalproperty *prop;
+ ICalProperty *prop;
gboolean recurs;
gboolean valid_iter;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE_RECURRENCE (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
page_recurrence = E_COMP_EDITOR_PAGE_RECURRENCE (page);
@@ -1822,21 +1868,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;
}
@@ -1849,12 +1895,12 @@ ecep_recurrence_fill_component (ECompEditorPage *page,
for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter;
valid_iter = gtk_tree_model_iter_next (model, &iter)) {
- const icaltimetype *dt;
+ ICalTime *dt;
dt = e_date_time_list_get_date_time (E_DATE_TIME_LIST (model), &iter);
g_return_val_if_fail (dt != NULL, FALSE);
- if (!icaltime_is_valid_time (*dt)) {
+ if (!i_cal_time_is_valid_time (dt)) {
e_comp_editor_set_validation_error (comp_editor,
page, page_recurrence->priv->exceptions_tree_view,
_("Recurrence exception date is invalid"));
@@ -1862,22 +1908,22 @@ ecep_recurrence_fill_component (ECompEditorPage *page,
return FALSE;
}
- prop = icalproperty_new_exdate (*dt);
- cal_comp_util_update_tzid_parameter (prop, *dt);
+ prop = i_cal_property_new_exdate (dt);
+ cal_comp_util_update_tzid_parameter (prop, dt);
- icalcomponent_add_property (component, prop);
+ i_cal_component_take_property (component, prop);
}
if (gtk_widget_get_visible (page_recurrence->priv->recr_ending_combo) &&
gtk_widget_get_sensitive (page_recurrence->priv->recr_ending_combo) &&
e_dialog_combo_box_get (page_recurrence->priv->recr_ending_combo, ending_types_map) ==
ENDING_UNTIL) {
/* check whether the "until" date is in the future */
- struct icaltimetype tt = icaltime_null_time ();
+ gint year, month, day;
gboolean ok = TRUE;
- if (e_date_edit_get_date (E_DATE_EDIT (page_recurrence->priv->ending_date_edit), &tt.year,
&tt.month, &tt.day)) {
+ if (e_date_edit_get_date (E_DATE_EDIT (page_recurrence->priv->ending_date_edit), &year,
&month, &day)) {
ECompEditorPropertyPart *dtstart_part = NULL;
- struct icaltimetype dtstart = icaltime_null_time ();
+ ICalTime *dtstart = NULL;
e_comp_editor_get_time_parts (comp_editor, &dtstart_part, NULL);
if (dtstart_part) {
@@ -1885,21 +1931,29 @@ ecep_recurrence_fill_component (ECompEditorPage *page,
E_COMP_EDITOR_PROPERTY_PART_DATETIME (dtstart_part));
}
- tt.is_date = 1;
- tt.zone = NULL;
+ if (dtstart && i_cal_time_is_valid_time (dtstart)) {
+ ICalTime *tt;
+
+ tt = i_cal_time_null_time ();
+ i_cal_time_set_timezone (tt, NULL);
+ i_cal_time_set_is_date (tt, TRUE);
+ i_cal_time_set_date (tt, year, month, day);
- if (icaltime_is_valid_time (dtstart)) {
- ok = icaltime_compare_date_only (dtstart, tt) <= 0;
+ ok = i_cal_time_compare_date_only (dtstart, tt) <= 0;
if (!ok) {
e_date_edit_set_date (E_DATE_EDIT
(page_recurrence->priv->ending_date_edit),
- dtstart.year, dtstart.month, dtstart.day);
+ i_cal_time_get_year (dtstart), i_cal_time_get_month
(dtstart), i_cal_time_get_day (dtstart));
} else {
/* to have the date shown in "normalized" format */
e_date_edit_set_date (E_DATE_EDIT
(page_recurrence->priv->ending_date_edit),
- tt.year, tt.month, tt.day);
+ i_cal_time_get_year (tt), i_cal_time_get_month (tt),
i_cal_time_get_day (tt));
}
+
+ g_clear_object (&tt);
}
+
+ g_clear_object (&dtstart);
}
if (!ok) {
@@ -2307,6 +2361,7 @@ ecep_recurrence_dispose (GObject *object)
}
g_clear_object (&page_recurrence->priv->exceptions_store);
+ g_clear_object (&page_recurrence->priv->ending_date_tt);
comp_editor = e_comp_editor_page_ref_editor (E_COMP_EDITOR_PAGE (page_recurrence));
if (comp_editor) {
diff --git a/src/calendar/gui/e-comp-editor-page-reminders.c b/src/calendar/gui/e-comp-editor-page-reminders.c
index 47a21457c7..b46f85691b 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[] = {
@@ -239,51 +239,59 @@ ecep_reminders_get_text_view_text (GtkWidget *text_view)
return gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);
}
-static void
+static gboolean
ecep_reminders_remove_needs_description_property (ECalComponentAlarm *alarm)
{
- icalcomponent *component;
- icalproperty *prop;
+ ECalComponentPropertyBag *bag;
+ guint ii, sz;
- g_return_if_fail (alarm != NULL);
+ g_return_val_if_fail (alarm != NULL, FALSE);
- component = e_cal_component_alarm_get_icalcomponent (alarm);
- g_return_if_fail (component != NULL);
+ bag = e_cal_component_alarm_get_property_bag (alarm);
+ g_return_val_if_fail (bag != NULL, FALSE);
- for (prop = icalcomponent_get_first_property (component, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (component, ICAL_X_PROPERTY)) {
+ sz = e_cal_component_property_bag_get_count (bag);
+ for (ii = 0; ii < sz; ii++) {
+ ICalProperty *prop;
const gchar *x_name;
- x_name = icalproperty_get_x_name (prop);
+ prop = e_cal_component_property_bag_get (bag, ii);
+ if (!prop || i_cal_property_isa (prop) != I_CAL_X_PROPERTY)
+ continue;
+
+ x_name = i_cal_property_get_x_name (prop);
if (g_str_equal (x_name, X_EVOLUTION_NEEDS_DESCRIPTION)) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
- break;
+ e_cal_component_property_bag_remove (bag, ii);
+ return TRUE;
}
}
+
+ return FALSE;
}
static gboolean
ecep_reminders_has_needs_description_property (ECalComponentAlarm *alarm)
{
- icalcomponent *component;
- icalproperty *prop;
+ ECalComponentPropertyBag *bag;
+ guint ii, sz;
g_return_val_if_fail (alarm != NULL, FALSE);
- component = e_cal_component_alarm_get_icalcomponent (alarm);
- g_return_val_if_fail (component != NULL, FALSE);
+ bag = e_cal_component_alarm_get_property_bag (alarm);
+ g_return_val_if_fail (bag != NULL, FALSE);
- for (prop = icalcomponent_get_first_property (component, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (component, ICAL_X_PROPERTY)) {
+ sz = e_cal_component_property_bag_get_count (bag);
+ for (ii = 0; ii < sz; ii++) {
+ ICalProperty *prop;
const gchar *x_name;
- x_name = icalproperty_get_x_name (prop);
- if (g_str_equal (x_name, X_EVOLUTION_NEEDS_DESCRIPTION)) {
+ prop = e_cal_component_property_bag_get (bag, ii);
+ if (!prop || i_cal_property_isa (prop) != I_CAL_X_PROPERTY)
+ continue;
+
+ x_name = i_cal_property_get_x_name (prop);
+ if (g_str_equal (x_name, X_EVOLUTION_NEEDS_DESCRIPTION))
return TRUE;
- }
}
return FALSE;
@@ -292,20 +300,20 @@ ecep_reminders_has_needs_description_property (ECalComponentAlarm *alarm)
static void
ecep_reminders_add_needs_description_property (ECalComponentAlarm *alarm)
{
- icalcomponent *component;
- icalproperty *prop;
+ ECalComponentPropertyBag *bag;
+ ICalProperty *prop;
g_return_if_fail (alarm != NULL);
if (ecep_reminders_has_needs_description_property (alarm))
return;
- component = e_cal_component_alarm_get_icalcomponent (alarm);
- g_return_if_fail (component != NULL);
+ bag = e_cal_component_alarm_get_property_bag (alarm);
+ g_return_if_fail (bag != NULL);
- prop = icalproperty_new_x ("1");
- icalproperty_set_x_name (prop, X_EVOLUTION_NEEDS_DESCRIPTION);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_x ("1");
+ i_cal_property_set_x_name (prop, X_EVOLUTION_NEEDS_DESCRIPTION);
+ e_cal_component_property_bag_take (bag, prop);
}
static void
@@ -345,10 +353,11 @@ ecep_reminders_reset_alarm_widget (ECompEditorPageReminders *page_reminders)
static void
ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
{
- ECalComponentAlarmTrigger trigger;
+ ECalComponentAlarmTrigger *trigger;
ECalComponentAlarmAction action;
- ECalComponentAlarmRepeat repeat;
+ ECalComponentAlarmRepeat *repeat;
ECalComponentAlarm *alarm;
+ ICalDuration *duration;
GtkTreeSelection *selection;
GtkTreeIter iter;
@@ -360,8 +369,8 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (page_reminders->priv->alarm_list, &iter);
g_return_if_fail (alarm != NULL);
- 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);
e_comp_editor_page_set_updating (E_COMP_EDITOR_PAGE (page_reminders), TRUE);
@@ -373,7 +382,7 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
}
/* Alarm Types */
- switch (trigger.type) {
+ switch (e_cal_component_alarm_trigger_get_kind (trigger)) {
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START:
e_dialog_combo_box_set (page_reminders->priv->relative_to_combo,
E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map);
break;
@@ -382,10 +391,11 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
e_dialog_combo_box_set (page_reminders->priv->relative_to_combo,
E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, time_map);
break;
default:
- g_warning ("%s: Unexpected alarm trigger type (%d)", G_STRLOC, trigger.type);
+ g_warning ("%s: Unexpected alarm trigger type (%d)", G_STRLOC,
e_cal_component_alarm_trigger_get_kind (trigger));
}
- switch (trigger.u.rel_duration.is_neg) {
+ duration = e_cal_component_alarm_trigger_get_duration (trigger);
+ switch (i_cal_duration_is_neg (duration)) {
case 1:
e_dialog_combo_box_set (page_reminders->priv->relative_time_combo, BEFORE, relative_map);
break;
@@ -395,47 +405,49 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
break;
}
- if (trigger.u.rel_duration.days) {
+ if (i_cal_duration_get_days (duration)) {
e_dialog_combo_box_set (page_reminders->priv->unit_combo, DAYS, value_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->time_spin),
- trigger.u.rel_duration.days);
- } else if (trigger.u.rel_duration.hours) {
+ i_cal_duration_get_days (duration));
+ } else if (i_cal_duration_get_hours (duration)) {
e_dialog_combo_box_set (page_reminders->priv->unit_combo, HOURS, value_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->time_spin),
- trigger.u.rel_duration.hours);
- } else if (trigger.u.rel_duration.minutes) {
+ i_cal_duration_get_hours (duration));
+ } else if (i_cal_duration_get_minutes (duration)) {
e_dialog_combo_box_set (page_reminders->priv->unit_combo, MINUTES, value_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->time_spin),
- trigger.u.rel_duration.minutes);
+ i_cal_duration_get_minutes (duration));
} else {
e_dialog_combo_box_set (page_reminders->priv->unit_combo, MINUTES, value_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->time_spin), 0);
}
/* Repeat options */
- e_cal_component_alarm_get_repeat (alarm, &repeat);
+ repeat = e_cal_component_alarm_get_repeat (alarm);
- if (repeat.repetitions) {
+ if (e_cal_component_alarm_repeat_get_repetitions (repeat)) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page_reminders->priv->repeat_check), TRUE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->repeat_times_spin),
- repeat.repetitions);
+ e_cal_component_alarm_repeat_get_repetitions (repeat));
- if (repeat.duration.minutes) {
+ duration = e_cal_component_alarm_repeat_get_interval (repeat);
+
+ if (i_cal_duration_get_minutes (duration)) {
e_dialog_combo_box_set (page_reminders->priv->repeat_unit_combo, DUR_MINUTES,
duration_units_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin),
- repeat.duration.minutes);
+ i_cal_duration_get_minutes (duration));
}
- if (repeat.duration.hours) {
+ if (i_cal_duration_get_hours (duration)) {
e_dialog_combo_box_set (page_reminders->priv->repeat_unit_combo, DUR_HOURS,
duration_units_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin),
- repeat.duration.hours);
+ i_cal_duration_get_hours (duration));
}
- if (repeat.duration.days) {
+ if (i_cal_duration_get_days (duration)) {
e_dialog_combo_box_set (page_reminders->priv->repeat_unit_combo, DUR_DAYS,
duration_units_map);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin),
- repeat.duration.days);
+ i_cal_duration_get_days (duration));
}
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page_reminders->priv->repeat_check), FALSE);
@@ -448,11 +460,17 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
switch (action) {
case E_CAL_COMPONENT_ALARM_AUDIO: {
- const gchar *url;
- icalattach *attach = NULL;
+ GSList *attachments;
+ const gchar *url = NULL;
+
+ attachments = e_cal_component_alarm_get_attachments (alarm);
+ /* Audio alarm can have only one attachment, the file to play */
+ if (attachments && !attachments->next) {
+ ICalAttach *attach = attachments->data;
+
+ url = attach ? i_cal_attach_get_url (attach) : NULL;
+ }
- e_cal_component_alarm_get_attach (alarm, &attach);
- url = attach ? icalattach_get_url (attach) : NULL;
if (url && *url) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_sound_check), TRUE);
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER
(page_reminders->priv->custom_sound_chooser), url);
@@ -460,19 +478,16 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_sound_check), FALSE);
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER
(page_reminders->priv->custom_sound_chooser));
}
-
- if (attach)
- icalattach_unref (attach);
} break;
case E_CAL_COMPONENT_ALARM_DISPLAY: {
- ECalComponentText description;
+ ECalComponentText* description;
- e_cal_component_alarm_get_description (alarm, &description);
+ description = e_cal_component_alarm_get_description (alarm);
- if (description.value && *description.value) {
+ if (description && e_cal_component_text_get_value (description) &&
e_cal_component_text_get_value (description)[0]) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_message_check), TRUE);
- ecep_reminders_set_text_view_text (page_reminders->priv->custom_message_text_view,
description.value);
+ ecep_reminders_set_text_view_text (page_reminders->priv->custom_message_text_view,
e_cal_component_text_get_value (description));
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_message_check), FALSE);
ecep_reminders_set_text_view_text (page_reminders->priv->custom_message_text_view,
NULL);
@@ -482,38 +497,36 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
case E_CAL_COMPONENT_ALARM_EMAIL: {
ENameSelectorModel *name_selector_model;
EDestinationStore *destination_store;
- ECalComponentText description;
- GSList *attendee_list, *link;
+ ECalComponentText *description;
+ GSList *attendees, *link;
/* Attendees */
name_selector_model = e_name_selector_peek_model (page_reminders->priv->name_selector);
e_name_selector_model_peek_section (name_selector_model, SECTION_NAME, NULL,
&destination_store);
- e_cal_component_alarm_get_attendee_list (alarm, &attendee_list);
- for (link = attendee_list; link; link = g_slist_next (link)) {
- ECalComponentAttendee *a = link->data;
+ attendees = e_cal_component_alarm_get_attendees (alarm);
+ for (link = attendees; link; link = g_slist_next (link)) {
+ ECalComponentAttendee *att = link->data;
EDestination *dest;
dest = e_destination_new ();
- if (a->cn && *a->cn)
- e_destination_set_name (dest, a->cn);
+ if (att && e_cal_component_attendee_get_cn (att) && e_cal_component_attendee_get_cn
(att)[0])
+ e_destination_set_name (dest, e_cal_component_attendee_get_cn (att));
- if (a->value && *a->value)
- e_destination_set_email (dest, itip_strip_mailto (a->value));
+ if (att && e_cal_component_attendee_get_value (att) &&
e_cal_component_attendee_get_value (att)[0])
+ e_destination_set_email (dest, itip_strip_mailto
(e_cal_component_attendee_get_value (att)));
e_destination_store_append_destination (destination_store, dest);
g_object_unref (dest);
}
- e_cal_component_free_attendee_list (attendee_list);
-
/* Description */
- e_cal_component_alarm_get_description (alarm, &description);
- if (description.value && *description.value) {
+ description = e_cal_component_alarm_get_description (alarm);
+ if (description && e_cal_component_text_get_value (description) &&
e_cal_component_text_get_value (description)[0]) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_email_message_check), TRUE);
- ecep_reminders_set_text_view_text
(page_reminders->priv->custom_email_message_text_view, description.value);
+ ecep_reminders_set_text_view_text
(page_reminders->priv->custom_email_message_text_view, e_cal_component_text_get_value (description));
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_email_message_check), FALSE);
ecep_reminders_set_text_view_text
(page_reminders->priv->custom_email_message_text_view, NULL);
@@ -521,26 +534,27 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
} break;
case E_CAL_COMPONENT_ALARM_PROCEDURE: {
- const gchar *url;
- icalattach *attach = NULL;
+ const gchar *url = NULL;
+ GSList *attachments;
- e_cal_component_alarm_get_attach (alarm, (&attach));
- url = attach ? icalattach_get_url (attach) : NULL;
+ attachments = e_cal_component_alarm_get_attachments (alarm);
+ if (attachments && !attachments->next) {
+ ICalAttach *attach = attachments->data;
+ url = attach ? i_cal_attach_get_url (attach) : NULL;
+ }
if (url && *url) {
- ECalComponentText description;
+ ECalComponentText *description;
- e_cal_component_alarm_get_description (alarm, &description);
+ description = e_cal_component_alarm_get_description (alarm);
gtk_entry_set_text (GTK_ENTRY (page_reminders->priv->custom_app_path_entry), url);
- gtk_entry_set_text (GTK_ENTRY (page_reminders->priv->custom_app_args_entry),
description.value ? description.value : "");
+ gtk_entry_set_text (GTK_ENTRY (page_reminders->priv->custom_app_args_entry),
+ (description && e_cal_component_text_get_value (description)) ?
e_cal_component_text_get_value (description) : "");
} else {
gtk_entry_set_text (GTK_ENTRY (page_reminders->priv->custom_app_path_entry), "");
gtk_entry_set_text (GTK_ENTRY (page_reminders->priv->custom_app_args_entry), "");
}
-
- if (attach)
- icalattach_unref (attach);
} break;
default:
g_warning ("%s: Unexpected alarm action (%d)", G_STRLOC, action);
@@ -552,10 +566,11 @@ ecep_reminders_selected_to_widgets (ECompEditorPageReminders *page_reminders)
static void
ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
{
- ECalComponentAlarmTrigger trigger;
+ ECalComponentAlarmTrigger *trigger;
ECalComponentAlarmAction action;
- ECalComponentAlarmRepeat repeat;
+ ECalComponentAlarmRepeat *repeat = NULL;
ECalComponentAlarm *alarm;
+ ICalDuration *duration;
GtkTreeSelection *selection;
GtkTreeIter iter;
@@ -570,71 +585,75 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
alarm = e_cal_component_alarm_new ();
- /* Fill out the alarm */
- memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger));
+ duration = i_cal_duration_null_duration ();
- trigger.type = e_dialog_combo_box_get (page_reminders->priv->relative_to_combo, time_map);
if (e_dialog_combo_box_get (page_reminders->priv->relative_time_combo, relative_map) == BEFORE)
- trigger.u.rel_duration.is_neg = 1;
+ i_cal_duration_set_is_neg (duration, TRUE);
else
- trigger.u.rel_duration.is_neg = 0;
+ i_cal_duration_set_is_neg (duration, FALSE);
switch (e_dialog_combo_box_get (page_reminders->priv->unit_combo, value_map)) {
case MINUTES:
- trigger.u.rel_duration.minutes = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->time_spin));
+ i_cal_duration_set_minutes (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->time_spin)));
break;
case HOURS:
- trigger.u.rel_duration.hours = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->time_spin));
+ i_cal_duration_set_hours (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->time_spin)));
break;
case DAYS:
- trigger.u.rel_duration.days = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->time_spin));
+ i_cal_duration_set_days (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->time_spin)));
break;
default:
g_return_if_reached ();
}
- e_cal_component_alarm_set_trigger (alarm, trigger);
+
+ trigger = e_cal_component_alarm_trigger_new_relative (
+ e_dialog_combo_box_get (page_reminders->priv->relative_to_combo, time_map),
+ duration);
+
+ g_object_unref (duration);
+
+ e_cal_component_alarm_take_trigger (alarm, trigger);
action = e_dialog_combo_box_get (page_reminders->priv->kind_combo, action_map);
e_cal_component_alarm_set_action (alarm, action);
/* Repeat stuff */
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page_reminders->priv->repeat_check))) {
- repeat.repetitions = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->repeat_times_spin));
-
- memset (&repeat.duration, 0, sizeof (repeat.duration));
+ duration = i_cal_duration_null_duration ();
switch (e_dialog_combo_box_get (page_reminders->priv->repeat_unit_combo, duration_units_map))
{
case DUR_MINUTES:
- repeat.duration.minutes = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin));
+ i_cal_duration_set_minutes (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin)));
break;
case DUR_HOURS:
- repeat.duration.hours = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin));
+ i_cal_duration_set_hours (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin)));
break;
case DUR_DAYS:
- repeat.duration.days = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin));
+ i_cal_duration_set_days (duration, gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->repeat_every_spin)));
break;
default:
g_return_if_reached ();
}
- } else {
- memset (&repeat, 0, sizeof (repeat));
- repeat.repetitions = 0;
+
+ repeat = e_cal_component_alarm_repeat_new (gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page_reminders->priv->repeat_times_spin)), duration);
+
+ g_object_unref (duration);
}
- e_cal_component_alarm_set_repeat (alarm, repeat);
+ e_cal_component_alarm_take_repeat (alarm, repeat);
/* Options */
switch (action) {
@@ -649,11 +668,12 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
url = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER
(page_reminders->priv->custom_sound_chooser));
if (url && *url) {
- icalattach *attach;
+ ICalAttach *attach;
+ GSList *attachments;
- attach = icalattach_new_from_url (url);
- e_cal_component_alarm_set_attach (alarm, attach);
- icalattach_unref (attach);
+ attach = i_cal_attach_new_from_url (url);
+ attachments = g_slist_prepend (NULL, attach);
+ e_cal_component_alarm_take_attachments (alarm, attachments);
}
g_free (url);
@@ -676,15 +696,15 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
case E_CAL_COMPONENT_ALARM_DISPLAY:
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_message_check))) {
- ECalComponentText description;
gchar *text;
text = ecep_reminders_get_text_view_text
(page_reminders->priv->custom_message_text_view);
if (text && *text) {
- description.value = text;
- description.altrep = NULL;
+ ECalComponentText *description;
- e_cal_component_alarm_set_description (alarm, &description);
+ description = e_cal_component_text_new (text, NULL);
+
+ e_cal_component_alarm_take_description (alarm, description);
ecep_reminders_remove_needs_description_property (alarm);
}
@@ -694,7 +714,7 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
break;
case E_CAL_COMPONENT_ALARM_EMAIL: {
- GSList *attendee_list = NULL;
+ GSList *attendees = NULL;
ENameSelectorModel *name_selector_model;
EDestinationStore *destination_store;
GList *destinations, *link;
@@ -706,33 +726,35 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
for (link = destinations; link; link = g_list_next (link)) {
EDestination *dest = link->data;
- ECalComponentAttendee *a;
+ ECalComponentAttendee *att;
+ gchar *mailto;
+
+ mailto = g_strconcat ("mailto:", e_destination_get_email (dest), NULL);
+ att = e_cal_component_attendee_new ();
+ e_cal_component_attendee_set_value (att, mailto);
+ e_cal_component_attendee_set_cn (att, e_destination_get_name (dest));
+ e_cal_component_attendee_set_cutype (att, I_CAL_CUTYPE_INDIVIDUAL);
+ e_cal_component_attendee_set_partstat (att, I_CAL_PARTSTAT_NEEDSACTION);
+ e_cal_component_attendee_set_role (att, I_CAL_ROLE_REQPARTICIPANT);
- a = g_new0 (ECalComponentAttendee, 1);
- a->value = e_destination_get_email (dest);
- a->cn = e_destination_get_name (dest);
- a->cutype = ICAL_CUTYPE_INDIVIDUAL;
- a->status = ICAL_PARTSTAT_NEEDSACTION;
- a->role = ICAL_ROLE_REQPARTICIPANT;
+ attendees = g_slist_prepend (attendees, att);
- attendee_list = g_slist_append (attendee_list, a);
+ g_free (mailto);
}
- e_cal_component_alarm_set_attendee_list (alarm, attendee_list);
+ e_cal_component_alarm_take_attendees (alarm, g_slist_reverse (attendees));
- e_cal_component_free_attendee_list (attendee_list);
g_list_free (destinations);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(page_reminders->priv->custom_email_message_check))) {
- ECalComponentText description;
gchar *text;
text = ecep_reminders_get_text_view_text
(page_reminders->priv->custom_email_message_text_view);
if (text && *text) {
- description.value = text;
- description.altrep = NULL;
+ ECalComponentText *description;
- e_cal_component_alarm_set_description (alarm, &description);
+ description = e_cal_component_text_new (text, NULL);
+ e_cal_component_alarm_take_description (alarm, description);
ecep_reminders_remove_needs_description_property (alarm);
}
@@ -742,22 +764,20 @@ ecep_reminders_widgets_to_selected (ECompEditorPageReminders *page_reminders)
} break;
case E_CAL_COMPONENT_ALARM_PROCEDURE: {
- ECalComponentText description;
- icalattach *attach;
+ ECalComponentText *description;
+ GSList *attachments;
const gchar *text;
text = gtk_entry_get_text (GTK_ENTRY (page_reminders->priv->custom_app_path_entry));
- attach = icalattach_new_from_url (text ? text : "");
- e_cal_component_alarm_set_attach (alarm, attach);
- icalattach_unref (attach);
+ attachments = g_slist_prepend (NULL, i_cal_attach_new_from_url (text ? text : ""));
+ e_cal_component_alarm_take_attachments (alarm, attachments);
text = gtk_entry_get_text (GTK_ENTRY (page_reminders->priv->custom_app_args_entry));
- description.value = text;
- description.altrep = NULL;
+ description = e_cal_component_text_new (text, NULL);
- e_cal_component_alarm_set_description (alarm, &description);
+ e_cal_component_alarm_take_description (alarm, description);
ecep_reminders_remove_needs_description_property (alarm);
} break;
@@ -793,7 +813,7 @@ ecep_reminders_alarms_combo_changed_cb (GtkComboBox *combo_box,
ECompEditorPageReminders *page_reminders)
{
ECalComponentAlarm *alarm;
- ECalComponentAlarmTrigger trigger;
+ ICalDuration *duration;
gint alarm_type;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_REMINDERS (page_reminders));
@@ -830,35 +850,35 @@ ecep_reminders_alarms_combo_changed_cb (GtkComboBox *combo_box,
e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
- memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger));
- trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
- trigger.u.rel_duration.is_neg = 1;
+ duration = i_cal_duration_null_duration ();
+
+ i_cal_duration_set_is_neg (duration, TRUE);
switch (alarm_type) {
case ALARM_15_MINUTES:
- trigger.u.rel_duration.minutes = 15;
+ i_cal_duration_set_minutes (duration, 15);
break;
case ALARM_1_HOUR:
- trigger.u.rel_duration.hours = 1;
+ i_cal_duration_set_hours (duration, 1);
break;
case ALARM_1_DAY:
- trigger.u.rel_duration.days = 1;
+ i_cal_duration_set_days (duration, 1);
break;
case ALARM_USER_TIME:
switch (page_reminders->priv->alarm_units) {
case E_DURATION_DAYS:
- trigger.u.rel_duration.days = page_reminders->priv->alarm_interval;
+ i_cal_duration_set_days (duration, page_reminders->priv->alarm_interval);
break;
case E_DURATION_HOURS:
- trigger.u.rel_duration.hours = page_reminders->priv->alarm_interval;
+ i_cal_duration_set_hours (duration, page_reminders->priv->alarm_interval);
break;
case E_DURATION_MINUTES:
- trigger.u.rel_duration.minutes = page_reminders->priv->alarm_interval;
+ i_cal_duration_set_minutes (duration, page_reminders->priv->alarm_interval);
break;
}
break;
@@ -867,10 +887,12 @@ ecep_reminders_alarms_combo_changed_cb (GtkComboBox *combo_box,
break;
}
- e_cal_component_alarm_set_trigger (alarm, trigger);
+ e_cal_component_alarm_take_trigger (alarm,
+ e_cal_component_alarm_trigger_new_relative (E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START,
duration));
ecep_reminders_add_needs_description_property (alarm);
e_alarm_list_append (page_reminders->priv->alarm_list, NULL, alarm);
e_cal_component_alarm_free (alarm);
+ g_object_unref (duration);
}
static void
@@ -880,7 +902,7 @@ ecep_reminders_alarms_add_clicked_cb (GtkButton *button,
GtkTreeSelection *selection;
GtkTreeIter iter;
ECalComponentAlarm *alarm;
- ECalComponentAlarmTrigger trigger;
+ ICalDuration *duration;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_REMINDERS (page_reminders));
@@ -888,13 +910,14 @@ ecep_reminders_alarms_add_clicked_cb (GtkButton *button,
ecep_reminders_add_needs_description_property (alarm);
- memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger));
- trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
- trigger.u.rel_duration.is_neg = 1;
- trigger.u.rel_duration.minutes = 15;
+ duration = i_cal_duration_null_duration ();
+ i_cal_duration_set_is_neg (duration, TRUE);
+ i_cal_duration_set_minutes (duration, 15);
e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
- e_cal_component_alarm_set_trigger (alarm, trigger);
+ e_cal_component_alarm_take_trigger (alarm,
+ e_cal_component_alarm_trigger_new_relative (E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START,
duration));
+ g_object_unref (duration);
e_alarm_list_append (page_reminders->priv->alarm_list, &iter, alarm);
@@ -963,7 +986,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;
@@ -1082,65 +1105,68 @@ ecep_reminders_is_custom_alarm (ECalComponentAlarm *ca,
gint user_interval,
gint *alarm_type)
{
- ECalComponentAlarmTrigger trigger;
- ECalComponentAlarmRepeat repeat;
+ ECalComponentAlarmTrigger *trigger;
+ ECalComponentAlarmRepeat *repeat;
ECalComponentAlarmAction action;
- ECalComponentText desc;
- icalattach *attach;
+ ECalComponentText *desc;
+ ICalDuration *duration;
+ GSList *attachments;
- e_cal_component_alarm_get_action (ca, &action);
+ action = e_cal_component_alarm_get_action (ca);
if (action != E_CAL_COMPONENT_ALARM_DISPLAY)
return TRUE;
- e_cal_component_alarm_get_attach (ca, &attach);
- if (attach)
+ attachments = e_cal_component_alarm_get_attachments (ca);
+ if (attachments)
return TRUE;
if (!ecep_reminders_has_needs_description_property (ca)) {
- e_cal_component_alarm_get_description (ca, &desc);
- if (!desc.value || !old_summary || strcmp (desc.value, old_summary))
+ desc = e_cal_component_alarm_get_description (ca);
+ if (!desc || !e_cal_component_text_get_value (desc) ||
+ !old_summary || strcmp (e_cal_component_text_get_value (desc), old_summary))
return TRUE;
}
- e_cal_component_alarm_get_repeat (ca, &repeat);
- if (repeat.repetitions != 0)
+ repeat = e_cal_component_alarm_get_repeat (ca);
+ if (repeat && e_cal_component_alarm_repeat_get_repetitions (repeat) != 0)
return TRUE;
if (e_cal_component_alarm_has_attendees (ca))
return TRUE;
- e_cal_component_alarm_get_trigger (ca, &trigger);
- if (trigger.type != E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START)
+ trigger = e_cal_component_alarm_get_trigger (ca);
+ if (!trigger || e_cal_component_alarm_trigger_get_kind (trigger) !=
E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START)
return TRUE;
- if (trigger.u.rel_duration.is_neg != 1)
+ duration = e_cal_component_alarm_trigger_get_duration (trigger);
+ if (!duration || i_cal_duration_is_neg (duration) != 1)
return TRUE;
- if (trigger.u.rel_duration.weeks != 0)
+ if (i_cal_duration_get_weeks (duration) != 0)
return TRUE;
- if (trigger.u.rel_duration.seconds != 0)
+ if (i_cal_duration_get_seconds (duration) != 0)
return TRUE;
- if (trigger.u.rel_duration.days == 1
- && trigger.u.rel_duration.hours == 0
- && trigger.u.rel_duration.minutes == 0) {
+ if (i_cal_duration_get_days (duration) == 1 &&
+ i_cal_duration_get_hours (duration) == 0 &&
+ i_cal_duration_get_minutes (duration) == 0) {
if (alarm_type)
*alarm_type = ALARM_1_DAY;
return FALSE;
}
- if (trigger.u.rel_duration.days == 0
- && trigger.u.rel_duration.hours == 1
- && trigger.u.rel_duration.minutes == 0) {
+ if (i_cal_duration_get_days (duration) == 0 &&
+ i_cal_duration_get_hours (duration) == 1 &&
+ i_cal_duration_get_minutes (duration) == 0) {
if (alarm_type)
*alarm_type = ALARM_1_HOUR;
return FALSE;
}
- if (trigger.u.rel_duration.days == 0
- && trigger.u.rel_duration.hours == 0
- && trigger.u.rel_duration.minutes == 15) {
+ if (i_cal_duration_get_days (duration) == 0 &&
+ i_cal_duration_get_hours (duration) == 0 &&
+ i_cal_duration_get_minutes (duration) == 15) {
if (alarm_type)
*alarm_type = ALARM_15_MINUTES;
return FALSE;
@@ -1149,9 +1175,9 @@ ecep_reminders_is_custom_alarm (ECalComponentAlarm *ca,
if (user_interval != -1) {
switch (user_units) {
case E_DURATION_DAYS:
- if (trigger.u.rel_duration.days == user_interval
- && trigger.u.rel_duration.hours == 0
- && trigger.u.rel_duration.minutes == 0) {
+ if (i_cal_duration_get_days (duration) == user_interval &&
+ i_cal_duration_get_hours (duration) == 0 &&
+ i_cal_duration_get_minutes (duration) == 0) {
if (alarm_type)
*alarm_type = ALARM_USER_TIME;
return FALSE;
@@ -1159,9 +1185,9 @@ ecep_reminders_is_custom_alarm (ECalComponentAlarm *ca,
break;
case E_DURATION_HOURS:
- if (trigger.u.rel_duration.days == 0
- && trigger.u.rel_duration.hours == user_interval
- && trigger.u.rel_duration.minutes == 0) {
+ if (i_cal_duration_get_days (duration) == 0 &&
+ i_cal_duration_get_hours (duration) == user_interval &&
+ i_cal_duration_get_minutes (duration) == 0) {
if (alarm_type)
*alarm_type = ALARM_USER_TIME;
return FALSE;
@@ -1169,9 +1195,9 @@ ecep_reminders_is_custom_alarm (ECalComponentAlarm *ca,
break;
case E_DURATION_MINUTES:
- if (trigger.u.rel_duration.days == 0
- && trigger.u.rel_duration.hours == 0
- && trigger.u.rel_duration.minutes == user_interval) {
+ if (i_cal_duration_get_days (duration) == 0 &&
+ i_cal_duration_get_hours (duration) == 0 &&
+ i_cal_duration_get_minutes (duration) == user_interval) {
if (alarm_type)
*alarm_type = ALARM_USER_TIME;
return FALSE;
@@ -1185,7 +1211,7 @@ ecep_reminders_is_custom_alarm (ECalComponentAlarm *ca,
static gboolean
ecep_reminders_is_custom_alarm_uid_list (ECalComponent *comp,
- GList *alarms,
+ GSList *alarm_uids,
const gchar *old_summary,
EDurationType user_units,
gint user_interval,
@@ -1194,10 +1220,13 @@ ecep_reminders_is_custom_alarm_uid_list (ECalComponent *comp,
ECalComponentAlarm *ca;
gboolean result;
- if (g_list_length (alarms) > 1)
+ if (!alarm_uids)
+ return FALSE;
+
+ if (alarm_uids->next)
return TRUE;
- ca = e_cal_component_get_alarm (comp, alarms->data);
+ ca = e_cal_component_get_alarm (comp, alarm_uids->data);
result = ecep_reminders_is_custom_alarm (ca, old_summary, user_units, user_interval, alarm_type);
e_cal_component_alarm_free (ca);
@@ -1269,7 +1298,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 +1341,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 +1354,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
@@ -1365,13 +1394,14 @@ ecep_reminders_sensitize_widgets (ECompEditorPage *page,
static void
ecep_reminders_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageReminders *page_reminders;
ECalComponent *comp;
+ ICalComponent *valarm;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_REMINDERS (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_reminders_parent_class)->fill_widgets (page, component);
@@ -1379,19 +1409,22 @@ ecep_reminders_fill_widgets (ECompEditorPage *page,
e_alarm_list_clear (page_reminders->priv->alarm_list);
- if (!icalcomponent_get_first_component (component, ICAL_VALARM_COMPONENT)) {
+ valarm = i_cal_component_get_first_component (component, I_CAL_VALARM_COMPONENT);
+ if (!valarm) {
e_dialog_combo_box_set (page_reminders->priv->alarms_combo, ALARM_NONE,
page_reminders->priv->alarm_map);
return;
}
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (component));
+ g_object_unref (valarm);
+
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (component));
if (comp && e_cal_component_has_alarms (comp)) {
- GList *alarms, *link;
- gint alarm_type;
+ GSList *alarms, *link;
+ gint alarm_type = ALARM_NONE;
alarms = e_cal_component_get_alarm_uids (comp);
- if (ecep_reminders_is_custom_alarm_uid_list (comp, alarms, icalcomponent_get_summary
(component),
+ if (ecep_reminders_is_custom_alarm_uid_list (comp, alarms, i_cal_component_get_summary
(component),
page_reminders->priv->alarm_units, page_reminders->priv->alarm_interval, &alarm_type))
alarm_type = ALARM_CUSTOM;
@@ -1399,7 +1432,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 +1441,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;
@@ -1427,22 +1460,22 @@ ecep_reminders_fill_widgets (ECompEditorPage *page,
static gboolean
ecep_reminders_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageReminders *page_reminders;
ECalComponent *comp;
- icalcomponent *changed_comp, *alarm;
+ ICalComponent *changed_comp, *alarm;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid_iter;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE_REMINDERS (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
if (!E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_reminders_parent_class)->fill_component (page,
component))
return TRUE;
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (component));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (component));
g_return_val_if_fail (comp != NULL, FALSE);
page_reminders = E_COMP_EDITOR_PAGE_REMINDERS (page);
@@ -1456,8 +1489,7 @@ ecep_reminders_fill_component (ECompEditorPage *page,
valid_iter = gtk_tree_model_iter_next (model, &iter)) {
ECalComponentAlarm *alarm, *alarm_copy;
ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ECalComponentPropertyBag *bag;
alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (page_reminders->priv->alarm_list,
&iter);
if (!alarm) {
@@ -1468,79 +1500,73 @@ ecep_reminders_fill_component (ECompEditorPage *page,
/* We set the description of the alarm if it's got
* the X-EVOLUTION-NEEDS-DESCRIPTION property.
*/
- icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
- const gchar *x_name;
-
- x_name = icalproperty_get_x_name (prop);
- if (g_str_equal (x_name, X_EVOLUTION_NEEDS_DESCRIPTION)) {
- ECalComponentText summary;
-
- e_cal_component_get_summary (comp, &summary);
- e_cal_component_alarm_set_description (alarm, &summary);
-
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
- break;
- }
+ if (ecep_reminders_remove_needs_description_property (alarm)) {
+ ECalComponentText *summary;
+
+ summary = e_cal_component_get_summary (comp);
+ e_cal_component_alarm_take_description (alarm, summary);
}
- e_cal_component_alarm_get_action (alarm, &action);
+ action = e_cal_component_alarm_get_action (alarm);
- prop = icalcomponent_get_first_property (icalcomp, ICAL_SUMMARY_PROPERTY);
+ bag = e_cal_component_alarm_get_property_bag (alarm);
if (action == E_CAL_COMPONENT_ALARM_EMAIL) {
- ECalComponentText summary = { NULL, NULL };
+ ECalComponentText *summary;
+ const gchar *text;
+ guint idx;
+
+ summary = e_cal_component_get_summary (comp);
+ text = (summary && e_cal_component_text_get_value (summary)) ?
e_cal_component_text_get_value (summary) : "";
- e_cal_component_get_summary (comp, &summary);
+ idx = e_cal_component_property_bag_get_first_by_kind (bag, I_CAL_SUMMARY_PROPERTY);
+ if (idx < e_cal_component_property_bag_get_count (bag)) {
+ ICalProperty *prop;
- if (prop) {
- icalproperty_set_summary (prop, summary.value ? summary.value : "");
+ prop = e_cal_component_property_bag_get (bag, idx);
+ i_cal_property_set_summary (prop, text);
} else {
- prop = icalproperty_new_summary (summary.value ? summary.value : "");
- icalcomponent_add_property (icalcomp, prop);
+ e_cal_component_property_bag_take (bag, i_cal_property_new_summary (text));
}
- } else if (prop) {
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
+
+ e_cal_component_text_free (summary);
+ } else {
+ e_cal_component_property_bag_remove_by_kind (bag, I_CAL_SUMMARY_PROPERTY, TRUE);
}
- prop = icalcomponent_get_first_property (icalcomp, ICAL_DESCRIPTION_PROPERTY);
if (action == E_CAL_COMPONENT_ALARM_EMAIL || action == E_CAL_COMPONENT_ALARM_DISPLAY) {
- if (!prop) {
+ if (e_cal_component_property_bag_get_first_by_kind (bag, I_CAL_DESCRIPTION_PROPERTY)
=
+ e_cal_component_property_bag_get_count (bag)) {
const gchar *description;
- description = icalcomponent_get_description
(e_cal_component_get_icalcomponent (comp));
+ description = i_cal_component_get_description
(e_cal_component_get_icalcomponent (comp));
- prop = icalproperty_new_description (description ? description : "");
- icalcomponent_add_property (icalcomp, prop);
+ e_cal_component_property_bag_take (bag, i_cal_property_new_description
(description ? description : ""));
}
- } else if (prop) {
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
+ } else {
+ e_cal_component_property_bag_remove_by_kind (bag, I_CAL_DESCRIPTION_PROPERTY, TRUE);
}
/* We clone the alarm to maintain the invariant that the alarm
* structures in the list did *not* come from the component.
*/
- alarm_copy = e_cal_component_alarm_clone (alarm);
+ alarm_copy = e_cal_component_alarm_copy (alarm);
e_cal_component_add_alarm (comp, alarm_copy);
e_cal_component_alarm_free (alarm_copy);
}
- while (alarm = icalcomponent_get_first_component (component, ICAL_VALARM_COMPONENT), alarm) {
- icalcomponent_remove_component (component, alarm);
- icalcomponent_free (alarm);
+ while (alarm = i_cal_component_get_first_component (component, I_CAL_VALARM_COMPONENT), alarm) {
+ i_cal_component_remove_component (component, alarm);
+ g_object_unref (alarm);
}
changed_comp = e_cal_component_get_icalcomponent (comp);
if (changed_comp) {
/* Move all VALARM components into the right 'component' */
- while (alarm = icalcomponent_get_first_component (changed_comp, ICAL_VALARM_COMPONENT),
alarm) {
- icalcomponent_remove_component (changed_comp, alarm);
- icalcomponent_add_component (component, alarm);
+ while (alarm = i_cal_component_get_first_component (changed_comp, I_CAL_VALARM_COMPONENT),
alarm) {
+ i_cal_component_remove_component (changed_comp, alarm);
+ i_cal_component_add_component (component, alarm);
+ g_object_unref (alarm);
}
} else {
g_warn_if_reached ();
diff --git a/src/calendar/gui/e-comp-editor-page-schedule.c b/src/calendar/gui/e-comp-editor-page-schedule.c
index dc44ea6df6..10c728c4b7 100644
--- a/src/calendar/gui/e-comp-editor-page-schedule.c
+++ b/src/calendar/gui/e-comp-editor-page-schedule.c
@@ -118,7 +118,7 @@ ecep_schedule_editor_times_changed_cb (ECompEditor *comp_editor,
ECompEditorPropertyPartDatetime *dtstart, *dtend;
ECompEditorPropertyPart *dtstart_part = NULL, *dtend_part = NULL;
EDateEdit *start_date_edit, *end_date_edit;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_SCHEDULE (page_schedule));
g_return_if_fail (page_schedule->priv->selector != NULL);
@@ -134,23 +134,42 @@ ecep_schedule_editor_times_changed_cb (ECompEditor *comp_editor,
start_tt = e_comp_editor_property_part_datetime_get_value (dtstart);
end_tt = e_comp_editor_property_part_datetime_get_value (dtend);
+ if (!start_tt || !end_tt) {
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
+ return;
+ }
+
/* For All Day Events, if DTEND is after DTSTART, we subtract 1 day from it. */
- if (start_tt.is_date && end_tt.is_date &&
- icaltime_compare_date_only (end_tt, start_tt) > 0)
- icaltime_adjust (&end_tt, -1, 0, 0, 0);
+ if (i_cal_time_is_date (start_tt) && i_cal_time_is_date (end_tt) &&
+ i_cal_time_compare_date_only (end_tt, start_tt) > 0)
+ i_cal_time_adjust (end_tt, -1, 0, 0, 0);
e_comp_editor_page_set_updating (E_COMP_EDITOR_PAGE (page_schedule), TRUE);
start_date_edit = E_DATE_EDIT (page_schedule->priv->selector->start_date_edit);
end_date_edit = E_DATE_EDIT (page_schedule->priv->selector->end_date_edit);
- e_date_edit_set_date (start_date_edit, start_tt.year, start_tt.month, start_tt.day);
- e_date_edit_set_time_of_day (start_date_edit, start_tt.hour, start_tt.minute);
-
- e_date_edit_set_date (end_date_edit, end_tt.year, end_tt.month, end_tt.day);
- e_date_edit_set_time_of_day (end_date_edit, end_tt.hour, end_tt.minute);
+ e_date_edit_set_date (start_date_edit,
+ i_cal_time_get_year (start_tt),
+ i_cal_time_get_month (start_tt),
+ i_cal_time_get_day (start_tt));
+ e_date_edit_set_time_of_day (start_date_edit,
+ i_cal_time_get_hour (start_tt),
+ i_cal_time_get_minute (start_tt));
+
+ e_date_edit_set_date (end_date_edit,
+ i_cal_time_get_year (end_tt),
+ i_cal_time_get_month (end_tt),
+ i_cal_time_get_day (end_tt));
+ e_date_edit_set_time_of_day (end_date_edit,
+ i_cal_time_get_hour (end_tt),
+ i_cal_time_get_minute (end_tt));
e_comp_editor_page_set_updating (E_COMP_EDITOR_PAGE (page_schedule), FALSE);
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
}
static void
@@ -178,7 +197,8 @@ ecep_schedule_set_time_to_editor (ECompEditorPageSchedule *page_schedule)
ECompEditorPropertyPartDatetime *dtstart, *dtend;
ECompEditorPropertyPart *dtstart_part = NULL, *dtend_part = NULL;
ECompEditor *comp_editor;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
+ gint year, month, day, hour, minute;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_SCHEDULE (page_schedule));
g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (page_schedule->priv->selector));
@@ -199,42 +219,41 @@ ecep_schedule_set_time_to_editor (ECompEditorPageSchedule *page_schedule)
start_tt = e_comp_editor_property_part_datetime_get_value (dtstart);
end_tt = e_comp_editor_property_part_datetime_get_value (dtend);
- e_date_edit_get_date (
- E_DATE_EDIT (selector->start_date_edit),
- &start_tt.year,
- &start_tt.month,
- &start_tt.day);
- e_date_edit_get_time_of_day (
- E_DATE_EDIT (selector->start_date_edit),
- &start_tt.hour,
- &start_tt.minute);
- e_date_edit_get_date (
- E_DATE_EDIT (selector->end_date_edit),
- &end_tt.year,
- &end_tt.month,
- &end_tt.day);
- e_date_edit_get_time_of_day (
- E_DATE_EDIT (selector->end_date_edit),
- &end_tt.hour,
- &end_tt.minute);
+ if (!start_tt || !end_tt) {
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
+ return;
+ }
+
+ e_date_edit_get_date (E_DATE_EDIT (selector->start_date_edit), &year, &month, &day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (selector->start_date_edit), &hour, &minute);
+ i_cal_time_set_date (start_tt, year, month, day);
+ i_cal_time_set_time (start_tt, hour, minute, 0);
+
+ e_date_edit_get_date (E_DATE_EDIT (selector->end_date_edit), &year, &month, &day);
+ e_date_edit_get_time_of_day (E_DATE_EDIT (selector->end_date_edit), &hour, &minute);
+ i_cal_time_set_date (end_tt, year, month, day);
+ i_cal_time_set_time (end_tt, hour, minute, 0);
if (!e_date_edit_get_show_time (E_DATE_EDIT (selector->start_date_edit))) {
/* For All-Day Events, we set the timezone to NULL, and add 1 day to DTEND. */
- start_tt.is_date = TRUE;
- start_tt.zone = NULL;
- end_tt.is_date = TRUE;
- end_tt.zone = NULL;
+ i_cal_time_set_timezone (start_tt, NULL);
+ i_cal_time_set_is_date (start_tt, TRUE);
+ i_cal_time_set_timezone (end_tt, NULL);
+ i_cal_time_set_is_date (end_tt, TRUE);
- icaltime_adjust (&end_tt, 1, 0, 0, 0);
+ i_cal_time_adjust (end_tt, 1, 0, 0, 0);
} else {
- start_tt.is_date = FALSE;
- end_tt.is_date = FALSE;
+ i_cal_time_set_is_date (start_tt, FALSE);
+ i_cal_time_set_is_date (end_tt, FALSE);
}
e_comp_editor_property_part_datetime_set_value (dtstart, start_tt);
e_comp_editor_property_part_datetime_set_value (dtend, end_tt);
g_clear_object (&comp_editor);
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
}
static void
@@ -276,17 +295,17 @@ ecep_schedule_sensitize_widgets (ECompEditorPage *page,
static void
ecep_schedule_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageSchedule *page_schedule;
ECompEditorPropertyPartDatetime *dtstart, *dtend;
ECompEditorPropertyPart *dtstart_part = NULL, *dtend_part = NULL;
ECompEditor *comp_editor;
EMeetingTimeSelector *selector;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE_SCHEDULE (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_schedule_parent_class)->fill_widgets (page, component);
@@ -314,51 +333,60 @@ ecep_schedule_fill_widgets (ECompEditorPage *page,
start_tt = e_comp_editor_property_part_datetime_get_value (dtstart);
end_tt = e_comp_editor_property_part_datetime_get_value (dtend);
- if (start_tt.is_date) {
+ if (!start_tt || !end_tt) {
+ g_clear_object (&comp_editor);
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
+ return;
+ }
+
+ if (i_cal_time_is_date (start_tt)) {
/* For All-Day Events, we set the timezone to NULL, and add 1 day to DTEND. */
- start_tt.is_date = TRUE;
- start_tt.zone = NULL;
- end_tt.is_date = TRUE;
- end_tt.zone = NULL;
+ i_cal_time_set_timezone (start_tt, NULL);
+ i_cal_time_set_is_date (start_tt, TRUE);
+ i_cal_time_set_timezone (end_tt, NULL);
+ i_cal_time_set_is_date (end_tt, TRUE);
- icaltime_adjust (&end_tt, 1, 0, 0, 0);
+ i_cal_time_adjust (end_tt, 1, 0, 0, 0);
} else {
- start_tt.is_date = FALSE;
- end_tt.is_date = FALSE;
+ i_cal_time_set_is_date (start_tt, FALSE);
+ i_cal_time_set_is_date (end_tt, FALSE);
}
e_comp_editor_page_set_updating (page, TRUE);
e_date_edit_set_date (
E_DATE_EDIT (selector->start_date_edit),
- start_tt.year,
- start_tt.month,
- start_tt.day);
+ i_cal_time_get_year (start_tt),
+ i_cal_time_get_month (start_tt),
+ i_cal_time_get_day (start_tt));
e_date_edit_set_time_of_day (
E_DATE_EDIT (selector->start_date_edit),
- start_tt.hour,
- start_tt.minute);
+ i_cal_time_get_hour (start_tt),
+ i_cal_time_get_minute (start_tt));
e_date_edit_set_date (
E_DATE_EDIT (selector->end_date_edit),
- end_tt.year,
- end_tt.month,
- end_tt.day);
+ i_cal_time_get_year (end_tt),
+ i_cal_time_get_month (end_tt),
+ i_cal_time_get_day (end_tt));
e_date_edit_set_time_of_day (
E_DATE_EDIT (selector->end_date_edit),
- end_tt.hour,
- end_tt.minute);
+ i_cal_time_get_hour (end_tt),
+ i_cal_time_get_minute (end_tt));
e_comp_editor_page_set_updating (page, FALSE);
g_clear_object (&comp_editor);
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
}
static gboolean
ecep_schedule_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE_SCHEDULE (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
return E_COMP_EDITOR_PAGE_CLASS (e_comp_editor_page_schedule_parent_class)->fill_component (page,
component);
}
diff --git a/src/calendar/gui/e-comp-editor-page.c b/src/calendar/gui/e-comp-editor-page.c
index 018d21b15e..c82c9d8721 100644
--- a/src/calendar/gui/e-comp-editor-page.c
+++ b/src/calendar/gui/e-comp-editor-page.c
@@ -89,12 +89,12 @@ ecep_sensitize_widgets (ECompEditorPage *page,
static void
ecep_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
GSList *link;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
for (link = page->priv->parts; link; link = g_slist_next (link)) {
PropertyPartData *ppd = link->data;
@@ -109,12 +109,12 @@ ecep_fill_widgets (ECompEditorPage *page,
static gboolean
ecep_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
GSList *link;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
for (link = page->priv->parts; link; link = g_slist_next (link)) {
PropertyPartData *ppd = link->data;
@@ -311,12 +311,12 @@ e_comp_editor_page_sensitize_widgets (ECompEditorPage *page,
void
e_comp_editor_page_fill_widgets (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageClass *klass;
g_return_if_fail (E_IS_COMP_EDITOR_PAGE (page));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
klass = E_COMP_EDITOR_PAGE_GET_CLASS (page);
g_return_if_fail (klass != NULL);
@@ -331,12 +331,12 @@ e_comp_editor_page_fill_widgets (ECompEditorPage *page,
gboolean
e_comp_editor_page_fill_component (ECompEditorPage *page,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPageClass *klass;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE (page), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
klass = E_COMP_EDITOR_PAGE_GET_CLASS (page);
g_return_val_if_fail (klass != NULL, FALSE);
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.c b/src/calendar/gui/e-comp-editor-property-part.c
index 3b661d7f43..68ceeb8884 100644
--- a/src/calendar/gui/e-comp-editor-property-part.c
+++ b/src/calendar/gui/e-comp-editor-property-part.c
@@ -279,7 +279,7 @@ e_comp_editor_property_part_get_edit_widget (ECompEditorPropertyPart *property_p
void
e_comp_editor_property_part_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartClass *klass;
@@ -294,7 +294,7 @@ e_comp_editor_property_part_fill_widget (ECompEditorPropertyPart *property_part,
void
e_comp_editor_property_part_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartClass *klass;
@@ -390,30 +390,33 @@ ecepp_string_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_string_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartStringClass *klass;
GtkWidget *edit_widget;
- GString *multivalue = NULL;
- icalproperty *prop;
- const gchar *value = NULL;
+ ICalProperty *prop;
+ gchar *text = NULL;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_STRING (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_ENTRY (edit_widget) || GTK_IS_SCROLLED_WINDOW (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_STRING_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_get_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_get_func != NULL);
if (e_comp_editor_property_part_string_is_multivalue (E_COMP_EDITOR_PROPERTY_PART_STRING
(property_part))) {
- for (prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ GString *multivalue = NULL;
+
+ for (prop = i_cal_component_get_first_property (component, klass->prop_kind);
prop;
- prop = icalcomponent_get_next_property (component, klass->ical_prop_kind)) {
- value = klass->ical_get_func (prop);
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
klass->prop_kind)) {
+ const gchar *value;
+
+ value = klass->i_cal_get_func (prop);
if (!value || !*value)
continue;
@@ -427,53 +430,49 @@ ecepp_string_fill_widget (ECompEditorPropertyPart *property_part,
}
if (multivalue)
- value = multivalue->str;
- else
- value = NULL;
+ text = g_string_free (multivalue, FALSE);
} else {
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
- if (prop)
- value = klass->ical_get_func (prop);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
+ if (prop) {
+ text = g_strdup (klass->i_cal_get_func (prop));
+ g_object_unref (prop);
+ }
}
- if (!value)
- value = "";
-
if (GTK_IS_ENTRY (edit_widget)) {
- gtk_entry_set_text (GTK_ENTRY (edit_widget), value);
+ gtk_entry_set_text (GTK_ENTRY (edit_widget), text ? text : "");
} else /* if (GTK_IS_SCROLLED_WINDOW (edit_widget)) */ {
GtkTextBuffer *buffer;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_bin_get_child (GTK_BIN (edit_widget))));
- gtk_text_buffer_set_text (buffer, value, -1);
+ gtk_text_buffer_set_text (buffer, text ? text : "", -1);
}
e_widget_undo_reset (edit_widget);
- if (multivalue)
- g_string_free (multivalue, TRUE);
+ g_free (text);
}
static void
ecepp_string_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartStringClass *klass;
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
gchar *value;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_STRING (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_ENTRY (edit_widget) || GTK_IS_SCROLLED_WINDOW (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_STRING_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_new_func != NULL);
- g_return_if_fail (klass->ical_set_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_new_func != NULL);
+ g_return_if_fail (klass->i_cal_set_func != NULL);
if (GTK_IS_ENTRY (edit_widget)) {
value = g_strdup (gtk_entry_get_text (GTK_ENTRY (edit_widget)));
@@ -489,24 +488,22 @@ ecepp_string_fill_component (ECompEditorPropertyPart *property_part,
if (e_comp_editor_property_part_string_is_multivalue (E_COMP_EDITOR_PROPERTY_PART_STRING
(property_part))) {
/* Clear all multivalues first */
- while (prop = icalcomponent_get_first_property (component, klass->ical_prop_kind), prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
- }
+ e_cal_util_component_remove_property_by_kind (component, klass->prop_kind, TRUE);
}
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
if (value && *value) {
if (prop) {
- klass->ical_set_func (prop, value);
+ klass->i_cal_set_func (prop, value);
+ g_object_unref (prop);
} else {
- prop = klass->ical_new_func (value);
- icalcomponent_add_property (component, prop);
+ prop = klass->i_cal_new_func (value);
+ i_cal_component_take_property (component, prop);
}
} else if (prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (component, prop);
+ g_object_unref (prop);
}
g_free (value);
@@ -530,10 +527,10 @@ e_comp_editor_property_part_string_class_init (ECompEditorPropertyPartStringClas
klass->entry_type = GTK_TYPE_ENTRY;
- klass->ical_prop_kind = ICAL_NO_PROPERTY;
- klass->ical_new_func = NULL;
- klass->ical_set_func = NULL;
- klass->ical_get_func = NULL;
+ klass->prop_kind = I_CAL_NO_PROPERTY;
+ klass->i_cal_new_func = NULL;
+ klass->i_cal_set_func = NULL;
+ klass->i_cal_get_func = NULL;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_string_create_widgets;
@@ -595,11 +592,11 @@ static guint ecepp_datetime_signals[ECEPP_DATETIME_LAST_SIGNAL];
G_DEFINE_ABSTRACT_TYPE (ECompEditorPropertyPartDatetime, e_comp_editor_property_part_datetime,
E_TYPE_COMP_EDITOR_PROPERTY_PART)
-static icaltimezone *
+static ICalTimezone *
ecepp_datetime_lookup_timezone (ECompEditorPropertyPartDatetime *part_datetime,
const gchar *tzid)
{
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
if (!tzid || !*tzid)
return NULL;
@@ -644,125 +641,135 @@ ecepp_datetime_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_datetime_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartDatetime *part_datetime;
ECompEditorPropertyPartDatetimeClass *klass;
GtkWidget *edit_widget;
- icalproperty *prop;
- struct icaltimetype value;
+ ICalProperty *prop;
+ ICalTime *value = NULL;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DATETIME (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (E_IS_DATE_EDIT (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_DATETIME_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_get_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_get_func != NULL);
part_datetime = E_COMP_EDITOR_PROPERTY_PART_DATETIME (property_part);
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
if (prop) {
ETimezoneEntry *timezone_entry = g_weak_ref_get (&part_datetime->priv->timezone_entry);
- value = klass->ical_get_func (prop);
+ value = klass->i_cal_get_func (prop);
- if (timezone_entry && !value.is_date) {
- icaltimezone *editor_zone = e_timezone_entry_get_timezone (timezone_entry);
+ if (timezone_entry && value && !i_cal_time_is_date (value)) {
+ ICalTimezone *editor_zone = e_timezone_entry_get_timezone (timezone_entry);
/* Attempt to convert time to the zone used in the editor */
- if (editor_zone && !value.zone && !icaltime_is_utc (value)) {
- icalparameter *param;
+ if (editor_zone && !i_cal_time_get_timezone (value) && !i_cal_time_is_utc (value)) {
+ ICalParameter *param;
- 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;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (tzid && *tzid) {
if (editor_zone &&
- (g_strcmp0 (icaltimezone_get_tzid (editor_zone), tzid) ==
0 ||
- g_strcmp0 (icaltimezone_get_location (editor_zone), tzid)
== 0)) {
- value.zone = editor_zone;
+ (g_strcmp0 (i_cal_timezone_get_tzid (editor_zone), tzid)
== 0 ||
+ g_strcmp0 (i_cal_timezone_get_location (editor_zone),
tzid) == 0)) {
+ i_cal_time_set_timezone (value, editor_zone);
} else {
- value.zone = ecepp_datetime_lookup_timezone
(part_datetime, tzid);
+ i_cal_time_set_timezone (value,
ecepp_datetime_lookup_timezone (part_datetime, tzid));
}
}
+
+ g_object_unref (param);
}
}
}
g_clear_object (&timezone_entry);
- } else {
- value = icaltime_null_time ();
}
+ if (!value)
+ value = i_cal_time_null_time ();
+
e_comp_editor_property_part_datetime_set_value (part_datetime, value);
+
+ g_clear_object (&value);
}
static void
ecepp_datetime_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartDatetime *part_datetime;
ECompEditorPropertyPartDatetimeClass *klass;
GtkWidget *edit_widget;
EDateEdit *date_edit;
- icalproperty *prop;
- struct icaltimetype value;
+ ICalProperty *prop;
+ ICalTime *value;
time_t tt;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DATETIME (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (E_IS_DATE_EDIT (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_DATETIME_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_new_func != NULL);
- g_return_if_fail (klass->ical_get_func != NULL);
- g_return_if_fail (klass->ical_set_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_new_func != NULL);
+ g_return_if_fail (klass->i_cal_get_func != NULL);
+ g_return_if_fail (klass->i_cal_set_func != NULL);
part_datetime = E_COMP_EDITOR_PROPERTY_PART_DATETIME (property_part);
date_edit = E_DATE_EDIT (edit_widget);
tt = e_date_edit_get_time (date_edit);
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
if (e_date_edit_get_allow_no_date_set (date_edit) && tt == (time_t) -1) {
if (prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (component, prop);
+ g_object_unref (prop);
}
} else {
value = e_comp_editor_property_part_datetime_get_value (part_datetime);
if (prop) {
/* Remove the VALUE parameter, to correspond to the actual value being set */
- icalproperty_remove_parameter_by_kind (prop, ICAL_VALUE_PARAMETER);
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_VALUE_PARAMETER);
- klass->ical_set_func (prop, value);
+ klass->i_cal_set_func (prop, value);
/* Re-read the value, because it could be changed by the descendant */
- value = klass->ical_get_func (prop);
+ g_clear_object (&value);
+ value = klass->i_cal_get_func (prop);
cal_comp_util_update_tzid_parameter (prop, value);
} else {
- prop = klass->ical_new_func (value);
+ prop = klass->i_cal_new_func (value);
/* Re-read the value, because it could be changed by the descendant */
- value = klass->ical_get_func (prop);
+ g_clear_object (&value);
+ value = klass->i_cal_get_func (prop);
cal_comp_util_update_tzid_parameter (prop, value);
- icalcomponent_add_property (component, prop);
+ i_cal_component_add_property (component, prop);
}
+
+ g_clear_object (&value);
+ g_clear_object (&prop);
}
}
@@ -794,10 +801,10 @@ e_comp_editor_property_part_datetime_class_init (ECompEditorPropertyPartDatetime
g_type_class_add_private (klass, sizeof (ECompEditorPropertyPartDatetimePrivate));
- klass->ical_prop_kind = ICAL_NO_PROPERTY;
- klass->ical_new_func = NULL;
- klass->ical_set_func = NULL;
- klass->ical_get_func = NULL;
+ klass->prop_kind = I_CAL_NO_PROPERTY;
+ klass->i_cal_new_func = NULL;
+ klass->i_cal_set_func = NULL;
+ klass->i_cal_get_func = NULL;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_datetime_create_widgets;
@@ -807,7 +814,7 @@ e_comp_editor_property_part_datetime_class_init (ECompEditorPropertyPartDatetime
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ecepp_datetime_finalize;
- /* icaltimezone *lookup_timezone (datetime, const gchar *tzid); */
+ /* ICalTimezone *lookup_timezone (datetime, const gchar *tzid); */
ecepp_datetime_signals[ECEPP_DATETIME_LOOKUP_TIMEZONE] = g_signal_new (
"lookup-timezone",
G_OBJECT_CLASS_TYPE (object_class),
@@ -888,10 +895,11 @@ e_comp_editor_property_part_datetime_get_allow_no_date_set (ECompEditorPropertyP
void
e_comp_editor_property_part_datetime_set_value (ECompEditorPropertyPartDatetime *part_datetime,
- struct icaltimetype value)
+ const ICalTime *value)
{
GtkWidget *edit_widget;
EDateEdit *date_edit;
+ ICalTime *tmp_value = NULL;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DATETIME (part_datetime));
@@ -900,53 +908,66 @@ e_comp_editor_property_part_datetime_set_value (ECompEditorPropertyPartDatetime
date_edit = E_DATE_EDIT (edit_widget);
- if (!e_date_edit_get_allow_no_date_set (date_edit) && (icaltime_is_null_time (value) ||
- !icaltime_is_valid_time (value))) {
- value = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+ if (!e_date_edit_get_allow_no_date_set (date_edit) && (!value || i_cal_time_is_null_time (value) ||
+ !i_cal_time_is_valid_time (value))) {
+ tmp_value = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+ value = tmp_value;
}
- if (icaltime_is_null_time (value) ||
- !icaltime_is_valid_time (value)) {
+ if (!value || i_cal_time_is_null_time (value) ||
+ !i_cal_time_is_valid_time (value)) {
e_date_edit_set_time (date_edit, (time_t) -1);
} else {
+ ICalTimezone *zone;
+
+ zone = i_cal_time_get_timezone (value);
+
/* Convert to the same time zone as the editor uses, if different */
- if (!value.is_date && value.zone) {
+ if (!i_cal_time_is_date (value) && zone) {
ETimezoneEntry *timezone_entry = g_weak_ref_get
(&part_datetime->priv->timezone_entry);
if (timezone_entry) {
- icaltimezone *editor_zone = e_timezone_entry_get_timezone (timezone_entry);
+ ICalTimezone *editor_zone = e_timezone_entry_get_timezone (timezone_entry);
+
+ if (editor_zone && zone != editor_zone &&
+ g_strcmp0 (i_cal_timezone_get_tzid (editor_zone), i_cal_timezone_get_tzid
(zone)) != 0 &&
+ g_strcmp0 (i_cal_timezone_get_location (editor_zone),
i_cal_timezone_get_location (zone)) != 0) {
+ if (tmp_value != value) {
+ tmp_value = i_cal_time_new_clone (value);
+ value = tmp_value;
+ }
- if (editor_zone && value.zone != editor_zone &&
- g_strcmp0 (icaltimezone_get_tzid (editor_zone), icaltimezone_get_tzid
((icaltimezone *) value.zone)) != 0 &&
- g_strcmp0 (icaltimezone_get_location (editor_zone),
icaltimezone_get_location ((icaltimezone *) value.zone)) != 0) {
- icaltimezone_convert_time (&value, (icaltimezone *) value.zone,
editor_zone);
- value.zone = editor_zone;
+ i_cal_timezone_convert_time (tmp_value, zone, editor_zone);
+ i_cal_time_set_timezone (tmp_value, editor_zone);
}
}
g_clear_object (&timezone_entry);
}
- e_date_edit_set_date (date_edit, value.year, value.month, value.day);
+ e_date_edit_set_date (date_edit, i_cal_time_get_year (value), i_cal_time_get_month (value),
i_cal_time_get_day (value));
- if (!value.is_date)
- e_date_edit_set_time_of_day (date_edit, value.hour, value.minute);
+ if (!i_cal_time_is_date (value))
+ e_date_edit_set_time_of_day (date_edit, i_cal_time_get_hour (value),
i_cal_time_get_minute (value));
else if (e_date_edit_get_show_time (date_edit))
e_date_edit_set_time_of_day (date_edit, 0, 0);
else if (e_date_edit_get_allow_no_date_set (date_edit))
e_date_edit_set_time_of_day (date_edit, -1, -1);
- e_comp_editor_property_part_datetime_set_date_only (part_datetime, value.is_date);
+ e_comp_editor_property_part_datetime_set_date_only (part_datetime, i_cal_time_is_date
(value));
}
+
+ g_clear_object (&tmp_value);
}
-struct icaltimetype
+ICalTime *
e_comp_editor_property_part_datetime_get_value (ECompEditorPropertyPartDatetime *part_datetime)
{
ETimezoneEntry *timezone_entry = NULL;
GtkWidget *edit_widget;
EDateEdit *date_edit;
- struct icaltimetype value = icaltime_null_time ();
+ ICalTime *value = i_cal_time_null_time ();
+ gint year, month, day;
g_return_val_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DATETIME (part_datetime), value);
@@ -955,21 +976,27 @@ e_comp_editor_property_part_datetime_get_value (ECompEditorPropertyPartDatetime
date_edit = E_DATE_EDIT (edit_widget);
- if (!e_date_edit_get_date (date_edit, &value.year, &value.month, &value.day))
- return icaltime_null_time ();
+ if (!e_date_edit_get_date (date_edit, &year, &month, &day))
+ return value;
+
+ i_cal_time_set_date (value, year, month, day);
if (!e_date_edit_get_show_time (date_edit)) {
- value.is_date = 1;
+ i_cal_time_set_is_date (value, TRUE);
} else {
- value.zone = NULL;
- value.is_date = !e_date_edit_get_time_of_day (date_edit, &value.hour, &value.minute);
+ gint hour, minute;
+
+ i_cal_time_set_timezone (value, NULL);
+ i_cal_time_set_is_date (value, !e_date_edit_get_time_of_day (date_edit, &hour, &minute));
+
+ if (!i_cal_time_is_date (value)) {
+ i_cal_time_set_time (value, hour, minute, 0);
- if (!value.is_date) {
timezone_entry = g_weak_ref_get (&part_datetime->priv->timezone_entry);
if (timezone_entry)
- value.zone = e_timezone_entry_get_timezone (timezone_entry);
- if (!value.zone)
- value.zone = icaltimezone_get_utc_timezone ();
+ i_cal_time_set_timezone (value, e_timezone_entry_get_timezone
(timezone_entry));
+ if (!i_cal_time_get_timezone (value))
+ i_cal_time_set_timezone (value, i_cal_timezone_get_utc_timezone ());
}
}
@@ -1053,27 +1080,28 @@ ecepp_spin_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_spin_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartSpinClass *klass;
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
gint value;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_SPIN (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_SPIN_BUTTON (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_SPIN_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_get_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_get_func != NULL);
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
if (prop) {
- value = klass->ical_get_func (prop);
+ value = klass->i_cal_get_func (prop);
+ g_object_unref (prop);
} else {
gdouble d_min, d_max;
@@ -1087,34 +1115,36 @@ ecepp_spin_fill_widget (ECompEditorPropertyPart *property_part,
static void
ecepp_spin_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartSpinClass *klass;
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
gint value;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_SPIN (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_SPIN_BUTTON (edit_widget));
klass = E_COMP_EDITOR_PROPERTY_PART_SPIN_GET_CLASS (property_part);
g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (klass->ical_new_func != NULL);
- g_return_if_fail (klass->ical_set_func != NULL);
+ g_return_if_fail (klass->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (klass->i_cal_new_func != NULL);
+ g_return_if_fail (klass->i_cal_set_func != NULL);
value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (edit_widget));
- prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, klass->prop_kind);
if (prop) {
- klass->ical_set_func (prop, value);
+ klass->i_cal_set_func (prop, value);
} else {
- prop = klass->ical_new_func (value);
- icalcomponent_add_property (component, prop);
+ prop = klass->i_cal_new_func (value);
+ i_cal_component_add_property (component, prop);
}
+
+ g_clear_object (&prop);
}
static void
@@ -1132,10 +1162,10 @@ e_comp_editor_property_part_spin_class_init (ECompEditorPropertyPartSpinClass *k
g_type_class_add_private (klass, sizeof (ECompEditorPropertyPartSpinPrivate));
- klass->ical_prop_kind = ICAL_NO_PROPERTY;
- klass->ical_new_func = NULL;
- klass->ical_set_func = NULL;
- klass->ical_get_func = NULL;
+ klass->prop_kind = I_CAL_NO_PROPERTY;
+ klass->i_cal_new_func = NULL;
+ klass->i_cal_set_func = NULL;
+ klass->i_cal_get_func = NULL;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_spin_create_widgets;
@@ -1247,13 +1277,13 @@ ecepp_picker_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_picker_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
GtkWidget *edit_widget;
gchar *id = NULL;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_PICKER (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (edit_widget));
@@ -1270,13 +1300,13 @@ ecepp_picker_fill_widget (ECompEditorPropertyPart *property_part,
static void
ecepp_picker_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
GtkWidget *edit_widget;
const gchar *id;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_PICKER (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (edit_widget));
@@ -1331,7 +1361,7 @@ e_comp_editor_property_part_picker_get_values (ECompEditorPropertyPartPicker *pa
gboolean
e_comp_editor_property_part_picker_get_from_component (ECompEditorPropertyPartPicker *part_picker,
- icalcomponent *component,
+ ICalComponent *component,
gchar **out_id)
{
ECompEditorPropertyPartPickerClass *klass;
@@ -1348,7 +1378,7 @@ e_comp_editor_property_part_picker_get_from_component (ECompEditorPropertyPartPi
void
e_comp_editor_property_part_picker_set_to_component (ECompEditorPropertyPartPicker *part_picker,
const gchar *id,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartPickerClass *klass;
@@ -1398,10 +1428,10 @@ struct _ECompEditorPropertyPartPickerWithMapPrivate {
gint n_map_elems;
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;
};
enum {
@@ -1440,28 +1470,29 @@ ecepp_picker_with_map_get_values (ECompEditorPropertyPartPicker *part_picker,
static gboolean
ecepp_picker_with_map_get_from_component (ECompEditorPropertyPartPicker *part_picker,
- icalcomponent *component,
+ ICalComponent *component,
gchar **out_id)
{
ECompEditorPropertyPartPickerWithMap *part_picker_with_map;
- icalproperty *prop;
+ ICalProperty *prop;
gint ii, value;
g_return_val_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (part_picker), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
g_return_val_if_fail (out_id != NULL, FALSE);
part_picker_with_map = E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (part_picker);
g_return_val_if_fail (part_picker_with_map->priv->map != NULL, FALSE);
g_return_val_if_fail (part_picker_with_map->priv->n_map_elems > 0, FALSE);
- g_return_val_if_fail (part_picker_with_map->priv->ical_prop_kind != ICAL_NO_PROPERTY, FALSE);
- g_return_val_if_fail (part_picker_with_map->priv->ical_get_func != NULL, FALSE);
+ g_return_val_if_fail (part_picker_with_map->priv->prop_kind != I_CAL_NO_PROPERTY, FALSE);
+ g_return_val_if_fail (part_picker_with_map->priv->i_cal_get_func != NULL, FALSE);
- prop = icalcomponent_get_first_property (component, part_picker_with_map->priv->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, part_picker_with_map->priv->prop_kind);
if (!prop)
return FALSE;
- value = part_picker_with_map->priv->ical_get_func (prop);
+ value = part_picker_with_map->priv->i_cal_get_func (prop);
+ g_clear_object (&prop);
for (ii = 0; ii < part_picker_with_map->priv->n_map_elems; ii++) {
gboolean matches;
@@ -1484,40 +1515,40 @@ ecepp_picker_with_map_get_from_component (ECompEditorPropertyPartPicker *part_pi
static void
ecepp_picker_with_map_set_to_component (ECompEditorPropertyPartPicker *part_picker,
const gchar *id,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartPickerWithMap *part_picker_with_map;
- icalproperty *prop;
+ ICalProperty *prop;
gint ii, value;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (part_picker));
g_return_if_fail (id != NULL);
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
part_picker_with_map = E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (part_picker);
g_return_if_fail (part_picker_with_map->priv->map != NULL);
g_return_if_fail (part_picker_with_map->priv->n_map_elems > 0);
- g_return_if_fail (part_picker_with_map->priv->ical_prop_kind != ICAL_NO_PROPERTY);
- g_return_if_fail (part_picker_with_map->priv->ical_new_func != NULL);
- g_return_if_fail (part_picker_with_map->priv->ical_set_func != NULL);
+ g_return_if_fail (part_picker_with_map->priv->prop_kind != I_CAL_NO_PROPERTY);
+ g_return_if_fail (part_picker_with_map->priv->i_cal_new_func != NULL);
+ g_return_if_fail (part_picker_with_map->priv->i_cal_set_func != NULL);
ii = (gint) g_ascii_strtoll (id, NULL, 10);
g_return_if_fail (ii >= 0 && ii < part_picker_with_map->priv->n_map_elems);
- prop = icalcomponent_get_first_property (component, part_picker_with_map->priv->ical_prop_kind);
+ prop = i_cal_component_get_first_property (component, part_picker_with_map->priv->prop_kind);
value = part_picker_with_map->priv->map[ii].value;
if (part_picker_with_map->priv->map[ii].delete_prop) {
- if (prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
- }
+ if (prop)
+ i_cal_component_remove_property (component, prop);
} else if (prop) {
- part_picker_with_map->priv->ical_set_func (prop, value);
+ part_picker_with_map->priv->i_cal_set_func (prop, value);
} else {
- prop = part_picker_with_map->priv->ical_new_func (value);
- icalcomponent_add_property (component, prop);
+ prop = part_picker_with_map->priv->i_cal_new_func (value);
+ i_cal_component_add_property (component, prop);
}
+
+ g_clear_object (&prop);
}
static void
@@ -1671,10 +1702,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)
{
ECompEditorPropertyPartPickerWithMap *part_picker_with_map;
ECompEditorPropertyPartPickerMap *map_copy;
@@ -1684,10 +1715,10 @@ e_comp_editor_property_part_picker_with_map_new (const ECompEditorPropertyPartPi
g_return_val_if_fail (map != NULL, NULL);
g_return_val_if_fail (n_map_elements > 0, NULL);
g_return_val_if_fail (label != NULL, NULL);
- g_return_val_if_fail (ical_prop_kind != ICAL_NO_PROPERTY, NULL);
- g_return_val_if_fail (ical_new_func != NULL, NULL);
- g_return_val_if_fail (ical_set_func != NULL, NULL);
- g_return_val_if_fail (ical_get_func != NULL, NULL);
+ g_return_val_if_fail (prop_kind != I_CAL_NO_PROPERTY, NULL);
+ g_return_val_if_fail (i_cal_new_func != NULL, NULL);
+ g_return_val_if_fail (i_cal_set_func != NULL, NULL);
+ g_return_val_if_fail (i_cal_get_func != NULL, NULL);
map_copy = g_new0 (ECompEditorPropertyPartPickerMap, n_map_elements + 1);
for (ii = 0; ii < n_map_elements; ii++) {
@@ -1702,10 +1733,10 @@ e_comp_editor_property_part_picker_with_map_new (const ECompEditorPropertyPartPi
part_picker_with_map = E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (property_part);
- part_picker_with_map->priv->ical_prop_kind = ical_prop_kind;
- part_picker_with_map->priv->ical_new_func = ical_new_func;
- part_picker_with_map->priv->ical_set_func = ical_set_func;
- part_picker_with_map->priv->ical_get_func = ical_get_func;
+ part_picker_with_map->priv->prop_kind = prop_kind;
+ part_picker_with_map->priv->i_cal_new_func = i_cal_new_func;
+ part_picker_with_map->priv->i_cal_set_func = i_cal_set_func;
+ part_picker_with_map->priv->i_cal_get_func = i_cal_get_func;
return property_part;
}
diff --git a/src/calendar/gui/e-comp-editor-property-part.h b/src/calendar/gui/e-comp-editor-property-part.h
index b504e3becd..cf29a09beb 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) (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) (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) (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) (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 78303ac976..daa3976d93 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.c
+++ b/src/calendar/gui/e-comp-editor-property-parts.c
@@ -102,10 +102,10 @@ e_comp_editor_property_part_summary_class_init (ECompEditorPropertyPartSummaryCl
part_string_class = E_COMP_EDITOR_PROPERTY_PART_STRING_CLASS (klass);
part_string_class->entry_type = E_TYPE_SPELL_ENTRY;
- part_string_class->ical_prop_kind = ICAL_SUMMARY_PROPERTY;
- part_string_class->ical_new_func = icalproperty_new_summary;
- part_string_class->ical_set_func = icalproperty_set_summary;
- part_string_class->ical_get_func = icalproperty_get_summary;
+ part_string_class->prop_kind = I_CAL_SUMMARY_PROPERTY;
+ part_string_class->i_cal_new_func = i_cal_property_new_summary;
+ part_string_class->i_cal_set_func = i_cal_property_set_summary;
+ part_string_class->i_cal_get_func = i_cal_property_get_summary;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_summary_create_widgets;
@@ -337,7 +337,7 @@ ecepp_location_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_location_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartClass *part_class;
GtkWidget *edit_widget;
@@ -368,10 +368,10 @@ e_comp_editor_property_part_location_class_init (ECompEditorPropertyPartLocation
ECompEditorPropertyPartClass *part_class;
part_string_class = E_COMP_EDITOR_PROPERTY_PART_STRING_CLASS (klass);
- part_string_class->ical_prop_kind = ICAL_LOCATION_PROPERTY;
- part_string_class->ical_new_func = icalproperty_new_location;
- part_string_class->ical_set_func = icalproperty_set_location;
- part_string_class->ical_get_func = icalproperty_get_location;
+ part_string_class->prop_kind = I_CAL_LOCATION_PROPERTY;
+ part_string_class->i_cal_new_func = i_cal_property_new_location;
+ part_string_class->i_cal_set_func = i_cal_property_set_location;
+ part_string_class->i_cal_get_func = i_cal_property_get_location;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_location_create_widgets;
@@ -482,10 +482,10 @@ e_comp_editor_property_part_categories_class_init (ECompEditorPropertyPartCatego
ECompEditorPropertyPartClass *part_class;
part_string_class = E_COMP_EDITOR_PROPERTY_PART_STRING_CLASS (klass);
- part_string_class->ical_prop_kind = ICAL_CATEGORIES_PROPERTY;
- part_string_class->ical_new_func = icalproperty_new_categories;
- part_string_class->ical_set_func = icalproperty_set_categories;
- part_string_class->ical_get_func = icalproperty_get_categories;
+ part_string_class->prop_kind = I_CAL_CATEGORIES_PROPERTY;
+ part_string_class->i_cal_new_func = i_cal_property_new_categories;
+ part_string_class->i_cal_set_func = i_cal_property_set_categories;
+ part_string_class->i_cal_get_func = i_cal_property_get_categories;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_categories_create_widgets;
@@ -581,13 +581,13 @@ ecepp_description_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_description_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorPropertyPartClass *part_class;
GtkWidget *edit_widget;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DESCRIPTION (property_part));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (e_comp_editor_property_part_description_parent_class);
g_return_if_fail (part_class != NULL);
@@ -614,10 +614,10 @@ e_comp_editor_property_part_description_class_init (ECompEditorPropertyPartDescr
part_string_class = E_COMP_EDITOR_PROPERTY_PART_STRING_CLASS (klass);
part_string_class->entry_type = GTK_TYPE_TEXT_VIEW;
- part_string_class->ical_prop_kind = ICAL_DESCRIPTION_PROPERTY;
- part_string_class->ical_new_func = icalproperty_new_description;
- part_string_class->ical_set_func = icalproperty_set_description;
- part_string_class->ical_get_func = icalproperty_get_description;
+ part_string_class->prop_kind = I_CAL_DESCRIPTION_PROPERTY;
+ part_string_class->i_cal_new_func = i_cal_property_new_description;
+ part_string_class->i_cal_set_func = i_cal_property_set_description;
+ part_string_class->i_cal_get_func = i_cal_property_get_description;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_description_create_widgets;
@@ -710,10 +710,10 @@ e_comp_editor_property_part_url_class_init (ECompEditorPropertyPartUrlClass *kla
part_string_class = E_COMP_EDITOR_PROPERTY_PART_STRING_CLASS (klass);
part_string_class->entry_type = E_TYPE_URL_ENTRY;
- part_string_class->ical_prop_kind = ICAL_URL_PROPERTY;
- part_string_class->ical_new_func = icalproperty_new_url;
- part_string_class->ical_set_func = icalproperty_set_url;
- part_string_class->ical_get_func = icalproperty_get_url;
+ part_string_class->prop_kind = I_CAL_URL_PROPERTY;
+ part_string_class->i_cal_new_func = i_cal_property_new_url;
+ part_string_class->i_cal_set_func = i_cal_property_set_url;
+ part_string_class->i_cal_get_func = i_cal_property_get_url;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_url_create_widgets;
@@ -920,10 +920,10 @@ e_comp_editor_property_part_dtstart_class_init (ECompEditorPropertyPartDtstartCl
ECompEditorPropertyPartDatetimeClass *part_datetime_class;
part_datetime_class = E_COMP_EDITOR_PROPERTY_PART_DATETIME_CLASS (klass);
- part_datetime_class->ical_prop_kind = ICAL_DTSTART_PROPERTY;
- part_datetime_class->ical_new_func = icalproperty_new_dtstart;
- part_datetime_class->ical_set_func = icalproperty_set_dtstart;
- part_datetime_class->ical_get_func = icalproperty_get_dtstart;
+ part_datetime_class->prop_kind = I_CAL_DTSTART_PROPERTY;
+ part_datetime_class->i_cal_new_func = i_cal_property_new_dtstart;
+ part_datetime_class->i_cal_set_func = i_cal_property_set_dtstart;
+ part_datetime_class->i_cal_get_func = i_cal_property_get_dtstart;
}
ECompEditorPropertyPart *
@@ -981,10 +981,10 @@ e_comp_editor_property_part_dtend_class_init (ECompEditorPropertyPartDtendClass
ECompEditorPropertyPartDatetimeClass *part_datetime_class;
part_datetime_class = E_COMP_EDITOR_PROPERTY_PART_DATETIME_CLASS (klass);
- part_datetime_class->ical_prop_kind = ICAL_DTEND_PROPERTY;
- part_datetime_class->ical_new_func = icalproperty_new_dtend;
- part_datetime_class->ical_set_func = icalproperty_set_dtend;
- part_datetime_class->ical_get_func = icalproperty_get_dtend;
+ part_datetime_class->prop_kind = I_CAL_DTEND_PROPERTY;
+ part_datetime_class->i_cal_new_func = i_cal_property_new_dtend;
+ part_datetime_class->i_cal_set_func = i_cal_property_set_dtend;
+ part_datetime_class->i_cal_get_func = i_cal_property_get_dtend;
}
ECompEditorPropertyPart *
@@ -1042,10 +1042,10 @@ e_comp_editor_property_part_due_class_init (ECompEditorPropertyPartDueClass *kla
ECompEditorPropertyPartDatetimeClass *part_datetime_class;
part_datetime_class = E_COMP_EDITOR_PROPERTY_PART_DATETIME_CLASS (klass);
- part_datetime_class->ical_prop_kind = ICAL_DUE_PROPERTY;
- part_datetime_class->ical_new_func = icalproperty_new_due;
- part_datetime_class->ical_set_func = icalproperty_set_due;
- part_datetime_class->ical_get_func = icalproperty_get_due;
+ part_datetime_class->prop_kind = I_CAL_DUE_PROPERTY;
+ part_datetime_class->i_cal_new_func = i_cal_property_new_due;
+ part_datetime_class->i_cal_set_func = i_cal_property_set_due;
+ part_datetime_class->i_cal_get_func = i_cal_property_get_due;
}
ECompEditorPropertyPart *
@@ -1092,39 +1092,37 @@ GType e_comp_editor_property_part_completed_get_type (void) G_GNUC_CONST;
G_DEFINE_TYPE (ECompEditorPropertyPartCompleted, e_comp_editor_property_part_completed,
E_TYPE_COMP_EDITOR_PROPERTY_PART_DATETIME_LABELED)
static void
-e_comp_editor_property_part_completed_ensure_date_time (struct icaltimetype *pvalue)
+e_comp_editor_property_part_completed_ensure_date_time (ICalTime *pvalue)
{
if (!pvalue)
return;
- if (pvalue->is_date) {
- pvalue->is_date = 0;
- pvalue->hour = 0;
- pvalue->minute = 0;
- pvalue->second = 0;
- pvalue->zone = icaltimezone_get_utc_timezone ();
- } else if (!icaltime_is_utc (*pvalue)) {
+ if (i_cal_time_is_date (pvalue)) {
+ i_cal_time_set_is_date (pvalue, FALSE);
+ i_cal_time_set_time (pvalue, 0, 0, 0);
+ i_cal_time_set_timezone (pvalue, i_cal_timezone_get_utc_timezone ());
+ } else if (!i_cal_time_is_utc (pvalue)) {
/* Make sure the time is in UTC */
- icaltimezone_convert_time (pvalue, (icaltimezone *) pvalue->zone,
icaltimezone_get_utc_timezone ());
- pvalue->zone = icaltimezone_get_utc_timezone ();
+ i_cal_timezone_convert_time (pvalue, i_cal_time_get_timezone (pvalue),
i_cal_timezone_get_utc_timezone ());
+ i_cal_time_set_timezone (pvalue, i_cal_timezone_get_utc_timezone ());
}
}
-static icalproperty *
-e_comp_editor_property_part_completed_new_func_wrapper (struct icaltimetype value)
+static ICalProperty *
+e_comp_editor_property_part_completed_new_func_wrapper (ICalTime *value)
{
- e_comp_editor_property_part_completed_ensure_date_time (&value);
+ e_comp_editor_property_part_completed_ensure_date_time (value);
- return icalproperty_new_completed (value);
+ return i_cal_property_new_completed (value);
}
static void
-e_comp_editor_property_part_completed_set_func_wrapper (icalproperty *prop,
- struct icaltimetype value)
+e_comp_editor_property_part_completed_set_func_wrapper (ICalProperty *prop,
+ ICalTime *value)
{
- e_comp_editor_property_part_completed_ensure_date_time (&value);
+ e_comp_editor_property_part_completed_ensure_date_time (value);
- return icalproperty_set_completed (prop, value);
+ i_cal_property_set_completed (prop, value);
}
static void
@@ -1138,10 +1136,10 @@ e_comp_editor_property_part_completed_class_init (ECompEditorPropertyPartComplet
ECompEditorPropertyPartDatetimeClass *part_datetime_class;
part_datetime_class = E_COMP_EDITOR_PROPERTY_PART_DATETIME_CLASS (klass);
- part_datetime_class->ical_prop_kind = ICAL_COMPLETED_PROPERTY;
- part_datetime_class->ical_new_func = e_comp_editor_property_part_completed_new_func_wrapper;
- part_datetime_class->ical_set_func = e_comp_editor_property_part_completed_set_func_wrapper;
- part_datetime_class->ical_get_func = icalproperty_get_completed;
+ part_datetime_class->prop_kind = I_CAL_COMPLETED_PROPERTY;
+ part_datetime_class->i_cal_new_func = e_comp_editor_property_part_completed_new_func_wrapper;
+ part_datetime_class->i_cal_set_func = e_comp_editor_property_part_completed_set_func_wrapper;
+ part_datetime_class->i_cal_get_func = i_cal_property_get_completed;
}
ECompEditorPropertyPart *
@@ -1167,9 +1165,9 @@ ECompEditorPropertyPart *
e_comp_editor_property_part_classification_new (void)
{
ECompEditorPropertyPartPickerMap map[] = {
- { ICAL_CLASS_PUBLIC, NC_("ECompEditor", "Public"), FALSE, NULL },
- { ICAL_CLASS_PRIVATE, NC_("ECompEditor", "Private"), FALSE, NULL },
- { ICAL_CLASS_CONFIDENTIAL, NC_("ECompEditor", "Confidential"), FALSE, NULL }
+ { I_CAL_CLASS_PUBLIC, NC_("ECompEditor", "Public"), FALSE, NULL },
+ { I_CAL_CLASS_PRIVATE, NC_("ECompEditor", "Private"), FALSE, NULL },
+ { I_CAL_CLASS_CONFIDENTIAL, NC_("ECompEditor", "Confidential"), FALSE, NULL }
};
GSettings *settings;
ECompEditorPropertyPart *part;
@@ -1186,10 +1184,10 @@ e_comp_editor_property_part_classification_new (void)
part = e_comp_editor_property_part_picker_with_map_new (map, n_elems,
C_("ECompEditor", "C_lassification:"),
- ICAL_CLASS_PROPERTY,
- (ECompEditorPropertyPartPickerMapICalNewFunc) icalproperty_new_class,
- (ECompEditorPropertyPartPickerMapICalSetFunc) icalproperty_set_class,
- (ECompEditorPropertyPartPickerMapICalGetFunc) icalproperty_get_class);
+ I_CAL_CLASS_PROPERTY,
+ (ECompEditorPropertyPartPickerMapICalNewFunc) i_cal_property_new_class,
+ (ECompEditorPropertyPartPickerMapICalSetFunc) i_cal_property_set_class,
+ (ECompEditorPropertyPartPickerMapICalGetFunc) i_cal_property_get_class);
e_comp_editor_property_part_picker_with_map_set_selected (
E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (part),
@@ -1204,10 +1202,10 @@ ECompEditorPropertyPart *
e_comp_editor_property_part_status_new (void)
{
ECompEditorPropertyPartPickerMap map[] = {
- { ICAL_STATUS_NONE, NC_("ECompEditor", "Not Started"), TRUE, NULL },
- { ICAL_STATUS_INPROCESS, NC_("ECompEditor", "In Progress"), FALSE, NULL },
- { ICAL_STATUS_COMPLETED, NC_("ECompEditor", "Completed"), FALSE, NULL },
- { ICAL_STATUS_CANCELLED, NC_("ECompEditor", "Cancelled"), FALSE, NULL }
+ { I_CAL_STATUS_NONE, NC_("ECompEditor", "Not Started"), TRUE, NULL },
+ { I_CAL_STATUS_INPROCESS, NC_("ECompEditor", "In Progress"), FALSE, NULL },
+ { I_CAL_STATUS_COMPLETED, NC_("ECompEditor", "Completed"), FALSE, NULL },
+ { I_CAL_STATUS_CANCELLED, NC_("ECompEditor", "Cancelled"), FALSE, NULL }
};
gint ii, n_elems = G_N_ELEMENTS (map);
@@ -1217,10 +1215,10 @@ e_comp_editor_property_part_status_new (void)
return e_comp_editor_property_part_picker_with_map_new (map, n_elems,
C_("ECompEditor", "_Status:"),
- ICAL_STATUS_PROPERTY,
- (ECompEditorPropertyPartPickerMapICalNewFunc) icalproperty_new_status,
- (ECompEditorPropertyPartPickerMapICalSetFunc) icalproperty_set_status,
- (ECompEditorPropertyPartPickerMapICalGetFunc) icalproperty_get_status);
+ I_CAL_STATUS_PROPERTY,
+ (ECompEditorPropertyPartPickerMapICalNewFunc) i_cal_property_new_status,
+ (ECompEditorPropertyPartPickerMapICalSetFunc) i_cal_property_set_status,
+ (ECompEditorPropertyPartPickerMapICalGetFunc) i_cal_property_get_status);
}
/* ************************************************************************* */
@@ -1259,10 +1257,10 @@ e_comp_editor_property_part_priority_new (void)
return e_comp_editor_property_part_picker_with_map_new (map, n_elems,
C_("ECompEditor", "Priorit_y:"),
- ICAL_PRIORITY_PROPERTY,
- icalproperty_new_priority,
- icalproperty_set_priority,
- icalproperty_get_priority);
+ I_CAL_PRIORITY_PROPERTY,
+ i_cal_property_new_priority,
+ i_cal_property_set_priority,
+ i_cal_property_get_priority);
}
/* ************************************************************************* */
@@ -1337,10 +1335,10 @@ e_comp_editor_property_part_percentcomplete_class_init (ECompEditorPropertyPartP
ECompEditorPropertyPartClass *part_class;
part_spin_class = E_COMP_EDITOR_PROPERTY_PART_SPIN_CLASS (klass);
- part_spin_class->ical_prop_kind = ICAL_PERCENTCOMPLETE_PROPERTY;
- part_spin_class->ical_new_func = icalproperty_new_percentcomplete;
- part_spin_class->ical_set_func = icalproperty_set_percentcomplete;
- part_spin_class->ical_get_func = icalproperty_get_percentcomplete;
+ part_spin_class->prop_kind = I_CAL_PERCENTCOMPLETE_PROPERTY;
+ part_spin_class->i_cal_new_func = i_cal_property_new_percentcomplete;
+ part_spin_class->i_cal_set_func = i_cal_property_set_percentcomplete;
+ part_spin_class->i_cal_get_func = i_cal_property_get_percentcomplete;
part_class = E_COMP_EDITOR_PROPERTY_PART_CLASS (klass);
part_class->create_widgets = ecepp_percentcomplete_create_widgets;
@@ -1417,44 +1415,47 @@ ecepp_timezone_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_timezone_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
- struct icaltimetype (* get_func) (const icalproperty *prop);
- icalproperty *prop;
+ ICalTime * (* get_func) (ICalProperty *prop);
+ ICalProperty *prop;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_TIMEZONE (property_part));
- get_func = icalproperty_get_dtstart;
- prop = icalcomponent_get_first_property (component, ICAL_DTSTART_PROPERTY);
+ get_func = i_cal_property_get_dtstart;
+ prop = i_cal_component_get_first_property (component, I_CAL_DTSTART_PROPERTY);
if (!prop) {
- get_func = icalproperty_get_dtend;
- prop = icalcomponent_get_first_property (component, ICAL_DTEND_PROPERTY);
+ get_func = i_cal_property_get_dtend;
+ prop = i_cal_component_get_first_property (component, I_CAL_DTEND_PROPERTY);
}
if (!prop) {
- get_func = icalproperty_get_due;
- prop = icalcomponent_get_first_property (component, ICAL_DUE_PROPERTY);
+ get_func = i_cal_property_get_due;
+ prop = i_cal_component_get_first_property (component, I_CAL_DUE_PROPERTY);
}
if (prop) {
- struct icaltimetype itt;
+ ICalTime *itt;
itt = get_func (prop);
- if (itt.zone) {
+ if (itt && i_cal_time_get_timezone (itt)) {
GtkWidget *edit_widget;
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (E_IS_TIMEZONE_ENTRY (edit_widget));
- e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (edit_widget), (icaltimezone *)
itt.zone);
+ e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (edit_widget),
i_cal_time_get_timezone (itt));
}
+
+ g_clear_object (&itt);
+ g_object_unref (prop);
}
}
static void
ecepp_timezone_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
/* Nothing to do here, this is sort-of virtual property part */
}
@@ -1535,20 +1536,22 @@ ecepp_transparency_create_widgets (ECompEditorPropertyPart *property_part,
static void
ecepp_transparency_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_TRANSPARENCY (property_part));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_CHECK_BUTTON (edit_widget));
- prop = icalcomponent_get_first_property (component, ICAL_TRANSP_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_TRANSP_PROPERTY);
if (prop) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edit_widget),
- icalproperty_get_transp (prop) == ICAL_TRANSP_OPAQUE);
+ i_cal_property_get_transp (prop) == I_CAL_TRANSP_OPAQUE);
+
+ g_object_unref (prop);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edit_widget), TRUE);
}
@@ -1556,26 +1559,28 @@ ecepp_transparency_fill_widget (ECompEditorPropertyPart *property_part,
static void
ecepp_transparency_fill_component (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
GtkWidget *edit_widget;
- icalproperty *prop;
- icalproperty_transp value;
+ ICalProperty *prop;
+ ICalPropertyTransp value;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_TRANSPARENCY (property_part));
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (GTK_IS_CHECK_BUTTON (edit_widget));
- value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (edit_widget)) ? ICAL_TRANSP_OPAQUE :
ICAL_TRANSP_TRANSPARENT;
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (edit_widget)) ? I_CAL_TRANSP_OPAQUE :
I_CAL_TRANSP_TRANSPARENT;
- prop = icalcomponent_get_first_property (component, ICAL_TRANSP_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_TRANSP_PROPERTY);
if (prop) {
- icalproperty_set_transp (prop, value);
+ i_cal_property_set_transp (prop, value);
} else {
- prop = icalproperty_new_transp (value);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_transp (value);
+ i_cal_component_add_property (component, prop);
}
+
+ g_clear_object (&prop);
}
static void
@@ -1628,7 +1633,6 @@ GType e_comp_editor_property_part_color_get_type (void) G_GNUC_CONST;
G_DEFINE_TYPE (ECompEditorPropertyPartColor, e_comp_editor_property_part_color,
E_TYPE_COMP_EDITOR_PROPERTY_PART)
-#ifdef HAVE_ICAL_COLOR_PROPERTY
static const gchar *
ecepp_color_rgba_to_string (const GdkRGBA *rgba)
{
@@ -1847,7 +1851,6 @@ ecepp_color_notify_current_color_cb (EColorCombo *color_combo,
g_signal_handler_unblock (color_combo, color_part->notify_current_color_id);
}
}
-#endif /* HAVE_ICAL_COLOR_PROPERTY */
static void
ecepp_color_set_palette (GtkWidget *color_combo)
@@ -1923,9 +1926,7 @@ ecepp_color_create_widgets (ECompEditorPropertyPart *property_part,
GtkWidget **out_label_widget,
GtkWidget **out_edit_widget)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
ECompEditorPropertyPartColor *color_part;
- #endif
GdkRGBA rgba;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_COLOR (property_part));
@@ -1956,21 +1957,18 @@ ecepp_color_create_widgets (ECompEditorPropertyPart *property_part,
ecepp_color_set_palette (*out_edit_widget);
- #ifdef HAVE_ICAL_COLOR_PROPERTY
color_part = E_COMP_EDITOR_PROPERTY_PART_COLOR (property_part);
color_part->notify_current_color_id =
g_signal_connect (*out_edit_widget, "notify::current-color",
G_CALLBACK (ecepp_color_notify_current_color_cb), property_part);
- #endif
}
static void
ecepp_color_fill_widget (ECompEditorPropertyPart *property_part,
- icalcomponent *component)
+ ICalComponent *component)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
gboolean color_set = FALSE;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_COLOR (property_part));
@@ -1978,15 +1976,17 @@ ecepp_color_fill_widget (ECompEditorPropertyPart *property_part,
edit_widget = e_comp_editor_property_part_get_edit_widget (property_part);
g_return_if_fail (E_IS_COLOR_COMBO (edit_widget));
- prop = icalcomponent_get_first_property (component, ICAL_COLOR_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_COLOR_PROPERTY);
if (prop) {
- const gchar *color = icalproperty_get_color (prop);
+ const gchar *color = i_cal_property_get_color (prop);
GdkRGBA rgba;
if (color && gdk_rgba_parse (&rgba, color)) {
e_color_combo_set_current_color (E_COLOR_COMBO (edit_widget), &rgba);
color_set = TRUE;
}
+
+ g_clear_object (&prop);
}
if (!color_set) {
@@ -1999,16 +1999,14 @@ 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)
+ ICalComponent *component)
{
- #ifdef HAVE_ICAL_COLOR_PROPERTY
GtkWidget *edit_widget;
- icalproperty *prop;
+ ICalProperty *prop;
GdkRGBA rgba;
g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_COLOR (property_part));
@@ -2023,29 +2021,28 @@ ecepp_color_fill_component (ECompEditorPropertyPart *property_part,
e_color_combo_get_current_color (E_COLOR_COMBO (edit_widget), &rgba);
- prop = icalcomponent_get_first_property (component, ICAL_COLOR_PROPERTY);
+ prop = i_cal_component_get_first_property (component, I_CAL_COLOR_PROPERTY);
if (rgba.alpha <= 1.0 - 1e-9) {
- if (prop) {
- icalcomponent_remove_property (component, prop);
- icalproperty_free (prop);
- }
+ if (prop)
+ i_cal_component_remove_property (component, prop);
} else {
const gchar *str;
str = ecepp_color_rgba_to_string (&rgba);
if (str) {
if (prop) {
- icalproperty_set_color (prop, str);
+ i_cal_property_set_color (prop, str);
} else {
- prop = icalproperty_new_color (str);
- icalcomponent_add_property (component, prop);
+ prop = i_cal_property_new_color (str);
+ i_cal_component_add_property (component, prop);
}
} else {
g_warning ("%s: Failed to convert RGBA (%f,%f,%f,%f) to string", G_STRFUNC, rgba.red,
rgba.green, rgba.blue, rgba.alpha);
}
}
- #endif
+
+ g_clear_object (&prop);
}
static void
@@ -2067,9 +2064,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..4869dd82a8 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -54,13 +54,13 @@ struct _ECompEditorTaskPrivate {
G_DEFINE_TYPE (ECompEditorTask, e_comp_editor_task, E_TYPE_COMP_EDITOR)
-static icaltimezone *
+static ICalTimezone *
ece_task_get_timezone_from_property (ECompEditor *comp_editor,
- icalproperty *property)
+ ICalProperty *property)
{
ECalClient *client;
- icalparameter *param;
- icaltimezone *zone = NULL;
+ ICalParameter *param;
+ ICalTimezone *zone = NULL;
const gchar *tzid;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), NULL);
@@ -68,25 +68,33 @@ ece_task_get_timezone_from_property (ECompEditor *comp_editor,
if (!property)
return NULL;
- param = icalproperty_get_first_parameter (property, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (property, I_CAL_TZID_PARAMETER);
if (!param)
return NULL;
- tzid = icalparameter_get_tzid (param);
- if (!tzid || !*tzid)
+ tzid = i_cal_parameter_get_tzid (param);
+ if (!tzid || !*tzid) {
+ g_clear_object (¶m);
return NULL;
+ }
- if (g_ascii_strcasecmp (tzid, "UTC") == 0)
- return icaltimezone_get_utc_timezone ();
+ if (g_ascii_strcasecmp (tzid, "UTC") == 0) {
+ g_clear_object (¶m);
+ return i_cal_timezone_get_utc_timezone ();
+ }
client = e_comp_editor_get_source_client (comp_editor);
/* It should be already fetched for the UI, thus this should be non-blocking. */
- if (client && e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, NULL) && zone)
+ if (client && e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, NULL) && zone) {
+ g_clear_object (¶m);
return zone;
+ }
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!zone)
- zone = icaltimezone_get_builtin_timezone (tzid);
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
+
+ g_clear_object (¶m);
return zone;
}
@@ -96,13 +104,13 @@ ece_task_update_timezone (ECompEditorTask *task_editor,
gboolean *force_allday)
{
const gint properties[] = {
- ICAL_DTSTART_PROPERTY,
- ICAL_DUE_PROPERTY,
- ICAL_COMPLETED_PROPERTY
+ I_CAL_DTSTART_PROPERTY,
+ I_CAL_DUE_PROPERTY,
+ I_CAL_COMPLETED_PROPERTY
};
ECompEditor *comp_editor;
- icalcomponent *component;
- icaltimezone *zone = NULL;
+ ICalComponent *component;
+ ICalTimezone *zone = NULL;
gint ii;
g_return_if_fail (E_IS_COMP_EDITOR_TASK (task_editor));
@@ -117,25 +125,32 @@ ece_task_update_timezone (ECompEditorTask *task_editor,
return;
for (ii = 0; !zone && ii < G_N_ELEMENTS (properties); ii++) {
- struct icaltimetype dt;
- if (icalcomponent_get_first_property (component, properties[ii])) {
- dt = icalcomponent_get_dtstart (component);
- if (icaltime_is_valid_time (dt)) {
- if (force_allday && dt.is_date)
+ if (e_cal_util_component_has_property (component, properties[ii])) {
+ ICalTime *dt;
+
+ dt = i_cal_component_get_dtstart (component);
+ if (dt && i_cal_time_is_valid_time (dt)) {
+ if (force_allday && i_cal_time_is_date (dt))
*force_allday = TRUE;
- if (icaltime_is_utc (dt))
- zone = icaltimezone_get_utc_timezone ();
- else
- zone = ece_task_get_timezone_from_property (comp_editor,
- icalcomponent_get_first_property (component, properties[ii]));
+ if (i_cal_time_is_utc (dt)) {
+ zone = i_cal_timezone_get_utc_timezone ();
+ } else {
+ ICalProperty *prop;
+
+ prop = i_cal_component_get_first_property (component, properties[ii]);
+ zone = ece_task_get_timezone_from_property (comp_editor, prop);
+ g_clear_object (&prop);
+ }
}
+
+ g_clear_object (&dt);
}
}
if (zone) {
GtkWidget *edit_widget;
- icaltimezone *cfg_zone;
+ ICalTimezone *cfg_zone;
edit_widget = e_comp_editor_property_part_get_edit_widget (task_editor->priv->timezone);
@@ -144,8 +159,8 @@ ece_task_update_timezone (ECompEditorTask *task_editor,
cfg_zone = calendar_config_get_icaltimezone ();
if (zone && cfg_zone && zone != cfg_zone &&
- (g_strcmp0 (icaltimezone_get_location (zone), icaltimezone_get_location (cfg_zone)) != 0
||
- g_strcmp0 (icaltimezone_get_tzid (zone), icaltimezone_get_tzid (cfg_zone)) != 0)) {
+ (g_strcmp0 (i_cal_timezone_get_location (zone), i_cal_timezone_get_location (cfg_zone))
!= 0 ||
+ g_strcmp0 (i_cal_timezone_get_tzid (zone), i_cal_timezone_get_tzid (cfg_zone)) != 0)) {
/* Show timezone part */
GtkAction *action;
@@ -189,7 +204,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 +224,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);
}
@@ -230,7 +245,7 @@ ece_task_check_dates_in_the_past (ECompEditorTask *task_editor)
if ((flags & E_COMP_EDITOR_FLAG_IS_NEW) != 0) {
GString *message = NULL;
- struct icaltimetype dtstart_itt, due_date_itt;
+ ICalTime *dtstart_itt, *due_date_itt;
dtstart_itt = e_comp_editor_property_part_datetime_get_value (
E_COMP_EDITOR_PROPERTY_PART_DATETIME (task_editor->priv->dtstart));
@@ -262,6 +277,9 @@ ece_task_check_dates_in_the_past (ECompEditorTask *task_editor)
g_string_free (message, TRUE);
g_clear_object (&alert);
}
+
+ g_clear_object (&dtstart_itt);
+ g_clear_object (&due_date_itt);
}
}
@@ -321,7 +339,7 @@ ece_task_completed_date_changed_cb (EDateEdit *date_edit,
{
GtkSpinButton *percent_spin;
ECompEditor *comp_editor;
- struct icaltimetype itt;
+ ICalTime *itt;
gint status;
g_return_if_fail (E_IS_DATE_EDIT (date_edit));
@@ -340,25 +358,27 @@ ece_task_completed_date_changed_cb (EDateEdit *date_edit,
E_COMP_EDITOR_PROPERTY_PART_DATETIME (task_editor->priv->completed_date));
percent_spin = GTK_SPIN_BUTTON (e_comp_editor_property_part_get_edit_widget
(task_editor->priv->percentcomplete));
- if (icaltime_is_null_time (itt)) {
- if (status == ICAL_STATUS_COMPLETED) {
+ if (!itt || i_cal_time_is_null_time (itt)) {
+ if (status == I_CAL_STATUS_COMPLETED) {
e_comp_editor_property_part_picker_with_map_set_selected (
E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (task_editor->priv->status),
- ICAL_STATUS_NONE);
+ I_CAL_STATUS_NONE);
gtk_spin_button_set_value (percent_spin, 0);
}
} else {
- if (status != ICAL_STATUS_COMPLETED) {
+ if (status != I_CAL_STATUS_COMPLETED) {
e_comp_editor_property_part_picker_with_map_set_selected (
E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (task_editor->priv->status),
- ICAL_STATUS_COMPLETED);
+ I_CAL_STATUS_COMPLETED);
}
gtk_spin_button_set_value (percent_spin, 100);
}
e_comp_editor_set_updating (comp_editor, FALSE);
+
+ g_clear_object (&itt);
}
static void
@@ -385,17 +405,17 @@ ece_task_status_changed_cb (GtkComboBox *combo_box,
status = e_comp_editor_property_part_picker_with_map_get_selected (
E_COMP_EDITOR_PROPERTY_PART_PICKER_WITH_MAP (task_editor->priv->status));
- if (status == ICAL_STATUS_NONE) {
+ if (status == I_CAL_STATUS_NONE) {
gtk_spin_button_set_value (percent_spin, 0);
e_date_edit_set_time (completed_date, (time_t) -1);
- } else if (status == ICAL_STATUS_INPROCESS) {
+ } else if (status == I_CAL_STATUS_INPROCESS) {
gint percent_complete = gtk_spin_button_get_value_as_int (percent_spin);
if (percent_complete <= 0 || percent_complete >= 100)
gtk_spin_button_set_value (percent_spin, 50);
e_date_edit_set_time (completed_date, (time_t) -1);
- } else if (status == ICAL_STATUS_COMPLETED) {
+ } else if (status == I_CAL_STATUS_COMPLETED) {
gtk_spin_button_set_value (percent_spin, 100);
e_date_edit_set_time (completed_date, time (NULL));
}
@@ -429,14 +449,14 @@ ece_task_percentcomplete_value_changed_cb (GtkSpinButton *spin_button,
percent = gtk_spin_button_get_value_as_int (percent_spin);
if (percent == 100) {
ctime = time (NULL);
- status = ICAL_STATUS_COMPLETED;
+ status = I_CAL_STATUS_COMPLETED;
} else {
ctime = (time_t) -1;
if (percent == 0)
- status = ICAL_STATUS_NONE;
+ status = I_CAL_STATUS_NONE;
else
- status = ICAL_STATUS_INPROCESS;
+ status = I_CAL_STATUS_INPROCESS;
}
e_comp_editor_property_part_picker_with_map_set_selected (
@@ -507,12 +527,12 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
static void
ece_task_fill_widgets (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
gboolean force_allday = FALSE;
g_return_if_fail (E_IS_COMP_EDITOR_TASK (comp_editor));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
ece_task_update_timezone (E_COMP_EDITOR_TASK (comp_editor), &force_allday);
@@ -528,10 +548,10 @@ ece_task_fill_widgets (ECompEditor *comp_editor,
static gboolean
ece_task_fill_component (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorTask *task_editor;
- struct icaltimetype itt;
+ ICalTime *itt;
g_return_val_if_fail (E_IS_COMP_EDITOR_TASK (comp_editor), FALSE);
@@ -549,18 +569,22 @@ ece_task_fill_component (ECompEditor *comp_editor,
}
if (e_cal_util_component_has_recurrences (component)) {
- struct icaltimetype dtstart;
+ ICalTime *dtstart;
dtstart = e_comp_editor_property_part_datetime_get_value
(E_COMP_EDITOR_PROPERTY_PART_DATETIME (task_editor->priv->dtstart));
- if (icaltime_is_null_time (dtstart) || !icaltime_is_valid_time (dtstart)) {
+ if (!dtstart || i_cal_time_is_null_time (dtstart) || !i_cal_time_is_valid_time (dtstart)) {
e_comp_editor_set_validation_error (comp_editor,
task_editor->priv->page_general,
e_comp_editor_property_part_get_edit_widget (task_editor->priv->dtstart),
_("Start date is required for recurring tasks"));
+ g_clear_object (&dtstart);
+
return FALSE;
}
+
+ g_clear_object (&dtstart);
}
if (!e_comp_editor_property_part_datetime_check_validity (
@@ -593,9 +617,13 @@ ece_task_fill_component (ECompEditor *comp_editor,
e_comp_editor_property_part_get_edit_widget (task_editor->priv->completed_date),
_("Completed date cannot be in the future"));
+ g_clear_object (&itt);
+
return FALSE;
}
+ g_clear_object (&itt);
+
if (!E_COMP_EDITOR_CLASS (e_comp_editor_task_parent_class)->fill_component (comp_editor, component))
return FALSE;
@@ -609,9 +637,9 @@ ece_task_fill_component (ECompEditor *comp_editor,
if (cal_client) {
if ((e_comp_editor_get_flags (comp_editor) & E_COMP_EDITOR_FLAG_IS_NEW) != 0) {
e_cal_util_init_recur_task_sync (component, cal_client, NULL, NULL);
- } else if (icalcomponent_get_first_property (component, ICAL_COMPLETED_PROPERTY)) {
+ } else if (e_cal_util_component_has_property (component, I_CAL_COMPLETED_PROPERTY)) {
e_cal_util_mark_task_complete_sync (component, (time_t) -1, cal_client, NULL,
NULL);
- } else if (!icalcomponent_get_first_property (component, ICAL_DUE_PROPERTY)) {
+ } else if (!e_cal_util_component_has_property (component, I_CAL_DUE_PROPERTY)) {
e_cal_util_init_recur_task_sync (component, cal_client, NULL, NULL);
}
}
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index 1e0fc23d5a..c164d011b7 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -48,7 +48,7 @@ struct _ECompEditorPrivate {
EShell *shell;
GSettings *calendar_settings;
ESource *origin_source;
- icalcomponent *component;
+ ICalComponent *component;
guint32 flags;
EFocusTracker *focus_tracker;
@@ -155,31 +155,31 @@ static void
ece_set_attendees_for_delegation (ECalComponent *comp,
const gchar *address)
{
- icalproperty *prop;
- icalparameter *param;
- icalcomponent *icalcomp;
+ ICalProperty *prop;
+ ICalParameter *param;
+ ICalComponent *icomp;
gboolean again;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PROPERTY);
prop;
- prop = again ? icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY) :
- icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
- const gchar *attendee = icalproperty_get_attendee (prop);
+ g_object_unref (prop), prop = again ? i_cal_component_get_first_property (icomp,
I_CAL_ATTENDEE_PROPERTY) :
+ i_cal_component_get_next_property (icomp, I_CAL_ATTENDEE_PROPERTY)) {
+ const gchar *attendee = i_cal_property_get_attendee (prop);
const gchar *delfrom = NULL;
again = FALSE;
- param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDFROM_PARAMETER);
if (param)
- delfrom = icalparameter_get_delegatedfrom (param);
+ delfrom = i_cal_parameter_get_delegatedfrom (param);
if (!(g_str_equal (itip_strip_mailto (attendee), address) ||
((delfrom && *delfrom) && g_str_equal (itip_strip_mailto (delfrom), address)))) {
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (icomp, prop);
again = TRUE;
}
+ g_clear_object (¶m);
}
}
@@ -273,14 +273,15 @@ ece_get_mime_attach_list (ECompEditor *comp_editor)
static void
e_comp_editor_set_component (ECompEditor *comp_editor,
- const icalcomponent *component)
+ const ICalComponent *component)
{
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
- if (comp_editor->priv->component)
- icalcomponent_free (comp_editor->priv->component);
- comp_editor->priv->component = icalcomponent_new_clone ((icalcomponent *) component);
+ if (comp_editor->priv->component != component) {
+ g_clear_object (&comp_editor->priv->component);
+ comp_editor->priv->component = i_cal_component_new_clone ((ICalComponent *) component);
+ }
g_warn_if_fail (comp_editor->priv->component != NULL);
}
@@ -289,7 +290,7 @@ typedef struct _SaveData {
ECompEditor *comp_editor;
ECalClient *source_client;
ECalClient *target_client;
- icalcomponent *component;
+ ICalComponent *component;
gboolean with_send;
gboolean close_after_save;
ECalObjModType recur_mod;
@@ -345,9 +346,8 @@ save_data_free (SaveData *sd)
g_clear_object (&sd->target_client);
g_clear_object (&sd->send_comp);
g_clear_object (&sd->send_activity);
+ g_clear_object (&sd->component);
g_clear_error (&sd->error);
- if (sd->component)
- icalcomponent_free (sd->component);
g_slist_free_full (sd->mime_attach_list, itip_cal_mime_attach_free);
g_free (sd->alert_ident);
g_free (sd->alert_arg_0);
@@ -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;
@@ -382,16 +382,19 @@ ece_send_process_method (SaveData *sd,
for (attach = mime_attach_list; attach; attach = attach->next) {
struct CalMimeAttach *cma = (struct CalMimeAttach *) attach->data;
+ gchar *url;
- attach_list = g_slist_append (
- attach_list, g_strconcat (
- "cid:", cma->content_id, NULL));
+ url = g_strconcat ("cid:", cma->content_id, NULL);
+ attach_list = g_slist_prepend (attach_list, i_cal_attach_new_from_url (url));
+ g_free (url);
}
if (attach_list) {
- e_cal_component_set_attachment_list (send_comp, attach_list);
+ attach_list = g_slist_reverse (attach_list);
+
+ e_cal_component_set_attachments (send_comp, attach_list);
- g_slist_free_full (attach_list, g_free);
+ g_slist_free_full (attach_list, g_object_unref);
}
}
@@ -471,7 +474,7 @@ ece_prepare_send_component_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (sd != NULL);
g_return_if_fail (E_IS_CAL_CLIENT (sd->target_client));
- g_return_if_fail (sd->component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (sd->component));
while (!sd->send_activity) {
/* Give the main thread a chance to set this object
@@ -480,18 +483,18 @@ ece_prepare_send_component_thread (EAlertSinkThreadJobData *job_data,
g_usleep (50000);
}
- switch (icalcomponent_isa (sd->component)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (sd->component)) {
+ case I_CAL_VEVENT_COMPONENT:
alert_ident = "calendar:failed-send-event";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
alert_ident = "calendar:failed-send-memo";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
alert_ident = "calendar:failed-send-task";
break;
default:
- g_warning ("%s: Cannot send component of kind %d", G_STRFUNC, icalcomponent_isa
(sd->component));
+ g_warning ("%s: Cannot send component of kind %d", G_STRFUNC, i_cal_component_isa
(sd->component));
sd->success = FALSE;
sd->alert_ident = g_strdup ("calendar:failed-send-event");
return;
@@ -507,13 +510,13 @@ ece_prepare_send_component_thread (EAlertSinkThreadJobData *job_data,
if (sd->recur_mod == E_CAL_OBJ_MOD_ALL && e_cal_component_is_instance (sd->send_comp)) {
/* Ensure we send the master object, not the instance only */
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
const gchar *uid = NULL;
- e_cal_component_get_uid (sd->send_comp, &uid);
- if (e_cal_client_get_object_sync (sd->target_client, uid, NULL, &icalcomp, cancellable, NULL)
&&
- icalcomp != NULL) {
- send_comp = e_cal_component_new_from_icalcomponent (icalcomp);
+ uid = e_cal_component_get_uid (sd->send_comp);
+ if (e_cal_client_get_object_sync (sd->target_client, uid, NULL, &icomp, cancellable, NULL) &&
+ icomp != NULL) {
+ send_comp = e_cal_component_new_from_icalcomponent (icomp);
}
}
@@ -557,7 +560,7 @@ ece_save_component_done (gpointer ptr)
if (sd->object_created)
g_signal_emit (sd->comp_editor, signals[OBJECT_CREATED], 0, NULL);
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (sd->component));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (sd->component));
if (sd->comp_editor->priv->page_general) {
GSList *added_attendees;
@@ -624,19 +627,19 @@ ece_save_component_done (gpointer ptr)
static gboolean
ece_save_component_attachments_sync (ECalClient *cal_client,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error)
{
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *local_store;
gchar *target_filename_prefix, *filename_prefix, *tmp;
gboolean success = TRUE;
g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
- tmp = g_strdup (icalcomponent_get_uid (component));
+ tmp = g_strdup (i_cal_component_get_uid (component));
e_filename_make_safe (tmp);
filename_prefix = g_strconcat (tmp, "-", NULL);
g_free (tmp);
@@ -651,25 +654,21 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
g_free (filename_prefix);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTACH_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTACH_PROPERTY);
prop && success;
- prop = icalcomponent_get_next_property (component, ICAL_ATTACH_PROPERTY)) {
- icalattach *attach;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTACH_PROPERTY)) {
+ ICalAttach *attach;
gchar *uri = NULL;
- attach = icalproperty_get_attach (prop);
+ attach = i_cal_property_get_attach (prop);
if (!attach)
continue;
- if (icalattach_get_is_url (attach)) {
+ if (i_cal_attach_get_is_url (attach)) {
const gchar *data;
- gsize buf_size;
- data = icalattach_get_url (attach);
- buf_size = strlen (data);
- uri = g_malloc0 (buf_size + 1);
-
- icalvalue_decode_ical_string (data, uri, buf_size);
+ data = i_cal_attach_get_url (attach);
+ uri = i_cal_value_decode_ical_string (data);
}
if (uri) {
@@ -693,19 +692,15 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
uri = g_file_get_uri (destination);
if (uri) {
- icalattach *new_attach;
- gsize buf_size;
+ ICalAttach *new_attach;
gchar *buf;
- buf_size = 2 * strlen (uri) + 1;
- buf = g_malloc0 (buf_size);
-
- icalvalue_encode_ical_string (uri, buf, buf_size);
- new_attach = icalattach_new_from_url (buf);
+ buf = i_cal_value_encode_ical_string (uri);
+ new_attach = i_cal_attach_new_from_url (buf);
- icalproperty_set_attach (prop, new_attach);
+ i_cal_property_set_attach (prop, new_attach);
- icalattach_unref (new_attach);
+ g_object_unref (new_attach);
g_free (buf);
}
}
@@ -722,13 +717,14 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
success = success & !g_cancellable_set_error_if_cancelled (cancellable, error);
}
+ g_clear_object (&prop);
g_free (target_filename_prefix);
return success;
}
static void
-ece_gather_tzids_cb (icalparameter *param,
+ece_gather_tzids_cb (ICalParameter *param,
gpointer user_data)
{
GHashTable *tzids = user_data;
@@ -737,7 +733,7 @@ ece_gather_tzids_cb (icalparameter *param,
g_return_if_fail (param != NULL);
g_return_if_fail (tzids != NULL);
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (tzid && *tzid && g_ascii_strcasecmp (tzid, "UTC") != 0)
g_hash_table_insert (tzids, g_strdup (tzid), NULL);
}
@@ -753,7 +749,7 @@ ece_save_component_add_timezones_sync (SaveData *sd,
gboolean source_is_target;
g_return_val_if_fail (sd != NULL, FALSE);
- g_return_val_if_fail (sd->component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (sd->component), FALSE);
g_return_val_if_fail (sd->target_client != NULL, FALSE);
sd->success = TRUE;
@@ -763,19 +759,19 @@ ece_save_component_add_timezones_sync (SaveData *sd,
e_source_equal (e_client_get_source (E_CLIENT (sd->target_client)),
e_client_get_source (E_CLIENT (sd->source_client)));
- icalcomponent_foreach_tzid (sd->component, ece_gather_tzids_cb, tzids);
+ i_cal_component_foreach_tzid (sd->component, ece_gather_tzids_cb, tzids);
g_hash_table_iter_init (&iter, tzids);
while (sd->success && g_hash_table_iter_next (&iter, &key, &value)) {
const gchar *tzid = key;
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
GError *local_error = NULL;
if (!e_cal_client_get_timezone_sync (source_is_target ? sd->target_client : sd->source_client,
tzid, &zone, cancellable, &local_error)) {
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!zone)
- zone = icaltimezone_get_builtin_timezone (tzid);
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
if (!zone) {
g_propagate_error (error, local_error);
local_error = NULL;
@@ -806,29 +802,29 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (sd != NULL);
g_return_if_fail (E_IS_CAL_CLIENT (sd->target_client));
- g_return_if_fail (sd->component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (sd->component));
- switch (icalcomponent_isa (sd->component)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (sd->component)) {
+ case I_CAL_VEVENT_COMPONENT:
create_alert_ident = "calendar:failed-create-event";
modify_alert_ident = "calendar:failed-modify-event";
remove_alert_ident = "calendar:failed-remove-event";
get_alert_ident = "calendar:failed-get-event";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
create_alert_ident = "calendar:failed-create-memo";
modify_alert_ident = "calendar:failed-modify-memo";
remove_alert_ident = "calendar:failed-remove-memo";
get_alert_ident = "calendar:failed-get-memo";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
create_alert_ident = "calendar:failed-create-task";
modify_alert_ident = "calendar:failed-modify-task";
remove_alert_ident = "calendar:failed-remove-task";
get_alert_ident = "calendar:failed-get-task";
break;
default:
- g_warning ("%s: Cannot save component of kind %d", G_STRFUNC, icalcomponent_isa
(sd->component));
+ g_warning ("%s: Cannot save component of kind %d", G_STRFUNC, i_cal_component_isa
(sd->component));
return;
}
@@ -844,7 +840,7 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
return;
}
- orig_uid = g_strdup (icalcomponent_get_uid (sd->component));
+ orig_uid = g_strdup (i_cal_component_get_uid (sd->component));
if (cal_comp_is_icalcomp_on_server_sync (sd->component, sd->target_client, cancellable, error)) {
ECalComponent *comp;
@@ -852,7 +848,7 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
e_alert_sink_thread_job_set_alert_ident (job_data, modify_alert_ident);
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (sd->component));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (sd->component));
g_return_if_fail (comp != NULL);
has_recurrences = e_cal_util_component_has_recurrences (sd->component);
@@ -863,20 +859,20 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
sd->success = TRUE;
if (sd->recur_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);
}
sd->success = sd->success && e_cal_client_modify_object_sync (
- sd->target_client, e_cal_component_get_icalcomponent (comp), sd->recur_mod,
cancellable, error);
+ sd->target_client, e_cal_component_get_icalcomponent (comp), sd->recur_mod,
E_CAL_OPERATION_FLAG_NONE, cancellable, error);
g_clear_object (&comp);
} else {
e_alert_sink_thread_job_set_alert_ident (job_data, create_alert_ident);
- sd->success = e_cal_client_create_object_sync (sd->target_client, sd->component, &new_uid,
cancellable, error);
+ sd->success = e_cal_client_create_object_sync (sd->target_client, sd->component,
E_CAL_OPERATION_FLAG_NONE, &new_uid, cancellable, error);
if (sd->success)
sd->object_created = TRUE;
@@ -894,8 +890,8 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
recur_mod = E_CAL_OBJ_MOD_ALL;
sd->success = e_cal_client_remove_object_sync (
- sd->source_client, orig_uid,
- NULL, recur_mod, cancellable, error);
+ sd->source_client, orig_uid, NULL, recur_mod,
+ E_CAL_OPERATION_FLAG_NONE, cancellable, error);
if (!sd->success) {
gchar *source_display_name;
@@ -911,29 +907,22 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
}
if (new_uid) {
- icalcomponent_set_uid (sd->component, new_uid);
+ i_cal_component_set_uid (sd->component, new_uid);
g_free (new_uid);
}
g_free (orig_uid);
if (sd->success && !sd->close_after_save) {
- icalcomponent *comp = NULL;
+ ICalComponent *comp = NULL;
gchar *uid, *rid = NULL;
- uid = g_strdup (icalcomponent_get_uid (sd->component));
- if (icalcomponent_get_first_property (sd->component, ICAL_RECURRENCEID_PROPERTY)) {
- struct icaltimetype ridtt;
-
- ridtt = icalcomponent_get_recurrenceid (sd->component);
- if (icaltime_is_valid_time (ridtt) && !icaltime_is_null_time (ridtt)) {
- rid = icaltime_as_ical_string_r (ridtt);
- }
- }
+ uid = g_strdup (i_cal_component_get_uid (sd->component));
+ rid = e_cal_util_component_get_recurid_as_string (sd->component);
sd->success = e_cal_client_get_object_sync (sd->target_client, uid, rid, &comp, cancellable,
error);
if (sd->success && comp) {
- icalcomponent_free (sd->component);
+ g_clear_object (&sd->component);
sd->component = comp;
} else {
e_alert_sink_thread_job_set_alert_ident (job_data, get_alert_ident);
@@ -946,7 +935,7 @@ ece_save_component_thread (EAlertSinkThreadJobData *job_data,
static void
ece_save_component (ECompEditor *comp_editor,
- icalcomponent *component,
+ ICalComponent *component,
gboolean with_send,
gboolean close_after_save)
{
@@ -957,9 +946,9 @@ ece_save_component (ECompEditor *comp_editor,
gchar *source_display_name;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
- summary = icalcomponent_get_summary (component);
+ summary = i_cal_component_get_summary (component);
if (!summary || !*summary) {
if (!e_cal_dialogs_send_component_prompt_subject (GTK_WINDOW (comp_editor), component)) {
return;
@@ -981,7 +970,7 @@ ece_save_component (ECompEditor *comp_editor,
sd->comp_editor = g_object_ref (comp_editor);
sd->source_client = comp_editor->priv->source_client ? g_object_ref
(comp_editor->priv->source_client) : NULL;
sd->target_client = g_object_ref (comp_editor->priv->target_client);
- sd->component = icalcomponent_new_clone (component);
+ sd->component = i_cal_component_new_clone (component);
sd->with_send = with_send;
sd->close_after_save = close_after_save;
sd->recur_mod = recur_mod;
@@ -1098,14 +1087,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);
}
@@ -1278,10 +1267,10 @@ e_comp_editor_save_and_close (ECompEditor *comp_editor,
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
if (comp_editor->priv->component) {
- icalcomponent *component = icalcomponent_new_clone (comp_editor->priv->component);
+ ICalComponent *component = i_cal_component_new_clone (comp_editor->priv->component);
if (component && e_comp_editor_fill_component (comp_editor, component)) {
ece_save_component (comp_editor, component, TRUE, can_close);
- icalcomponent_free (component);
+ g_clear_object (&component);
}
}
}
@@ -1289,7 +1278,7 @@ e_comp_editor_save_and_close (ECompEditor *comp_editor,
static GtkResponseType
ece_save_component_dialog (ECompEditor *comp_editor)
{
- const icalcomponent *component;
+ ICalComponent *component;
GtkWindow *parent;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), GTK_RESPONSE_NO);
@@ -1297,15 +1286,15 @@ ece_save_component_dialog (ECompEditor *comp_editor)
parent = GTK_WINDOW (comp_editor);
component = e_comp_editor_get_component (comp_editor);
- switch (icalcomponent_isa (component)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (component)) {
+ case I_CAL_VEVENT_COMPONENT:
if (e_comp_editor_page_general_get_show_attendees (comp_editor->priv->page_general))
return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-meeting",
NULL);
else
return e_alert_run_dialog_for_args (parent,
"calendar:prompt-save-appointment", NULL);
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-task", NULL);
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-memo", NULL);
default:
return GTK_RESPONSE_NO;
@@ -1316,7 +1305,7 @@ static gboolean
e_comp_editor_prompt_and_save_changes (ECompEditor *comp_editor,
gboolean with_send)
{
- icalcomponent *component;
+ ICalComponent *component;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
@@ -1338,8 +1327,8 @@ 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)) {
+ i_cal_component_isa (comp_editor->priv->component) == I_CAL_VTODO_COMPONENT
+ && 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",
@@ -1349,9 +1338,9 @@ e_comp_editor_prompt_and_save_changes (ECompEditor *comp_editor,
return FALSE;
}
- component = icalcomponent_new_clone (comp_editor->priv->component);
+ component = i_cal_component_new_clone (comp_editor->priv->component);
if (!e_comp_editor_fill_component (comp_editor, component)) {
- icalcomponent_free (component);
+ g_clear_object (&component);
return FALSE;
}
@@ -1396,15 +1385,15 @@ static void
ece_print_or_preview (ECompEditor *comp_editor,
GtkPrintOperationAction print_action)
{
- icalcomponent *component;
+ ICalComponent *component;
ECalComponent *comp;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
g_return_if_fail (e_comp_editor_get_component (comp_editor) != NULL);
- component = icalcomponent_new_clone (e_comp_editor_get_component (comp_editor));
+ component = i_cal_component_new_clone (e_comp_editor_get_component (comp_editor));
if (!e_comp_editor_fill_component (comp_editor, component)) {
- icalcomponent_free (component);
+ g_clear_object (&component);
return;
}
@@ -1471,7 +1460,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));
@@ -1481,51 +1470,70 @@ ece_organizer_email_address_is_user (ECompEditor *comp_editor,
static gboolean
ece_organizer_is_user (ECompEditor *comp_editor,
- icalcomponent *component,
+ ICalComponent *component,
EClient *client)
{
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *organizer;
+ gboolean res;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
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))
+ prop = i_cal_component_get_first_property (component, I_CAL_ORGANIZER_PROPERTY);
+ if (!prop || e_client_check_capability (client, E_CAL_STATIC_CAPABILITY_NO_ORGANIZER)) {
+ g_clear_object (&prop);
return FALSE;
+ }
- organizer = itip_strip_mailto (icalproperty_get_organizer (prop));
- if (!organizer || !*organizer)
+ organizer = itip_strip_mailto (i_cal_property_get_organizer (prop));
+ if (!organizer || !*organizer) {
+ g_clear_object (&prop);
return FALSE;
+ }
+
+ res = ece_organizer_email_address_is_user (comp_editor, client, organizer, TRUE);
+
+ g_clear_object (&prop);
- return ece_organizer_email_address_is_user (comp_editor, client, organizer, TRUE);
+ return res;
}
static gboolean
ece_sentby_is_user (ECompEditor *comp_editor,
- icalcomponent *component,
+ ICalComponent *component,
EClient *client)
{
- icalproperty *prop;
- icalparameter *param;
+ ICalProperty *prop;
+ ICalParameter *param;
const gchar *sentby;
+ gboolean res;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
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))
+ prop = i_cal_component_get_first_property (component, I_CAL_ORGANIZER_PROPERTY);
+ if (!prop || e_client_check_capability (client, E_CAL_STATIC_CAPABILITY_NO_ORGANIZER)) {
+ g_clear_object (&prop);
return FALSE;
+ }
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
- if (!param)
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
+ if (!param) {
+ g_clear_object (&prop);
return FALSE;
+ }
+
+ sentby = i_cal_parameter_get_sentby (param);
- sentby = icalparameter_get_sentby (param);
+ res = ece_organizer_email_address_is_user (comp_editor, client, sentby, FALSE);
- return ece_organizer_email_address_is_user (comp_editor, client, sentby, FALSE);
+ g_clear_object (¶m);
+ g_clear_object (&prop);
+
+ return res;
}
static void
@@ -1591,12 +1599,12 @@ ece_sensitize_widgets (ECompEditor *comp_editor,
static void
ece_fill_widgets (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
GSList *link;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
for (link = comp_editor->priv->pages; link; link = g_slist_next (link)) {
ECompEditorPage *page = link->data;
@@ -1611,12 +1619,12 @@ ece_fill_widgets (ECompEditor *comp_editor,
static gboolean
ece_fill_component (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
GSList *link;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
for (link = comp_editor->priv->pages; link; link = g_slist_next (link)) {
ECompEditorPage *page = link->data;
@@ -1798,7 +1806,7 @@ e_comp_editor_set_property (GObject *object,
case PROP_COMPONENT:
e_comp_editor_set_component (
E_COMP_EDITOR (object),
- g_value_get_pointer (value));
+ g_value_get_object (value));
return;
case PROP_FLAGS:
@@ -1870,7 +1878,7 @@ e_comp_editor_get_property (GObject *object,
return;
case PROP_COMPONENT:
- g_value_set_pointer (
+ g_value_set_object (
value,
e_comp_editor_get_component (
E_COMP_EDITOR (object)));
@@ -2340,10 +2348,7 @@ e_comp_editor_dispose (GObject *object)
g_free (comp_editor->priv->title_suffix);
comp_editor->priv->title_suffix = NULL;
- if (comp_editor->priv->component) {
- icalcomponent_free (comp_editor->priv->component);
- comp_editor->priv->component = NULL;
- }
+ g_clear_object (&comp_editor->priv->component);
ece_connect_time_parts (comp_editor, NULL, NULL);
@@ -2433,10 +2438,11 @@ e_comp_editor_class_init (ECompEditorClass *klass)
g_object_class_install_property (
object_class,
PROP_COMPONENT,
- g_param_spec_pointer (
+ g_param_spec_object (
"component",
"Component",
- "icalcomponent currently edited",
+ "ICalComponent currently edited",
+ I_CAL_TYPE_COMPONENT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -2588,12 +2594,12 @@ e_comp_editor_sensitize_widgets (ECompEditor *comp_editor)
void
e_comp_editor_fill_widgets (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorClass *comp_editor_class;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
- g_return_if_fail (component != NULL);
+ g_return_if_fail (I_CAL_IS_COMPONENT (component));
comp_editor_class = E_COMP_EDITOR_GET_CLASS (comp_editor);
g_return_if_fail (comp_editor_class != NULL);
@@ -2608,13 +2614,13 @@ e_comp_editor_fill_widgets (ECompEditor *comp_editor,
gboolean
e_comp_editor_fill_component (ECompEditor *comp_editor,
- icalcomponent *component)
+ ICalComponent *component)
{
ECompEditorClass *comp_editor_class;
gboolean is_valid;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
comp_editor_class = E_COMP_EDITOR_GET_CLASS (comp_editor);
g_return_val_if_fail (comp_editor_class != NULL, FALSE);
@@ -2640,8 +2646,8 @@ e_comp_editor_fill_component (ECompEditor *comp_editor,
ece_sentby_is_user (comp_editor, component, client)))) {
gint sequence;
- sequence = icalcomponent_get_sequence (component);
- icalcomponent_set_sequence (component, sequence + 1);
+ sequence = i_cal_component_get_sequence (component);
+ i_cal_component_set_sequence (component, sequence + 1);
}
}
@@ -2706,7 +2712,7 @@ e_comp_editor_get_origin_source (ECompEditor *comp_editor)
return comp_editor->priv->origin_source;
}
-icalcomponent *
+ICalComponent *
e_comp_editor_get_component (ECompEditor *comp_editor)
{
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), NULL);
@@ -3152,98 +3158,116 @@ e_comp_editor_add_error (ECompEditor *comp_editor,
static gboolean
ece_check_start_before_end (ECompEditor *comp_editor,
- struct icaltimetype *start_tt,
- struct icaltimetype *end_tt,
+ ICalTime **pstart_tt,
+ ICalTime **pend_tt,
gboolean adjust_end_time)
{
- struct icaltimetype end_tt_copy;
- icaltimezone *start_zone, *end_zone;
+ ICalTime *start_tt, *end_tt, *end_tt_copy;
+ ICalTimezone *start_zone, *end_zone;
gint duration = -1;
gint cmp;
+ start_tt = *pstart_tt;
+ end_tt = *pend_tt;
+
if ((e_comp_editor_get_flags (comp_editor) & E_COMP_EDITOR_FLAG_IS_NEW) == 0) {
- icalcomponent *icomp;
+ ICalComponent *icomp;
icomp = e_comp_editor_get_component (comp_editor);
if (icomp &&
- icalcomponent_get_first_property (icomp, ICAL_DTSTART_PROPERTY) &&
- (icalcomponent_get_first_property (icomp, ICAL_DTEND_PROPERTY) ||
- icalcomponent_get_first_property (icomp, ICAL_DUE_PROPERTY))) {
- struct icaltimetype orig_start, orig_end;
+ e_cal_util_component_has_property (icomp, I_CAL_DTSTART_PROPERTY) &&
+ (e_cal_util_component_has_property (icomp, I_CAL_DTEND_PROPERTY) ||
+ e_cal_util_component_has_property (icomp, I_CAL_DUE_PROPERTY))) {
+ ICalTime *orig_start, *orig_end;
- orig_start = icalcomponent_get_dtstart (icomp);
- orig_end = icalcomponent_get_dtend (icomp);
+ orig_start = i_cal_component_get_dtstart (icomp);
+ orig_end = i_cal_component_get_dtend (icomp);
- if (icaltime_is_valid_time (orig_start) &&
- icaltime_is_valid_time (orig_end)) {
- duration = icaltime_as_timet (orig_end) - icaltime_as_timet (orig_start);
+ if (orig_start && i_cal_time_is_valid_time (orig_start) &&
+ orig_end && i_cal_time_is_valid_time (orig_end)) {
+ duration = i_cal_time_as_timet (orig_end) - i_cal_time_as_timet (orig_start);
}
+
+ g_clear_object (&orig_start);
+ g_clear_object (&orig_end);
}
}
- start_zone = (icaltimezone *) start_tt->zone;
- end_zone = (icaltimezone *) end_tt->zone;
+ start_zone = i_cal_time_get_timezone (start_tt);
+ end_zone = i_cal_time_get_timezone (end_tt);
/* Convert the end time to the same timezone as the start time. */
- end_tt_copy = *end_tt;
+ end_tt_copy = i_cal_time_new_clone (end_tt);
if (start_zone && end_zone && start_zone != end_zone)
- icaltimezone_convert_time (&end_tt_copy, end_zone, start_zone);
+ i_cal_timezone_convert_time (end_tt_copy, end_zone, start_zone);
/* Now check if the start time is after the end time. If it is,
* we need to modify one of the times. */
- cmp = icaltime_compare (*start_tt, end_tt_copy);
+ cmp = i_cal_time_compare (start_tt, end_tt_copy);
if (cmp > 0) {
if (adjust_end_time) {
/* Try to switch only the date */
- end_tt->year = start_tt->year;
- end_tt->month = start_tt->month;
- end_tt->day = start_tt->day;
+ i_cal_time_set_date (end_tt,
+ i_cal_time_get_year (start_tt),
+ i_cal_time_get_month (start_tt),
+ i_cal_time_get_day (start_tt));
- end_tt_copy = *end_tt;
+ g_clear_object (&end_tt_copy);
+ end_tt_copy = i_cal_time_new_clone (end_tt);
if (start_zone && end_zone && start_zone != end_zone)
- icaltimezone_convert_time (&end_tt_copy, end_zone, start_zone);
+ i_cal_timezone_convert_time (end_tt_copy, end_zone, start_zone);
if (duration > 0)
- icaltime_adjust (&end_tt_copy, 0, 0, 0, -duration);
+ i_cal_time_adjust (end_tt_copy, 0, 0, 0, -duration);
- if (icaltime_compare (*start_tt, end_tt_copy) >= 0) {
- *end_tt = *start_tt;
+ if (i_cal_time_compare (start_tt, end_tt_copy) >= 0) {
+ g_clear_object (&end_tt);
+ end_tt = i_cal_time_new_clone (start_tt);
if (duration >= 0) {
- icaltime_adjust (end_tt, 0, 0, 0, duration);
+ i_cal_time_adjust (end_tt, 0, 0, 0, duration);
} else {
/* Modify the end time, to be the start + 1 hour/day. */
- icaltime_adjust (end_tt, 0, start_tt->is_date ? 24 : 1, 0, 0);
+ i_cal_time_adjust (end_tt, 0, i_cal_time_is_date (start_tt) ? 24 : 1,
0, 0);
}
if (start_zone && end_zone && start_zone != end_zone)
- icaltimezone_convert_time (end_tt, start_zone, end_zone);
+ i_cal_timezone_convert_time (end_tt, start_zone, end_zone);
}
} else {
/* Try to switch only the date */
- start_tt->year = end_tt->year;
- start_tt->month = end_tt->month;
- start_tt->day = end_tt->day;
+ i_cal_time_set_date (start_tt,
+ i_cal_time_get_year (end_tt),
+ i_cal_time_get_month (end_tt),
+ i_cal_time_get_day (end_tt));
- if (icaltime_compare (*start_tt, end_tt_copy) >= 0) {
- *start_tt = *end_tt;
+ if (i_cal_time_compare (start_tt, end_tt_copy) >= 0) {
+ g_clear_object (&start_tt);
+ start_tt = i_cal_time_new_clone (end_tt);
if (duration >= 0) {
- icaltime_adjust (start_tt, 0, 0, 0, -duration);
+ i_cal_time_adjust (start_tt, 0, 0, 0, -duration);
} else {
/* Modify the start time, to be the end - 1 hour/day. */
- icaltime_adjust (start_tt, 0, start_tt->is_date ? -24 : -1, 0, 0);
+ i_cal_time_adjust (start_tt, 0, i_cal_time_is_date (start_tt) ? -24 :
-1, 0, 0);
}
if (start_zone && end_zone && start_zone != end_zone)
- icaltimezone_convert_time (start_tt, end_zone, start_zone);
+ i_cal_timezone_convert_time (start_tt, end_zone, start_zone);
}
}
+ *pstart_tt = start_tt;
+ *pend_tt = end_tt;
+
+ g_clear_object (&end_tt_copy);
+
return TRUE;
}
+ g_clear_object (&end_tt_copy);
+
return FALSE;
}
@@ -3254,7 +3278,7 @@ e_comp_editor_ensure_start_before_end (ECompEditor *comp_editor,
gboolean change_end_datetime)
{
ECompEditorPropertyPartDatetime *start_dtm, *end_dtm;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
gboolean set_dtstart = FALSE, set_dtend = FALSE;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
@@ -3267,28 +3291,36 @@ e_comp_editor_ensure_start_before_end (ECompEditor *comp_editor,
start_tt = e_comp_editor_property_part_datetime_get_value (start_dtm);
end_tt = e_comp_editor_property_part_datetime_get_value (end_dtm);
- if (icaltime_is_null_time (start_tt) ||
- icaltime_is_null_time (end_tt) ||
- !icaltime_is_valid_time (start_tt) ||
- !icaltime_is_valid_time (end_tt))
+ if (!start_tt || !end_tt ||
+ i_cal_time_is_null_time (start_tt) ||
+ i_cal_time_is_null_time (end_tt) ||
+ !i_cal_time_is_valid_time (start_tt) ||
+ !i_cal_time_is_valid_time (end_tt)) {
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
return;
+ }
- if (start_tt.is_date || end_tt.is_date) {
+ if (i_cal_time_is_date (start_tt) || i_cal_time_is_date (end_tt)) {
/* All Day Events are simple. We just compare the dates and if
* start > end we copy one of them to the other. */
gint cmp;
- start_tt.is_date = TRUE;
- end_tt.is_date = TRUE;
+ i_cal_time_set_is_date (start_tt, TRUE);
+ i_cal_time_set_is_date (end_tt, TRUE);
- cmp = icaltime_compare_date_only (start_tt, end_tt);
+ cmp = i_cal_time_compare_date_only (start_tt, end_tt);
if (cmp > 0) {
if (change_end_datetime) {
+ g_clear_object (&end_tt);
end_tt = start_tt;
+ start_tt = NULL;
set_dtend = TRUE;
} else {
+ g_clear_object (&start_tt);
start_tt = end_tt;
+ end_tt = NULL;
set_dtstart = TRUE;
}
}
@@ -3312,41 +3344,47 @@ e_comp_editor_ensure_start_before_end (ECompEditor *comp_editor,
e_comp_editor_set_updating (comp_editor, FALSE);
}
+
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
}
static gboolean
e_comp_editor_holds_component (ECompEditor *comp_editor,
ESource *origin_source,
- const icalcomponent *component)
+ const ICalComponent *component)
{
const gchar *component_uid, *editor_uid;
gboolean equal;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), FALSE);
- g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), FALSE);
if (!origin_source || !comp_editor->priv->origin_source ||
!e_source_equal (origin_source, comp_editor->priv->origin_source))
return FALSE;
- component_uid = icalcomponent_get_uid ((icalcomponent *) component);
- editor_uid = icalcomponent_get_uid (comp_editor->priv->component);
+ component_uid = i_cal_component_get_uid ((ICalComponent *) component);
+ editor_uid = i_cal_component_get_uid (comp_editor->priv->component);
if (!component_uid || !editor_uid)
return FALSE;
equal = g_strcmp0 (component_uid, editor_uid) == 0;
if (equal) {
- struct icaltimetype component_rid, editor_rid;
+ ICalTime *component_rid, *editor_rid;
- component_rid = icalcomponent_get_recurrenceid ((icalcomponent *) component);
- editor_rid = icalcomponent_get_recurrenceid (comp_editor->priv->component);
+ component_rid = i_cal_component_get_recurrenceid ((ICalComponent *) component);
+ editor_rid = i_cal_component_get_recurrenceid (comp_editor->priv->component);
- if (icaltime_is_null_time (component_rid)) {
- equal = icaltime_is_null_time (editor_rid);
- } else if (!icaltime_is_null_time (editor_rid)) {
- equal = icaltime_compare (component_rid, editor_rid) == 0;
+ if (!component_rid || i_cal_time_is_null_time (component_rid)) {
+ equal = !editor_rid || i_cal_time_is_null_time (editor_rid);
+ } else if (editor_rid && !i_cal_time_is_null_time (editor_rid)) {
+ equal = i_cal_time_compare (component_rid, editor_rid) == 0;
}
+
+ g_clear_object (&component_rid);
+ g_clear_object (&editor_rid);
}
return equal;
@@ -3356,7 +3394,7 @@ 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 *comp_editor;
@@ -3365,7 +3403,7 @@ e_comp_editor_open_for_component (GtkWindow *parent,
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
if (origin_source)
g_return_val_if_fail (E_IS_SOURCE (origin_source), NULL);
- g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), NULL);
comp_editor = e_comp_editor_find_existing_for (origin_source, component);
if (comp_editor) {
@@ -3373,14 +3411,14 @@ e_comp_editor_open_for_component (GtkWindow *parent,
return comp_editor;
}
- switch (icalcomponent_isa (component)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (component)) {
+ case I_CAL_VEVENT_COMPONENT:
comp_editor_type = E_TYPE_COMP_EDITOR_EVENT;
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
comp_editor_type = E_TYPE_COMP_EDITOR_TASK;
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
comp_editor_type = E_TYPE_COMP_EDITOR_MEMO;
break;
default:
@@ -3404,14 +3442,14 @@ e_comp_editor_open_for_component (GtkWindow *parent,
ECompEditor *
e_comp_editor_find_existing_for (ESource *origin_source,
- const icalcomponent *component)
+ const ICalComponent *component)
{
ECompEditor *comp_editor;
GSList *link;
if (origin_source)
g_return_val_if_fail (E_IS_SOURCE (origin_source), NULL);
- g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (I_CAL_IS_COMPONENT (component), NULL);
for (link = opened_editors; link; link = g_slist_next (link)) {
comp_editor = link->data;
@@ -3429,21 +3467,21 @@ e_comp_editor_find_existing_for (ESource *origin_source,
}
/* Returned pointer is owned by libical or ECalClient; can return NULL */
-icaltimezone *
+ICalTimezone *
e_comp_editor_lookup_timezone (ECompEditor *comp_editor,
const gchar *tzid)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), NULL);
if (!tzid || !*tzid)
return NULL;
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!zone)
- zone = icaltimezone_get_builtin_timezone (tzid);
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
if (!zone && comp_editor->priv->source_client) {
if (!e_cal_client_get_timezone_sync (comp_editor->priv->source_client, tzid, &zone, NULL,
NULL))
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..39e93634fe 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
@@ -784,13 +788,13 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
("%2i:%02i-%2i:%02i",
start_display_hour, start_minute,
end_display_hour, end_minute);
- } else {
- if (format_time) {
+ } else if (format_time) {
/* 24 hour format without end time. */
text = g_strdup_printf
("%2i:%02i",
start_display_hour, start_minute);
- }
+ } else {
+ text = NULL;
}
} else {
if (day_view->show_event_end_times && show_span) {
@@ -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.c b/src/calendar/gui/e-meeting-attendee.c
index 3c50466daf..133a0197c5 100644
--- a/src/calendar/gui/e-meeting-attendee.c
+++ b/src/calendar/gui/e-meeting-attendee.c
@@ -35,15 +35,15 @@ struct _EMeetingAttendeePrivate {
gchar *member;
gchar *fburi;
- icalparameter_cutype cutype;
- icalparameter_role role;
+ ICalParameterCutype cutype;
+ ICalParameterRole role;
gboolean rsvp;
gchar *delto;
gchar *delfrom;
- icalparameter_partstat status;
+ ICalParameterPartstat partstat;
gchar *sentby;
gchar *cn;
@@ -76,13 +76,13 @@ static void e_meeting_attendee_finalize (GObject *obj);
G_DEFINE_TYPE (EMeetingAttendee, e_meeting_attendee, G_TYPE_OBJECT)
static gchar *
-string_test (gchar *string)
+string_test (const gchar *string)
{
- return string != NULL ? string : g_strdup ("");
+ return g_strdup (string ? string : "");
}
static gboolean
-string_is_set (gchar *string)
+string_is_set (const gchar *string)
{
if (string != NULL && *string != '\0')
return TRUE;
@@ -110,25 +110,42 @@ notify_changed (EMeetingAttendee *ia)
g_signal_emit_by_name (ia, "changed");
}
+static void
+set_string_value (EMeetingAttendee *ia,
+ gchar **member,
+ const gchar *value)
+{
+ if (!string_is_set (*member) && !string_is_set (value))
+ return;
+
+ if (g_strcmp0 (*member, value) == 0)
+ return;
+
+ g_free (*member);
+ *member = string_test (value);
+
+ notify_changed (ia);
+}
+
static void
e_meeting_attendee_finalize (GObject *object)
{
- EMeetingAttendeePrivate *priv;
+ EMeetingAttendee *ia;
- priv = E_MEETING_ATTENDEE_GET_PRIVATE (object);
+ ia = E_MEETING_ATTENDEE (object);
- g_free (priv->address);
- g_free (priv->member);
- g_free (priv->fburi);
+ g_free (ia->priv->address);
+ g_free (ia->priv->member);
+ g_free (ia->priv->fburi);
- g_free (priv->delto);
- g_free (priv->delfrom);
+ g_free (ia->priv->delto);
+ g_free (ia->priv->delfrom);
- g_free (priv->sentby);
- g_free (priv->cn);
- g_free (priv->language);
+ g_free (ia->priv->sentby);
+ g_free (ia->priv->cn);
+ g_free (ia->priv->language);
- g_array_free (priv->busy_periods, TRUE);
+ g_array_free (ia->priv->busy_periods, TRUE);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize (object);
@@ -162,15 +179,15 @@ e_meeting_attendee_init (EMeetingAttendee *ia)
ia->priv->address = string_test (NULL);
ia->priv->member = string_test (NULL);
- ia->priv->cutype = ICAL_CUTYPE_NONE;
- ia->priv->role = ICAL_ROLE_NONE;
+ ia->priv->cutype = I_CAL_CUTYPE_NONE;
+ ia->priv->role = I_CAL_ROLE_NONE;
ia->priv->rsvp = FALSE;
ia->priv->delto = string_test (NULL);
ia->priv->delfrom = string_test (NULL);
- ia->priv->status = ICAL_PARTSTAT_NONE;
+ ia->priv->partstat = I_CAL_PARTSTAT_NONE;
ia->priv->sentby = string_test (NULL);
ia->priv->cn = string_test (NULL);
@@ -205,465 +222,351 @@ e_meeting_attendee_new (void)
}
GObject *
-e_meeting_attendee_new_from_e_cal_component_attendee (ECalComponentAttendee *ca)
+e_meeting_attendee_new_from_e_cal_component_attendee (const ECalComponentAttendee *ca)
{
EMeetingAttendee *ia;
+ g_return_val_if_fail (ca != NULL, NULL);
+
ia = E_MEETING_ATTENDEE (g_object_new (E_TYPE_MEETING_ATTENDEE, NULL));
- e_meeting_attendee_set_address (ia, g_strdup (ca->value));
- e_meeting_attendee_set_member (ia, g_strdup (ca->member));
- e_meeting_attendee_set_cutype (ia, ca->cutype);
- e_meeting_attendee_set_role (ia, ca->role);
- e_meeting_attendee_set_status (ia, ca->status);
- e_meeting_attendee_set_rsvp (ia, ca->rsvp);
- e_meeting_attendee_set_delto (ia, g_strdup (ca->delto));
- e_meeting_attendee_set_delfrom (ia, g_strdup (ca->delfrom));
- e_meeting_attendee_set_sentby (ia, g_strdup (ca->sentby));
- e_meeting_attendee_set_cn (ia, g_strdup (ca->cn));
- e_meeting_attendee_set_language (ia, g_strdup (ca->language));
+ e_meeting_attendee_set_address (ia, e_cal_component_attendee_get_value (ca));
+ e_meeting_attendee_set_member (ia, e_cal_component_attendee_get_member (ca));
+ e_meeting_attendee_set_cutype (ia, e_cal_component_attendee_get_cutype (ca));
+ e_meeting_attendee_set_role (ia, e_cal_component_attendee_get_role (ca));
+ e_meeting_attendee_set_partstat (ia, e_cal_component_attendee_get_partstat (ca));
+ e_meeting_attendee_set_rsvp (ia, e_cal_component_attendee_get_rsvp (ca));
+ e_meeting_attendee_set_delto (ia, e_cal_component_attendee_get_delegatedto (ca));
+ e_meeting_attendee_set_delfrom (ia, e_cal_component_attendee_get_delegatedfrom (ca));
+ e_meeting_attendee_set_sentby (ia, e_cal_component_attendee_get_sentby (ca));
+ e_meeting_attendee_set_cn (ia, e_cal_component_attendee_get_cn (ca));
+ e_meeting_attendee_set_language (ia, e_cal_component_attendee_get_language (ca));
return G_OBJECT (ia);
}
ECalComponentAttendee *
-e_meeting_attendee_as_e_cal_component_attendee (EMeetingAttendee *ia)
+e_meeting_attendee_as_e_cal_component_attendee (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
- ECalComponentAttendee *ca;
-
- priv = ia->priv;
-
- ca = g_new0 (ECalComponentAttendee, 1);
-
- ca->value = priv->address;
- ca->member = string_is_set (priv->member) ? priv->member : NULL;
- ca->cutype= priv->cutype;
- ca->role = priv->role;
- ca->status = priv->status;
- ca->rsvp = priv->rsvp;
- ca->delto = string_is_set (priv->delto) ? priv->delto : NULL;
- ca->delfrom = string_is_set (priv->delfrom) ? priv->delfrom : NULL;
- ca->sentby = string_is_set (priv->sentby) ? priv->sentby : NULL;
- ca->cn = string_is_set (priv->cn) ? priv->cn : NULL;
- ca->language = string_is_set (priv->language) ? priv->language : NULL;
-
- return ca;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
+
+ return e_cal_component_attendee_new_full (
+ ia->priv->address,
+ string_is_set (ia->priv->member) ? ia->priv->member : NULL,
+ ia->priv->cutype,
+ ia->priv->role,
+ ia->priv->partstat,
+ ia->priv->rsvp,
+ string_is_set (ia->priv->delfrom) ? ia->priv->delfrom : NULL,
+ string_is_set (ia->priv->delto) ? ia->priv->delto : NULL,
+ string_is_set (ia->priv->sentby) ? ia->priv->sentby : NULL,
+ string_is_set (ia->priv->cn) ? ia->priv->cn : NULL,
+ string_is_set (ia->priv->language) ? ia->priv->language : NULL);
}
const gchar *
-e_meeting_attendee_get_fburi (EMeetingAttendee *ia)
+e_meeting_attendee_get_fburi (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- priv = ia->priv;
-
- return priv->fburi;
+ return ia->priv->fburi;
}
void
e_meeting_attendee_set_fburi (EMeetingAttendee *ia,
- gchar *fburi)
+ const gchar *fburi)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->fburi != NULL)
- g_free (priv->fburi);
-
- priv->fburi = string_test (fburi);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->fburi, fburi);
}
const gchar *
-e_meeting_attendee_get_address (EMeetingAttendee *ia)
+e_meeting_attendee_get_address (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- priv = ia->priv;
-
- return priv->address;
+ return ia->priv->address;
}
void
e_meeting_attendee_set_address (EMeetingAttendee *ia,
- gchar *address)
+ const gchar *address)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->address != NULL)
- g_free (priv->address);
-
- priv->address = string_test (address);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->address, address);
}
gboolean
-e_meeting_attendee_is_set_address (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_address (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->address);
+ return string_is_set (ia->priv->address);
}
const gchar *
-e_meeting_attendee_get_member (EMeetingAttendee *ia)
+e_meeting_attendee_get_member (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- priv = ia->priv;
-
- return priv->member;
+ return ia->priv->member;
}
void
e_meeting_attendee_set_member (EMeetingAttendee *ia,
- gchar *member)
+ const gchar *member)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->member != NULL)
- g_free (priv->member);
-
- priv->member = string_test (member);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->member, member);
}
gboolean
-e_meeting_attendee_is_set_member (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_member (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->member);
+ return string_is_set (ia->priv->member);
}
-icalparameter_cutype
-e_meeting_attendee_get_cutype (EMeetingAttendee *ia)
+ICalParameterCutype
+e_meeting_attendee_get_cutype (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), I_CAL_CUTYPE_NONE);
- return priv->cutype;
+ return ia->priv->cutype;
}
void
e_meeting_attendee_set_cutype (EMeetingAttendee *ia,
- icalparameter_cutype cutype)
+ ICalParameterCutype cutype)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- priv->cutype = cutype;
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ if (ia->priv->cutype != cutype) {
+ ia->priv->cutype = cutype;
+ notify_changed (ia);
+ }
}
-icalparameter_role
-e_meeting_attendee_get_role (EMeetingAttendee *ia)
+ICalParameterRole
+e_meeting_attendee_get_role (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), I_CAL_ROLE_NONE);
- return priv->role;
+ return ia->priv->role;
}
void
e_meeting_attendee_set_role (EMeetingAttendee *ia,
- icalparameter_role role)
+ ICalParameterRole role)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- priv->role = role;
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ if (ia->priv->role != role) {
+ ia->priv->role = role;
+ notify_changed (ia);
+ }
}
gboolean
-e_meeting_attendee_get_rsvp (EMeetingAttendee *ia)
+e_meeting_attendee_get_rsvp (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return priv->rsvp;
+ return ia->priv->rsvp;
}
void
e_meeting_attendee_set_rsvp (EMeetingAttendee *ia,
gboolean rsvp)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- priv->rsvp = rsvp;
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ if ((ia->priv->rsvp ? 1 : 0) != (rsvp ? 1 : 0)) {
+ ia->priv->rsvp = rsvp;
+ notify_changed (ia);
+ }
}
const gchar *
-e_meeting_attendee_get_delto (EMeetingAttendee *ia)
+e_meeting_attendee_get_delto (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- priv = ia->priv;
-
- return priv->delto;
+ return ia->priv->delto;
}
void
e_meeting_attendee_set_delto (EMeetingAttendee *ia,
- gchar *delto)
+ const gchar *delto)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->delto != NULL)
- g_free (priv->delto);
-
- priv->delto = string_test (delto);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->delto, delto);
}
gboolean
-e_meeting_attendee_is_set_delto (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_delto (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->delto);
+ return string_is_set (ia->priv->delto);
}
const gchar *
-e_meeting_attendee_get_delfrom (EMeetingAttendee *ia)
+e_meeting_attendee_get_delfrom (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- priv = ia->priv;
-
- return priv->delfrom;
+ return ia->priv->delfrom;
}
void
e_meeting_attendee_set_delfrom (EMeetingAttendee *ia,
- gchar *delfrom)
+ const gchar *delfrom)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->delfrom != NULL)
- g_free (priv->delfrom);
-
- priv->delfrom = string_test (delfrom);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->delfrom, delfrom);
}
gboolean
-e_meeting_attendee_is_set_delfrom (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_delfrom (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->delfrom);
+ return string_is_set (ia->priv->delfrom);
}
-icalparameter_partstat
-e_meeting_attendee_get_status (EMeetingAttendee *ia)
+ICalParameterPartstat
+e_meeting_attendee_get_partstat (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), I_CAL_PARTSTAT_NONE);
- return priv->status;
+ return ia->priv->partstat;
}
void
-e_meeting_attendee_set_status (EMeetingAttendee *ia,
- icalparameter_partstat status)
+e_meeting_attendee_set_partstat (EMeetingAttendee *ia,
+ ICalParameterPartstat partstat)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- priv->status = status;
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ if (ia->priv->partstat != partstat) {
+ ia->priv->partstat = partstat;
+ notify_changed (ia);
+ }
}
const gchar *
-e_meeting_attendee_get_sentby (EMeetingAttendee *ia)
+e_meeting_attendee_get_sentby (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- return priv->sentby;
+ return ia->priv->sentby;
}
void
e_meeting_attendee_set_sentby (EMeetingAttendee *ia,
- gchar *sentby)
+ const gchar *sentby)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->sentby != NULL)
- g_free (priv->sentby);
-
- priv->sentby = string_test (sentby);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->sentby, sentby);
}
gboolean
-e_meeting_attendee_is_set_sentby (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_sentby (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->sentby);
+ return string_is_set (ia->priv->sentby);
}
const gchar *
-e_meeting_attendee_get_cn (EMeetingAttendee *ia)
+e_meeting_attendee_get_cn (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- return priv->cn;
+ return ia->priv->cn;
}
void
e_meeting_attendee_set_cn (EMeetingAttendee *ia,
- gchar *cn)
+ const gchar *cn)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->cn != NULL)
- g_free (priv->cn);
-
- priv->cn = string_test (cn);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->cn, cn);
}
gboolean
-e_meeting_attendee_is_set_cn (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_cn (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->cn);
+ return string_is_set (ia->priv->cn);
}
const gchar *
-e_meeting_attendee_get_language (EMeetingAttendee *ia)
+e_meeting_attendee_get_language (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
- return priv->language;
+ return ia->priv->language;
}
void
e_meeting_attendee_set_language (EMeetingAttendee *ia,
- gchar *language)
+ const gchar *language)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->language != NULL)
- g_free (priv->language);
-
- priv->language = string_test (language);
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- notify_changed (ia);
+ set_string_value (ia, &ia->priv->language, language);
}
gboolean
-e_meeting_attendee_is_set_language (EMeetingAttendee *ia)
+e_meeting_attendee_is_set_language (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return string_is_set (priv->language);
+ return string_is_set (ia->priv->language);
}
EMeetingAttendeeType
-e_meeting_attendee_get_atype (EMeetingAttendee *ia)
+e_meeting_attendee_get_atype (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), E_MEETING_ATTENDEE_RESOURCE_UNKNOWN);
- if (priv->cutype == ICAL_CUTYPE_ROOM
- || priv->cutype == ICAL_CUTYPE_RESOURCE)
+ if (ia->priv->cutype == I_CAL_CUTYPE_ROOM ||
+ ia->priv->cutype == I_CAL_CUTYPE_RESOURCE)
return E_MEETING_ATTENDEE_RESOURCE;
- if (priv->role == ICAL_ROLE_CHAIR
- || priv->role == ICAL_ROLE_REQPARTICIPANT)
+ if (ia->priv->role == I_CAL_ROLE_CHAIR ||
+ ia->priv->role == I_CAL_ROLE_REQPARTICIPANT)
return E_MEETING_ATTENDEE_REQUIRED_PERSON;
return E_MEETING_ATTENDEE_OPTIONAL_PERSON;
}
EMeetingAttendeeEditLevel
-e_meeting_attendee_get_edit_level (EMeetingAttendee *ia)
+e_meeting_attendee_get_edit_level (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- g_return_val_if_fail (ia != NULL, E_MEETING_ATTENDEE_EDIT_NONE);
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), E_MEETING_ATTENDEE_EDIT_NONE);
- priv = ia->priv;
-
- return priv->edit_level;
+ return ia->priv->edit_level;
}
void
e_meeting_attendee_set_edit_level (EMeetingAttendee *ia,
EMeetingAttendeeEditLevel level)
{
- EMeetingAttendeePrivate *priv;
-
- g_return_if_fail (ia != NULL);
g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- priv = ia->priv;
-
- priv->edit_level = level;
+ ia->priv->edit_level = level;
}
static gint
@@ -707,23 +610,19 @@ compare_period_starts (gconstpointer arg1,
static void
ensure_periods_sorted (EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
-
- if (priv->busy_periods_sorted)
+ if (ia->priv->busy_periods_sorted)
return;
qsort (
- priv->busy_periods->data, priv->busy_periods->len,
+ ia->priv->busy_periods->data, ia->priv->busy_periods->len,
sizeof (EMeetingFreeBusyPeriod),
compare_period_starts);
- priv->busy_periods_sorted = TRUE;
+ ia->priv->busy_periods_sorted = TRUE;
}
gboolean
-e_meeting_attendee_get_show_address (EMeetingAttendee *ia)
+e_meeting_attendee_get_show_address (const EMeetingAttendee *ia)
{
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
@@ -745,48 +644,41 @@ e_meeting_attendee_set_show_address (EMeetingAttendee *ia,
}
gboolean
-e_meeting_attendee_get_has_calendar_info (EMeetingAttendee *ia)
+e_meeting_attendee_get_has_calendar_info (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- return priv->has_calendar_info;
+ return ia->priv->has_calendar_info;
}
void
e_meeting_attendee_set_has_calendar_info (EMeetingAttendee *ia,
gboolean has_calendar_info)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- priv->has_calendar_info = has_calendar_info;
+ ia->priv->has_calendar_info = has_calendar_info;
}
const GArray *
e_meeting_attendee_get_busy_periods (EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), NULL);
ensure_periods_sorted (ia);
- return priv->busy_periods;
+ return ia->priv->busy_periods;
}
gint
e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia,
- GDate *date)
+ const GDate *date)
{
- EMeetingAttendeePrivate *priv;
EMeetingFreeBusyPeriod *period;
gint lower, upper, middle = 0, cmp = 0;
GDate tmp_date;
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), -1);
/* Make sure the busy periods have been sorted. */
ensure_periods_sorted (ia);
@@ -794,11 +686,11 @@ e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia,
/* Calculate the first day which could have a busy period which
* continues onto our given date. */
tmp_date = *date;
- g_date_subtract_days (&tmp_date, priv->longest_period_in_days);
+ g_date_subtract_days (&tmp_date, ia->priv->longest_period_in_days);
/* We want the first busy period which starts on tmp_date. */
lower = 0;
- upper = priv->busy_periods->len;
+ upper = ia->priv->busy_periods->len;
if (upper == 0)
return -1;
@@ -806,7 +698,7 @@ e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia,
while (lower < upper) {
middle = (lower + upper) >> 1;
- period = &g_array_index (priv->busy_periods,
+ period = &g_array_index (ia->priv->busy_periods,
EMeetingFreeBusyPeriod, middle);
cmp = g_date_compare (&tmp_date, &period->start.date);
@@ -823,7 +715,7 @@ e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia,
* backwards to the first one. */
if (cmp == 0) {
while (middle > 0) {
- period = &g_array_index (priv->busy_periods,
+ period = &g_array_index (ia->priv->busy_periods,
EMeetingFreeBusyPeriod, middle - 1);
if (g_date_compare (&tmp_date, &period->start.date) != 0)
break;
@@ -834,7 +726,7 @@ e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia,
* the last one we looked at was before it, so if there are
* any more periods after this one we return it. */
middle++;
- if (priv->busy_periods->len <= middle)
+ if (ia->priv->busy_periods->len <= middle)
return -1;
}
@@ -857,18 +749,14 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
const gchar *summary,
const gchar *location)
{
- EMeetingAttendeePrivate *priv;
EMeetingFreeBusyPeriod period;
gint period_in_days;
- g_return_val_if_fail (ia != NULL, FALSE);
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
g_return_val_if_fail (busy_type < E_MEETING_FREE_BUSY_LAST, FALSE);
/* summary may be NULL (optional XFB data) */
/* location may be NULL (optional XFB data) */
- priv = ia->priv;
-
/* Check the dates are valid. */
if (!g_date_valid_dmy (start_day, start_month, start_year))
return FALSE;
@@ -902,31 +790,31 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
goto done;
/* If the busy range is not set elsewhere, track it as best we can */
- if (!priv->start_busy_range_set) {
- if (!g_date_valid (&priv->busy_periods_start.date)) {
- priv->busy_periods_start.date = period.start.date;
- priv->busy_periods_start.hour = period.start.hour;
- priv->busy_periods_start.minute = period.start.minute;
+ if (!ia->priv->start_busy_range_set) {
+ if (!g_date_valid (&ia->priv->busy_periods_start.date)) {
+ ia->priv->busy_periods_start.date = period.start.date;
+ ia->priv->busy_periods_start.hour = period.start.hour;
+ ia->priv->busy_periods_start.minute = period.start.minute;
} else {
gint compare;
compare = g_date_compare (
&period.start.date,
- &priv->busy_periods_start.date);
+ &ia->priv->busy_periods_start.date);
switch (compare) {
case -1:
- priv->busy_periods_start.date = period.start.date;
- priv->busy_periods_start.hour = period.start.hour;
- priv->busy_periods_start.minute = period.start.minute;
+ ia->priv->busy_periods_start.date = period.start.date;
+ ia->priv->busy_periods_start.hour = period.start.hour;
+ ia->priv->busy_periods_start.minute = period.start.minute;
break;
case 0:
- if (period.start.hour < priv->busy_periods_start.hour
- || (period.start.hour == priv->busy_periods_start.hour
- && period.start.minute < priv->busy_periods_start.minute)) {
- priv->busy_periods_start.date = period.start.date;
- priv->busy_periods_start.hour = period.start.hour;
- priv->busy_periods_start.minute = period.start.minute;
+ if (period.start.hour < ia->priv->busy_periods_start.hour
+ || (period.start.hour == ia->priv->busy_periods_start.hour
+ && period.start.minute < ia->priv->busy_periods_start.minute)) {
+ ia->priv->busy_periods_start.date = period.start.date;
+ ia->priv->busy_periods_start.hour = period.start.hour;
+ ia->priv->busy_periods_start.minute = period.start.minute;
break;
}
break;
@@ -934,33 +822,33 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
}
}
- if (!priv->end_busy_range_set) {
- if (!g_date_valid (&priv->busy_periods_end.date)) {
- priv->busy_periods_end.date = period.end.date;
- priv->busy_periods_end.hour = period.end.hour;
- priv->busy_periods_end.minute = period.end.minute;
+ if (!ia->priv->end_busy_range_set) {
+ if (!g_date_valid (&ia->priv->busy_periods_end.date)) {
+ ia->priv->busy_periods_end.date = period.end.date;
+ ia->priv->busy_periods_end.hour = period.end.hour;
+ ia->priv->busy_periods_end.minute = period.end.minute;
} else {
gint compare;
compare = g_date_compare (
&period.end.date,
- &priv->busy_periods_end.date);
+ &ia->priv->busy_periods_end.date);
switch (compare) {
case 0:
- if (period.end.hour > priv->busy_periods_end.hour
- || (period.end.hour == priv->busy_periods_end.hour
- && period.end.minute > priv->busy_periods_end.minute)) {
- priv->busy_periods_end.date = period.end.date;
- priv->busy_periods_end.hour = period.end.hour;
- priv->busy_periods_end.minute = period.end.minute;
+ if (period.end.hour > ia->priv->busy_periods_end.hour
+ || (period.end.hour == ia->priv->busy_periods_end.hour
+ && period.end.minute > ia->priv->busy_periods_end.minute)) {
+ ia->priv->busy_periods_end.date = period.end.date;
+ ia->priv->busy_periods_end.hour = period.end.hour;
+ ia->priv->busy_periods_end.minute = period.end.minute;
break;
}
break;
case 1:
- priv->busy_periods_end.date = period.end.date;
- priv->busy_periods_end.hour = period.end.hour;
- priv->busy_periods_end.minute = period.end.minute;
+ ia->priv->busy_periods_end.date = period.end.date;
+ ia->priv->busy_periods_end.hour = period.end.hour;
+ ia->priv->busy_periods_end.minute = period.end.minute;
break;
}
}
@@ -970,39 +858,47 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
e_meeting_xfb_data_init (&(period.xfb));
e_meeting_xfb_data_set (&(period.xfb), summary, location);
- g_array_append_val (priv->busy_periods, period);
+ g_array_append_val (ia->priv->busy_periods, period);
period_in_days =
g_date_get_julian (&period.end.date) -
g_date_get_julian (&period.start.date) + 1;
- priv->longest_period_in_days =
- MAX (priv->longest_period_in_days, period_in_days);
+ ia->priv->longest_period_in_days =
+ MAX (ia->priv->longest_period_in_days, period_in_days);
done:
- priv->has_calendar_info = TRUE;
- priv->busy_periods_sorted = FALSE;
+ ia->priv->has_calendar_info = TRUE;
+ ia->priv->busy_periods_sorted = FALSE;
return TRUE;
}
EMeetingTime
-e_meeting_attendee_get_start_busy_range (EMeetingAttendee *ia)
+e_meeting_attendee_get_start_busy_range (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ EMeetingTime mt;
+
+ g_date_clear (&mt.date, 1);
+ mt.hour = 0;
+ mt.minute = 0;
- priv = ia->priv;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), mt);
- return priv->busy_periods_start;
+ return ia->priv->busy_periods_start;
}
EMeetingTime
-e_meeting_attendee_get_end_busy_range (EMeetingAttendee *ia)
+e_meeting_attendee_get_end_busy_range (const EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
+ EMeetingTime mt;
- priv = ia->priv;
+ g_date_clear (&mt.date, 1);
+ mt.hour = 0;
+ mt.minute = 0;
- return priv->busy_periods_end;
+ g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), mt);
+
+ return ia->priv->busy_periods_end;
}
gboolean
@@ -1013,12 +909,8 @@ e_meeting_attendee_set_start_busy_range (EMeetingAttendee *ia,
gint start_hour,
gint start_minute)
{
- EMeetingAttendeePrivate *priv;
-
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- priv = ia->priv;
-
/* Check the dates are valid. */
if (!g_date_valid_dmy (start_day, start_month, start_year))
return FALSE;
@@ -1027,14 +919,14 @@ e_meeting_attendee_set_start_busy_range (EMeetingAttendee *ia,
if (start_minute < 0 || start_minute > 59)
return FALSE;
- g_date_clear (&priv->busy_periods_start.date, 1);
+ g_date_clear (&ia->priv->busy_periods_start.date, 1);
g_date_set_dmy (
- &priv->busy_periods_start.date,
+ &ia->priv->busy_periods_start.date,
start_day, start_month, start_year);
- priv->busy_periods_start.hour = start_hour;
- priv->busy_periods_start.minute = start_minute;
+ ia->priv->busy_periods_start.hour = start_hour;
+ ia->priv->busy_periods_start.minute = start_minute;
- priv->start_busy_range_set = TRUE;
+ ia->priv->start_busy_range_set = TRUE;
return TRUE;
}
@@ -1047,12 +939,8 @@ e_meeting_attendee_set_end_busy_range (EMeetingAttendee *ia,
gint end_hour,
gint end_minute)
{
- EMeetingAttendeePrivate *priv;
-
g_return_val_if_fail (E_IS_MEETING_ATTENDEE (ia), FALSE);
- priv = ia->priv;
-
/* Check the dates are valid. */
if (!g_date_valid_dmy (end_day, end_month, end_year))
return FALSE;
@@ -1061,14 +949,14 @@ e_meeting_attendee_set_end_busy_range (EMeetingAttendee *ia,
if (end_minute < 0 || end_minute > 59)
return FALSE;
- g_date_clear (&priv->busy_periods_end.date, 1);
+ g_date_clear (&ia->priv->busy_periods_end.date, 1);
g_date_set_dmy (
- &priv->busy_periods_end.date,
+ &ia->priv->busy_periods_end.date,
end_day, end_month, end_year);
- priv->busy_periods_end.hour = end_hour;
- priv->busy_periods_end.minute = end_minute;
+ ia->priv->busy_periods_end.hour = end_hour;
+ ia->priv->busy_periods_end.minute = end_minute;
- priv->end_busy_range_set = TRUE;
+ ia->priv->end_busy_range_set = TRUE;
return TRUE;
}
@@ -1077,22 +965,18 @@ e_meeting_attendee_set_end_busy_range (EMeetingAttendee *ia,
void
e_meeting_attendee_clear_busy_periods (EMeetingAttendee *ia)
{
- EMeetingAttendeePrivate *priv;
-
g_return_if_fail (E_IS_MEETING_ATTENDEE (ia));
- priv = ia->priv;
+ g_array_set_size (ia->priv->busy_periods, 0);
+ ia->priv->busy_periods_sorted = TRUE;
- g_array_set_size (priv->busy_periods, 0);
- priv->busy_periods_sorted = TRUE;
-
- g_date_clear (&priv->busy_periods_start.date, 1);
- priv->busy_periods_start.hour = 0;
- priv->busy_periods_start.minute = 0;
+ g_date_clear (&ia->priv->busy_periods_start.date, 1);
+ ia->priv->busy_periods_start.hour = 0;
+ ia->priv->busy_periods_start.minute = 0;
- g_date_clear (&priv->busy_periods_end.date, 1);
- priv->busy_periods_end.hour = 0;
- priv->busy_periods_end.minute = 0;
+ g_date_clear (&ia->priv->busy_periods_end.date, 1);
+ ia->priv->busy_periods_end.hour = 0;
+ ia->priv->busy_periods_end.minute = 0;
- priv->longest_period_in_days = 0;
+ ia->priv->longest_period_in_days = 0;
}
diff --git a/src/calendar/gui/e-meeting-attendee.h b/src/calendar/gui/e-meeting-attendee.h
index a345ff6b42..1e6bd839b6 100644
--- a/src/calendar/gui/e-meeting-attendee.h
+++ b/src/calendar/gui/e-meeting-attendee.h
@@ -44,11 +44,11 @@ typedef struct _EMeetingAttendeeClass EMeetingAttendeeClass;
* meeting room). These are used for the Autopick options, where the user can
* ask for a time when, for example, all people and one resource are free.
* The default is E_MEETING_ATTENDEE_REQUIRED_PERSON. */
-typedef enum
-{
+typedef enum {
E_MEETING_ATTENDEE_REQUIRED_PERSON,
E_MEETING_ATTENDEE_OPTIONAL_PERSON,
- E_MEETING_ATTENDEE_RESOURCE
+ E_MEETING_ATTENDEE_RESOURCE,
+ E_MEETING_ATTENDEE_RESOURCE_UNKNOWN
} EMeetingAttendeeType;
typedef enum
@@ -70,101 +70,122 @@ struct _EMeetingAttendeeClass {
void (* changed) (EMeetingAttendee *ia);
};
-
-GType e_meeting_attendee_get_type (void);
-GObject *e_meeting_attendee_new (void);
-GObject *e_meeting_attendee_new_from_e_cal_component_attendee (ECalComponentAttendee *ca);
-
-ECalComponentAttendee *e_meeting_attendee_as_e_cal_component_attendee (EMeetingAttendee *ia);
-
-const gchar *e_meeting_attendee_get_address (EMeetingAttendee *ia);
-void e_meeting_attendee_set_address (EMeetingAttendee *ia, gchar *address);
-gboolean e_meeting_attendee_is_set_address (EMeetingAttendee *ia);
-
-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);
-
-icalparameter_role e_meeting_attendee_get_role (EMeetingAttendee *ia);
-void e_meeting_attendee_set_role (EMeetingAttendee *ia, icalparameter_role role);
-
-gboolean e_meeting_attendee_get_rsvp (EMeetingAttendee *ia);
-void e_meeting_attendee_set_rsvp (EMeetingAttendee *ia, gboolean rsvp);
-
-const gchar *e_meeting_attendee_get_delto (EMeetingAttendee *ia);
-void e_meeting_attendee_set_delto (EMeetingAttendee *ia, gchar *delto);
-gboolean e_meeting_attendee_is_set_delto (EMeetingAttendee *ia);
-
-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);
-
-const gchar *e_meeting_attendee_get_sentby (EMeetingAttendee *ia);
-void e_meeting_attendee_set_sentby (EMeetingAttendee *ia, gchar *sentby);
-gboolean e_meeting_attendee_is_set_sentby (EMeetingAttendee *ia);
-
-const gchar *e_meeting_attendee_get_cn (EMeetingAttendee *ia);
-void e_meeting_attendee_set_cn (EMeetingAttendee *ia, gchar *cn);
-gboolean e_meeting_attendee_is_set_cn (EMeetingAttendee *ia);
-
-const gchar *e_meeting_attendee_get_language (EMeetingAttendee *ia);
-void e_meeting_attendee_set_language (EMeetingAttendee *ia, gchar *language);
-gboolean e_meeting_attendee_is_set_language (EMeetingAttendee *ia);
-
-EMeetingAttendeeType e_meeting_attendee_get_atype (EMeetingAttendee *ia);
-
-EMeetingAttendeeEditLevel e_meeting_attendee_get_edit_level (EMeetingAttendee *ia);
-void e_meeting_attendee_set_edit_level (EMeetingAttendee *ia, EMeetingAttendeeEditLevel level);
-
-gboolean e_meeting_attendee_get_show_address (EMeetingAttendee *ia);
-void e_meeting_attendee_set_show_address (EMeetingAttendee *ia, gboolean show_address);
-
-gboolean e_meeting_attendee_get_has_calendar_info (EMeetingAttendee *ia);
-void e_meeting_attendee_set_has_calendar_info (EMeetingAttendee *ia, gboolean has_calendar_info);
-
-const gchar * e_meeting_attendee_get_fburi (EMeetingAttendee *ia);
-void e_meeting_attendee_set_fburi (EMeetingAttendee *ia, gchar *fburi);
-
-const GArray *e_meeting_attendee_get_busy_periods (EMeetingAttendee *ia);
-gint e_meeting_attendee_find_first_busy_period (EMeetingAttendee *ia, GDate *date);
-gboolean e_meeting_attendee_add_busy_period (EMeetingAttendee *ia,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute,
- EMeetingFreeBusyType busy_type,
- const gchar *summary,
- const gchar *location);
-
-EMeetingTime e_meeting_attendee_get_start_busy_range (EMeetingAttendee *ia);
-EMeetingTime e_meeting_attendee_get_end_busy_range (EMeetingAttendee *ia);
-
-gboolean e_meeting_attendee_set_start_busy_range (EMeetingAttendee *ia,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute);
-gboolean e_meeting_attendee_set_end_busy_range (EMeetingAttendee *ia,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute);
-
-void e_meeting_attendee_clear_busy_periods (EMeetingAttendee *ia);
+GType e_meeting_attendee_get_type (void);
+GObject * e_meeting_attendee_new (void);
+GObject * e_meeting_attendee_new_from_e_cal_component_attendee
+ (const ECalComponentAttendee *ca);
+
+ECalComponentAttendee *
+ e_meeting_attendee_as_e_cal_component_attendee
+ (const EMeetingAttendee *ia);
+
+const gchar * e_meeting_attendee_get_address (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_address (EMeetingAttendee *ia,
+ const gchar *address);
+gboolean e_meeting_attendee_is_set_address
+ (const EMeetingAttendee *ia);
+const gchar * e_meeting_attendee_get_member (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_member (EMeetingAttendee *ia,
+ const gchar *member);
+gboolean e_meeting_attendee_is_set_member(const EMeetingAttendee *ia);
+ICalParameterCutype
+ e_meeting_attendee_get_cutype (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_cutype (EMeetingAttendee *ia,
+ ICalParameterCutype cutype);
+ICalParameterRole
+ e_meeting_attendee_get_role (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_role (EMeetingAttendee *ia,
+ ICalParameterRole role);
+gboolean e_meeting_attendee_get_rsvp (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_rsvp (EMeetingAttendee *ia,
+ gboolean rsvp);
+const gchar * e_meeting_attendee_get_delto (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_delto (EMeetingAttendee *ia,
+ const gchar *delto);
+gboolean e_meeting_attendee_is_set_delto (const EMeetingAttendee *ia);
+const gchar * e_meeting_attendee_get_delfrom (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_delfrom (EMeetingAttendee *ia,
+ const gchar *delfrom);
+gboolean e_meeting_attendee_is_set_delfrom
+ (const EMeetingAttendee *ia);
+ICalParameterPartstat
+ e_meeting_attendee_get_partstat (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_partstat (EMeetingAttendee *ia,
+ ICalParameterPartstat partstat);
+const gchar * e_meeting_attendee_get_sentby (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_sentby (EMeetingAttendee *ia,
+ const gchar *sentby);
+gboolean e_meeting_attendee_is_set_sentby(const EMeetingAttendee *ia);
+const gchar * e_meeting_attendee_get_cn (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_cn (EMeetingAttendee *ia,
+ const gchar *cn);
+gboolean e_meeting_attendee_is_set_cn (const EMeetingAttendee *ia);
+const gchar * e_meeting_attendee_get_language (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_language (EMeetingAttendee *ia,
+ const gchar *language);
+gboolean e_meeting_attendee_is_set_language
+ (const EMeetingAttendee *ia);
+EMeetingAttendeeType
+ e_meeting_attendee_get_atype (const EMeetingAttendee *ia);
+EMeetingAttendeeEditLevel
+ e_meeting_attendee_get_edit_level
+ (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_edit_level
+ (EMeetingAttendee *ia,
+ EMeetingAttendeeEditLevel level);
+gboolean e_meeting_attendee_get_show_address
+ (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_show_address
+ (EMeetingAttendee *ia,
+ gboolean show_address);
+gboolean e_meeting_attendee_get_has_calendar_info
+ (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_has_calendar_info
+ (EMeetingAttendee *ia,
+ gboolean has_calendar_info);
+const gchar * e_meeting_attendee_get_fburi (const EMeetingAttendee *ia);
+void e_meeting_attendee_set_fburi (EMeetingAttendee *ia,
+ const gchar *fburi);
+const GArray * e_meeting_attendee_get_busy_periods
+ (EMeetingAttendee *ia);
+gint e_meeting_attendee_find_first_busy_period
+ (EMeetingAttendee *ia,
+ const GDate *date);
+gboolean e_meeting_attendee_add_busy_period
+ (EMeetingAttendee *ia,
+ gint start_year,
+ gint start_month,
+ gint start_day,
+ gint start_hour,
+ gint start_minute,
+ gint end_year,
+ gint end_month,
+ gint end_day,
+ gint end_hour,
+ gint end_minute,
+ EMeetingFreeBusyType busy_type,
+ const gchar *summary,
+ const gchar *location);
+EMeetingTime e_meeting_attendee_get_start_busy_range
+ (const EMeetingAttendee *ia);
+EMeetingTime e_meeting_attendee_get_end_busy_range
+ (const EMeetingAttendee *ia);
+gboolean e_meeting_attendee_set_start_busy_range
+ (EMeetingAttendee *ia,
+ gint start_year,
+ gint start_month,
+ gint start_day,
+ gint start_hour,
+ gint start_minute);
+gboolean e_meeting_attendee_set_end_busy_range
+ (EMeetingAttendee *ia,
+ gint end_year,
+ gint end_month,
+ gint end_day,
+ gint end_hour,
+ gint end_minute);
+void e_meeting_attendee_clear_busy_periods
+ (EMeetingAttendee *ia);
G_END_DECLS
diff --git a/src/calendar/gui/e-meeting-list-view.c b/src/calendar/gui/e-meeting-list-view.c
index 8b4b67b62b..9c4ebbd669 100644
--- a/src/calendar/gui/e-meeting-list-view.c
+++ b/src/calendar/gui/e-meeting-list-view.c
@@ -65,11 +65,11 @@ static const gchar *sections[] = {N_("Chair Persons"),
N_("Resources"),
NULL};
-static icalparameter_role roles[] = {ICAL_ROLE_CHAIR,
- ICAL_ROLE_REQPARTICIPANT,
- ICAL_ROLE_OPTPARTICIPANT,
- ICAL_ROLE_NONPARTICIPANT,
- ICAL_ROLE_NONE};
+static ICalParameterRole roles[] = { I_CAL_ROLE_CHAIR,
+ I_CAL_ROLE_REQPARTICIPANT,
+ I_CAL_ROLE_OPTPARTICIPANT,
+ I_CAL_ROLE_NONPARTICIPANT,
+ I_CAL_ROLE_NONE };
G_DEFINE_TYPE (EMeetingListView, e_meeting_list_view, GTK_TYPE_TREE_VIEW)
@@ -239,16 +239,16 @@ value_edited (GtkTreeView *view,
}
static guint
-get_index_from_role (icalparameter_role role)
+get_index_from_role (ICalParameterRole role)
{
switch (role) {
- case ICAL_ROLE_CHAIR:
+ case I_CAL_ROLE_CHAIR:
return 0;
- case ICAL_ROLE_REQPARTICIPANT:
+ case I_CAL_ROLE_REQPARTICIPANT:
return 1;
- case ICAL_ROLE_OPTPARTICIPANT:
+ case I_CAL_ROLE_OPTPARTICIPANT:
return 2;
- case ICAL_ROLE_NONPARTICIPANT:
+ case I_CAL_ROLE_NONPARTICIPANT:
return 3;
default:
return 1;
@@ -368,7 +368,7 @@ attendee_edited_cb (GtkCellRenderer *renderer,
gboolean can_remove = TRUE;
for (l = addresses, m = names; l && m; l = l->next, m = m->next) {
- gchar *name = m->data, *email = l->data;
+ gchar *name = m->data, *email = l->data, *mailto;
if (!((name && *name) || (email && *email)))
continue;
@@ -381,15 +381,17 @@ attendee_edited_cb (GtkCellRenderer *renderer,
}
attendee = e_meeting_store_add_attendee_with_defaults (model);
- e_meeting_attendee_set_address (attendee, g_strdup_printf ("mailto:%s", (gchar *)
l->data));
- e_meeting_attendee_set_cn (attendee, g_strdup (m->data));
+ mailto = g_strdup_printf ("mailto:%s", (gchar *) l->data);
+ e_meeting_attendee_set_address (attendee, mailto);
+ g_free (mailto);
+ e_meeting_attendee_set_cn (attendee, m->data);
if (existing_attendee) {
e_meeting_attendee_set_cutype (attendee, e_meeting_attendee_get_cutype
(existing_attendee));
e_meeting_attendee_set_role (attendee, e_meeting_attendee_get_role
(existing_attendee));
e_meeting_attendee_set_rsvp (attendee, e_meeting_attendee_get_rsvp
(existing_attendee));
- e_meeting_attendee_set_status (attendee, ICAL_PARTSTAT_NEEDSACTION);
- e_meeting_attendee_set_delfrom (attendee, g_strdup
(e_meeting_attendee_get_delfrom (existing_attendee)));
- e_meeting_attendee_set_fburi (attendee, g_strdup
(e_meeting_attendee_get_fburi (existing_attendee)));
+ e_meeting_attendee_set_partstat (attendee, I_CAL_PARTSTAT_NEEDSACTION);
+ e_meeting_attendee_set_delfrom (attendee, e_meeting_attendee_get_delfrom
(existing_attendee));
+ e_meeting_attendee_set_fburi (attendee, e_meeting_attendee_get_fburi
(existing_attendee));
e_meeting_attendee_set_show_address (attendee,
e_meeting_attendee_get_show_address (existing_attendee));
}
e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view),
attendee);
@@ -414,6 +416,7 @@ attendee_edited_cb (GtkCellRenderer *renderer,
gboolean show_address = FALSE;
EMeetingAttendee *attendee;
EDestination *destination;
+ gchar *mailto;
if (existing_attendee) {
const gchar *addr = e_meeting_attendee_get_address (existing_attendee);
@@ -432,9 +435,11 @@ attendee_edited_cb (GtkCellRenderer *renderer,
value_edited (view, E_MEETING_STORE_ADDRESS_COL, path, email);
value_edited (view, E_MEETING_STORE_CN_COL, path, name);
- e_meeting_attendee_set_address (attendee, g_strdup_printf ("mailto:%s", email));
- e_meeting_attendee_set_cn (attendee, g_strdup (name));
- e_meeting_attendee_set_role (attendee, ICAL_ROLE_REQPARTICIPANT);
+ mailto = g_strdup_printf ("mailto:%s", email);
+ e_meeting_attendee_set_address (attendee, mailto);
+ g_free (mailto);
+ e_meeting_attendee_set_cn (attendee, name);
+ e_meeting_attendee_set_role (attendee, I_CAL_ROLE_REQPARTICIPANT);
destination = e_select_names_renderer_get_destination (E_SELECT_NAMES_RENDERER
(renderer));
if (destination) {
@@ -447,8 +452,7 @@ attendee_edited_cb (GtkCellRenderer *renderer,
fburi = e_contact_get (contact, E_CONTACT_FREEBUSY_URL);
if (fburi && *fburi)
e_meeting_attendee_set_fburi (attendee, fburi);
- else
- g_free (fburi);
+ g_free (fburi);
if (!e_contact_get (contact, E_CONTACT_IS_LIST)) {
GList *email_list;
@@ -466,7 +470,7 @@ attendee_edited_cb (GtkCellRenderer *renderer,
e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view),
attendee);
if (address_changed)
- e_meeting_attendee_set_status (attendee, ICAL_PARTSTAT_NEEDSACTION);
+ e_meeting_attendee_set_partstat (attendee, I_CAL_PARTSTAT_NEEDSACTION);
g_signal_emit_by_name (view, "attendee_added", (gpointer) attendee);
}
@@ -875,7 +879,7 @@ e_meeting_list_view_edit (EMeetingListView *emlv,
static void
process_section (EMeetingListView *view,
GList *destinations,
- icalparameter_role role,
+ ICalParameterRole role,
GSList **la)
{
EMeetingListViewPrivate *priv;
@@ -1000,18 +1004,19 @@ process_section (EMeetingListView *view,
if (e_meeting_store_find_attendee (priv->store, email_addr, NULL) == NULL) {
EMeetingAttendee *ia = e_meeting_store_add_attendee_with_defaults
(priv->store);
+ gchar *mailto;
- e_meeting_attendee_set_address (ia, g_strdup_printf ("mailto:%s",
email_addr));
+ mailto = g_strdup_printf ("mailto:%s", email_addr);
+ e_meeting_attendee_set_address (ia, mailto);
+ g_free (mailto);
e_meeting_attendee_set_role (ia, role);
- if (role == ICAL_ROLE_NONPARTICIPANT)
- e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
- e_meeting_attendee_set_cn (ia, g_strdup (name));
+ if (role == I_CAL_ROLE_NONPARTICIPANT)
+ e_meeting_attendee_set_cutype (ia, I_CAL_CUTYPE_RESOURCE);
+ e_meeting_attendee_set_cn (ia, name);
e_meeting_attendee_set_show_address (ia, show_address);
- if (fburi) {
+ if (fburi)
e_meeting_attendee_set_fburi (ia, fburi);
- fburi = NULL;
- }
} else {
if (g_slist_length (*la) == 1) {
g_slist_free (*la);
diff --git a/src/calendar/gui/e-meeting-store.c b/src/calendar/gui/e-meeting-store.c
index 02c8766285..815f55719a 100644
--- a/src/calendar/gui/e-meeting-store.c
+++ b/src/calendar/gui/e-meeting-store.c
@@ -49,7 +49,7 @@ struct _EMeetingStorePrivate {
gint stamp;
ECalClient *client;
- icaltimezone *zone;
+ ICalTimezone *zone;
gint default_reminder_interval;
EDurationType default_reminder_units;
@@ -104,32 +104,32 @@ G_DEFINE_TYPE_WITH_CODE (
G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, ems_tree_model_init))
-static icalparameter_cutype
+static ICalParameterCutype
text_to_type (const gchar *type)
{
if (!e_util_utf8_strcasecmp (type, _("Individual")))
- return ICAL_CUTYPE_INDIVIDUAL;
+ return I_CAL_CUTYPE_INDIVIDUAL;
else if (!e_util_utf8_strcasecmp (type, _("Group")))
- return ICAL_CUTYPE_GROUP;
+ return I_CAL_CUTYPE_GROUP;
else if (!e_util_utf8_strcasecmp (type, _("Resource")))
- return ICAL_CUTYPE_RESOURCE;
+ return I_CAL_CUTYPE_RESOURCE;
else if (!e_util_utf8_strcasecmp (type, _("Room")))
- return ICAL_CUTYPE_ROOM;
+ return I_CAL_CUTYPE_ROOM;
else
- return ICAL_CUTYPE_NONE;
+ return I_CAL_CUTYPE_NONE;
}
static gchar *
-type_to_text (icalparameter_cutype type)
+type_to_text (ICalParameterCutype type)
{
switch (type) {
- case ICAL_CUTYPE_INDIVIDUAL:
+ case I_CAL_CUTYPE_INDIVIDUAL:
return _("Individual");
- case ICAL_CUTYPE_GROUP:
+ case I_CAL_CUTYPE_GROUP:
return _("Group");
- case ICAL_CUTYPE_RESOURCE:
+ case I_CAL_CUTYPE_RESOURCE:
return _("Resource");
- case ICAL_CUTYPE_ROOM:
+ case I_CAL_CUTYPE_ROOM:
return _("Room");
default:
return _("Unknown");
@@ -139,32 +139,32 @@ type_to_text (icalparameter_cutype type)
}
-static icalparameter_role
+static ICalParameterRole
text_to_role (const gchar *role)
{
if (!e_util_utf8_strcasecmp (role, _("Chair")))
- return ICAL_ROLE_CHAIR;
+ return I_CAL_ROLE_CHAIR;
else if (!e_util_utf8_strcasecmp (role, _("Required Participant")))
- return ICAL_ROLE_REQPARTICIPANT;
+ return I_CAL_ROLE_REQPARTICIPANT;
else if (!e_util_utf8_strcasecmp (role, _("Optional Participant")))
- return ICAL_ROLE_OPTPARTICIPANT;
+ return I_CAL_ROLE_OPTPARTICIPANT;
else if (!e_util_utf8_strcasecmp (role, _("Non-Participant")))
- return ICAL_ROLE_NONPARTICIPANT;
+ return I_CAL_ROLE_NONPARTICIPANT;
else
- return ICAL_ROLE_NONE;
+ return I_CAL_ROLE_NONE;
}
static gchar *
-role_to_text (icalparameter_role role)
+role_to_text (ICalParameterRole role)
{
switch (role) {
- case ICAL_ROLE_CHAIR:
+ case I_CAL_ROLE_CHAIR:
return _("Chair");
- case ICAL_ROLE_REQPARTICIPANT:
+ case I_CAL_ROLE_REQPARTICIPANT:
return _("Required Participant");
- case ICAL_ROLE_OPTPARTICIPANT:
+ case I_CAL_ROLE_OPTPARTICIPANT:
return _("Optional Participant");
- case ICAL_ROLE_NONPARTICIPANT:
+ case I_CAL_ROLE_NONPARTICIPANT:
return _("Non-Participant");
default:
return _("Unknown");
@@ -189,46 +189,46 @@ boolean_to_text (gboolean b)
return _("No");
}
-static icalparameter_partstat
+static ICalParameterPartstat
text_to_partstat (const gchar *partstat)
{
if (!e_util_utf8_strcasecmp (partstat, _("Needs Action")))
- return ICAL_PARTSTAT_NEEDSACTION;
+ return I_CAL_PARTSTAT_NEEDSACTION;
else if (!e_util_utf8_strcasecmp (partstat, _("Accepted")))
- return ICAL_PARTSTAT_ACCEPTED;
+ return I_CAL_PARTSTAT_ACCEPTED;
else if (!e_util_utf8_strcasecmp (partstat, _("Declined")))
- return ICAL_PARTSTAT_DECLINED;
+ return I_CAL_PARTSTAT_DECLINED;
else if (!e_util_utf8_strcasecmp (partstat, _("Tentative")))
- return ICAL_PARTSTAT_TENTATIVE;
+ return I_CAL_PARTSTAT_TENTATIVE;
else if (!e_util_utf8_strcasecmp (partstat, _("Delegated")))
- return ICAL_PARTSTAT_DELEGATED;
+ return I_CAL_PARTSTAT_DELEGATED;
else if (!e_util_utf8_strcasecmp (partstat, _("Completed")))
- return ICAL_PARTSTAT_COMPLETED;
+ return I_CAL_PARTSTAT_COMPLETED;
else if (!e_util_utf8_strcasecmp (partstat, _("In Process")))
- return ICAL_PARTSTAT_INPROCESS;
+ return I_CAL_PARTSTAT_INPROCESS;
else
- return ICAL_PARTSTAT_NONE;
+ return I_CAL_PARTSTAT_NONE;
}
static gchar *
-partstat_to_text (icalparameter_partstat partstat)
+partstat_to_text (ICalParameterPartstat partstat)
{
switch (partstat) {
- case ICAL_PARTSTAT_NEEDSACTION:
+ case I_CAL_PARTSTAT_NEEDSACTION:
return _("Needs Action");
- case ICAL_PARTSTAT_ACCEPTED:
+ case I_CAL_PARTSTAT_ACCEPTED:
return _("Accepted");
- case ICAL_PARTSTAT_DECLINED:
+ case I_CAL_PARTSTAT_DECLINED:
return _("Declined");
- case ICAL_PARTSTAT_TENTATIVE:
+ case I_CAL_PARTSTAT_TENTATIVE:
return _("Tentative");
- case ICAL_PARTSTAT_DELEGATED:
+ case I_CAL_PARTSTAT_DELEGATED:
return _("Delegated");
- case ICAL_PARTSTAT_COMPLETED:
+ case I_CAL_PARTSTAT_COMPLETED:
return _("Completed");
- case ICAL_PARTSTAT_INPROCESS:
+ case I_CAL_PARTSTAT_INPROCESS:
return _("In Process");
- case ICAL_PARTSTAT_NONE:
+ case I_CAL_PARTSTAT_NONE:
default:
return _("Unknown");
}
@@ -384,7 +384,7 @@ get_value (GtkTreeModel *model,
g_value_init (value, G_TYPE_STRING);
g_value_set_string (
value, partstat_to_text (
- e_meeting_attendee_get_status (attendee)));
+ e_meeting_attendee_get_partstat (attendee)));
break;
case E_MEETING_STORE_CN_COL:
g_value_init (value, G_TYPE_STRING);
@@ -535,24 +535,27 @@ e_meeting_store_set_value (EMeetingStore *store,
gint col,
const gchar *val)
{
- icalparameter_cutype type;
+ ICalParameterCutype cutype;
EMeetingAttendee *attendee = g_ptr_array_index (store->priv->attendees, row);
switch (col) {
case E_MEETING_STORE_ADDRESS_COL:
- if (val != NULL && *((gchar *) val))
- e_meeting_attendee_set_address (
- attendee, g_strdup_printf (
- "mailto:%s", (gchar *) val));
+ if (val != NULL && *((gchar *) val)) {
+ gchar *mailto;
+
+ mailto = g_strdup_printf ("mailto:%s", (const gchar *) val);
+ e_meeting_attendee_set_address (attendee, mailto);
+ g_free (mailto);
+ }
break;
case E_MEETING_STORE_MEMBER_COL:
- e_meeting_attendee_set_member (attendee, g_strdup (val));
+ e_meeting_attendee_set_member (attendee, val);
break;
case E_MEETING_STORE_TYPE_COL:
- type = text_to_type (val);
- e_meeting_attendee_set_cutype (attendee, text_to_type (val));
- if (type == ICAL_CUTYPE_RESOURCE) {
- e_meeting_attendee_set_role (attendee, ICAL_ROLE_NONPARTICIPANT);
+ cutype = text_to_type (val);
+ e_meeting_attendee_set_cutype (attendee, cutype);
+ if (cutype == I_CAL_CUTYPE_RESOURCE) {
+ e_meeting_attendee_set_role (attendee, I_CAL_ROLE_NONPARTICIPANT);
}
break;
case E_MEETING_STORE_ROLE_COL:
@@ -562,19 +565,19 @@ e_meeting_store_set_value (EMeetingStore *store,
e_meeting_attendee_set_rsvp (attendee, text_to_boolean (val));
break;
case E_MEETING_STORE_DELTO_COL:
- e_meeting_attendee_set_delto (attendee, g_strdup (val));
+ e_meeting_attendee_set_delto (attendee, val);
break;
case E_MEETING_STORE_DELFROM_COL:
- e_meeting_attendee_set_delfrom (attendee, g_strdup (val));
+ e_meeting_attendee_set_delfrom (attendee, val);
break;
case E_MEETING_STORE_STATUS_COL:
- e_meeting_attendee_set_status (attendee, text_to_partstat (val));
+ e_meeting_attendee_set_partstat (attendee, text_to_partstat (val));
break;
case E_MEETING_STORE_CN_COL:
- e_meeting_attendee_set_cn (attendee, g_strdup (val));
+ e_meeting_attendee_set_cn (attendee, val);
break;
case E_MEETING_STORE_LANGUAGE_COL:
- e_meeting_attendee_set_language (attendee, g_strdup (val));
+ e_meeting_attendee_set_language (attendee, val);
break;
}
}
@@ -776,6 +779,8 @@ meeting_store_finalize (GObject *object)
g_free (priv->fb_uri);
+ g_clear_object (&priv->zone);
+
g_mutex_clear (&priv->mutex);
/* Chain up to parent's finalize() method. */
@@ -977,7 +982,7 @@ e_meeting_store_set_free_busy_template (EMeetingStore *store,
g_object_notify (G_OBJECT (store), "free-busy-template");
}
-icaltimezone *
+ICalTimezone *
e_meeting_store_get_timezone (EMeetingStore *store)
{
g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
@@ -987,14 +992,15 @@ e_meeting_store_get_timezone (EMeetingStore *store)
void
e_meeting_store_set_timezone (EMeetingStore *store,
- icaltimezone *timezone)
+ const ICalTimezone *timezone)
{
g_return_if_fail (E_IS_MEETING_STORE (store));
if (store->priv->zone == timezone)
return;
- store->priv->zone = timezone;
+ g_clear_object (&store->priv->zone);
+ store->priv->zone = e_cal_util_copy_timezone (timezone);
g_object_notify (G_OBJECT (store), "timezone");
}
@@ -1078,8 +1084,8 @@ e_meeting_store_add_attendee_with_defaults (EMeetingStore *store)
attendee = E_MEETING_ATTENDEE (e_meeting_attendee_new ());
- e_meeting_attendee_set_address (attendee, g_strdup (""));
- e_meeting_attendee_set_member (attendee, g_strdup (""));
+ e_meeting_attendee_set_address (attendee, "");
+ e_meeting_attendee_set_member (attendee, "");
str = g_strdup (_("Individual"));
e_meeting_attendee_set_cutype (attendee, text_to_type (str));
@@ -1091,15 +1097,15 @@ e_meeting_store_add_attendee_with_defaults (EMeetingStore *store)
e_meeting_attendee_set_rsvp (attendee, text_to_boolean (str));
g_free (str);
- e_meeting_attendee_set_delto (attendee, g_strdup (""));
- e_meeting_attendee_set_delfrom (attendee, g_strdup (""));
+ e_meeting_attendee_set_delto (attendee, "");
+ e_meeting_attendee_set_delfrom (attendee, "");
str = g_strdup (_("Needs Action"));
- e_meeting_attendee_set_status (attendee, text_to_partstat (str));
+ e_meeting_attendee_set_partstat (attendee, text_to_partstat (str));
g_free (str);
- e_meeting_attendee_set_cn (attendee, g_strdup (""));
- e_meeting_attendee_set_language (attendee, g_strdup ("en"));
+ e_meeting_attendee_set_cn (attendee, "");
+ e_meeting_attendee_set_language (attendee, "en");
e_meeting_store_add_attendee (store, attendee);
@@ -1308,44 +1314,57 @@ e_meeting_store_get_attendees (EMeetingStore *store)
return store->priv->attendees;
}
-static icaltimezone *
-find_zone (icalproperty *ip,
- icalcomponent *tz_top_level)
+static ICalTimezone *
+find_zone (ICalProperty *in_prop,
+ ICalComponent *tz_top_level)
{
- icalparameter *param;
- icalcomponent *sub_comp;
+ ICalParameter *param;
+ ICalComponent *subcomp;
const gchar *tzid;
- icalcompiter iter;
+ ICalCompIter *iter;
if (tz_top_level == NULL)
return NULL;
- param = icalproperty_get_first_parameter (ip, ICAL_TZID_PARAMETER);
+ param = i_cal_property_get_first_parameter (in_prop, I_CAL_TZID_PARAMETER);
if (param == NULL)
return NULL;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
+
+ iter = i_cal_component_begin_component (tz_top_level, I_CAL_VTIMEZONE_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
+ ICalProperty *prop;
+
+ next_subcomp = i_cal_comp_iter_next (iter);
- iter = icalcomponent_begin_component (tz_top_level, ICAL_VTIMEZONE_COMPONENT);
- while ((sub_comp = icalcompiter_deref (&iter)) != NULL) {
- icalcomponent *clone;
- icalproperty *prop;
- const gchar *tz_tzid;
+ prop = i_cal_component_get_first_property (subcomp, I_CAL_TZID_PROPERTY);
+ if (prop && !g_strcmp0 (tzid, i_cal_property_get_tzid (prop))) {
+ ICalComponent *clone;
+ ICalTimezone *zone;
- prop = icalcomponent_get_first_property (sub_comp, ICAL_TZID_PROPERTY);
- tz_tzid = icalproperty_get_tzid (prop);
- if (!strcmp (tzid, tz_tzid)) {
- icaltimezone *zone;
+ zone = i_cal_timezone_new ();
+ clone = i_cal_component_new_clone (subcomp);
+ i_cal_timezone_set_component (zone, clone);
- zone = icaltimezone_new ();
- clone = icalcomponent_new_clone (sub_comp);
- icaltimezone_set_component (zone, clone);
+ g_clear_object (&next_subcomp);
+ g_clear_object (&subcomp);
+ g_clear_object (¶m);
+ g_clear_object (&prop);
+ g_clear_object (&iter);
return zone;
}
- icalcompiter_next (&iter);
+ g_clear_object (&prop);
+ g_object_unref (subcomp);
+ subcomp = next_subcomp;
}
+ g_clear_object (¶m);
+ g_clear_object (&iter);
+
return NULL;
}
@@ -1376,106 +1395,122 @@ process_callbacks (EMeetingStoreQueueData *qdata)
}
static void
-process_free_busy_comp_get_xfb (icalproperty *ip,
+process_free_busy_comp_get_xfb (ICalProperty *ip,
gchar **summary,
gchar **location)
{
- const gchar *tmp = NULL;
+ gchar *tmp;
g_return_if_fail (ip != NULL);
g_return_if_fail (summary != NULL && *summary == NULL);
g_return_if_fail (location != NULL && *location == NULL);
- /* We extract extended free/busy information from the icalproperty
+ /* We extract extended free/busy information from the ICalProperty
* here (X-SUMMARY and X-LOCATION). If the property carries such,
* it will be displayed as a tooltip for the busy period. Otherwise,
* nothing will happen (*summary and/or *location will be NULL)
*/
- tmp = icalproperty_get_parameter_as_string (
- ip, E_MEETING_FREE_BUSY_XPROP_SUMMARY);
- *summary = e_meeting_xfb_utf8_string_new_from_ical (
- tmp, E_MEETING_FREE_BUSY_XPROP_MAXLEN);
- tmp = icalproperty_get_parameter_as_string (
- ip, E_MEETING_FREE_BUSY_XPROP_LOCATION);
- *location = e_meeting_xfb_utf8_string_new_from_ical (
- tmp, E_MEETING_FREE_BUSY_XPROP_MAXLEN);
+ tmp = i_cal_property_get_parameter_as_string_r (ip, E_MEETING_FREE_BUSY_XPROP_SUMMARY);
+ *summary = e_meeting_xfb_utf8_string_new_from_ical (tmp, E_MEETING_FREE_BUSY_XPROP_MAXLEN);
+ g_free (tmp);
+
+ tmp = i_cal_property_get_parameter_as_string_r (ip, E_MEETING_FREE_BUSY_XPROP_LOCATION);
+ *location = e_meeting_xfb_utf8_string_new_from_ical (tmp, E_MEETING_FREE_BUSY_XPROP_MAXLEN);
+ g_free (tmp);
}
static void
process_free_busy_comp (EMeetingAttendee *attendee,
- icalcomponent *fb_comp,
- icaltimezone *zone,
- icalcomponent *tz_top_level)
+ ICalComponent *fb_comp,
+ ICalTimezone *zone,
+ ICalComponent *tz_top_level)
{
- icalproperty *ip;
+ ICalProperty *ip;
- ip = icalcomponent_get_first_property (fb_comp, ICAL_DTSTART_PROPERTY);
+ ip = i_cal_component_get_first_property (fb_comp, I_CAL_DTSTART_PROPERTY);
if (ip != NULL) {
- struct icaltimetype dtstart;
- icaltimezone *ds_zone;
-
- dtstart = icalproperty_get_dtstart (ip);
- if (!icaltime_is_utc (dtstart))
- ds_zone = find_zone (ip, tz_top_level);
- else
- ds_zone = icaltimezone_get_utc_timezone ();
- icaltimezone_convert_time (&dtstart, ds_zone, zone);
- e_meeting_attendee_set_start_busy_range (
- attendee,
- dtstart.year,
- dtstart.month,
- dtstart.day,
- dtstart.hour,
- dtstart.minute);
+ ICalTime *dtstart;
+ ICalTimezone *ds_zone;
+
+ dtstart = i_cal_property_get_dtstart (ip);
+ if (dtstart) {
+ if (!i_cal_time_is_utc (dtstart))
+ ds_zone = find_zone (ip, tz_top_level);
+ else
+ ds_zone = g_object_ref (i_cal_timezone_get_utc_timezone ());
+ i_cal_timezone_convert_time (dtstart, ds_zone, zone);
+
+ e_meeting_attendee_set_start_busy_range (
+ attendee,
+ i_cal_time_get_year (dtstart),
+ i_cal_time_get_month (dtstart),
+ i_cal_time_get_day (dtstart),
+ i_cal_time_get_hour (dtstart),
+ i_cal_time_get_minute (dtstart));
+
+ g_clear_object (&ds_zone);
+ g_clear_object (&dtstart);
+ }
}
+ g_clear_object (&ip);
- ip = icalcomponent_get_first_property (fb_comp, ICAL_DTEND_PROPERTY);
+ ip = i_cal_component_get_first_property (fb_comp, I_CAL_DTEND_PROPERTY);
if (ip != NULL) {
- struct icaltimetype dtend;
- icaltimezone *de_zone;
-
- dtend = icalproperty_get_dtend (ip);
- if (!icaltime_is_utc (dtend))
- de_zone = find_zone (ip, tz_top_level);
- else
- de_zone = icaltimezone_get_utc_timezone ();
- icaltimezone_convert_time (&dtend, de_zone, zone);
- e_meeting_attendee_set_end_busy_range (
- attendee,
- dtend.year,
- dtend.month,
- dtend.day,
- dtend.hour,
- dtend.minute);
+ ICalTime *dtend;
+ ICalTimezone *de_zone;
+
+ dtend = i_cal_property_get_dtend (ip);
+ if (dtend) {
+ if (!i_cal_time_is_utc (dtend))
+ de_zone = find_zone (ip, tz_top_level);
+ else
+ de_zone = g_object_ref (i_cal_timezone_get_utc_timezone ());
+ i_cal_timezone_convert_time (dtend, de_zone, zone);
+
+ e_meeting_attendee_set_end_busy_range (
+ attendee,
+ i_cal_time_get_year (dtend),
+ i_cal_time_get_month (dtend),
+ i_cal_time_get_day (dtend),
+ i_cal_time_get_hour (dtend),
+ i_cal_time_get_minute (dtend));
+
+ g_clear_object (&de_zone);
+ g_clear_object (&dtend);
+ }
}
+ g_clear_object (&ip);
- ip = icalcomponent_get_first_property (fb_comp, ICAL_FREEBUSY_PROPERTY);
- while (ip != NULL) {
- icalparameter *param;
- struct icalperiodtype fb;
+ for (ip = i_cal_component_get_first_property (fb_comp, I_CAL_FREEBUSY_PROPERTY);
+ ip;
+ g_object_unref (ip), ip = i_cal_component_get_next_property (fb_comp, I_CAL_FREEBUSY_PROPERTY)) {
+ ICalParameter *param;
+ ICalPeriod *fb;
EMeetingFreeBusyType busy_type = E_MEETING_FREE_BUSY_LAST;
- icalparameter_fbtype fbtype = ICAL_FBTYPE_BUSY;
+ ICalParameterFbtype fbtype = I_CAL_FBTYPE_BUSY;
- fb = icalproperty_get_freebusy (ip);
- param = icalproperty_get_first_parameter (ip, ICAL_FBTYPE_PARAMETER);
- if (param != NULL)
- fbtype = icalparameter_get_fbtype (param);
+ fb = i_cal_property_get_freebusy (ip);
+ param = i_cal_property_get_first_parameter (ip, I_CAL_FBTYPE_PARAMETER);
+ if (param) {
+ fbtype = i_cal_parameter_get_fbtype (param);
+ g_clear_object (¶m);
+ }
switch (fbtype) {
- case ICAL_FBTYPE_BUSY:
+ case I_CAL_FBTYPE_BUSY:
busy_type = E_MEETING_FREE_BUSY_BUSY;
break;
- case ICAL_FBTYPE_BUSYUNAVAILABLE:
+ case I_CAL_FBTYPE_BUSYUNAVAILABLE:
busy_type = E_MEETING_FREE_BUSY_OUT_OF_OFFICE;
break;
- case ICAL_FBTYPE_BUSYTENTATIVE:
+ case I_CAL_FBTYPE_BUSYTENTATIVE:
busy_type = E_MEETING_FREE_BUSY_TENTATIVE;
break;
- case ICAL_FBTYPE_FREE:
+ case I_CAL_FBTYPE_FREE:
busy_type = E_MEETING_FREE_BUSY_FREE;
break;
@@ -1484,15 +1519,19 @@ process_free_busy_comp (EMeetingAttendee *attendee,
}
if (busy_type != E_MEETING_FREE_BUSY_LAST) {
- icaltimezone *utc_zone = icaltimezone_get_utc_timezone ();
+ ICalTimezone *utc_zone = i_cal_timezone_get_utc_timezone ();
+ ICalTime *fbstart, *fbend;
gchar *summary = NULL;
gchar *location = NULL;
- icaltimezone_convert_time (&fb.start, utc_zone, zone);
- icaltimezone_convert_time (&fb.end, utc_zone, zone);
+ fbstart = i_cal_period_get_start (fb);
+ fbend = i_cal_period_get_end (fb);
+
+ i_cal_timezone_convert_time (fbstart, utc_zone, zone);
+ i_cal_timezone_convert_time (fbend, utc_zone, zone);
/* Extract extended free/busy (XFB) information from
- * the icalproperty, if it carries such.
+ * the ICalProperty, if it carries such.
* See the comment for the EMeetingXfbData structure
* for a reference.
*/
@@ -1500,77 +1539,91 @@ process_free_busy_comp (EMeetingAttendee *attendee,
e_meeting_attendee_add_busy_period (
attendee,
- fb.start.year,
- fb.start.month,
- fb.start.day,
- fb.start.hour,
- fb.start.minute,
- fb.end.year,
- fb.end.month,
- fb.end.day,
- fb.end.hour,
- fb.end.minute,
+ i_cal_time_get_year (fbstart),
+ i_cal_time_get_month (fbstart),
+ i_cal_time_get_day (fbstart),
+ i_cal_time_get_hour (fbstart),
+ i_cal_time_get_minute (fbstart),
+ i_cal_time_get_year (fbend),
+ i_cal_time_get_month (fbend),
+ i_cal_time_get_day (fbend),
+ i_cal_time_get_hour (fbend),
+ i_cal_time_get_minute (fbend),
busy_type,
summary,
location);
- if (summary != NULL)
- g_free (summary);
- if (location != NULL)
- g_free (location);
+ g_clear_object (&fbstart);
+ g_clear_object (&fbend);
+ g_free (summary);
+ g_free (location);
}
- ip = icalcomponent_get_next_property (fb_comp, ICAL_FREEBUSY_PROPERTY);
+ g_clear_object (&fb);
}
}
static void
process_free_busy (EMeetingStoreQueueData *qdata,
- gchar *text)
+ const gchar *text)
{
EMeetingStore *store = qdata->store;
EMeetingStorePrivate *priv;
EMeetingAttendee *attendee = qdata->attendee;
- icalcomponent *main_comp;
- icalcomponent_kind kind = ICAL_NO_COMPONENT;
+ ICalComponent *main_comp;
+ ICalComponentKind kind = I_CAL_NO_COMPONENT;
priv = store->priv;
- main_comp = icalparser_parse_string (text);
+ main_comp = i_cal_parser_parse_string (text);
if (main_comp == NULL) {
process_callbacks (qdata);
return;
}
- kind = icalcomponent_isa (main_comp);
- if (kind == ICAL_VCALENDAR_COMPONENT) {
- icalcompiter iter;
- icalcomponent *tz_top_level, *sub_comp;
+ kind = i_cal_component_isa (main_comp);
+ if (kind == I_CAL_VCALENDAR_COMPONENT) {
+ ICalCompIter *iter;
+ ICalComponent *tz_top_level, *subcomp;
tz_top_level = e_cal_util_new_top_level ();
- iter = icalcomponent_begin_component (main_comp, ICAL_VTIMEZONE_COMPONENT);
- while ((sub_comp = icalcompiter_deref (&iter)) != NULL) {
- icalcomponent *clone;
+ iter = i_cal_component_begin_component (main_comp, I_CAL_VTIMEZONE_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
- clone = icalcomponent_new_clone (sub_comp);
- icalcomponent_add_component (tz_top_level, clone);
+ next_subcomp = i_cal_comp_iter_next (iter);
- icalcompiter_next (&iter);
+ i_cal_component_take_component (tz_top_level,
+ i_cal_component_new_clone (subcomp));
+
+ g_object_unref (subcomp);
+ subcomp = next_subcomp;
}
- iter = icalcomponent_begin_component (main_comp, ICAL_VFREEBUSY_COMPONENT);
- while ((sub_comp = icalcompiter_deref (&iter)) != NULL) {
- process_free_busy_comp (attendee, sub_comp, priv->zone, tz_top_level);
+ g_clear_object (&iter);
+
+ iter = i_cal_component_begin_component (main_comp, I_CAL_VFREEBUSY_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
- icalcompiter_next (&iter);
+ next_subcomp = i_cal_comp_iter_next (iter);
+
+ process_free_busy_comp (attendee, subcomp, priv->zone, tz_top_level);
+
+ g_object_unref (subcomp);
+ subcomp = next_subcomp;
}
- icalcomponent_free (tz_top_level);
- } else if (kind == ICAL_VFREEBUSY_COMPONENT) {
+
+ g_clear_object (&iter);
+ g_clear_object (&tz_top_level);
+ } else if (kind == I_CAL_VFREEBUSY_COMPONENT) {
process_free_busy_comp (attendee, main_comp, priv->zone, NULL);
}
- icalcomponent_free (main_comp);
+ g_clear_object (&main_comp);
process_callbacks (qdata);
}
@@ -1747,25 +1800,33 @@ refresh_busy_periods (gpointer data)
/* Check the server for free busy data */
if (priv->client) {
- struct icaltimetype itt;
-
- itt = icaltime_null_time ();
- itt.year = g_date_get_year (&qdata->start.date);
- itt.month = g_date_get_month (&qdata->start.date);
- itt.day = g_date_get_day (&qdata->start.date);
- itt.hour = qdata->start.hour;
- itt.minute = qdata->start.minute;
- fbd->startt = icaltime_as_timet_with_zone (itt, priv->zone);
-
- itt = icaltime_null_time ();
- itt.year = g_date_get_year (&qdata->end.date);
- itt.month = g_date_get_month (&qdata->end.date);
- itt.day = g_date_get_day (&qdata->end.date);
- itt.hour = qdata->end.hour;
- itt.minute = qdata->end.minute;
- fbd->endt = icaltime_as_timet_with_zone (itt, priv->zone);
- fbd->qdata = qdata;
+ ICalTime *itt;
+
+ itt = i_cal_time_null_time ();
+ i_cal_time_set_date (itt,
+ g_date_get_year (&qdata->start.date),
+ g_date_get_month (&qdata->start.date),
+ g_date_get_day (&qdata->start.date));
+ i_cal_time_set_time (itt,
+ qdata->start.hour,
+ qdata->start.minute,
+ 0);
+ fbd->startt = i_cal_time_as_timet_with_zone (itt, priv->zone);
+ g_clear_object (&itt);
+
+ itt = i_cal_time_null_time ();
+ i_cal_time_set_date (itt,
+ g_date_get_year (&qdata->end.date),
+ g_date_get_month (&qdata->end.date),
+ g_date_get_day (&qdata->end.date));
+ i_cal_time_set_time (itt,
+ qdata->end.hour,
+ qdata->end.minute,
+ 0);
+ fbd->endt = i_cal_time_as_timet_with_zone (itt, priv->zone);
+ g_clear_object (&itt);
+ fbd->qdata = qdata;
fbd->users = g_slist_append (fbd->users, g_strdup (fbd->email));
}
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-meeting-utils.c b/src/calendar/gui/e-meeting-utils.c
index e7df2f89fa..8b9678e6b0 100644
--- a/src/calendar/gui/e-meeting-utils.c
+++ b/src/calendar/gui/e-meeting-utils.c
@@ -93,7 +93,7 @@ e_meeting_xfb_data_clear (EMeetingXfbData *xfb)
}
/* Creates an XFB string from a string property of a vfreebusy
- * icalproperty. The ical string we read may be base64 encoded, but
+ * ICalProperty. The iCal string we read may be base64 encoded, but
* we get no reliable indication whether it really is. So we
* try to base64-decode, and failing that, assume the string
* is plain. The result is validated for UTF-8. We try to convert
@@ -117,7 +117,7 @@ e_meeting_xfb_utf8_string_new_from_ical (const gchar *icalstring,
if (icalstring == NULL)
return NULL;
- /* ical does not carry charset hints, so we
+ /* iCal does not carry charset hints, so we
* try UTF-8 first, then conversion using
* system locale info.
*/
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 a9730a8ee8..b145bc8703 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -171,70 +171,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) {
@@ -249,10 +252,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);
}
}
@@ -280,37 +283,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;
}
@@ -319,7 +327,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,
@@ -328,13 +336,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);
@@ -347,16 +356,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");
@@ -367,24 +378,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" */
@@ -392,19 +405,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" */
@@ -427,34 +442,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)" */
@@ -463,21 +480,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 ? ")" : "");
}
@@ -485,7 +506,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 ? ")" : "");
}
@@ -505,32 +526,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;
@@ -553,9 +586,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;
}
@@ -574,10 +610,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;
@@ -589,46 +625,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);
@@ -784,10 +820,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);
@@ -801,17 +835,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)));
@@ -819,35 +853,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);
@@ -867,7 +905,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 };
@@ -889,12 +927,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);
@@ -917,20 +955,20 @@ etdp_add_component (EToDoPane *to_do_pane,
} else {
GSList *attendees = NULL, *link;
- 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 *ca = link->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))
icon_name = "stock_task-assigned-to";
break;
}
}
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
} else
icon_name = "stock_people";
@@ -973,7 +1011,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);
@@ -1376,15 +1414,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;
@@ -1394,7 +1432,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;
@@ -1477,11 +1515,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"));
@@ -1512,7 +1550,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);
@@ -1534,12 +1572,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
@@ -1581,7 +1621,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");
@@ -1591,12 +1631,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);
@@ -1810,28 +1850,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);
}
}
@@ -1945,7 +1987,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
@@ -1970,7 +2012,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;
@@ -1999,8 +2041,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));
@@ -2011,7 +2053,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 40943fc880..37c19ed96d 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;
@@ -3345,7 +3342,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;
@@ -3358,10 +3355,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)));
@@ -3372,8 +3369,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;
@@ -3384,8 +3382,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;
@@ -3402,6 +3400,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. */
@@ -3493,8 +3494,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)) {
@@ -3686,28 +3687,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;
}
@@ -3770,8 +3770,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);
@@ -3845,12 +3846,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 (
@@ -3865,12 +3865,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 (
@@ -4097,7 +4096,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 = "";
@@ -4193,7 +4192,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 */
@@ -4427,7 +4426,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;
@@ -4447,10 +4446,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);
@@ -4472,15 +4471,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)
@@ -4561,10 +4563,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;
@@ -4585,19 +4587,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);
@@ -4615,10 +4617,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;
@@ -4667,7 +4669,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,
@@ -4691,7 +4693,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;
@@ -4724,7 +4726,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;
@@ -4734,14 +4736,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);
@@ -4752,29 +4758,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 */
@@ -4788,52 +4796,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;
@@ -4846,6 +4858,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
out:
+ e_cal_component_text_free (summary);
g_free (text);
g_object_unref (comp);
@@ -4920,16 +4933,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 84ae2a8176..72783cc140 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.c b/src/calendar/gui/print.c
index 68fd533c4a..1935bab32b 100644
--- a/src/calendar/gui/print.c
+++ b/src/calendar/gui/print.c
@@ -39,6 +39,7 @@
#include "e-cal-model.h"
#include "e-day-view.h"
#include "e-day-view-layout.h"
+#include "itip-utils.h"
#include "e-week-view.h"
#include "e-week-view-layout.h"
#include "e-task-table.h"
@@ -51,7 +52,7 @@ typedef struct PrintCalItem PrintCalItem;
struct PrintCompItem {
ECalClient *client;
ECalComponent *comp;
- icaltimezone *zone;
+ ICalTimezone *zone;
gboolean use_24_hour_format;
};
@@ -206,7 +207,7 @@ struct pdinfo
gint mins_per_row;
guint8 cols_per_row[CALC_DAY_VIEW_ROWS (1)];
gboolean use_24_hour_format;
- icaltimezone *zone;
+ ICalTimezone *zone;
};
struct psinfo {
@@ -225,31 +226,24 @@ struct psinfo {
gboolean use_24_hour_format;
gdouble row_height;
gdouble header_row_height;
- icaltimezone *zone;
+ ICalTimezone *zone;
};
/* Convenience function to help the transition to timezone functions.
* It converts a time_t to a struct tm. */
static void
convert_timet_to_struct_tm (time_t time,
- icaltimezone *zone,
+ ICalTimezone *zone,
struct tm *tm)
{
- struct icaltimetype tt;
+ ICalTime *tt;
- /* Convert it to an icaltimetype. */
- tt = icaltime_from_timet_with_zone (time, FALSE, zone);
+ /* Convert it to an ICalTime. */
+ tt = i_cal_time_from_timet_with_zone (time, FALSE, zone);
- /* Fill in the struct tm. */
- tm->tm_year = tt.year - 1900;
- tm->tm_mon = tt.month - 1;
- tm->tm_mday = tt.day;
- tm->tm_hour = tt.hour;
- tm->tm_min = tt.minute;
- tm->tm_sec = tt.second;
- tm->tm_isdst = tt.is_daylight;
+ *tm = e_cal_util_icaltime_to_tm (tt);
- tm->tm_wday = time_day_of_week (tt.day, tt.month - 1, tt.year);
+ g_clear_object (&tt);
}
/* Fills the 42-element days array with the day numbers for the specified
@@ -713,13 +707,15 @@ format_date (struct tm *tm,
}
static gboolean
-instance_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+instance_cb (ICalComponent *comp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- gboolean *found = ((ECalModelGenerateInstancesData *) data)->cb_data;
+ gboolean *found = ((ECalModelGenerateInstancesData *) user_data)->cb_data;
*found = TRUE;
@@ -784,7 +780,7 @@ print_month_small (GtkPrintContext *context,
time_t greyend,
gint bordertitle)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
PangoFontDescription *font, *font_bold, *font_normal;
time_t now, next;
gint x, y;
@@ -928,7 +924,7 @@ print_month_small (GtkPrintContext *context,
e_cal_model_generate_instances_sync (
model, now,
time_day_end_with_zone (now, zone),
- instance_cb, &found);
+ NULL, instance_cb, &found);
font = found ? font_bold : font_normal;
@@ -1141,7 +1137,7 @@ static gint
print_day_add_event (ECalModelComponent *comp_data,
time_t start,
time_t end,
- icaltimezone *zone,
+ ICalTimezone *zone,
gint days_shown,
time_t *day_starts,
GArray *long_events,
@@ -1150,7 +1146,7 @@ print_day_add_event (ECalModelComponent *comp_data,
{
EDayViewEvent event;
gint day, offset;
- struct icaltimetype start_tt, end_tt;
+ ICalTime *start_tt, *end_tt;
#if 0
g_print ("Day view lower: %s", ctime (&day_starts[0]));
@@ -1164,8 +1160,8 @@ print_day_add_event (ECalModelComponent *comp_data,
g_return_val_if_fail (start < day_starts[days_shown], -1);
g_return_val_if_fail (end > day_starts[0], -1);
- 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);
event.comp_data = comp_data;
event.start = start;
@@ -1177,8 +1173,8 @@ print_day_add_event (ECalModelComponent *comp_data,
/*offset = day_view->first_hour_shown * 60
+ day_view->first_minute_shown;*/
offset = 0;
- 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;
event.start_row_or_col = 0;
event.num_columns = 0;
@@ -1211,16 +1207,20 @@ print_day_add_event (ECalModelComponent *comp_data,
}
static gboolean
-print_day_details_cb (ECalComponent *comp,
- time_t istart,
- time_t iend,
- gpointer data)
-{
- ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) data;
+print_day_details_cb (ICalComponent *comp,
+ ICalTime *istart,
+ ICalTime *iend,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
+{
+ ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) user_data;
struct pdinfo *pdi = (struct pdinfo *) mdata->cb_data;
print_day_add_event (
- mdata->comp_data, istart, iend,
+ mdata->comp_data,
+ i_cal_time_as_timet_with_zone (istart, pdi->zone),
+ i_cal_time_as_timet_with_zone (iend, pdi->zone),
pdi->zone, pdi->days_shown, pdi->day_starts,
pdi->long_events, pdi->events);
@@ -1243,34 +1243,34 @@ free_event_array (GArray *array)
}
static const gchar *
-get_type_as_string (icalparameter_cutype cutype)
+get_type_as_string (ICalParameterCutype cutype)
{
const gchar *res;
switch (cutype) {
- case ICAL_CUTYPE_NONE: res = NULL; break;
- case ICAL_CUTYPE_INDIVIDUAL: res = _("Individual"); break;
- case ICAL_CUTYPE_GROUP: res = _("Group"); break;
- case ICAL_CUTYPE_RESOURCE: res = _("Resource"); break;
- case ICAL_CUTYPE_ROOM: res = _("Room"); break;
- default: res = _("Unknown"); break;
+ case I_CAL_CUTYPE_NONE: res = NULL; break;
+ case I_CAL_CUTYPE_INDIVIDUAL: res = _("Individual"); break;
+ case I_CAL_CUTYPE_GROUP: res = _("Group"); break;
+ case I_CAL_CUTYPE_RESOURCE: res = _("Resource"); break;
+ case I_CAL_CUTYPE_ROOM: res = _("Room"); break;
+ default: res = _("Unknown"); break;
}
return res;
}
static const gchar *
-get_role_as_string (icalparameter_role role)
+get_role_as_string (ICalParameterRole role)
{
const gchar *res;
switch (role) {
- case ICAL_ROLE_NONE: res = NULL; break;
- case ICAL_ROLE_CHAIR: res = _("Chair"); break;
- case ICAL_ROLE_REQPARTICIPANT: res = _("Required Participant"); break;
- case ICAL_ROLE_OPTPARTICIPANT: res = _("Optional Participant"); break;
- case ICAL_ROLE_NONPARTICIPANT: res = _("Non-Participant"); break;
- default: res = _("Unknown"); break;
+ case I_CAL_ROLE_NONE: res = NULL; break;
+ case I_CAL_ROLE_CHAIR: res = _("Chair"); break;
+ case I_CAL_ROLE_REQPARTICIPANT: res = _("Required Participant"); break;
+ case I_CAL_ROLE_OPTPARTICIPANT: res = _("Optional Participant"); break;
+ case I_CAL_ROLE_NONPARTICIPANT: res = _("Non-Participant"); break;
+ default: res = _("Unknown"); break;
}
return res;
@@ -1294,30 +1294,33 @@ print_attendees (GtkPrintContext *context,
g_return_val_if_fail (font != NULL, top);
g_return_val_if_fail (cr != NULL, top);
- e_cal_component_get_attendee_list (comp, &attendees);
+ attendees = e_cal_component_get_attendees (comp);
for (l = attendees; l; l = l->next) {
ECalComponentAttendee *attendee = l->data;
+ const gchar *value;
+
+ if (!attendee)
+ continue;
- if (attendee && attendee->value && *attendee->value) {
+ value = e_cal_component_attendee_get_value (attendee);
+ if (value && *value) {
GString *text;
const gchar *tmp;
- tmp = get_type_as_string (attendee->cutype);
+ tmp = get_type_as_string (e_cal_component_attendee_get_cutype (attendee));
text = g_string_new (tmp ? tmp : "");
if (tmp)
g_string_append (text, " ");
- if (attendee->cn && *attendee->cn)
- g_string_append (text, attendee->cn);
+ if (e_cal_component_attendee_get_cn (attendee) && e_cal_component_attendee_get_cn
(attendee)[0])
+ g_string_append (text, e_cal_component_attendee_get_cn (attendee));
else {
- /* it's usually in form of "mailto:email@domain" */
- tmp = strchr (attendee->value, ':');
- g_string_append (text, tmp ? tmp + 1 : attendee->value);
+ g_string_append (text, itip_strip_mailto (value));
}
- tmp = get_role_as_string (attendee->role);
+ tmp = get_role_as_string (e_cal_component_attendee_get_role (attendee));
if (tmp) {
g_string_append (text, " (");
g_string_append (text, tmp);
@@ -1337,28 +1340,27 @@ print_attendees (GtkPrintContext *context,
}
}
- e_cal_component_free_attendee_list (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
return top;
}
static gchar *
-get_summary_with_location (icalcomponent *icalcomp)
+get_summary_with_location (ICalComponent *icomp)
{
- const gchar *summary, *location;
- gchar *text;
+ const gchar *location;
+ gchar *text, *summary;
- g_return_val_if_fail (icalcomp != NULL, NULL);
+ g_return_val_if_fail (icomp != NULL, NULL);
- summary = icalcomponent_get_summary (icalcomp);
- if (summary == NULL)
- summary = "";
+ summary = e_calendar_view_dup_component_summary (icomp);
- location = icalcomponent_get_location (icalcomp);
+ location = i_cal_component_get_location (icomp);
if (location && *location) {
- text = g_strdup_printf ("%s (%s)", summary, location);
+ text = g_strdup_printf ("%s (%s)", summary ? summary : "", location);
+ g_free (summary);
} else {
- text = g_strdup (summary);
+ text = summary ? summary : g_strdup ("");
}
return text;
@@ -1564,7 +1566,7 @@ print_day_details (GtkPrintContext *context,
gdouble top,
gdouble bottom)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
EDayViewEvent *event;
PangoFontDescription *font;
time_t start, end;
@@ -1598,7 +1600,7 @@ print_day_details (GtkPrintContext *context,
pdi.zone = e_cal_model_get_timezone (model);
/* Get the events from the server. */
- e_cal_model_generate_instances_sync (model, start, end, print_day_details_cb, &pdi);
+ e_cal_model_generate_instances_sync (model, start, end, NULL, print_day_details_cb, &pdi);
qsort (
pdi.long_events->data, pdi.long_events->len,
sizeof (EDayViewEvent), e_day_view_event_sort_func);
@@ -1608,22 +1610,24 @@ print_day_details (GtkPrintContext *context,
/* Also print events outside of work hours */
if (pdi.events[0]->len > 0) {
- struct icaltimetype tt;
+ ICalTime *tt;
event = &g_array_index (pdi.events[0], EDayViewEvent, 0);
- tt = icaltime_from_timet_with_zone (event->start, FALSE, zone);
- if (tt.hour < pdi.start_hour)
- pdi.start_hour = tt.hour;
+ tt = i_cal_time_from_timet_with_zone (event->start, FALSE, zone);
+ if (i_cal_time_get_hour (tt) < pdi.start_hour)
+ pdi.start_hour = i_cal_time_get_hour (tt);
pdi.start_minute_offset = pdi.start_hour * 60;
+ g_clear_object (&tt);
event = &g_array_index (pdi.events[0], EDayViewEvent, pdi.events[0]->len - 1);
- tt = icaltime_from_timet_with_zone (event->end, FALSE, zone);
- if (tt.hour > pdi.end_hour || tt.hour == 0) {
- pdi.end_hour = tt.hour ? tt.hour : 24;
- if (tt.minute > 0)
+ tt = i_cal_time_from_timet_with_zone (event->end, FALSE, zone);
+ if (i_cal_time_get_hour (tt) > pdi.end_hour || i_cal_time_get_hour (tt) == 0) {
+ pdi.end_hour = i_cal_time_get_hour (tt) ? i_cal_time_get_hour (tt) : 24;
+ if (i_cal_time_get_minute (tt) > 0)
pdi.end_hour++;
}
pdi.end_minute_offset = pdi.end_hour * 60;
+ g_clear_object (&tt);
pdi.rows = (pdi.end_hour - pdi.start_hour) * (60 / pdi.mins_per_row);
}
@@ -2113,19 +2117,23 @@ print_week_view_background (GtkPrintContext *context,
/* This adds one event to the view, adding it to the appropriate array. */
static gboolean
-print_week_summary_cb (ECalComponent *comp,
- time_t start,
- time_t end,
- gpointer data)
-
+print_week_summary_cb (ICalComponent *comp,
+ ICalTime *istart,
+ ICalTime *iend,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
EWeekViewEvent event;
- struct icaltimetype start_tt, end_tt;
- ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) data;
+ time_t start, end;
+ ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) user_data;
struct psinfo *psi = (struct psinfo *) mdata->cb_data;
/* Check that the event times are valid. */
+ start = i_cal_time_as_timet_with_zone (istart, psi->zone);
+ end = i_cal_time_as_timet_with_zone (iend, psi->zone);
+
#if 0
g_print (
"View start:%li end:%li Event start:%li end:%li\n",
@@ -2137,9 +2145,6 @@ print_week_summary_cb (ECalComponent *comp,
g_return_val_if_fail (start < psi->day_starts[psi->days_shown], TRUE);
g_return_val_if_fail (end > psi->day_starts[0], TRUE);
- start_tt = icaltime_from_timet_with_zone (start, FALSE, psi->zone);
- end_tt = icaltime_from_timet_with_zone (end, FALSE, psi->zone);
-
event.comp_data = g_object_ref (mdata->comp_data);
event.start = start;
@@ -2147,8 +2152,8 @@ print_week_summary_cb (ECalComponent *comp,
event.spans_index = 0;
event.num_spans = 0;
- 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 (istart) * 60 + i_cal_time_get_minute (istart);
+ event.end_minute = i_cal_time_get_hour (iend) * 60 + i_cal_time_get_minute (iend);
if (event.end_minute == 0 && start != end)
event.end_minute = 24 * 60;
@@ -2171,7 +2176,7 @@ print_week_summary (GtkPrintContext *context,
gdouble top,
gdouble bottom)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
EWeekViewEvent *event;
struct psinfo psi = { 0 };
time_t day_start;
@@ -2212,7 +2217,7 @@ print_week_summary (GtkPrintContext *context,
e_cal_model_generate_instances_sync (
model,
psi.day_starts[0], psi.day_starts[psi.days_shown],
- print_week_summary_cb, &psi);
+ NULL, print_week_summary_cb, &psi);
qsort (
psi.events->data, psi.events->len,
sizeof (EWeekViewEvent), e_week_view_event_sort_func);
@@ -2284,10 +2289,10 @@ print_month_summary (GtkPrintContext *context,
gdouble top,
gdouble bottom)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t date;
struct tm tm;
- struct icaltimetype tt;
+ ICalTime *tt;
gchar buffer[100];
PangoFontDescription *font;
gboolean compress_weekend;
@@ -2321,8 +2326,9 @@ print_month_summary (GtkPrintContext *context,
}
/* Remember which month we want. */
- tt = icaltime_from_timet_with_zone (whence, FALSE, zone);
- month = tt.month - 1;
+ tt = i_cal_time_from_timet_with_zone (whence, FALSE, zone);
+ month = i_cal_time_get_month (tt) - 1;
+ g_clear_object (&tt);
/* Find the start of the month, and then the start of the week on
* or before that day. */
@@ -2395,7 +2401,7 @@ print_todo_details (GtkPrintContext *context,
{
PangoFontDescription *font_summary;
gdouble y, yend, x, xend;
- struct icaltimetype *tt;
+ ICalTime *tt;
ECalModel *model;
gint rows, row;
cairo_t *cr;
@@ -2424,7 +2430,7 @@ print_todo_details (GtkPrintContext *context,
for (row = 0; row < rows; row++) {
ECalModelComponent *comp_data;
ECalComponent *comp;
- ECalComponentText summary;
+ ECalComponentText *summary;
gint model_row;
model_row = e_table_view_to_model_row (tasks_table, row);
@@ -2432,12 +2438,13 @@ print_todo_details (GtkPrintContext *context,
if (!comp_data)
continue;
- 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 (!comp)
+ continue;
- e_cal_component_get_summary (comp, &summary);
- if (!summary.value) {
+ summary = e_cal_component_get_summary (comp);
+ if (!summary || !e_cal_component_text_get_value (summary)) {
+ e_cal_component_text_free (summary);
g_object_unref (comp);
continue;
}
@@ -2445,6 +2452,7 @@ print_todo_details (GtkPrintContext *context,
x = left;
xend = right - 2;
if (y > bottom) {
+ e_cal_component_text_free (summary);
g_object_unref (comp);
break;
}
@@ -2453,9 +2461,9 @@ print_todo_details (GtkPrintContext *context,
print_border (context, x + 2, x + 8, y + 6, y + 15, 0.1, -1.0);
/* If the task is complete, print a tick in the box. */
- e_cal_component_get_completed (comp, &tt);
+ tt = e_cal_component_get_completed (comp);
if (tt) {
- e_cal_component_free_icaltimetype (tt);
+ g_clear_object (&tt);
cr = gtk_print_context_get_cairo_context (context);
cairo_set_source_rgb (cr, 0, 0, 0);
@@ -2467,7 +2475,7 @@ print_todo_details (GtkPrintContext *context,
}
y = bound_text (
- context, font_summary, summary.value, -1,
+ context, font_summary, e_cal_component_text_get_value (summary), -1,
x + 14, y + 4, xend, yend, FALSE, NULL, NULL, NULL);
y += get_font_size (font_summary) - 5;
@@ -2477,6 +2485,7 @@ print_todo_details (GtkPrintContext *context,
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
+ e_cal_component_text_free (summary);
g_object_unref (comp);
}
@@ -2491,7 +2500,7 @@ print_day_view (GtkPrintContext *context,
{
ECalModel *model;
GtkPageSetup *setup;
- icaltimezone *zone;
+ ICalTimezone *zone;
gint i, days = 1;
gdouble todo, l, week_numbers_inc, small_month_width;
gchar buf[100];
@@ -2732,7 +2741,7 @@ print_work_week_day_details (GtkPrintContext *context,
gdouble bottom,
struct pdinfo *_pdi)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
EDayViewEvent *event;
PangoFontDescription *font;
time_t start, end;
@@ -2766,7 +2775,7 @@ print_work_week_day_details (GtkPrintContext *context,
pdi.zone = e_cal_model_get_timezone (model);
/* Get the events from the server. */
- e_cal_model_generate_instances_sync (model, start, end, print_day_details_cb, &pdi);
+ e_cal_model_generate_instances_sync (model, start, end, NULL, print_day_details_cb, &pdi);
qsort (
pdi.long_events->data, pdi.long_events->len,
sizeof (EDayViewEvent), e_day_view_event_sort_func);
@@ -2780,22 +2789,24 @@ print_work_week_day_details (GtkPrintContext *context,
/* TODO: This should be redundant */
/* Also print events outside of work hours */
if (pdi.events[0]->len > 0) {
- struct icaltimetype tt;
+ ICalTime *tt;
event = &g_array_index (pdi.events[0], EDayViewEvent, 0);
- tt = icaltime_from_timet_with_zone (event->start, FALSE, zone);
- if (tt.hour < pdi.start_hour)
- pdi.start_hour = tt.hour;
+ tt = i_cal_time_from_timet_with_zone (event->start, FALSE, zone);
+ if (i_cal_time_get_hour (tt) < pdi.start_hour)
+ pdi.start_hour = i_cal_time_get_hour (tt);
pdi.start_minute_offset = pdi.start_hour * 60;
+ g_clear_object (&tt);
event = &g_array_index (pdi.events[0], EDayViewEvent, pdi.events[0]->len - 1);
- tt = icaltime_from_timet_with_zone (event->end, FALSE, zone);
- if (tt.hour > pdi.end_hour || tt.hour == 0) {
- pdi.end_hour = tt.hour ? tt.hour : 24;
- if (tt.minute > 0)
+ tt = i_cal_time_from_timet_with_zone (event->end, FALSE, zone);
+ if (i_cal_time_get_hour (tt) > pdi.end_hour || i_cal_time_get_hour (tt) == 0) {
+ pdi.end_hour = i_cal_time_get_hour (tt) ? i_cal_time_get_hour (tt) : 24;
+ if (i_cal_time_get_minute (tt) > 0)
pdi.end_hour++;
}
pdi.end_minute_offset = pdi.end_hour * 60;
+ g_clear_object (&tt);
pdi.rows = (pdi.end_hour - pdi.start_hour) * (60 / pdi.mins_per_row);
}
@@ -2909,21 +2920,20 @@ print_work_week_day_details (GtkPrintContext *context,
/* Figure out what the overal hour limits are */
static gboolean
-print_work_week_view_cb (ECalComponent *comp,
- time_t istart,
- time_t iend,
- gpointer data)
-{
- ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) data;
+print_work_week_view_cb (ICalComponent *comp,
+ ICalTime *istart,
+ ICalTime *iend,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
+{
+ ECalModelGenerateInstancesData *mdata = (ECalModelGenerateInstancesData *) user_data;
struct pdinfo *pdi = (struct pdinfo *) mdata->cb_data;
- struct icaltimetype tt;
- tt = icaltime_from_timet_with_zone (istart, FALSE, pdi->zone);
- pdi->start_hour = MIN (pdi->start_hour, tt.hour);
+ pdi->start_hour = MIN (pdi->start_hour, i_cal_time_get_hour (istart));
- tt = icaltime_from_timet_with_zone (iend, FALSE, pdi->zone);
/* If we're past the hour, use the next one */
- pdi->end_hour = MAX (pdi->end_hour, tt.minute ? tt.hour + 1 : tt.hour);
+ pdi->end_hour = MAX (pdi->end_hour, i_cal_time_get_minute (iend) ? i_cal_time_get_hour (iend) + 1 :
i_cal_time_get_hour (iend));
return TRUE;
}
@@ -2934,7 +2944,7 @@ print_work_week_view (GtkPrintContext *context,
time_t date)
{
GtkPageSetup *setup;
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t when, start, end;
gdouble width, height, l;
gdouble small_month_width;
@@ -2967,7 +2977,7 @@ print_work_week_view (GtkPrintContext *context,
pdi.end_hour = e_cal_model_get_work_day_end_hour (model);
pdi.zone = zone;
- e_cal_model_generate_instances_sync (model, start, end, print_work_week_view_cb, &pdi);
+ e_cal_model_generate_instances_sync (model, start, end, NULL, print_work_week_view_cb, &pdi);
print_work_week_background (
context, model, date, &pdi, 0.0, width,
@@ -3040,7 +3050,7 @@ print_week_view (GtkPrintContext *context,
{
GtkPageSetup *setup;
ECalModel *model;
- icaltimezone *zone;
+ ICalTimezone *zone;
gdouble l, week_numbers_inc, small_month_width;
gchar buf[100];
time_t when;
@@ -3132,7 +3142,7 @@ print_month_view (GtkPrintContext *context,
{
ECalModel *model;
GtkPageSetup *setup;
- icaltimezone *zone;
+ ICalTimezone *zone;
gchar buf[100];
gdouble width, height;
gdouble l, week_numbers_inc, small_month_width;
@@ -3181,8 +3191,8 @@ print_month_view (GtkPrintContext *context,
static gboolean
same_date (struct tm tm1,
- time_t t2,
- icaltimezone *zone)
+ time_t t2,
+ ICalTimezone *zone)
{
struct tm tm2;
@@ -3197,7 +3207,7 @@ same_date (struct tm tm1,
static void
write_label_piece (time_t t,
time_t *start_cmp,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format,
gchar *buffer,
gint size,
@@ -3230,20 +3240,23 @@ write_label_piece (time_t t,
}
}
-static icaltimezone *
+static ICalTimezone *
get_zone_from_tzid (ECalClient *client,
const gchar *tzid)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
+
+ if (!tzid)
+ return NULL;
/* Note that the timezones may not be on the server, so we try to get
* the builtin timezone with the TZID first. */
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (!zone && tzid) {
GError *error = 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 (
@@ -3260,56 +3273,57 @@ static void
print_date_label (GtkPrintContext *context,
ECalComponent *comp,
ECalClient *client,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format,
gdouble left,
gdouble right,
gdouble top,
gdouble bottom)
{
- icaltimezone *start_zone, *end_zone, *due_zone, *completed_zone;
- ECalComponentDateTime datetime;
+ ICalTimezone *start_zone, *end_zone, *due_zone, *completed_zone;
+ ICalTime *completed_tt;
+ ECalComponentDateTime *datetime;
time_t start = 0, end = 0, complete = 0, due = 0;
static gchar buffer[1024];
- e_cal_component_get_dtstart (comp, &datetime);
- if (datetime.value) {
- start_zone = get_zone_from_tzid (client, datetime.tzid);
- if (!start_zone || datetime.value->is_date)
+ datetime = e_cal_component_get_dtstart (comp);
+ if (datetime && e_cal_component_datetime_get_value (datetime)) {
+ ICalTime *value = e_cal_component_datetime_get_value (datetime);
+
+ start_zone = get_zone_from_tzid (client, e_cal_component_datetime_get_tzid (datetime));
+ if (!start_zone || i_cal_time_is_date (value))
start_zone = zone;
- start = icaltime_as_timet_with_zone (
- *datetime.value,
- start_zone);
+ start = i_cal_time_as_timet_with_zone (value, start_zone);
}
- e_cal_component_free_datetime (&datetime);
+ e_cal_component_datetime_free (datetime);
+
+ datetime = e_cal_component_get_dtend (comp);
+ if (datetime && e_cal_component_datetime_get_value (datetime)) {
+ ICalTime *value = e_cal_component_datetime_get_value (datetime);
- e_cal_component_get_dtend (comp, &datetime);
- if (datetime.value) {
- end_zone = get_zone_from_tzid (client, datetime.tzid);
- if (!end_zone || datetime.value->is_date)
+ end_zone = get_zone_from_tzid (client, e_cal_component_datetime_get_tzid (datetime));
+ if (!end_zone || i_cal_time_is_date (value))
end_zone = zone;
- end = icaltime_as_timet_with_zone (
- *datetime.value,
- end_zone);
+ end = i_cal_time_as_timet_with_zone (value, end_zone);
}
- e_cal_component_free_datetime (&datetime);
+ e_cal_component_datetime_free (datetime);
+
+ datetime = e_cal_component_get_due (comp);
+ if (datetime && e_cal_component_datetime_get_value (datetime)) {
+ ICalTime *value = e_cal_component_datetime_get_value (datetime);
- e_cal_component_get_due (comp, &datetime);
- if (datetime.value) {
- due_zone = get_zone_from_tzid (client, datetime.tzid);
- if (!due_zone || datetime.value->is_date)
+ due_zone = get_zone_from_tzid (client, e_cal_component_datetime_get_tzid (datetime));
+ if (!due_zone || i_cal_time_is_date (value))
due_zone = zone;
- due = icaltime_as_timet_with_zone (
- *datetime.value, due_zone);
+ due = i_cal_time_as_timet_with_zone (value, due_zone);
}
- e_cal_component_free_datetime (&datetime);
+ e_cal_component_datetime_free (datetime);
- e_cal_component_get_completed (comp, &datetime.value);
- if (datetime.value) {
- completed_zone = icaltimezone_get_utc_timezone ();
- complete = icaltime_as_timet_with_zone (
- *datetime.value, completed_zone);
- e_cal_component_free_icaltimetype (datetime.value);
+ completed_tt = e_cal_component_get_completed (comp);
+ if (completed_tt) {
+ completed_zone = i_cal_timezone_get_utc_timezone ();
+ complete = i_cal_time_as_timet_with_zone (completed_tt, completed_zone);
+ g_clear_object (&completed_tt);
}
buffer[0] = '\0';
@@ -3417,18 +3431,20 @@ print_calendar (ECalendarView *cal_view,
if (multi_week_view &&
weeks_shown >= 4 &&
g_date_valid (&date)) {
-
- struct icaltimetype start_tt;
+ ICalTime *start_tt;
g_date_add_days (&date, 7);
- start_tt = icaltime_null_time ();
- start_tt.is_date = TRUE;
- start_tt.year = g_date_get_year (&date);
- start_tt.month = g_date_get_month (&date);
- start_tt.day = g_date_get_day (&date);
+ start_tt = i_cal_time_null_time ();
+ i_cal_time_set_is_date (start_tt, TRUE);
+ i_cal_time_set_date (start_tt,
+ g_date_get_year (&date),
+ g_date_get_month (&date),
+ g_date_get_day (&date));
+
+ start = i_cal_time_as_timet (start_tt);
- start = icaltime_as_timet (start_tt);
+ g_clear_object (&start_tt);
} else if (multi_week_view) {
start = week_view->day_starts[0];
}
@@ -3463,11 +3479,10 @@ print_comp_draw_real (GtkPrintOperation *operation,
ECalClient *client;
ECalComponent *comp;
ECalComponentVType vtype;
- ECalComponentText text;
- GSList *desc, *l;
- GSList *contact_list, *elem;
-
- const gchar *title, *categories, *location;
+ ECalComponentText *text;
+ GSList *desc, *contact_list, *elem;
+ const gchar *title;
+ gchar *categories, *location;
gchar *categories_string, *location_string, *summary_string;
gdouble header_size;
cairo_t *cr;
@@ -3530,16 +3545,16 @@ print_comp_draw_real (GtkPrintOperation *operation,
/* Summary */
font = get_font_for_size (18, PANGO_WEIGHT_BOLD);
- e_cal_component_get_summary (comp, &text);
- summary_string = g_strdup_printf (_("Summary: %s"), text.value ? text.value : "");
+ text = e_cal_component_get_summary (comp);
+ summary_string = g_strdup_printf (_("Summary: %s"), (text && e_cal_component_text_get_value (text)) ?
e_cal_component_text_get_value (text) : "");
top = bound_text (
context, font, summary_string, -1, 0.0, top, width,
height, FALSE, NULL, &page_start, &pages);
-
+ e_cal_component_text_free (text);
g_free (summary_string);
/* Location */
- e_cal_component_get_location (comp, &location);
+ location = e_cal_component_get_location (comp);
if (location && location[0]) {
location_string = g_strdup_printf (
_("Location: %s"),
@@ -3549,6 +3564,7 @@ print_comp_draw_real (GtkPrintOperation *operation,
top + 3, width, height, FALSE, NULL, &page_start, &pages);
g_free (location_string);
}
+ g_free (location);
/* Date information */
if (page_nr == 0)
@@ -3577,26 +3593,26 @@ print_comp_draw_real (GtkPrintOperation *operation,
/* For a VTODO we print the Status, Priority, % Complete and URL. */
if (vtype == E_CAL_COMPONENT_TODO) {
- icalproperty_status status;
+ ICalPropertyStatus status;
const gchar *status_string = NULL;
- gint *percent;
- gint *priority;
- const gchar *url;
+ gint percent;
+ gint priority;
+ gchar *url;
/* Status */
- e_cal_component_get_status (comp, &status);
- if (status != ICAL_STATUS_NONE) {
+ status = e_cal_component_get_status (comp);
+ if (status != I_CAL_STATUS_NONE) {
switch (status) {
- case ICAL_STATUS_NEEDSACTION:
+ case I_CAL_STATUS_NEEDSACTION:
status_string = _("Not Started");
break;
- case ICAL_STATUS_INPROCESS:
+ case I_CAL_STATUS_INPROCESS:
status_string = _("In Progress");
break;
- case ICAL_STATUS_COMPLETED:
+ case I_CAL_STATUS_COMPLETED:
status_string = _("Completed");
break;
- case ICAL_STATUS_CANCELLED:
+ case I_CAL_STATUS_CANCELLED:
status_string = _("Cancelled");
break;
default:
@@ -3616,13 +3632,13 @@ print_comp_draw_real (GtkPrintOperation *operation,
}
/* Priority */
- e_cal_component_get_priority (comp, &priority);
- if (priority && *priority >= 0) {
+ priority = e_cal_component_get_priority (comp);
+ if (priority >= 0) {
gchar *pri_text;
pri_text = g_strdup_printf (
_("Priority: %s"),
- e_cal_util_priority_to_string (*priority));
+ e_cal_util_priority_to_string (priority));
top = bound_text (
context, font, pri_text, -1,
0.0, top, width, height, FALSE, NULL,
@@ -3631,25 +3647,23 @@ print_comp_draw_real (GtkPrintOperation *operation,
g_free (pri_text);
}
- if (priority)
- e_cal_component_free_priority (priority);
-
/* Percent Complete */
- e_cal_component_get_percent (comp, &percent);
- if (percent) {
+ percent = e_cal_component_get_percent_complete (comp);
+ if (percent >= 0) {
gchar *percent_string;
- percent_string = g_strdup_printf (_("Percent Complete: %i"), *percent);
- e_cal_component_free_percent (percent);
+ percent_string = g_strdup_printf (_("Percent Complete: %i"), percent);
top = bound_text (
context, font, percent_string, -1,
0.0, top, width, height, FALSE, NULL, &page_start, &pages);
top += get_font_size (font) - 6;
+
+ g_free (percent_string);
}
/* URL */
- e_cal_component_get_url (comp, &url);
+ url = e_cal_component_get_url (comp);
if (url && url[0]) {
gchar *url_string;
@@ -3661,10 +3675,12 @@ print_comp_draw_real (GtkPrintOperation *operation,
top += get_font_size (font) - 6;
g_free (url_string);
}
+
+ g_free (url);
}
/* Categories */
- e_cal_component_get_categories (comp, &categories);
+ categories = e_cal_component_get_categories (comp);
if (categories && categories[0]) {
categories_string = g_strdup_printf (
_("Categories: %s"), categories);
@@ -3674,9 +3690,10 @@ print_comp_draw_real (GtkPrintOperation *operation,
top += get_font_size (font) - 6;
g_free (categories_string);
}
+ g_free (categories);
/* Contacts */
- e_cal_component_get_contact_list (comp, &contact_list);
+ contact_list = e_cal_component_get_contacts (comp);
if (contact_list) {
GString *contacts = g_string_new (_("Contacts: "));
for (elem = contact_list; elem; elem = elem->next) {
@@ -3684,9 +3701,9 @@ print_comp_draw_real (GtkPrintOperation *operation,
/* Put a comma between contacts. */
if (elem != contact_list)
g_string_append (contacts, ", ");
- g_string_append (contacts, t->value);
+ g_string_append (contacts, e_cal_component_text_get_value (t));
}
- e_cal_component_free_text_list (contact_list);
+ g_slist_free_full (contact_list, e_cal_component_text_free);
top = bound_text (
context, font, contacts->str, -1,
@@ -3697,12 +3714,12 @@ print_comp_draw_real (GtkPrintOperation *operation,
top += 16;
/* Description */
- e_cal_component_get_description_list (comp, &desc);
- for (l = desc; l != NULL; l = l->next) {
- ECalComponentText *ptext = l->data;
+ desc = e_cal_component_get_descriptions (comp);
+ for (elem = desc; elem; elem = g_slist_next (elem)) {
+ ECalComponentText *ptext = elem->data;
const gchar *line, *next_line;
- for (line = ptext->value; line != NULL; line = next_line) {
+ for (line = e_cal_component_text_get_value (ptext); line != NULL; line = next_line) {
next_line = strchr (line, '\n');
top = bound_text (
@@ -3720,7 +3737,7 @@ print_comp_draw_real (GtkPrintOperation *operation,
}
- e_cal_component_free_text_list (desc);
+ g_slist_free_full (desc, e_cal_component_text_free);
pango_font_description_free (font);
return pages;
@@ -3750,7 +3767,7 @@ print_comp_begin_print (GtkPrintOperation *operation,
void
print_comp (ECalComponent *comp,
ECalClient *cal_client,
- icaltimezone *zone,
+ ICalTimezone *zone,
gboolean use_24_hour_format,
GtkPrintOperationAction action)
{
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..e0408b4d86 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..5677a1c9cf 100644
--- a/src/e-util/test-source-selector.c
+++ b/src/e-util/test-source-selector.c
@@ -270,12 +270,15 @@ cal_view_objects_added_cb (ECalClientView *client_view,
g_slist_length ((GSList *) objects));
for (link = (GSList *) objects; link; link = g_slist_next (link)) {
- icalcomponent *icalcomp = link->data;
+ ICalComponent *icomp = link->data;
- if (icalcomp)
- g_print ("%s\n -----------------------------\n", icalcomponent_as_ical_string
(icalcomp));
- else
+ if (icomp) {
+ gchar *str = i_cal_component_as_ical_string_r (icomp);
+ g_print ("%s\n -----------------------------\n", str);
+ g_free (str);
+ } else {
g_print ("\tnull\n");
+ }
}
}
@@ -290,11 +293,13 @@ cal_view_objects_modified_cb (ECalClientView *client_view,
g_slist_length ((GSList *) objects));
for (link = (GSList *) objects; link; link = g_slist_next (link)) {
- icalcomponent *icalcomp = link->data;
+ ICalComponent *icomp = link->data;
- if (icalcomp)
- g_print ("%s\n -----------------------------\n", icalcomponent_as_ical_string
(icalcomp));
- else
+ if (icomp) {
+ gchar *str = i_cal_component_as_ical_string_r (icomp);
+ g_print ("%s\n -----------------------------\n", str);
+ g_free (str);
+ } else
g_print ("\tnull\n");
}
}
@@ -311,9 +316,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");
}
@@ -454,18 +463,19 @@ create_view_clicked_cb (GtkWidget *button,
gchar *expr = NULL;
if (e_cal_client_get_source_type (E_CAL_CLIENT (client)) == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
- struct icaltimetype tt;
+ ICalTime *tt;
gchar *start, *end;
- tt = icaltime_today ();
- start = isodate_from_time_t (icaltime_as_timet (tt));
- icaltime_adjust (&tt, 14, 0, 0, 0);
- end = isodate_from_time_t (icaltime_as_timet (tt));
+ tt = i_cal_time_today ();
+ start = isodate_from_time_t (i_cal_time_as_timet (tt));
+ i_cal_time_adjust (tt, 14, 0, 0, 0);
+ end = isodate_from_time_t (i_cal_time_as_timet (tt));
expr = g_strdup_printf (
"(occur-in-time-range? (make-time \"%s\") (make-time \"%s\") \"UTC\")",
start, end);
+ g_clear_object (&tt);
g_free (start);
g_free (end);
}
diff --git a/src/modules/alarm-notify/alarm-notify.c b/src/modules/alarm-notify/alarm-notify.c
index 5176357014..7a374f66da 100644
--- a/src/modules/alarm-notify/alarm-notify.c
+++ b/src/modules/alarm-notify/alarm-notify.c
@@ -66,7 +66,7 @@ alarm_notify_module_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");
@@ -76,12 +76,12 @@ alarm_notify_module_map_string_to_icaltimezone (GValue *value,
location = g_variant_get_string (variant, NULL);
if (location && *location)
- timezone = icaltimezone_get_builtin_timezone (location);
+ timezone = i_cal_timezone_get_builtin_timezone (location);
if (!timezone)
- timezone = icaltimezone_get_utc_timezone ();
+ timezone = i_cal_timezone_get_utc_timezone ();
- g_value_set_boxed (value, timezone);
+ g_value_set_object (value, timezone);
g_object_unref (settings);
@@ -91,7 +91,7 @@ alarm_notify_module_map_string_to_icaltimezone (GValue *value,
static void
alarm_notify_module_format_time_cb (EReminderWatcher *watcher,
const EReminderData *rd,
- struct icaltimetype *itt,
+ ICalTime *itt,
gchar **inout_buffer,
gint buffer_size)
{
@@ -104,8 +104,8 @@ 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);
- text = e_datetime_format_format_tm ("calendar", "table", itt->is_date ? DTFormatKindDate :
DTFormatKindDateTime, &tm);
+ tm = e_cal_util_icaltime_to_tm (itt);
+ text = e_datetime_format_format_tm ("calendar", "table", i_cal_time_is_date (itt) ? DTFormatKindDate
: DTFormatKindDateTime, &tm);
if (text) {
g_snprintf (*inout_buffer, buffer_size, "%s", text);
@@ -118,15 +118,17 @@ alarm_notify_module_row_activated_cb (ERemindersWidget *reminders,
const EReminderData *rd,
gpointer user_data)
{
+ ECalComponent *comp;
const gchar *scheme = NULL;
const gchar *comp_uid = NULL;
g_return_val_if_fail (E_IS_REMINDERS_WIDGET (reminders), FALSE);
g_return_val_if_fail (rd != NULL, FALSE);
- e_cal_component_get_uid (rd->component, &comp_uid);
+ comp = e_reminder_data_get_component (rd);
+ comp_uid = e_cal_component_get_uid (comp);
- switch (e_cal_component_get_vtype (rd->component)) {
+ switch (e_cal_component_get_vtype (comp)) {
case E_CAL_COMPONENT_EVENT:
scheme = "calendar:";
break;
@@ -140,7 +142,7 @@ alarm_notify_module_row_activated_cb (ERemindersWidget *reminders,
break;
}
- if (scheme && comp_uid && rd->source_uid) {
+ if (scheme && comp_uid && e_reminder_data_get_source_uid (rd)) {
GString *cmd;
gchar *tmp;
GError *error = NULL;
@@ -152,7 +154,7 @@ alarm_notify_module_row_activated_cb (ERemindersWidget *reminders,
g_string_append (cmd, scheme);
g_string_append (cmd, "///?");
- tmp = g_uri_escape_string (rd->source_uid, NULL, TRUE);
+ tmp = g_uri_escape_string (e_reminder_data_get_source_uid (rd), NULL, TRUE);
g_string_append (cmd, "source-uid=");
g_string_append (cmd, tmp);
g_free (tmp);
diff --git a/src/modules/calendar/e-cal-attachment-handler.c b/src/modules/calendar/e-cal-attachment-handler.c
index 5cf9cd755a..b3e7e0faee 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>
@@ -43,7 +42,7 @@ struct _ECalAttachmentHandlerPrivate {
struct _ImportContext {
ECalClient *client;
- icalcomponent *component;
+ ICalComponent *component;
ECalClientSourceType source_type;
};
@@ -60,15 +59,15 @@ static const gchar *ui =
" </popup>"
"</ui>";
-static icalcomponent *
+static ICalComponent *
attachment_handler_get_component (EAttachment *attachment)
{
CamelDataWrapper *wrapper;
CamelMimePart *mime_part;
CamelStream *stream;
GByteArray *buffer;
- icalcomponent *component;
- const gchar *key = "__icalcomponent__";
+ ICalComponent *component;
+ const gchar *key = "__ICalComponent__";
component = g_object_get_data (G_OBJECT (attachment), key);
if (component != NULL)
@@ -110,9 +109,7 @@ attachment_handler_get_component (EAttachment *attachment)
if (component == NULL)
return NULL;
- g_object_set_data_full (
- G_OBJECT (attachment), key, component,
- (GDestroyNotify) icalcomponent_free);
+ g_object_set_data_full (G_OBJECT (attachment), key, component, g_object_unref);
return component;
}
@@ -120,7 +117,7 @@ attachment_handler_get_component (EAttachment *attachment)
typedef struct {
EShell *shell;
ESource *source;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
const gchar *extension_name;
} ImportComponentData;
@@ -132,8 +129,7 @@ import_component_data_free (gpointer ptr)
if (icd) {
g_clear_object (&icd->shell);
g_clear_object (&icd->source);
- if (icd->icalcomp)
- icalcomponent_free (icd->icalcomp);
+ g_clear_object (&icd->icomp);
g_free (icd);
}
}
@@ -145,9 +141,9 @@ import_component_thread (EAlertSinkThreadJobData *job_data,
GError **error)
{
ImportComponentData *icd = user_data;
- icalcomponent_kind need_kind = ICAL_ANY_COMPONENT;
- icalcomponent *subcomp, *vcalendar;
- icalcompiter iter;
+ ICalComponentKind need_kind = I_CAL_ANY_COMPONENT;
+ ICalComponent *subcomp, *vcalendar;
+ ICalCompIter *iter;
EClient *e_client;
ECalClient *client = NULL;
@@ -161,60 +157,62 @@ import_component_thread (EAlertSinkThreadJobData *job_data,
return;
if (g_str_equal (icd->extension_name, E_SOURCE_EXTENSION_CALENDAR))
- need_kind = ICAL_VEVENT_COMPONENT;
+ need_kind = I_CAL_VEVENT_COMPONENT;
else if (g_str_equal (icd->extension_name, E_SOURCE_EXTENSION_MEMO_LIST))
- need_kind = ICAL_VJOURNAL_COMPONENT;
+ need_kind = I_CAL_VJOURNAL_COMPONENT;
else if (g_str_equal (icd->extension_name, E_SOURCE_EXTENSION_TASK_LIST))
- need_kind = ICAL_VTODO_COMPONENT;
+ need_kind = I_CAL_VTODO_COMPONENT;
- if (need_kind == ICAL_ANY_COMPONENT) {
+ if (need_kind == I_CAL_ANY_COMPONENT) {
g_warn_if_reached ();
goto out;
}
- iter = icalcomponent_begin_component (icd->icalcomp, ICAL_ANY_COMPONENT);
+ iter = i_cal_component_begin_component (icd->icomp, I_CAL_ANY_COMPONENT);
+ subcomp = i_cal_comp_iter_deref (iter);
+ while (subcomp) {
+ ICalComponent *next_subcomp;
+ ICalComponentKind kind;
- while ((subcomp = icalcompiter_deref (&iter)) != NULL) {
- icalcomponent_kind kind;
+ next_subcomp = i_cal_comp_iter_next (iter);
- kind = icalcomponent_isa (subcomp);
- icalcompiter_next (&iter);
-
- if (kind == need_kind)
- continue;
-
- if (kind == ICAL_VTIMEZONE_COMPONENT)
- continue;
+ kind = i_cal_component_isa (subcomp);
+ if (kind != need_kind &&
+ kind != I_CAL_VTIMEZONE_COMPONENT) {
+ i_cal_component_remove_component (icd->icomp, subcomp);
+ }
- icalcomponent_remove_component (icd->icalcomp, subcomp);
- icalcomponent_free (subcomp);
+ g_object_unref (subcomp);
+ subcomp = next_subcomp;
}
- switch (icalcomponent_isa (icd->icalcomp)) {
- case ICAL_VEVENT_COMPONENT:
- case ICAL_VJOURNAL_COMPONENT:
- case ICAL_VTODO_COMPONENT:
+ g_clear_object (&iter);
+
+ switch (i_cal_component_isa (icd->icomp)) {
+ case I_CAL_VEVENT_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
vcalendar = e_cal_util_new_top_level ();
- if (icalcomponent_get_method (icd->icalcomp) == ICAL_METHOD_CANCEL)
- icalcomponent_set_method (vcalendar, ICAL_METHOD_CANCEL);
+ if (i_cal_component_get_method (icd->icomp) == I_CAL_METHOD_CANCEL)
+ i_cal_component_set_method (vcalendar, I_CAL_METHOD_CANCEL);
else
- icalcomponent_set_method (vcalendar, ICAL_METHOD_PUBLISH);
- icalcomponent_add_component (vcalendar, icalcomponent_new_clone (icd->icalcomp));
+ i_cal_component_set_method (vcalendar, I_CAL_METHOD_PUBLISH);
+ i_cal_component_take_component (vcalendar, i_cal_component_new_clone (icd->icomp));
break;
- case ICAL_VCALENDAR_COMPONENT:
- vcalendar = icalcomponent_new_clone (icd->icalcomp);
- if (!icalcomponent_get_first_property (vcalendar, ICAL_METHOD_PROPERTY))
- icalcomponent_set_method (vcalendar, ICAL_METHOD_PUBLISH);
+ case I_CAL_VCALENDAR_COMPONENT:
+ vcalendar = i_cal_component_new_clone (icd->icomp);
+ if (!e_cal_util_component_has_property (vcalendar, I_CAL_METHOD_PROPERTY))
+ i_cal_component_set_method (vcalendar, I_CAL_METHOD_PUBLISH);
break;
default:
goto out;
}
- e_cal_client_receive_objects_sync (client, vcalendar, cancellable, error);
+ e_cal_client_receive_objects_sync (client, vcalendar, E_CAL_OPERATION_FLAG_NONE, cancellable, error);
- icalcomponent_free (vcalendar);
+ g_object_unref (vcalendar);
out:
g_clear_object (&client);
}
@@ -240,7 +238,7 @@ attachment_handler_run_dialog (GtkWindow *parent,
ESourceSelector *selector;
ESource *source;
const gchar *extension_name;
- icalcomponent *component;
+ ICalComponent *component;
switch (source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -323,12 +321,12 @@ attachment_handler_run_dialog (GtkWindow *parent,
if (source != NULL) {
EShellView *shell_view;
EActivity *activity;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
ImportComponentData *icd;
const gchar *description;
const gchar *alert_ident;
- icalcomp = attachment_handler_get_component (attachment);
+ icomp = attachment_handler_get_component (attachment);
switch (source_type) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -354,7 +352,7 @@ attachment_handler_run_dialog (GtkWindow *parent,
icd = g_new0 (ImportComponentData, 1);
icd->shell = g_object_ref (shell);
icd->source = g_object_ref (source);
- icd->icalcomp = icalcomponent_new_clone (icalcomp);
+ icd->icomp = i_cal_component_new_clone (icomp);
icd->extension_name = extension_name;
activity = e_shell_view_submit_thread_job (shell_view, description, alert_ident,
@@ -445,9 +443,9 @@ cal_attachment_handler_update_actions (EAttachmentView *view)
EAttachment *attachment;
GtkAction *action;
GList *selected;
- icalcomponent *component;
- icalcomponent *subcomponent;
- icalcomponent_kind kind;
+ ICalComponent *component;
+ ICalComponent *subcomponent;
+ ICalComponentKind kind;
gboolean is_vevent = FALSE;
gboolean is_vjournal = FALSE;
gboolean is_vtodo = FALSE;
@@ -463,15 +461,17 @@ cal_attachment_handler_update_actions (EAttachmentView *view)
if (component == NULL)
goto exit;
- subcomponent = icalcomponent_get_inner (component);
+ subcomponent = i_cal_component_get_inner (component);
if (subcomponent == NULL)
goto exit;
- kind = icalcomponent_isa (subcomponent);
- is_vevent = (kind == ICAL_VEVENT_COMPONENT);
- is_vjournal = (kind == ICAL_VJOURNAL_COMPONENT);
- is_vtodo = (kind == ICAL_VTODO_COMPONENT);
+ kind = i_cal_component_isa (subcomponent);
+ is_vevent = (kind == I_CAL_VEVENT_COMPONENT);
+ is_vjournal = (kind == I_CAL_VJOURNAL_COMPONENT);
+ is_vtodo = (kind == I_CAL_VTODO_COMPONENT);
+
+ g_object_unref (subcomponent);
exit:
action = e_attachment_view_get_action (view, "import-to-calendar");
diff --git a/src/modules/calendar/e-cal-base-shell-backend.c b/src/modules/calendar/e-cal-base-shell-backend.c
index ba3b673203..bdc0c2468f 100644
--- a/src/modules/calendar/e-cal-base-shell-backend.c
+++ b/src/modules/calendar/e-cal-base-shell-backend.c
@@ -33,26 +33,6 @@
#include "e-cal-base-shell-view.h"
#include "e-cal-base-shell-backend.h"
-/*
- * FIXME: Remove this when there's a build time dependency on libical
- * 3.0.4 (where this is fixed). See
- * https://github.com/libical/libical/pull/335 and the implementation in
- * https://github.com/libical/libical/blob/master/src/libical/icalversion.h.cmake.
- */
-#if defined(ICAL_CHECK_VERSION) && defined(ICAL_MAJOR_VERSION) && defined(ICAL_MINOR_VERSION) &&
defined(ICAL_MICRO_VERSION)
-#undef ICAL_CHECK_VERSION
-#define ICAL_CHECK_VERSION(major,minor,micro) \
- (ICAL_MAJOR_VERSION > (major) || \
- (ICAL_MAJOR_VERSION == (major) && ICAL_MINOR_VERSION > (minor)) || \
- (ICAL_MAJOR_VERSION == (major) && ICAL_MINOR_VERSION == (minor) && \
- ICAL_MICRO_VERSION >= (micro)))
-#else
-#if defined(ICAL_CHECK_VERSION)
-#undef ICAL_CHECK_VERSION
-#endif
-#define ICAL_CHECK_VERSION(major,minor,micro) (0)
-#endif
-
#define E_CAL_BASE_SHELL_BACKEND_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CAL_BASE_SHELL_BACKEND, ECalBaseShellBackendPrivate))
@@ -264,42 +244,7 @@ e_cal_base_shell_backend_class_init (ECalBaseShellBackendClass *class)
static void
e_cal_base_shell_backend_init (ECalBaseShellBackend *cal_base_shell_backend)
{
-#if !ICAL_CHECK_VERSION(3, 0, 2)
- icalarray *builtin_timezones;
- gint ii;
-#endif
-
cal_base_shell_backend->priv = E_CAL_BASE_SHELL_BACKEND_GET_PRIVATE (cal_base_shell_backend);
-
-#if !ICAL_CHECK_VERSION(3, 0, 2)
- /* XXX Pre-load all built-in timezones in libical.
- *
- * Built-in time zones in libical 0.43 are loaded on demand,
- * but not in a thread-safe manner, resulting in a race when
- * multiple threads call icaltimezone_load_builtin_timezone()
- * on the same time zone. Until built-in time zone loading
- * in libical is made thread-safe, work around the issue by
- * loading all built-in time zones now, so libical's internal
- * time zone array will be fully populated before any threads
- * are spawned.
- *
- * This is apparently fixed with additional locking in
- * libical 3.0.1 and 3.0.2:
- * https://github.com/libical/libical/releases/tag/v3.0.1
- * https://github.com/libical/libical/releases/tag/v3.0.2
- */
- builtin_timezones = icaltimezone_get_builtin_timezones ();
- for (ii = 0; ii < builtin_timezones->num_elements; ii++) {
- icaltimezone *zone;
-
- zone = icalarray_element_at (builtin_timezones, ii);
-
- /* We don't care about the component right now,
- * we just need some function that will trigger
- * icaltimezone_load_builtin_timezone(). */
- icaltimezone_get_component (zone);
- }
-#endif
}
void
@@ -363,7 +308,7 @@ typedef struct {
gchar *comp_rid;
ECalClient *cal_client;
- icalcomponent *existing_icalcomp;
+ ICalComponent *existing_icomp;
} HandleUriData;
static void
@@ -380,15 +325,13 @@ handle_uri_data_free (gpointer ptr)
comp_editor = e_comp_editor_open_for_component (NULL,
e_shell_backend_get_shell (hud->shell_backend),
e_client_get_source (E_CLIENT (hud->cal_client)),
- hud->existing_icalcomp, 0);
+ hud->existing_icomp, 0);
if (comp_editor)
gtk_window_present (GTK_WINDOW (comp_editor));
}
- if (hud->existing_icalcomp)
- icalcomponent_free (hud->existing_icalcomp);
-
+ g_clear_object (&hud->existing_icomp);
g_clear_object (&hud->cal_client);
g_clear_object (&hud->shell_backend);
g_free (hud->source_uid);
@@ -444,7 +387,7 @@ cal_base_shell_backend_handle_uri_thread (EAlertSinkThreadJobData *job_data,
hud->cal_client = E_CAL_CLIENT (client);
if (!e_cal_client_get_object_sync (hud->cal_client, hud->comp_uid,
- hud->comp_rid, &hud->existing_icalcomp, cancellable, &local_error))
+ hud->comp_rid, &hud->existing_icomp, cancellable, &local_error))
g_clear_object (&hud->cal_client);
}
}
@@ -457,27 +400,28 @@ cal_base_shell_backend_handle_uri_thread (EAlertSinkThreadJobData *job_data,
static void
populate_g_date (GDate *date,
time_t utc_time,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
- struct icaltimetype icaltm;
+ ICalTime *itt;
g_return_if_fail (date != NULL);
if ((gint) utc_time == -1)
return;
- icaltm = icaltime_from_timet_with_zone (utc_time, FALSE, zone);
+ itt = i_cal_time_from_timet_with_zone (utc_time, FALSE, zone);
- if (icaltime_is_null_time (icaltm) ||
- !icaltime_is_valid_time (icaltm))
- return;
+ if (itt && !i_cal_time_is_null_time (itt) &&
+ i_cal_time_is_valid_time (itt)) {
+ g_date_set_dmy (date, i_cal_time_get_day (itt), i_cal_time_get_month (itt),
i_cal_time_get_year (itt));
+ }
- g_date_set_dmy (date, icaltm.day, icaltm.month, icaltm.year);
+ g_clear_object (&itt);
}
static time_t
convert_time_from_isodate (const gchar *text,
- icaltimezone *use_date_zone)
+ ICalTimezone *use_date_zone)
{
time_t res;
@@ -487,10 +431,11 @@ convert_time_from_isodate (const gchar *text,
/* Is it date only? Then use the date zone to match the right day */
if (use_date_zone && strlen (text) == 8) {
- struct icaltimetype itt;
+ ICalTime *itt;
- itt = icaltime_from_timet_with_zone (res, TRUE, NULL);
- res = icaltime_as_timet_with_zone (itt, use_date_zone);
+ itt = i_cal_time_from_timet_with_zone (res, TRUE, NULL);
+ res = i_cal_time_as_timet_with_zone (itt, use_date_zone);
+ g_clear_object (&itt);
}
return res;
@@ -516,7 +461,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
GList *windows, *link;
GDate start_date;
GDate end_date;
- icaltimezone *zone = NULL;
+ ICalTimezone *zone = NULL;
const gchar *extension_name;
g_return_val_if_fail (E_IS_CAL_BASE_SHELL_BACKEND (shell_backend), FALSE);
@@ -557,13 +502,13 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
location = g_settings_get_string (settings, "timezone");
if (location != NULL) {
- zone = icaltimezone_get_builtin_timezone (location);
+ zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location);
}
}
if (zone == NULL)
- zone = icaltimezone_get_utc_timezone ();
+ zone = i_cal_timezone_get_utc_timezone ();
g_object_unref (settings);
@@ -645,7 +590,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
if (new_ics) {
gchar *content = NULL;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GError *error = NULL;
if (!g_file_get_contents (new_ics, &content, NULL, &error)) {
@@ -657,26 +602,26 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
goto exit;
}
- icalcomp = content ? icalcomponent_new_from_string (content) : NULL;
- if (!icalcomp) {
+ icomp = content ? i_cal_component_new_from_string (content) : NULL;
+ if (!icomp) {
g_warning ("Cannot create new ics: File '%s' doesn't contain valid iCalendar
component", new_ics);
g_free (content);
goto exit;
}
- if (icalcomponent_isa (icalcomp) == ICAL_VEVENT_COMPONENT &&
+ if (i_cal_component_isa (icomp) == I_CAL_VEVENT_COMPONENT &&
source_type != E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
g_warning ("Cannot create new ics: Expected %s, but got VEVENT", source_type ==
E_CAL_CLIENT_SOURCE_TYPE_TASKS ? "VTODO" : "VJOURNAL");
- } else if (icalcomponent_isa (icalcomp) == ICAL_VJOURNAL_COMPONENT &&
+ } else if (i_cal_component_isa (icomp) == I_CAL_VJOURNAL_COMPONENT &&
source_type != E_CAL_CLIENT_SOURCE_TYPE_MEMOS) {
g_warning ("Cannot create new ics: Expected %s, but got VJOURNAL", source_type ==
E_CAL_CLIENT_SOURCE_TYPE_TASKS ? "VTODO" : "VEVENT");
- } else if (icalcomponent_isa (icalcomp) == ICAL_VTODO_COMPONENT &&
+ } else if (i_cal_component_isa (icomp) == I_CAL_VTODO_COMPONENT &&
source_type != E_CAL_CLIENT_SOURCE_TYPE_TASKS) {
g_warning ("Cannot create new ics: Expected %s, but got VTODO", source_type ==
E_CAL_CLIENT_SOURCE_TYPE_MEMOS ? "VJOURNAL" : "VEVENT");
- } else if (icalcomponent_isa (icalcomp) != ICAL_VEVENT_COMPONENT &&
- icalcomponent_isa (icalcomp) != ICAL_VJOURNAL_COMPONENT &&
- icalcomponent_isa (icalcomp) != ICAL_VTODO_COMPONENT) {
- g_warning ("Cannot create new ics: Received unexpected component type '%s'",
icalcomponent_kind_to_string (icalcomponent_isa (icalcomp)));
+ } else if (i_cal_component_isa (icomp) != I_CAL_VEVENT_COMPONENT &&
+ i_cal_component_isa (icomp) != I_CAL_VJOURNAL_COMPONENT &&
+ i_cal_component_isa (icomp) != I_CAL_VTODO_COMPONENT) {
+ g_warning ("Cannot create new ics: Received unexpected component type '%s'",
i_cal_component_kind_to_string (i_cal_component_isa (icomp)));
} else {
ECompEditor *comp_editor;
ESource *source = NULL;
@@ -692,7 +637,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
flags = E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER |
(attendees ? E_COMP_EDITOR_FLAG_WITH_ATTENDEES : 0);
- comp_editor = e_comp_editor_open_for_component (NULL, shell, source, icalcomp, flags);
+ comp_editor = e_comp_editor_open_for_component (NULL, shell, source, icomp, flags);
if (comp_editor)
gtk_window_present (GTK_WINDOW (comp_editor));
@@ -700,7 +645,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
g_clear_object (&source);
}
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
g_free (content);
} else if (shell_window) {
HandleUriData *hud;
@@ -718,7 +663,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
hud->comp_uid = g_strdup (comp_uid);
hud->comp_rid = g_strdup (comp_rid);
hud->cal_client = NULL;
- hud->existing_icalcomp = NULL;
+ hud->existing_icomp = NULL;
registry = e_shell_get_registry (shell);
source = e_source_registry_ref_source (registry, source_uid);
diff --git a/src/modules/calendar/e-cal-base-shell-sidebar.c b/src/modules/calendar/e-cal-base-shell-sidebar.c
index a0aabc40ac..64d541081d 100644
--- a/src/modules/calendar/e-cal-base-shell-sidebar.c
+++ b/src/modules/calendar/e-cal-base-shell-sidebar.c
@@ -460,7 +460,7 @@ typedef struct {
ESource *source;
ESource *destination;
gboolean do_copy;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
EClientSelector *selector;
} TransferItemToData;
@@ -473,10 +473,7 @@ transfer_item_to_data_free (gpointer ptr)
g_clear_object (&titd->source);
g_clear_object (&titd->destination);
g_clear_object (&titd->selector);
-
- if (titd->icalcomp)
- icalcomponent_free (titd->icalcomp);
-
+ g_clear_object (&titd->icomp);
g_free (titd);
}
}
@@ -494,7 +491,7 @@ cal_base_shell_sidebar_transfer_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (E_IS_SOURCE (titd->source));
g_return_if_fail (E_IS_SOURCE (titd->destination));
g_return_if_fail (E_IS_CLIENT_SELECTOR (titd->selector));
- g_return_if_fail (titd->icalcomp != NULL);
+ g_return_if_fail (titd->icomp != NULL);
source_client = e_client_selector_get_client_sync (
titd->selector, titd->source, FALSE, 30, cancellable, error);
@@ -509,7 +506,7 @@ cal_base_shell_sidebar_transfer_thread (EAlertSinkThreadJobData *job_data,
}
cal_comp_transfer_item_to_sync (E_CAL_CLIENT (source_client), E_CAL_CLIENT (destination_client),
- titd->icalcomp, titd->do_copy, cancellable, error);
+ titd->icomp, titd->do_copy, cancellable, error);
g_clear_object (&source_client);
g_clear_object (&destination_client);
@@ -523,7 +520,7 @@ e_cal_base_shell_sidebar_selector_data_dropped (ESourceSelector *selector,
guint info,
ECalBaseShellSidebar *sidebar)
{
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
EActivity *activity;
EShellView *shell_view;
ESource *source = NULL;
@@ -549,9 +546,9 @@ e_cal_base_shell_sidebar_selector_data_dropped (ESourceSelector *selector,
goto exit;
source_uid = g_strdup (segments[0]);
- icalcomp = icalparser_parse_string (segments[1]);
+ icomp = i_cal_parser_parse_string (segments[1]);
- if (!icalcomp)
+ if (!icomp)
goto exit;
registry = e_source_selector_get_registry (selector);
@@ -591,10 +588,10 @@ e_cal_base_shell_sidebar_selector_data_dropped (ESourceSelector *selector,
titd->source = g_object_ref (source);
titd->destination = g_object_ref (destination);
titd->do_copy = do_copy;
- titd->icalcomp = icalcomp;
+ titd->icomp = icomp;
titd->selector = g_object_ref (selector);
- icalcomp = NULL;
+ icomp = NULL;
activity = e_shell_view_submit_thread_job (shell_view, message,
alert_ident, display_name, cal_base_shell_sidebar_transfer_thread,
@@ -603,9 +600,7 @@ e_cal_base_shell_sidebar_selector_data_dropped (ESourceSelector *selector,
g_clear_object (&activity);
exit:
- if (icalcomp)
- icalcomponent_free (icalcomp);
-
+ g_clear_object (&icomp);
g_clear_object (&source);
g_free (message);
g_free (source_uid);
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index 25b876d6d8..fa9c1ffc08 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -93,12 +93,16 @@ G_DEFINE_DYNAMIC_TYPE (ECalShellContent, e_cal_shell_content, E_TYPE_CAL_BASE_SH
static time_t
convert_to_local_zone (time_t tm,
- icaltimezone *from_zone)
+ ICalTimezone *from_zone)
{
- struct icaltimetype tt;
+ ICalTime *itt;
+ time_t tt;
- tt = icaltime_from_timet_with_zone (tm, FALSE, from_zone);
- return icaltime_as_timet (tt);
+ itt = i_cal_time_from_timet_with_zone (tm, FALSE, from_zone);
+ tt = i_cal_time_as_timet (itt);
+ g_clear_object (&itt);
+
+ return tt;
}
static void
@@ -118,7 +122,7 @@ cal_shell_content_update_model_and_current_view_times (ECalShellContent *cal_she
gint syy, smm, sdd, eyy, emm, edd;
time_t visible_range_start, visible_range_end;
gboolean filters_updated = FALSE;
- icaltimezone *zone;
+ ICalTimezone *zone;
gchar *cal_filter;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -229,7 +233,7 @@ e_cal_shell_content_change_view (ECalShellContent *cal_shell_content,
EShellView *shell_view;
ECalendar *calendar;
ECalModel *model;
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t view_start_tt, view_end_tt;
gboolean view_changed = FALSE;
gint selected_days;
@@ -374,7 +378,7 @@ static void
cal_shell_content_change_selection_in_current_view (ECalShellContent *cal_shell_content,
time_t sel_start_tt,
time_t sel_end_tt,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -390,8 +394,15 @@ cal_shell_content_change_selection_in_current_view (ECalShellContent *cal_shell_
time_t current_sel_start = (time_t) -1, current_sel_end = (time_t) -1;
if (e_calendar_view_get_selected_time_range (view, ¤t_sel_start,
¤t_sel_end)) {
- current_sel_start = icaltime_as_timet_with_zone
(icaltime_from_timet_with_zone (current_sel_start, 0, zone), NULL);
- current_sel_end = icaltime_as_timet_with_zone (icaltime_from_timet_with_zone
(current_sel_end, 0, zone), NULL);
+ ICalTime *itt;
+
+ itt = i_cal_time_from_timet_with_zone (current_sel_start, 0, zone);
+ current_sel_start = i_cal_time_as_timet_with_zone (itt, NULL);
+ g_clear_object (&itt);
+
+ itt = i_cal_time_from_timet_with_zone (current_sel_end, 0, zone);
+ current_sel_end = i_cal_time_as_timet_with_zone (itt, NULL);
+ g_clear_object (&itt);
sel_start_tt += current_sel_start % (24 * 60 * 60);
sel_end_tt += current_sel_end % (24 * 60 * 60);
@@ -408,7 +419,7 @@ cal_shell_content_datepicker_selection_changed_cb (ECalendarItem *calitem,
{
GDate sel_start, sel_end;
guint32 selected_days, start_julian, end_julian;
- icaltimezone *zone;
+ ICalTimezone *zone;
time_t sel_start_tt, sel_end_tt;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -636,7 +647,7 @@ cal_shell_content_current_view_id_changed_cb (ECalShellContent *cal_shell_conten
if (cal_shell_content->priv->previous_selected_start_time != -1 &&
cal_shell_content->priv->previous_selected_end_time != -1) {
- icaltimezone *zone;
+ ICalTimezone *zone;
zone = e_cal_model_get_timezone (model);
time_to_gdate_with_zone (&sel_start, cal_shell_content->priv->previous_selected_start_time,
zone);
@@ -722,7 +733,7 @@ cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
calendar_view = cal_shell_content->priv->views[view_kind];
gal_view_etable_attach_table (
GAL_VIEW_ETABLE (gal_view),
- E_CAL_LIST_VIEW (calendar_view)->table);
+ e_cal_list_view_get_table (E_CAL_LIST_VIEW (calendar_view)));
} else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_DAY) {
view_kind = E_CAL_VIEW_KIND_DAY;
@@ -852,75 +863,79 @@ cal_shell_content_load_table_state (EShellContent *shell_content,
g_free (filename);
}
-static icalproperty *
-cal_shell_content_get_attendee_prop (icalcomponent *icalcomp,
+static ICalProperty *
+cal_shell_content_get_attendee_prop (ICalComponent *icomp,
const gchar *address)
{
- icalproperty *prop;
+ ICalProperty *prop;
if (address == NULL || *address == '\0')
return NULL;
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ATTENDEE_PROPERTY);
-
- while (prop != NULL) {
+ 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)) {
const gchar *attendee;
- attendee = icalproperty_get_attendee (prop);
+ attendee = itip_strip_mailto (i_cal_property_get_attendee (prop));
- if (g_str_equal (itip_strip_mailto (attendee), address))
+ if (attendee && g_ascii_strcasecmp (attendee, address) == 0)
return prop;
-
- prop = icalcomponent_get_next_property (
- icalcomp, ICAL_ATTENDEE_PROPERTY);
}
return NULL;
}
static gboolean
-cal_shell_content_icalcomp_is_delegated (icalcomponent *icalcomp,
- const gchar *user_email)
+cal_shell_content_icomp_is_delegated (ICalComponent *icomp,
+ const gchar *user_email)
{
- icalproperty *prop;
- icalparameter *param;
- const gchar *delto = NULL;
+ ICalProperty *prop;
+ ICalParameter *param;
+ gchar *delto = NULL;
gboolean is_delegated = FALSE;
- prop = cal_shell_content_get_attendee_prop (icalcomp, user_email);
+ prop = cal_shell_content_get_attendee_prop (icomp, user_email);
- if (prop != NULL) {
- param = icalproperty_get_first_parameter (
- prop, ICAL_DELEGATEDTO_PARAMETER);
- if (param != NULL) {
- delto = icalparameter_get_delegatedto (param);
- delto = itip_strip_mailto (delto);
+ if (prop) {
+ param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDTO_PARAMETER);
+ if (param) {
+ delto = g_strdup (itip_strip_mailto (i_cal_parameter_get_delegatedto (param)));
+ g_object_unref (param);
}
+
+ g_object_unref (prop);
} else
return FALSE;
- prop = cal_shell_content_get_attendee_prop (icalcomp, delto);
+ prop = cal_shell_content_get_attendee_prop (icomp, delto);
- if (prop != NULL) {
- const gchar *delfrom = NULL;
- icalparameter_partstat status = ICAL_PARTSTAT_NONE;
+ if (prop) {
+ gchar *delfrom = NULL;
+ ICalParameterPartstat partstat = I_CAL_PARTSTAT_NONE;
- param = icalproperty_get_first_parameter (
- prop, ICAL_DELEGATEDFROM_PARAMETER);
- if (param != NULL) {
- delfrom = icalparameter_get_delegatedfrom (param);
- delfrom = itip_strip_mailto (delfrom);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATEDFROM_PARAMETER);
+ if (param) {
+ delfrom = g_strdup (itip_strip_mailto (i_cal_parameter_get_delegatedfrom (param)));
+ g_object_unref (param);
}
- param = icalproperty_get_first_parameter (
- prop, ICAL_PARTSTAT_PARAMETER);
- if (param != NULL)
- status = icalparameter_get_partstat (param);
- is_delegated =
- (status != ICAL_PARTSTAT_DECLINED) &&
- (g_strcmp0 (delfrom, user_email) == 0);
+
+ param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
+ if (param) {
+ partstat = i_cal_parameter_get_partstat (param);
+ g_object_unref (param);
+ }
+
+ is_delegated = delfrom && user_email &&
+ partstat != I_CAL_PARTSTAT_DECLINED &&
+ g_ascii_strcasecmp (delfrom, user_email) == 0;
+
+ g_object_unref (prop);
+ g_free (delfrom);
}
+ g_free (delto);
+
return is_delegated;
}
@@ -966,32 +981,32 @@ cal_shell_content_check_state (EShellContent *shell_content)
ECalClient *client;
ECalComponent *comp;
gchar *user_email;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
const gchar *capability;
gboolean cap_delegate_supported;
gboolean cap_delegate_to_many;
- gboolean icalcomp_is_delegated;
+ gboolean icomp_is_delegated;
gboolean read_only;
if (!is_comp_data_valid (event))
continue;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
read_only = e_client_is_readonly (E_CLIENT (client));
selection_is_editable &= !read_only;
selection_is_instance |=
- e_cal_util_component_is_instance (icalcomp);
+ e_cal_util_component_is_instance (icomp);
selection_is_meeting =
(n_selected == 1) &&
- e_cal_util_component_has_attendee (icalcomp);
+ e_cal_util_component_has_attendee (icomp);
selection_is_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);
/* XXX The rest of this is rather expensive and
* only applies if a single event is selected,
@@ -1002,36 +1017,31 @@ cal_shell_content_check_state (EShellContent *shell_content)
/* XXX This probably belongs in comp-util.c. */
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (icalcomp));
- user_email = itip_get_comp_attendee (
- registry, comp, client);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
+ user_email = itip_get_comp_attendee (registry, comp, client);
selection_is_organizer =
- e_cal_util_component_has_organizer (icalcomp) &&
+ e_cal_util_component_has_organizer (icomp) &&
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);
- icalcomp_is_delegated =
- (user_email != NULL) &&
- cal_shell_content_icalcomp_is_delegated (
- icalcomp, user_email);
+ icomp_is_delegated = user_email != NULL &&
+ cal_shell_content_icomp_is_delegated (icomp, user_email);
selection_can_delegate =
cap_delegate_supported &&
(cap_delegate_to_many ||
(!selection_is_organizer &&
- !icalcomp_is_delegated));
+ !icomp_is_delegated));
g_free (user_email);
g_object_unref (comp);
@@ -1074,7 +1084,9 @@ cal_shell_content_get_default_time (ECalModel *model,
gpointer user_data)
{
ECalShellContent *cal_shell_content = user_data;
- icaltimezone *zone;
+ ICalTimezone *zone;
+ ICalTime *itt;
+ time_t tt;
g_return_val_if_fail (model != NULL, 0);
g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), 0);
@@ -1090,8 +1102,11 @@ cal_shell_content_get_default_time (ECalModel *model,
}
zone = e_cal_model_get_timezone (model);
+ itt = i_cal_time_current_time_with_zone (zone);
+ tt = i_cal_time_as_timet_with_zone (itt, zone);
+ g_clear_object (&itt);
- return icaltime_as_timet_with_zone (icaltime_current_time_with_zone (zone), zone);
+ return tt;
}
static void
@@ -1104,10 +1119,10 @@ update_adjustment (ECalShellContent *cal_shell_content,
GDate first_day_shown;
ECalModel *model;
gint week_offset;
- struct icaltimetype start_tt = icaltime_null_time ();
+ ICalTime *start_tt = NULL;
+ ICalTimezone *timezone;
time_t lower;
guint32 old_first_day_julian, new_first_day_julian;
- icaltimezone *timezone;
gdouble value;
e_week_view_get_first_day_shown (week_view, &first_day_shown);
@@ -1136,13 +1151,16 @@ update_adjustment (ECalShellContent *cal_shell_content,
return;
/* Convert it to a time_t. */
- start_tt.year = g_date_get_year (&start_date);
- start_tt.month = g_date_get_month (&start_date);
- start_tt.day = g_date_get_day (&start_date);
+ start_tt = i_cal_time_null_time ();
+ i_cal_time_set_date (start_tt,
+ g_date_get_year (&start_date),
+ g_date_get_month (&start_date),
+ g_date_get_day (&start_date));
model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal_shell_content));
timezone = e_cal_model_get_timezone (model);
- lower = icaltime_as_timet_with_zone (start_tt, timezone);
+ lower = i_cal_time_as_timet_with_zone (start_tt, timezone);
+ g_clear_object (&start_tt);
end_date = start_date;
if (move_by_week) {
@@ -1975,8 +1993,8 @@ cal_shell_content_resubscribe (ECalendarView *cal_view,
data_model = e_cal_model_get_data_model (model);
subscriber = E_CAL_DATA_MODEL_SUBSCRIBER (model);
- is_tasks_or_memos = e_cal_model_get_component_kind (model) == ICAL_VJOURNAL_COMPONENT ||
- e_cal_model_get_component_kind (model) == ICAL_VTODO_COMPONENT;
+ is_tasks_or_memos = e_cal_model_get_component_kind (model) == I_CAL_VJOURNAL_COMPONENT ||
+ e_cal_model_get_component_kind (model) == I_CAL_VTODO_COMPONENT;
if ((!is_tasks_or_memos && e_calendar_view_get_visible_time_range (cal_view, &range_start,
&range_end)) ||
e_cal_data_model_get_subscriber_range (data_model, subscriber, &range_start, &range_end)) {
@@ -2117,7 +2135,7 @@ e_cal_shell_content_get_current_range (ECalShellContent *cal_shell_content,
time_t *range_start,
time_t *range_end)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
g_return_if_fail (range_start != NULL);
@@ -2205,8 +2223,8 @@ e_cal_shell_content_move_view_range (ECalShellContent *cal_shell_content,
ECalDataModel *data_model;
EShellSidebar *shell_sidebar;
EShellView *shell_view;
- struct icaltimetype tt;
- icaltimezone *zone;
+ ICalTime *tt;
+ ICalTimezone *zone;
GDate date;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -2230,8 +2248,9 @@ e_cal_shell_content_move_view_range (ECalShellContent *cal_shell_content,
cal_shell_content_move_view_range_relative (cal_shell_content, +1);
break;
case E_CALENDAR_VIEW_MOVE_TO_TODAY:
- tt = icaltime_current_time_with_zone (zone);
- g_date_set_dmy (&date, tt.day, tt.month, tt.year);
+ tt = i_cal_time_current_time_with_zone (zone);
+ g_date_set_dmy (&date, i_cal_time_get_day (tt), i_cal_time_get_month (tt),
i_cal_time_get_year (tt));
+ g_clear_object (&tt);
/* one-day selection takes care of the view range move with left view kind */
e_calendar_item_set_selection (e_calendar_get_item (calendar), &date, &date);
break;
@@ -2356,7 +2375,7 @@ e_cal_shell_content_update_filters (ECalShellContent *cal_shell_content,
data_model = e_cal_model_get_data_model (model);
if (start_range != 0 && end_range != 0) {
- icaltimezone *zone;
+ ICalTimezone *zone;
const gchar *default_tzloc = NULL;
time_t end = end_range;
gchar *filter;
@@ -2364,8 +2383,8 @@ e_cal_shell_content_update_filters (ECalShellContent *cal_shell_content,
gchar *iso_end;
zone = e_cal_data_model_get_timezone (data_model);
- if (zone && zone != icaltimezone_get_utc_timezone ())
- default_tzloc = icaltimezone_get_location (zone);
+ if (zone && zone != i_cal_timezone_get_utc_timezone ())
+ default_tzloc = i_cal_timezone_get_location (zone);
if (!default_tzloc)
default_tzloc = "";
diff --git a/src/modules/calendar/e-cal-shell-view-actions.c b/src/modules/calendar/e-cal-shell-view-actions.c
index 0b31589c2c..a34670b422 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.c
+++ b/src/modules/calendar/e-cal-shell-view-actions.c
@@ -195,7 +195,7 @@ cal_shell_view_actions_print_or_preview (ECalShellView *cal_shell_view,
if (E_IS_CAL_LIST_VIEW (cal_view)) {
ETable *table;
- table = E_CAL_LIST_VIEW (cal_view)->table;
+ table = e_cal_list_view_get_table (E_CAL_LIST_VIEW (cal_view));
print_table (table, _("Print"), _("Calendar"), print_action);
} else {
EPrintView print_view_type;
@@ -535,7 +535,7 @@ cal_shell_view_transfer_selected (ECalShellView *cal_shell_view,
ESource *destination_source = NULL;
ESourceRegistry *registry;
GList *selected, *link;
- GHashTable *by_source; /* ESource ~> GSList{icalcomponent} */
+ GHashTable *by_source; /* ESource ~> GSList{ICalComponent} */
GHashTableIter iter;
gpointer key, value;
@@ -571,7 +571,7 @@ cal_shell_view_transfer_selected (ECalShellView *cal_shell_view,
for (link = selected; link != NULL; link = g_list_next (link)) {
ECalendarViewEvent *event = link->data;
ESource *source;
- GSList *icalcomps;
+ GSList *icomps;
if (!event || !event->comp_data)
continue;
@@ -580,9 +580,9 @@ cal_shell_view_transfer_selected (ECalShellView *cal_shell_view,
if (!source)
continue;
- icalcomps = g_hash_table_lookup (by_source, source);
- icalcomps = g_slist_prepend (icalcomps, event->comp_data->icalcomp);
- g_hash_table_insert (by_source, source, icalcomps);
+ icomps = g_hash_table_lookup (by_source, source);
+ icomps = g_slist_prepend (icomps, event->comp_data->icalcomp);
+ g_hash_table_insert (by_source, source, icomps);
}
e_cal_ops_transfer_components (shell_view, e_calendar_view_get_model (calendar_view),
@@ -590,9 +590,9 @@ cal_shell_view_transfer_selected (ECalShellView *cal_shell_view,
g_hash_table_iter_init (&iter, by_source);
while (g_hash_table_iter_next (&iter, &key, &value)) {
- GSList *icalcomps = value;
+ GSList *icomps = value;
- g_slist_free (icalcomps);
+ g_slist_free (icomps);
}
g_hash_table_destroy (by_source);
@@ -626,8 +626,8 @@ action_event_delegate_cb (GtkAction *action,
ECalClient *client;
ECalModel *model;
GList *selected;
- icalcomponent *clone;
- icalproperty *property;
+ ICalComponent *clone;
+ ICalProperty *prop;
gboolean found = FALSE;
gchar *attendee;
@@ -646,63 +646,59 @@ action_event_delegate_cb (GtkAction *action,
return;
client = event->comp_data->client;
- clone = icalcomponent_new_clone (event->comp_data->icalcomp);
+ clone = i_cal_component_new_clone (event->comp_data->icalcomp);
/* Set the attendee status for the delegate. */
- component = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- component, icalcomponent_new_clone (clone));
+ component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (clone));
- attendee = itip_get_comp_attendee (
- registry, component, client);
- property = icalcomponent_get_first_property (
- clone, ICAL_ATTENDEE_PROPERTY);
+ attendee = itip_get_comp_attendee (registry, component, client);
- while (property != NULL) {
+ for (prop = i_cal_component_get_first_property (clone, I_CAL_ATTENDEE_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (clone,
I_CAL_ATTENDEE_PROPERTY)) {
const gchar *candidate;
- candidate = icalproperty_get_attendee (property);
+ candidate = i_cal_property_get_attendee (prop);
candidate = itip_strip_mailto (candidate);
- if (g_ascii_strcasecmp (candidate, attendee) == 0) {
- icalparameter *parameter;
+ if (candidate && g_ascii_strcasecmp (candidate, attendee) == 0) {
+ ICalParameter *param;
- parameter = icalparameter_new_role (
- ICAL_ROLE_NONPARTICIPANT);
- icalproperty_set_parameter (property, parameter);
+ param = i_cal_parameter_new_role (I_CAL_ROLE_NONPARTICIPANT);
+ i_cal_property_set_parameter (prop, param);
+ g_clear_object (¶m);
- parameter = icalparameter_new_partstat (
- ICAL_PARTSTAT_DELEGATED);
- icalproperty_set_parameter (property, parameter);
+ param = i_cal_parameter_new_partstat (I_CAL_PARTSTAT_DELEGATED);
+ i_cal_property_set_parameter (prop, param);
+ g_clear_object (¶m);
found = TRUE;
break;
}
-
- property = icalcomponent_get_next_property (
- clone, ICAL_ATTENDEE_PROPERTY);
}
+ g_clear_object (&prop);
+
/* If the attendee is not already in the component, add it. */
if (!found) {
- icalparameter *parameter;
+ ICalParameter *param;
gchar *address;
address = g_strdup_printf ("mailto:%s", attendee);
- property = icalproperty_new_attendee (address);
- icalcomponent_add_property (clone, property);
+ prop = i_cal_property_new_attendee (address);
- parameter = icalparameter_new_role (ICAL_ROLE_NONPARTICIPANT);
- icalproperty_add_parameter (property, parameter);
+ param = i_cal_parameter_new_role (I_CAL_ROLE_NONPARTICIPANT);
+ i_cal_property_take_parameter (prop, param);
- parameter = icalparameter_new_cutype (ICAL_CUTYPE_INDIVIDUAL);
- icalproperty_add_parameter (property, parameter);
+ param = i_cal_parameter_new_cutype (I_CAL_CUTYPE_INDIVIDUAL);
+ i_cal_property_take_parameter (prop, param);
- parameter = icalparameter_new_rsvp (ICAL_RSVP_TRUE);
- icalproperty_add_parameter (property, parameter);
+ param = i_cal_parameter_new_rsvp (I_CAL_RSVP_TRUE);
+ i_cal_property_take_parameter (prop, param);
+ i_cal_component_take_property (clone, prop);
g_free (address);
}
@@ -713,7 +709,7 @@ action_event_delegate_cb (GtkAction *action,
calendar_view, event->comp_data->client, clone,
E_COMP_EDITOR_FLAG_WITH_ATTENDEES | E_COMP_EDITOR_FLAG_DELEGATE);
- icalcomponent_free (clone);
+ g_object_unref (clone);
g_list_free (selected);
}
@@ -752,7 +748,7 @@ action_event_forward_cb (GtkAction *action,
ECalendarViewEvent *event;
ECalComponent *component;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GList *selected;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -767,9 +763,9 @@ action_event_forward_cb (GtkAction *action,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
- component = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (icalcomp));
+ component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
g_return_if_fail (component != NULL);
itip_send_component_with_model (e_calendar_view_get_model (calendar_view),
@@ -777,7 +773,6 @@ action_event_forward_cb (GtkAction *action,
NULL, NULL, NULL, TRUE, FALSE, TRUE);
g_object_unref (component);
-
g_list_free (selected);
}
@@ -809,12 +804,11 @@ action_event_new_cb (GtkAction *action,
(e_shell_view_is_active (E_SHELL_VIEW (cal_shell_view)) ? 0 :
E_NEW_APPOINTMENT_FLAG_FORCE_CURRENT_TIME));
}
-typedef struct
-{
+typedef struct {
ECalClient *client;
gchar *remove_uid;
gchar *remove_rid;
- icalcomponent *create_icalcomp;
+ ICalComponent *create_icomp;
} MakeMovableData;
static void
@@ -826,7 +820,7 @@ make_movable_data_free (gpointer ptr)
g_clear_object (&mmd->client);
g_free (mmd->remove_uid);
g_free (mmd->remove_rid);
- icalcomponent_free (mmd->create_icalcomp);
+ g_clear_object (&mmd->create_icomp);
g_free (mmd);
}
}
@@ -841,10 +835,10 @@ make_movable_thread (EAlertSinkThreadJobData *job_data,
g_return_if_fail (mmd != NULL);
- if (!e_cal_client_remove_object_sync (mmd->client, mmd->remove_uid, mmd->remove_rid,
E_CAL_OBJ_MOD_THIS, cancellable, error))
+ if (!e_cal_client_remove_object_sync (mmd->client, mmd->remove_uid, mmd->remove_rid,
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, cancellable, error))
return;
- e_cal_client_create_object_sync (mmd->client, mmd->create_icalcomp, NULL, cancellable, error);
+ e_cal_client_create_object_sync (mmd->client, mmd->create_icomp, E_CAL_OPERATION_FLAG_NONE, NULL,
cancellable, error);
}
static void
@@ -857,12 +851,11 @@ action_event_occurrence_movable_cb (GtkAction *action,
ECalendarViewEvent *event;
ECalComponent *exception_component;
ECalComponent *recurring_component;
- ECalComponentDateTime date;
+ ECalComponentDateTime *date;
ECalComponentId *id;
ECalClient *client;
- icalcomponent *icalcomp;
- icaltimetype itt;
- icaltimezone *timezone;
+ ICalComponent *icomp;
+ ICalTimezone *timezone;
GList *selected;
gchar *uid;
EActivity *activity;
@@ -883,56 +876,51 @@ action_event_occurrence_movable_cb (GtkAction *action,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
/* For the recurring object, we add an exception
* to get rid of the instance. */
- recurring_component = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- recurring_component, icalcomponent_new_clone (icalcomp));
+ recurring_component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
id = e_cal_component_get_id (recurring_component);
/* For the unrecurred instance, we duplicate the original object,
* create a new UID for it, get rid of the recurrence rules, and
* set the start and end times to the instance times. */
- exception_component = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- exception_component, icalcomponent_new_clone (icalcomp));
+ exception_component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
uid = e_util_generate_uid ();
e_cal_component_set_uid (exception_component, uid);
g_free (uid);
e_cal_component_set_recurid (exception_component, NULL);
- e_cal_component_set_rdate_list (exception_component, NULL);
- e_cal_component_set_rrule_list (exception_component, NULL);
- e_cal_component_set_exdate_list (exception_component, NULL);
- e_cal_component_set_exrule_list (exception_component, NULL);
-
- date.value = &itt;
- date.tzid = icaltimezone_get_tzid (timezone);
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_start, FALSE, timezone);
- cal_comp_set_dtstart_with_oldzone (client, exception_component, &date);
- *date.value = icaltime_from_timet_with_zone (
- event->comp_data->instance_end, FALSE, timezone);
- cal_comp_set_dtend_with_oldzone (client, exception_component, &date);
+ e_cal_component_set_rdates (exception_component, NULL);
+ e_cal_component_set_rrules (exception_component, NULL);
+ e_cal_component_set_exdates (exception_component, NULL);
+ e_cal_component_set_exrules (exception_component, NULL);
+
+ date = e_cal_component_datetime_new_take (i_cal_time_from_timet_with_zone
(event->comp_data->instance_start, FALSE, timezone),
+ timezone ? g_strdup (i_cal_timezone_get_tzid (timezone)) : NULL);
+ cal_comp_set_dtstart_with_oldzone (client, exception_component, date);
+ e_cal_component_datetime_take_value (date, i_cal_time_from_timet_with_zone
(event->comp_data->instance_end, FALSE, timezone));
+ cal_comp_set_dtend_with_oldzone (client, exception_component, date);
+ e_cal_component_datetime_free (date);
+
e_cal_component_commit_sequence (exception_component);
mmd = g_new0 (MakeMovableData, 1);
mmd->client = g_object_ref (client);
- mmd->remove_uid = g_strdup (id->uid);
- mmd->remove_rid = g_strdup (id->rid);
- mmd->create_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent
(exception_component));
+ mmd->remove_uid = g_strdup (e_cal_component_id_get_uid (id));
+ mmd->remove_rid = g_strdup (e_cal_component_id_get_rid (id));
+ mmd->create_icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent
(exception_component));
activity = e_shell_view_submit_thread_job (E_SHELL_VIEW (cal_shell_view),
_("Making an occurrence movable"), "calendar:failed-make-movable",
NULL, make_movable_thread, mmd, make_movable_data_free);
g_clear_object (&activity);
- e_cal_component_free_id (id);
+ e_cal_component_id_free (id);
g_object_unref (recurring_component);
g_object_unref (exception_component);
g_list_free (selected);
@@ -959,7 +947,7 @@ action_event_edit_as_new_cb (GtkAction *action,
ECalendarView *calendar_view;
ECalendarViewEvent *event;
GList *selected;
- icalcomponent *clone;
+ ICalComponent *clone;
gchar *uid;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -976,18 +964,17 @@ action_event_edit_as_new_cb (GtkAction *action,
return;
}
- clone = icalcomponent_new_clone (event->comp_data->icalcomp);
+ clone = i_cal_component_new_clone (event->comp_data->icalcomp);
uid = e_util_generate_uid ();
- icalcomponent_set_uid (clone, uid);
-
+ i_cal_component_set_uid (clone, uid);
g_free (uid);
e_calendar_view_open_event_with_flags (
calendar_view, event->comp_data->client, clone,
E_COMP_EDITOR_FLAG_IS_NEW);
- icalcomponent_free (clone);
+ g_clear_object (&clone);
g_list_free (selected);
}
@@ -1001,7 +988,7 @@ action_event_print_cb (GtkAction *action,
ECalComponent *component;
ECalModel *model;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GList *selected;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -1017,12 +1004,10 @@ action_event_print_cb (GtkAction *action,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
- component = e_cal_component_new ();
+ component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
- e_cal_component_set_icalcomponent (
- component, icalcomponent_new_clone (icalcomp));
print_comp (
component, client,
e_cal_model_get_timezone (model),
@@ -1030,7 +1015,6 @@ action_event_print_cb (GtkAction *action,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
g_object_unref (component);
-
g_list_free (selected);
}
@@ -1044,7 +1028,7 @@ cal_shell_view_actions_reply (ECalShellView *cal_shell_view,
ECalComponent *component;
ECalClient *client;
ESourceRegistry *registry;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GList *selected;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -1060,18 +1044,15 @@ cal_shell_view_actions_reply (ECalShellView *cal_shell_view,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
- component = e_cal_component_new ();
+ component = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
- e_cal_component_set_icalcomponent (
- component, icalcomponent_new_clone (icalcomp));
reply_to_calendar_comp (
registry, E_CAL_COMPONENT_METHOD_REPLY,
component, client, reply_all, NULL, NULL);
g_object_unref (component);
-
g_list_free (selected);
}
@@ -1101,7 +1082,7 @@ action_event_save_as_cb (GtkAction *action,
ECalendarView *calendar_view;
ECalendarViewEvent *event;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
EActivity *activity;
GList *selected;
GFile *file;
@@ -1124,11 +1105,11 @@ action_event_save_as_cb (GtkAction *action,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
/* 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 (icomp, _("event"));
file = e_shell_run_save_dialog (
shell, _("Save as iCalendar"), string,
"*.ics:text/calendar", NULL, NULL);
@@ -1136,7 +1117,7 @@ action_event_save_as_cb (GtkAction *action,
if (file == NULL)
return;
- string = e_cal_client_get_component_as_string (client, icalcomp);
+ string = e_cal_client_get_component_as_string (client, icomp);
if (string == NULL) {
g_warning ("Could not convert item to a string");
goto exit;
@@ -1156,7 +1137,6 @@ action_event_save_as_cb (GtkAction *action,
exit:
g_object_unref (file);
-
g_list_free (selected);
}
@@ -1168,7 +1148,7 @@ edit_event_as (ECalShellView *cal_shell_view,
ECalendarView *calendar_view;
ECalendarViewEvent *event;
ECalClient *client;
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GList *selected;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -1183,42 +1163,23 @@ edit_event_as (ECalShellView *cal_shell_view,
return;
client = event->comp_data->client;
- icalcomp = event->comp_data->icalcomp;
+ icomp = event->comp_data->icalcomp;
- if (!as_meeting && icalcomp) {
+ if (!as_meeting && icomp) {
/* remove organizer and all attendees */
- icalproperty *prop;
-
/* do it on a copy, as user can cancel changes */
- icalcomp = icalcomponent_new_clone (icalcomp);
+ icomp = i_cal_component_new_clone (icomp);
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ATTENDEE_PROPERTY);
- while (prop != NULL) {
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
-
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ATTENDEE_PROPERTY);
- }
-
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ORGANIZER_PROPERTY);
- while (prop != NULL) {
- icalcomponent_remove_property (icalcomp, prop);
- icalproperty_free (prop);
-
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ORGANIZER_PROPERTY);
- }
+ e_cal_util_component_remove_property_by_kind (icomp, I_CAL_ATTENDEE_PROPERTY, TRUE);
+ e_cal_util_component_remove_property_by_kind (icomp, I_CAL_ORGANIZER_PROPERTY, TRUE);
}
e_calendar_view_edit_appointment (
- calendar_view, client, icalcomp, as_meeting ?
+ calendar_view, client, icomp, as_meeting ?
EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT);
- if (!as_meeting && icalcomp) {
- icalcomponent_free (icalcomp);
+ if (!as_meeting && icomp) {
+ g_object_unref (icomp);
}
g_list_free (selected);
diff --git a/src/modules/calendar/e-cal-shell-view-memopad.c b/src/modules/calendar/e-cal-shell-view-memopad.c
index 198d4925b0..74820efea5 100644
--- a/src/modules/calendar/e-cal-shell-view-memopad.c
+++ b/src/modules/calendar/e-cal-shell-view-memopad.c
@@ -46,7 +46,7 @@ action_calendar_memopad_forward_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only forward the first selected memo. */
- 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));
g_return_if_fail (comp != NULL);
itip_send_component_with_model (e_memo_table_get_model (memo_table),
@@ -112,7 +112,7 @@ action_calendar_memopad_open_url_cb (GtkAction *action,
ECalShellContent *cal_shell_content;
EMemoTable *memo_table;
ECalModelComponent *comp_data;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uri;
GSList *list;
@@ -128,12 +128,12 @@ action_calendar_memopad_open_url_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only open the URI of the first selected memo. */
- 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);
g_return_if_fail (prop != NULL);
- uri = icalproperty_get_url (prop);
+ uri = i_cal_property_get_url (prop);
e_show_uri (GTK_WINDOW (shell_window), uri);
+ g_object_unref (prop);
}
static void
@@ -145,7 +145,6 @@ action_calendar_memopad_print_cb (GtkAction *action,
ECalModelComponent *comp_data;
ECalComponent *comp;
ECalModel *model;
- icalcomponent *clone;
GSList *list;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -158,9 +157,7 @@ action_calendar_memopad_print_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only print the first selected memo. */
- comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- e_cal_component_set_icalcomponent (comp, clone);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
print_comp (
comp, comp_data->client,
@@ -202,7 +199,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);
@@ -339,15 +336,12 @@ e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view)
list = e_memo_table_get_selected (memo_table);
for (iter = list; iter != NULL; iter = iter->next) {
ECalModelComponent *comp_data = iter->data;
- icalproperty *prop;
gboolean read_only;
read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
editable &= !read_only;
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_URL_PROPERTY);
- has_url |= (prop != NULL);
+ has_url |= e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
}
g_slist_free (list);
diff --git a/src/modules/calendar/e-cal-shell-view-private.c b/src/modules/calendar/e-cal-shell-view-private.c
index 42a4b2712a..fcec8ac770 100644
--- a/src/modules/calendar/e-cal-shell-view-private.c
+++ b/src/modules/calendar/e-cal-shell-view-private.c
@@ -50,17 +50,20 @@ cal_shell_view_get_current_time (ECalendarItem *calitem,
ECalShellView *cal_shell_view)
{
ECalShellContent *cal_shell_content;
- struct icaltimetype tt;
- icaltimezone *timezone;
+ ICalTime *tt;
+ ICalTimezone *timezone;
ECalModel *model;
+ struct tm tm;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal_shell_content));
timezone = e_cal_model_get_timezone (model);
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone);
+ tt = i_cal_time_from_timet_with_zone (time (NULL), FALSE, timezone);
+ tm = e_cal_util_icaltime_to_tm (tt);
+ g_clear_object (&tt);
- return icaltimetype_to_tm (&tt);
+ return tm;
}
static void
@@ -612,44 +615,65 @@ cal_searching_instances_done_cb (gpointer user_data)
}
static gboolean
-cal_searching_got_instance_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer user_data)
+cal_searching_got_instance_cb (ICalComponent *icomp,
+ ICalTime *instance_start,
+ ICalTime *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
struct GenerateInstancesData *gid = user_data;
ECalShellViewPrivate *priv;
- ECalComponentDateTime dt;
- time_t *value;
+ ICalTime *dtstart = NULL;
+ ICalProperty *prop;
+ time_t *value, start = (time_t) 0;
g_return_val_if_fail (gid != NULL, FALSE);
- if (g_cancellable_is_cancelled (gid->cancellable))
+ if (g_cancellable_is_cancelled (cancellable))
return FALSE;
g_return_val_if_fail (gid->cal_shell_view != NULL, FALSE);
g_return_val_if_fail (gid->cal_shell_view->priv != NULL, FALSE);
- e_cal_component_get_dtstart (comp, &dt);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_DTSTART_PROPERTY);
+ dtstart = i_cal_component_get_dtstart (icomp);
+
+ if (dtstart && prop) {
+ ICalParameter *param;
+ const gchar *tzid = NULL;
- if (dt.tzid && dt.value) {
- icaltimezone *zone = NULL;
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
+ if (param)
+ tzid = i_cal_parameter_get_tzid (param);
- e_cal_client_get_timezone_sync (
- gid->client, dt.tzid, &zone, gid->cancellable, NULL);
+ if (tzid && *tzid) {
+ ICalTimezone *zone = NULL;
- if (g_cancellable_is_cancelled (gid->cancellable))
- return FALSE;
+ if (!e_cal_client_get_timezone_sync (gid->client, tzid, &zone, cancellable, NULL))
+ zone = NULL;
- if (zone)
- instance_start = icaltime_as_timet_with_zone (*dt.value, zone);
+ if (g_cancellable_is_cancelled (cancellable)) {
+ g_object_unref (dtstart);
+ g_clear_object (¶m);
+ return FALSE;
+ }
+
+ if (zone)
+ start = i_cal_time_as_timet_with_zone (dtstart, zone);
+ }
+
+ g_clear_object (¶m);
}
- e_cal_component_free_datetime (&dt);
+ g_clear_object (&dtstart);
+
+ if (!start)
+ start = i_cal_time_as_timet (instance_start);
priv = gid->cal_shell_view->priv;
value = g_new (time_t, 1);
- *value = instance_start;
+ *value = start;
if (!g_slist_find_custom (priv->search_hit_cache, value, cal_time_t_ptr_compare))
priv->search_hit_cache = g_slist_append (priv->search_hit_cache, value);
else
@@ -665,7 +689,7 @@ cal_search_get_object_list_cb (GObject *source,
{
ECalClient *client = E_CAL_CLIENT (source);
ECalShellView *cal_shell_view = user_data;
- GSList *icalcomps = NULL;
+ GSList *icomps = NULL;
GError *error = NULL;
g_return_if_fail (client != NULL);
@@ -673,14 +697,14 @@ cal_search_get_object_list_cb (GObject *source,
g_return_if_fail (cal_shell_view != NULL);
e_cal_client_get_object_list_finish (
- client, result, &icalcomps, &error);
+ client, result, &icomps, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- g_warn_if_fail (icalcomps == NULL);
+ g_warn_if_fail (icomps == NULL);
g_error_free (error);
- } else if (error != NULL || !icalcomps) {
- g_warn_if_fail (icalcomps == NULL);
+ } else if (error != NULL || !icomps) {
+ g_warn_if_fail (icomps == NULL);
g_clear_error (&error);
cal_shell_view->priv->search_pending_count--;
@@ -702,8 +726,8 @@ cal_search_get_object_list_cb (GObject *source,
end = tmp;
}
- for (iter = icalcomps; iter; iter = iter->next) {
- icalcomponent *icalcomp = iter->data;
+ for (iter = icomps; iter; iter = iter->next) {
+ ICalComponent *icomp = iter->data;
struct GenerateInstancesData *gid;
gid = g_new0 (struct GenerateInstancesData, 1);
@@ -712,14 +736,14 @@ cal_search_get_object_list_cb (GObject *source,
gid->cancellable = g_object_ref (cancellable);
e_cal_client_generate_instances_for_object (
- client, icalcomp, start, end, cancellable,
+ client, icomp, start, end, cancellable,
cal_searching_got_instance_cb, gid,
cal_searching_instances_done_cb);
}
- e_cal_client_free_icalcomp_slist (icalcomps);
+ e_util_free_nullable_object_slist (icomps);
} else {
- e_cal_client_free_icalcomp_slist (icalcomps);
+ e_util_free_nullable_object_slist (icomps);
}
}
@@ -765,8 +789,8 @@ cal_searching_check_candidates (ECalShellView *cal_shell_view)
}
if (candidate > 0) {
- struct icaltimetype tt;
- icaltimezone *zone;
+ ICalTime *tt;
+ ICalTimezone *zone;
ECalDataModel *data_model;
ECalendar *calendar;
@@ -774,13 +798,13 @@ cal_searching_check_candidates (ECalShellView *cal_shell_view)
data_model = e_cal_base_shell_content_get_data_model (E_CAL_BASE_SHELL_CONTENT
(cal_shell_view->priv->cal_shell_content));
zone = e_cal_data_model_get_timezone (data_model);
- tt = icaltime_from_timet_with_zone (candidate, FALSE, zone);
+ tt = i_cal_time_from_timet_with_zone (candidate, FALSE, 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)) {
ECalendarView *cal_view;
GDate *dt;
- dt = g_date_new_dmy (tt.day, tt.month, tt.year);
+ dt = g_date_new_dmy (i_cal_time_get_day (tt), i_cal_time_get_month (tt),
i_cal_time_get_year (tt));
e_calendar_item_set_selection (e_calendar_get_item (calendar), dt, dt);
g_signal_emit_by_name (e_calendar_get_item (calendar), "selection-changed", 0);
g_date_free (dt);
@@ -789,6 +813,8 @@ cal_searching_check_candidates (ECalShellView *cal_shell_view)
e_calendar_view_set_selected_time_range (cal_view, candidate, candidate);
}
+ g_clear_object (&tt);
+
return TRUE;
}
@@ -839,7 +865,7 @@ cal_iterate_searching (ECalShellView *cal_shell_view)
GList *list, *link;
ECalDataModel *data_model;
time_t new_time, range1, range2;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
const gchar *default_tzloc = NULL;
GCancellable *cancellable;
gchar *sexp, *start, *end, *data_filter;
@@ -949,8 +975,8 @@ cal_iterate_searching (ECalShellView *cal_shell_view)
end = isodate_from_time_t (time_day_end (range1));
}
- if (timezone && timezone != icaltimezone_get_utc_timezone ())
- default_tzloc = icaltimezone_get_location (timezone);
+ if (timezone && timezone != i_cal_timezone_get_utc_timezone ())
+ default_tzloc = i_cal_timezone_get_location (timezone);
if (!default_tzloc)
default_tzloc = "";
diff --git a/src/modules/calendar/e-cal-shell-view-taskpad.c b/src/modules/calendar/e-cal-shell-view-taskpad.c
index 891bbb1917..27445f6edf 100644
--- a/src/modules/calendar/e-cal-shell-view-taskpad.c
+++ b/src/modules/calendar/e-cal-shell-view-taskpad.c
@@ -69,7 +69,7 @@ action_calendar_taskpad_forward_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only forward the first selected task. */
- 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));
g_return_if_fail (comp != NULL);
itip_send_component_with_model (e_task_table_get_model (task_table),
@@ -181,7 +181,7 @@ action_calendar_taskpad_open_url_cb (GtkAction *action,
ECalShellContent *cal_shell_content;
ECalModelComponent *comp_data;
ETaskTable *task_table;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uri;
GSList *list;
@@ -196,12 +196,12 @@ action_calendar_taskpad_open_url_cb (GtkAction *action,
comp_data = list->data;
/* XXX We only open the URI of the first selected task. */
- 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);
g_return_if_fail (prop != NULL);
- uri = icalproperty_get_url (prop);
+ uri = i_cal_property_get_url (prop);
e_show_uri (GTK_WINDOW (shell_window), uri);
+ g_object_unref (prop);
}
static void
@@ -213,7 +213,6 @@ action_calendar_taskpad_print_cb (GtkAction *action,
ETaskTable *task_table;
ECalComponent *comp;
ECalModel *model;
- icalcomponent *clone;
GSList *list;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
@@ -226,9 +225,7 @@ action_calendar_taskpad_print_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only print the first selected task. */
- comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- e_cal_component_set_icalcomponent (comp, clone);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
print_comp (
comp, comp_data->client,
@@ -270,7 +267,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);
@@ -430,28 +427,23 @@ e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
list = e_task_table_get_selected (task_table);
for (iter = list; iter != NULL; iter = iter->next) {
ECalModelComponent *comp_data = iter->data;
- icalproperty *prop;
const gchar *cap;
gboolean read_only;
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;
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_URL_PROPERTY);
- has_url |= (prop != NULL);
+ has_url |= e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop != NULL)
+ if (e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY))
n_complete++;
else
n_incomplete++;
diff --git a/src/modules/calendar/e-cal-shell-view.c b/src/modules/calendar/e-cal-shell-view.c
index 4400ae753e..f80a711e6b 100644
--- a/src/modules/calendar/e-cal-shell-view.c
+++ b/src/modules/calendar/e-cal-shell-view.c
@@ -89,9 +89,9 @@ cal_shell_view_execute_search (EShellView *shell_view)
ECalendar *calendar;
ECalDataModel *data_model;
GtkRadioAction *action;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
const gchar *default_tzloc = NULL;
- struct icaltimetype current_time;
+ ICalTime *current_time;
time_t start_range;
time_t end_range;
time_t now_time;
@@ -113,11 +113,12 @@ cal_shell_view_execute_search (EShellView *shell_view)
data_model = e_cal_base_shell_content_get_data_model (E_CAL_BASE_SHELL_CONTENT (cal_shell_content));
timezone = e_cal_data_model_get_timezone (data_model);
- current_time = icaltime_current_time_with_zone (timezone);
- now_time = time_day_begin (icaltime_as_timet (current_time));
+ current_time = i_cal_time_current_time_with_zone (timezone);
+ now_time = time_day_begin (i_cal_time_as_timet (current_time));
+ g_clear_object (¤t_time);
- if (timezone && timezone != icaltimezone_get_utc_timezone ())
- default_tzloc = icaltimezone_get_location (timezone);
+ if (timezone && timezone != i_cal_timezone_get_utc_timezone ())
+ default_tzloc = i_cal_timezone_get_location (timezone);
if (!default_tzloc)
default_tzloc = "";
diff --git a/src/modules/calendar/e-calendar-preferences.c b/src/modules/calendar/e-calendar-preferences.c
index c6ec4ffe62..a2a5892f03 100644
--- a/src/modules/calendar/e-calendar-preferences.c
+++ b/src/modules/calendar/e-calendar-preferences.c
@@ -99,7 +99,7 @@ calendar_preferences_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");
@@ -109,12 +109,12 @@ calendar_preferences_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);
@@ -130,7 +130,7 @@ calendar_preferences_map_icaltimezone_to_string (const GValue *value,
GSettings *settings;
const gchar *location = NULL;
gchar *location_str = NULL;
- icaltimezone *timezone;
+ ICalTimezone *timezone;
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
@@ -138,10 +138,10 @@ calendar_preferences_map_icaltimezone_to_string (const GValue *value,
location_str = g_settings_get_string (settings, "timezone");
location = location_str;
} else {
- timezone = g_value_get_pointer (value);
+ timezone = g_value_get_object (value);
if (timezone != NULL)
- location = icaltimezone_get_location (timezone);
+ location = i_cal_timezone_get_location (timezone);
}
if (location == NULL)
@@ -303,7 +303,7 @@ update_day_second_zone_caption (ECalendarPreferences *prefs)
{
gchar *location;
const gchar *caption;
- icaltimezone *zone;
+ ICalTimezone *zone;
g_return_if_fail (prefs != NULL);
@@ -312,9 +312,9 @@ update_day_second_zone_caption (ECalendarPreferences *prefs)
location = calendar_config_get_day_second_zone ();
if (location && *location) {
- zone = icaltimezone_get_builtin_timezone (location);
- if (zone && icaltimezone_get_display_name (zone)) {
- caption = icaltimezone_get_display_name (zone);
+ zone = i_cal_timezone_get_builtin_timezone (location);
+ if (zone && i_cal_timezone_get_display_name (zone)) {
+ caption = i_cal_timezone_get_display_name (zone);
}
}
g_free (location);
@@ -350,13 +350,13 @@ day_second_zone_clicked (GtkWidget *widget,
GtkWidget *menu, *item;
GSList *group = NULL, *recent_zones, *s;
gchar *location;
- icaltimezone *zone, *second_zone = NULL;
+ ICalTimezone *zone, *second_zone = NULL;
menu = gtk_menu_new ();
location = calendar_config_get_day_second_zone ();
if (location && *location)
- second_zone = icaltimezone_get_builtin_timezone (location);
+ second_zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location);
group = NULL;
@@ -371,11 +371,11 @@ day_second_zone_clicked (GtkWidget *widget,
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));
+ item = gtk_radio_menu_item_new_with_label (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 == second_zone)
@@ -477,7 +477,7 @@ update_system_tz_widgets (GtkCheckButton *button,
ECalendarPreferences *prefs)
{
GtkWidget *widget;
- icaltimezone *zone;
+ ICalTimezone *zone;
const gchar *display_name;
gchar *text;
@@ -486,7 +486,7 @@ update_system_tz_widgets (GtkCheckButton *button,
zone = e_cal_util_get_system_timezone ();
if (zone != NULL)
- display_name = gettext (icaltimezone_get_display_name (zone));
+ display_name = gettext (i_cal_timezone_get_display_name (zone));
else
display_name = "UTC";
diff --git a/src/modules/calendar/e-memo-shell-content.c b/src/modules/calendar/e-memo-shell-content.c
index 49c1ffc348..ea3a36c3f8 100644
--- a/src/modules/calendar/e-memo-shell-content.c
+++ b/src/modules/calendar/e-memo-shell-content.c
@@ -73,8 +73,8 @@ memo_shell_content_table_foreach_cb (gint model_row,
gpointer user_data)
{
ECalModelComponent *comp_data;
- icalcomponent *clone;
- icalcomponent *vcal;
+ ICalComponent *clone;
+ ICalComponent *vcal;
gchar *string;
struct {
@@ -86,12 +86,11 @@ memo_shell_content_table_foreach_cb (gint model_row,
foreach_data->model, model_row);
vcal = e_cal_util_new_top_level ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
+ clone = i_cal_component_new_clone (comp_data->icalcomp);
e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
- icalcomponent_add_component (vcal, clone);
+ i_cal_component_take_component (vcal, clone);
- /* String is owned by libical; do not free. */
- string = icalcomponent_as_ical_string (vcal);
+ string = i_cal_component_as_ical_string_r (vcal);
if (string != NULL) {
ESource *source;
const gchar *source_uid;
@@ -102,9 +101,11 @@ memo_shell_content_table_foreach_cb (gint model_row,
foreach_data->list = g_slist_prepend (
foreach_data->list,
g_strdup_printf ("%s\n%s", source_uid, string));
+
+ g_free (string);
}
- icalcomponent_free (vcal);
+ g_object_unref (vcal);
}
static void
@@ -190,7 +191,7 @@ memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
ECalComponent *comp;
comp = e_cal_component_new_from_icalcomponent (
- icalcomponent_new_clone (comp_data->icalcomp));
+ i_cal_component_new_clone (comp_data->icalcomp));
e_cal_component_preview_display (
memo_preview, comp_data->client, comp,
@@ -200,7 +201,7 @@ memo_shell_content_cursor_change_cb (EMemoShellContent *memo_shell_content,
g_object_unref (comp);
}
- uid = icalcomponent_get_uid (comp_data->icalcomp);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
g_free (memo_shell_content->priv->current_uid);
memo_shell_content->priv->current_uid = g_strdup (uid);
}
@@ -242,7 +243,7 @@ memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content,
if (comp_data == NULL)
return;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
if (g_strcmp0 (uid, current_uid) != 0)
return;
@@ -281,7 +282,6 @@ memo_shell_content_check_state (EShellContent *shell_content)
list = e_memo_table_get_selected (memo_table);
for (iter = list; iter != NULL; iter = iter->next) {
ECalModelComponent *comp_data = iter->data;
- icalproperty *prop;
gboolean read_only;
if (!comp_data)
@@ -290,8 +290,7 @@ memo_shell_content_check_state (EShellContent *shell_content)
read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
editable &= !read_only;
- prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY);
- has_url |= (prop != NULL);
+ has_url |= e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
}
g_slist_free (list);
diff --git a/src/modules/calendar/e-memo-shell-view-actions.c
b/src/modules/calendar/e-memo-shell-view-actions.c
index d2d3fc6ec3..ab8bab8e98 100644
--- a/src/modules/calendar/e-memo-shell-view-actions.c
+++ b/src/modules/calendar/e-memo-shell-view-actions.c
@@ -72,7 +72,7 @@ action_memo_forward_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only forward the first selected memo. */
- 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));
g_return_if_fail (comp != NULL);
itip_send_component_with_model (e_memo_table_get_model (memo_table),
@@ -405,7 +405,7 @@ action_memo_open_url_cb (GtkAction *action,
EMemoShellContent *memo_shell_content;
EMemoTable *memo_table;
ECalModelComponent *comp_data;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uri;
GSList *list;
@@ -421,12 +421,13 @@ action_memo_open_url_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only open the URI of the first selected memo. */
- 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);
g_return_if_fail (prop != NULL);
- uri = icalproperty_get_url (prop);
+ uri = i_cal_property_get_url (prop);
e_show_uri (GTK_WINDOW (shell_window), uri);
+
+ g_object_unref (prop);
}
static void
@@ -450,7 +451,6 @@ action_memo_print_cb (GtkAction *action,
ECalModelComponent *comp_data;
ECalComponent *comp;
ECalModel *model;
- icalcomponent *clone;
GSList *list;
memo_shell_content = memo_shell_view->priv->memo_shell_content;
@@ -463,9 +463,7 @@ action_memo_print_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only print the first selected memo. */
- comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- e_cal_component_set_icalcomponent (comp, clone);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
print_comp (
comp, comp_data->client,
@@ -507,7 +505,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..50a974a6d7 100644
--- a/src/modules/calendar/e-task-shell-content.c
+++ b/src/modules/calendar/e-task-shell-content.c
@@ -72,8 +72,8 @@ task_shell_content_table_foreach_cb (gint model_row,
gpointer user_data)
{
ECalModelComponent *comp_data;
- icalcomponent *clone;
- icalcomponent *vcal;
+ ICalComponent *clone;
+ ICalComponent *vcal;
gchar *string;
struct {
@@ -85,12 +85,11 @@ task_shell_content_table_foreach_cb (gint model_row,
foreach_data->model, model_row);
vcal = e_cal_util_new_top_level ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
+ clone = i_cal_component_new_clone (comp_data->icalcomp);
e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
- icalcomponent_add_component (vcal, clone);
+ i_cal_component_take_component (vcal, clone);
- /* String is owned by libical; do not free. */
- string = icalcomponent_as_ical_string (vcal);
+ string = i_cal_component_as_ical_string_r (vcal);
if (string != NULL) {
ESource *source;
const gchar *source_uid;
@@ -101,9 +100,11 @@ task_shell_content_table_foreach_cb (gint model_row,
foreach_data->list = g_slist_prepend (
foreach_data->list,
g_strdup_printf ("%s\n%s", source_uid, string));
+
+ g_free (string);
}
- icalcomponent_free (vcal);
+ g_object_unref (vcal);
}
static void
@@ -189,7 +190,7 @@ task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
ECalComponent *comp;
comp = e_cal_component_new_from_icalcomponent (
- icalcomponent_new_clone (comp_data->icalcomp));
+ i_cal_component_new_clone (comp_data->icalcomp));
e_cal_component_preview_display (
task_preview, comp_data->client, comp,
@@ -199,7 +200,7 @@ task_shell_content_cursor_change_cb (ETaskShellContent *task_shell_content,
g_object_unref (comp);
}
- uid = icalcomponent_get_uid (comp_data->icalcomp);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
g_free (task_shell_content->priv->current_uid);
task_shell_content->priv->current_uid = g_strdup (uid);
}
@@ -239,7 +240,7 @@ task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content,
if (comp_data == NULL)
return;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
+ uid = i_cal_component_get_uid (comp_data->icalcomp);
if (g_strcmp0 (uid, current_uid) != 0)
return;
@@ -281,7 +282,6 @@ task_shell_content_check_state (EShellContent *shell_content)
list = e_task_table_get_selected (task_table);
for (iter = list; iter != NULL; iter = iter->next) {
ECalModelComponent *comp_data = iter->data;
- icalproperty *prop;
const gchar *cap;
gboolean read_only;
@@ -291,21 +291,17 @@ 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;
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_URL_PROPERTY);
- has_url |= (prop != NULL);
+ has_url |= e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_URL_PROPERTY);
- prop = icalcomponent_get_first_property (
- comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
- if (prop != NULL)
+ if (e_cal_util_component_has_property (comp_data->icalcomp, I_CAL_COMPLETED_PROPERTY))
n_complete++;
else
n_incomplete++;
diff --git a/src/modules/calendar/e-task-shell-view-actions.c
b/src/modules/calendar/e-task-shell-view-actions.c
index 857cad866f..48da46078e 100644
--- a/src/modules/calendar/e-task-shell-view-actions.c
+++ b/src/modules/calendar/e-task-shell-view-actions.c
@@ -95,7 +95,7 @@ action_task_forward_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only forward the first selected task. */
- 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));
g_return_if_fail (comp != NULL);
itip_send_component_with_model (e_task_table_get_model (task_table),
@@ -475,7 +475,7 @@ action_task_open_url_cb (GtkAction *action,
ETaskShellContent *task_shell_content;
ECalModelComponent *comp_data;
ETaskTable *task_table;
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uri;
GSList *list;
@@ -490,12 +490,13 @@ action_task_open_url_cb (GtkAction *action,
comp_data = list->data;
/* XXX We only open the URI of the first selected task. */
- 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);
g_return_if_fail (prop != NULL);
- uri = icalproperty_get_url (prop);
+ uri = i_cal_property_get_url (prop);
e_show_uri (GTK_WINDOW (shell_window), uri);
+
+ g_object_unref (prop);
}
static void
@@ -519,7 +520,6 @@ action_task_print_cb (GtkAction *action,
ECalComponent *comp;
ECalModel *model;
ETaskTable *task_table;
- icalcomponent *clone;
GSList *list;
task_shell_content = task_shell_view->priv->task_shell_content;
@@ -532,9 +532,7 @@ action_task_print_cb (GtkAction *action,
g_slist_free (list);
/* XXX We only print the first selected task. */
- comp = e_cal_component_new ();
- clone = icalcomponent_new_clone (comp_data->icalcomp);
- e_cal_component_set_icalcomponent (comp, clone);
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (comp_data->icalcomp));
print_comp (
comp, comp_data->client,
@@ -626,7 +624,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/calendar/e-task-shell-view.c b/src/modules/calendar/e-task-shell-view.c
index 88668585d6..5db889ae28 100644
--- a/src/modules/calendar/e-task-shell-view.c
+++ b/src/modules/calendar/e-task-shell-view.c
@@ -51,8 +51,8 @@ task_shell_view_execute_search (EShellView *shell_view)
EWebView *web_view;
ECalModel *model;
ECalDataModel *data_model;
- icaltimezone *timezone;
- struct icaltimetype current_time;
+ ICalTimezone *timezone;
+ ICalTime *current_time;
time_t start_range;
time_t end_range;
time_t now_time;
@@ -72,8 +72,9 @@ task_shell_view_execute_search (EShellView *shell_view)
model = e_task_table_get_model (task_table);
data_model = e_cal_model_get_data_model (model);
timezone = e_cal_model_get_timezone (model);
- current_time = icaltime_current_time_with_zone (timezone);
- now_time = time_day_begin (icaltime_as_timet (current_time));
+ current_time = i_cal_time_current_time_with_zone (timezone);
+ now_time = time_day_begin (i_cal_time_as_timet (current_time));
+ g_clear_object (¤t_time);
action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS));
value = gtk_radio_action_get_current_value (action);
diff --git a/src/modules/composer-to-meeting/e-composer-to-meeting.c
b/src/modules/composer-to-meeting/e-composer-to-meeting.c
index 5f4c131ac4..8bc2b52bfc 100644
--- a/src/modules/composer-to-meeting/e-composer-to-meeting.c
+++ b/src/modules/composer-to-meeting/e-composer-to-meeting.c
@@ -63,18 +63,6 @@ GType e_composer_to_meeting_get_type (void) G_GNUC_CONST;
G_DEFINE_DYNAMIC_TYPE (EComposerToMeeting, e_composer_to_meeting, E_TYPE_EXTENSION)
-static void
-composer_to_meeting_attendees_free (gpointer ptr)
-{
- ECalComponentAttendee *attendee = ptr;
-
- if (attendee) {
- g_free ((gpointer) attendee->value);
- g_free ((gpointer) attendee->cn);
- g_free (attendee);
- }
-}
-
static ECalComponent *
composer_to_meeting_component (EMsgComposer *composer)
{
@@ -91,7 +79,7 @@ composer_to_meeting_component (EMsgComposer *composer)
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
- comp = e_cal_component_new_from_icalcomponent (e_cal_util_new_component (ICAL_VEVENT_COMPONENT));
+ comp = e_cal_component_new_from_icalcomponent (e_cal_util_new_component (I_CAL_VEVENT_COMPONENT));
g_return_val_if_fail (comp != NULL, NULL);
header_table = e_msg_composer_get_header_table (composer);
@@ -99,12 +87,12 @@ composer_to_meeting_component (EMsgComposer *composer)
/* Summary */
subject = e_composer_header_table_get_subject (header_table);
if (subject && *subject) {
- ECalComponentText summary;
+ ECalComponentText *summary;
- summary.value = subject;
- summary.altrep = NULL;
+ summary = e_cal_component_text_new (subject, NULL);
- e_cal_component_set_summary (comp, &summary);
+ e_cal_component_set_summary (comp, summary);
+ e_cal_component_text_free (summary);
}
/* Organizer */
@@ -148,15 +136,18 @@ composer_to_meeting_component (EMsgComposer *composer)
}
if (address && *address) {
- ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
+ ECalComponentOrganizer *organizer;
gchar *mailto;
mailto = g_strconcat ("mailto:", address, NULL);
- organizer.value = mailto;
- organizer.cn = name;
- e_cal_component_set_organizer (comp, &organizer);
+ organizer = e_cal_component_organizer_new ();
+ e_cal_component_organizer_set_value (organizer, mailto);
+ e_cal_component_organizer_set_cn (organizer, name);
+
+ e_cal_component_set_organizer (comp, organizer);
+ e_cal_component_organizer_free (organizer);
g_free (mailto);
}
@@ -190,15 +181,19 @@ composer_to_meeting_component (EMsgComposer *composer)
if (camel_internet_address_get (address, jj, &name, &mail)) {
ECalComponentAttendee *attendee;
+ gchar *mailto;
- attendee = g_new0 (ECalComponentAttendee, 1);
- attendee->value = g_strconcat ("mailto:", mail, NULL);
- attendee->cn = g_strdup (name);
- attendee->cutype = ICAL_CUTYPE_INDIVIDUAL;
- attendee->status = ICAL_PARTSTAT_NEEDSACTION;
- attendee->role = ii == 0 ? ICAL_ROLE_REQPARTICIPANT :
ICAL_ROLE_OPTPARTICIPANT;
+ mailto = g_strconcat ("mailto:", mail, NULL);
+ attendee = e_cal_component_attendee_new ();
+ e_cal_component_attendee_set_value (attendee, mailto);
+ e_cal_component_attendee_set_cn (attendee,name);
+ e_cal_component_attendee_set_cutype (attendee,
I_CAL_CUTYPE_INDIVIDUAL);
+ e_cal_component_attendee_set_partstat (attendee,
I_CAL_PARTSTAT_NEEDSACTION);
+ e_cal_component_attendee_set_role (attendee, ii == 0 ?
I_CAL_ROLE_REQPARTICIPANT : I_CAL_ROLE_OPTPARTICIPANT);
- attendees = g_slist_append (attendees, attendee);
+ attendees = g_slist_prepend (attendees, attendee);
+
+ g_free (mailto);
}
}
}
@@ -208,9 +203,11 @@ composer_to_meeting_component (EMsgComposer *composer)
e_destination_freev (destinations);
}
- e_cal_component_set_attendee_list (comp, attendees);
+ attendees = g_slist_reverse (attendees);
+
+ e_cal_component_set_attendees (comp, attendees);
- g_slist_free_full (attendees, composer_to_meeting_attendees_free);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
/* Description */
html_editor = e_msg_composer_get_editor (composer);
@@ -227,15 +224,13 @@ composer_to_meeting_component (EMsgComposer *composer)
g_free (tmp);
}
- description = g_new0 (ECalComponentText, 1);
- description->value = text;
- description->altrep = NULL;
+ description = e_cal_component_text_new (text, NULL);
descr_list = g_slist_append (descr_list, description);
- e_cal_component_set_description_list (comp, descr_list);
+ e_cal_component_set_descriptions (comp, descr_list);
- g_slist_free_full (descr_list, g_free);
+ g_slist_free_full (descr_list, e_cal_component_text_free);
}
g_free (text);
diff --git a/src/modules/composer-to-meeting/e-meeting-to-composer.c
b/src/modules/composer-to-meeting/e-meeting-to-composer.c
index f0fec00778..0e79d1b1a9 100644
--- a/src/modules/composer-to-meeting/e-meeting-to-composer.c
+++ b/src/modules/composer-to-meeting/e-meeting-to-composer.c
@@ -153,8 +153,8 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
EMsgComposer *composer;
EComposerHeaderTable *header_table;
gboolean did_updating;
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ICalComponent *icomp;
+ ICalProperty *prop;
const gchar *text;
GPtrArray *to_recips, *cc_recips;
GError *error = NULL;
@@ -173,24 +173,24 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
/* Just a trick to not show validation errors when getting the component */
e_comp_editor_set_updating (comp_editor, TRUE);
- icalcomp = icalcomponent_new_clone (e_comp_editor_get_component (comp_editor));
- e_comp_editor_fill_component (comp_editor, icalcomp);
+ icomp = i_cal_component_new_clone (e_comp_editor_get_component (comp_editor));
+ e_comp_editor_fill_component (comp_editor, icomp);
e_comp_editor_set_updating (comp_editor, did_updating);
/* Subject */
- text = icalcomponent_get_summary (icalcomp);
+ text = i_cal_component_get_summary (icomp);
if (text && *text)
e_composer_header_table_set_subject (header_table, text);
/* From */
- prop = icalcomponent_get_first_property (icalcomp, ICAL_ORGANIZER_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_ORGANIZER_PROPERTY);
if (prop) {
EComposerHeader *from_header;
const gchar *organizer;
from_header = e_composer_header_table_get_header (header_table, E_COMPOSER_HEADER_FROM);
- organizer = itip_strip_mailto (icalproperty_get_organizer (prop));
+ organizer = itip_strip_mailto (i_cal_property_get_organizer (prop));
if (organizer && *organizer && from_header) {
GtkComboBox *identities_combo;
@@ -227,34 +227,38 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
} while (gtk_tree_model_iter_next (model, &iter));
}
}
+
+ g_clear_object (&prop);
}
/* Recipients */
to_recips = g_ptr_array_new_with_free_func (meeting_to_composer_unref_nonull_object);
cc_recips = g_ptr_array_new_with_free_func (meeting_to_composer_unref_nonull_object);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
- icalparameter *param;
- icalparameter_role role = ICAL_ROLE_REQPARTICIPANT;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_ATTENDEE_PROPERTY)) {
+ ICalParameter *param;
+ ICalParameterRole role = I_CAL_ROLE_REQPARTICIPANT;
const gchar *name = NULL, *address;
EDestination *dest;
- address = itip_strip_mailto (icalproperty_get_attendee (prop));
+ address = itip_strip_mailto (i_cal_property_get_attendee (prop));
if (!address || !*address)
continue;
- param = icalproperty_get_first_parameter (prop, ICAL_ROLE_PARAMETER);
- if (param)
- role = icalparameter_get_role (param);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_ROLE_PARAMETER);
+ if (param) {
+ role = i_cal_parameter_get_role (param);
+ g_object_unref (param);
+ }
- if (role == ICAL_ROLE_NONPARTICIPANT || role == ICAL_ROLE_NONE)
+ if (role == I_CAL_ROLE_NONPARTICIPANT || role == I_CAL_ROLE_NONE)
continue;
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
if (param)
- name = icalparameter_get_cn (param);
+ name = i_cal_parameter_get_cn (param);
if (name && !*name)
name = NULL;
@@ -263,10 +267,12 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
e_destination_set_name (dest, name);
e_destination_set_email (dest, address);
- if (role == ICAL_ROLE_REQPARTICIPANT)
+ if (role == I_CAL_ROLE_REQPARTICIPANT)
g_ptr_array_add (to_recips, dest);
else
g_ptr_array_add (cc_recips, dest);
+
+ g_clear_object (¶m);
}
if (to_recips->len > 0) {
@@ -285,9 +291,9 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
g_ptr_array_free (cc_recips, TRUE);
/* Body */
- prop = icalcomponent_get_first_property (icalcomp, ICAL_DESCRIPTION_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_DESCRIPTION_PROPERTY);
if (prop) {
- text = icalproperty_get_description (prop);
+ text = i_cal_property_get_description (prop);
if (text && *text) {
EHTMLEditor *html_editor;
@@ -299,6 +305,8 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
e_content_editor_set_html_mode (cnt_editor, FALSE);
e_content_editor_insert_content (cnt_editor, text,
E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_PLAIN);
}
+
+ g_object_unref (prop);
}
/* Attachments */
@@ -307,25 +315,25 @@ meeting_to_composer_composer_created_cb (GObject *source_object,
gtk_window_present (GTK_WINDOW (composer));
gtk_widget_destroy (GTK_WIDGET (comp_editor));
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
}
static void
action_meeting_to_composer_cb (GtkAction *action,
ECompEditor *comp_editor)
{
- icalcomponent *icalcomp;
- icalcomponent_kind kind;
+ ICalComponent *icomp;
+ ICalComponentKind kind;
const gchar *prompt_key;
g_return_if_fail (E_IS_COMP_EDITOR (comp_editor));
- icalcomp = e_comp_editor_get_component (comp_editor);
- kind = icalcomp ? icalcomponent_isa (icalcomp) : ICAL_VEVENT_COMPONENT;
+ icomp = e_comp_editor_get_component (comp_editor);
+ kind = icomp ? i_cal_component_isa (icomp) : I_CAL_VEVENT_COMPONENT;
- if (kind == ICAL_VTODO_COMPONENT)
+ if (kind == I_CAL_VTODO_COMPONENT)
prompt_key = "mail-composer:prompt-task-to-composer";
- else if (kind == ICAL_VJOURNAL_COMPONENT)
+ else if (kind == I_CAL_VJOURNAL_COMPONENT)
prompt_key = "mail-composer:prompt-memo-to-composer";
else
prompt_key = "mail-composer:prompt-event-to-composer";
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 058a6c8262..295e4cd4d6 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -131,11 +131,10 @@ struct _ItipViewPrivate {
gchar *vcalendar;
ECalComponent *comp;
- icalcomponent *main_comp;
- icalcomponent *ical_comp;
- icalcomponent *top_level;
- icalcompiter iter;
- icalproperty_method method;
+ ICalComponent *main_comp;
+ ICalComponent *ical_comp;
+ ICalComponent *top_level;
+ ICalPropertyMethod method;
time_t start_time;
time_t end_time;
@@ -1505,12 +1504,8 @@ itip_view_finalize (GObject *object)
g_clear_object (&priv->folder);
g_clear_object (&priv->message);
g_clear_object (&priv->itip_mime_part);
-
- if (priv->top_level != NULL)
- icalcomponent_free (priv->top_level);
-
- if (priv->main_comp != NULL)
- icalcomponent_free (priv->main_comp);
+ g_clear_object (&priv->top_level);
+ g_clear_object (&priv->main_comp);
g_hash_table_destroy (priv->real_comps);
@@ -2351,8 +2346,8 @@ itip_plain_text_to_html (const gchar *plain)
static void
itip_view_extract_attendee_info (ItipView *view)
{
- icalproperty *prop;
- icalcomponent *ical_comp;
+ ICalProperty *prop;
+ ICalComponent *icomp;
gint num_attendees;
const gchar *top_comment;
GString *new_comment = NULL;
@@ -2362,28 +2357,31 @@ itip_view_extract_attendee_info (ItipView *view)
if (!view->priv->comp)
return;
- ical_comp = e_cal_component_get_icalcomponent (view->priv->comp);
- if (!ical_comp)
+ icomp = e_cal_component_get_icalcomponent (view->priv->comp);
+ if (!icomp)
return;
- num_attendees = icalcomponent_count_properties (ical_comp, ICAL_ATTENDEE_PROPERTY);
+ num_attendees = i_cal_component_count_properties (icomp, I_CAL_ATTENDEE_PROPERTY);
if (num_attendees <= 0)
return;
- top_comment = icalcomponent_get_comment (ical_comp);
+ top_comment = i_cal_component_get_comment (icomp);
- for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (ical_comp, 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 *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)
@@ -2420,13 +2418,13 @@ itip_view_extract_attendee_info (ItipView *view)
g_free (html);
}
} else 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;
}
@@ -2465,8 +2463,11 @@ itip_view_extract_attendee_info (ItipView *view)
if (value && *value)
g_string_append (new_comment, value);
}
+
+ g_clear_object (&cnparam);
}
+ g_free (prop_value);
g_free (guests_str);
}
@@ -3189,24 +3190,24 @@ typedef struct {
gint count;
} FormatItipFindData;
-static gboolean check_is_instance (icalcomponent *icalcomp);
+static gboolean check_is_instance (ICalComponent *icomp);
-static icalproperty *
-find_attendee (icalcomponent *ical_comp,
+static ICalProperty *
+find_attendee (ICalComponent *icomp,
const gchar *address)
{
- icalproperty *prop;
+ ICalProperty *prop;
- if (address == NULL)
+ if (!address)
return NULL;
- for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (ical_comp, 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 *attendee;
gchar *text;
- attendee = icalproperty_get_value_as_string_r (prop);
+ attendee = i_cal_property_get_value_as_string_r (prop);
if (!attendee)
continue;
@@ -3225,37 +3226,41 @@ find_attendee (icalcomponent *ical_comp,
return prop;
}
-static icalproperty *
-find_attendee_if_sentby (icalcomponent *ical_comp,
+static ICalProperty *
+find_attendee_if_sentby (ICalComponent *icomp,
const gchar *address)
{
- icalproperty *prop;
+ ICalProperty *prop;
- if (address == NULL)
+ if (!address)
return NULL;
- for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) {
- icalparameter *param;
+ 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)) {
+ ICalParameter *param;
const gchar *attendee_sentby;
gchar *text;
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
if (!param)
continue;
- attendee_sentby = icalparameter_get_sentby (param);
+ attendee_sentby = i_cal_parameter_get_sentby (param);
- if (!attendee_sentby)
+ if (!attendee_sentby) {
+ g_object_unref (param);
continue;
+ }
text = g_strdup (itip_strip_mailto (attendee_sentby));
text = g_strstrip (text);
if (text && !g_ascii_strcasecmp (address, text)) {
+ g_object_unref (param);
g_free (text);
break;
}
+ g_object_unref (param);
g_free (text);
}
@@ -3264,8 +3269,8 @@ find_attendee_if_sentby (icalcomponent *ical_comp,
static void
find_to_address (ItipView *view,
- icalcomponent *ical_comp,
- icalparameter_partstat *status)
+ ICalComponent *icomp,
+ ICalParameterPartstat *partstat)
{
ESourceRegistry *registry;
ESourceMailIdentity *extension;
@@ -3302,15 +3307,15 @@ find_to_address (ItipView *view,
for (link = list; link != NULL; link = g_list_next (link)) {
ESource *source = E_SOURCE (link->data);
- icalproperty *prop = NULL;
- icalparameter *param;
+ ICalProperty *prop;
+ ICalParameter *param;
gchar *address;
gchar *text;
extension = e_source_get_extension (source, extension_name);
address = e_source_mail_identity_dup_address (extension);
- prop = find_attendee (ical_comp, address);
+ prop = find_attendee (icomp, address);
if (!prop) {
GHashTable *aliases;
@@ -3324,7 +3329,7 @@ find_to_address (ItipView *view,
const gchar *alias_address = key;
if (alias_address && *alias_address) {
- prop = find_attendee (ical_comp, alias_address);
+ prop = find_attendee (icomp, alias_address);
if (prop) {
g_free (address);
address = g_strdup (alias_address);
@@ -3342,11 +3347,12 @@ find_to_address (ItipView *view,
continue;
}
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
- if (param != NULL)
- view->priv->to_name = g_strdup (icalparameter_get_cn (param));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
+ if (param)
+ view->priv->to_name = g_strdup (i_cal_parameter_get_cn (param));
+ g_clear_object (¶m);
- text = icalproperty_get_value_as_string_r (prop);
+ text = i_cal_property_get_value_as_string_r (prop);
view->priv->to_address = g_strdup (itip_strip_mailto (text));
g_free (text);
@@ -3354,16 +3360,19 @@ find_to_address (ItipView *view,
view->priv->my_address = address;
- param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_RSVP_PARAMETER);
if (param != NULL &&
- icalparameter_get_rsvp (param) == ICAL_RSVP_FALSE)
+ i_cal_parameter_get_rsvp (param) == I_CAL_RSVP_FALSE)
view->priv->no_reply_wanted = TRUE;
+ g_clear_object (¶m);
- if (status) {
- param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
- *status = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION;
+ if (partstat) {
+ param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
+ *partstat = param ? i_cal_parameter_get_partstat (param) : I_CAL_PARTSTAT_NEEDSACTION;
+ g_clear_object (¶m);
}
+ g_object_unref (prop);
break;
}
@@ -3377,7 +3386,6 @@ find_to_address (ItipView *view,
* In this case, we would want to go through the SENT-BY fields of
* the attendees to find the user's address.
*
- *
* Note: This functionality could have been (easily) implemented
* in the previous loop, but it would hurt the performance for all
* providers in general. Hence, we choose to iterate through the
@@ -3388,15 +3396,15 @@ find_to_address (ItipView *view,
for (link = list; link != NULL; link = g_list_next (link)) {
ESource *source = E_SOURCE (link->data);
- icalproperty *prop = NULL;
- icalparameter *param;
+ ICalProperty *prop;
+ ICalParameter *param;
gchar *address;
gchar *text;
extension = e_source_get_extension (source, extension_name);
address = e_source_mail_identity_dup_address (extension);
- prop = find_attendee_if_sentby (ical_comp, address);
+ prop = find_attendee_if_sentby (icomp, address);
if (!prop) {
GHashTable *aliases;
@@ -3410,7 +3418,7 @@ find_to_address (ItipView *view,
const gchar *alias_address = key;
if (alias_address && *alias_address) {
- prop = find_attendee_if_sentby (ical_comp, alias_address);
+ prop = find_attendee_if_sentby (icomp, alias_address);
if (prop) {
g_free (address);
address = g_strdup (alias_address);
@@ -3428,11 +3436,12 @@ find_to_address (ItipView *view,
continue;
}
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
- if (param != NULL)
- view->priv->to_name = g_strdup (icalparameter_get_cn (param));
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
+ if (param)
+ view->priv->to_name = g_strdup (i_cal_parameter_get_cn (param));
+ g_clear_object (¶m);
- text = icalproperty_get_value_as_string_r (prop);
+ text = i_cal_property_get_value_as_string_r (prop);
view->priv->to_address = g_strdup (itip_strip_mailto (text));
g_free (text);
@@ -3440,16 +3449,19 @@ find_to_address (ItipView *view,
view->priv->my_address = address;
- param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_RSVP_PARAMETER);
if (param != NULL &&
- ICAL_RSVP_FALSE == icalparameter_get_rsvp (param))
+ i_cal_parameter_get_rsvp (param) == I_CAL_RSVP_FALSE)
view->priv->no_reply_wanted = TRUE;
+ g_clear_object (¶m);
- if (status) {
- param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
- *status = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION;
+ if (partstat) {
+ param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
+ *partstat = param ? i_cal_parameter_get_partstat (param) : I_CAL_PARTSTAT_NEEDSACTION;
+ g_clear_object (¶m);
}
+ g_object_unref (prop);
break;
}
@@ -3458,13 +3470,13 @@ find_to_address (ItipView *view,
static void
find_from_address (ItipView *view,
- icalcomponent *ical_comp)
+ ICalComponent *icomp)
{
ESourceRegistry *registry;
GList *list, *link;
- icalproperty *prop;
+ ICalProperty *prop;
+ ICalParameter *param;
gchar *organizer;
- icalparameter *param;
const gchar *extension_name;
const gchar *organizer_sentby;
gchar *organizer_clean = NULL;
@@ -3472,35 +3484,39 @@ find_from_address (ItipView *view,
registry = view->priv->registry;
- prop = icalcomponent_get_first_property (ical_comp, ICAL_ORGANIZER_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_ORGANIZER_PROPERTY);
if (!prop)
return;
- organizer = icalproperty_get_value_as_string_r (prop);
+ organizer = i_cal_property_get_value_as_string_r (prop);
if (organizer) {
organizer_clean = g_strdup (itip_strip_mailto (organizer));
organizer_clean = g_strstrip (organizer_clean);
g_free (organizer);
}
- param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_SENTBY_PARAMETER);
if (param) {
- organizer_sentby = icalparameter_get_sentby (param);
+ organizer_sentby = i_cal_parameter_get_sentby (param);
if (organizer_sentby) {
organizer_sentby_clean = g_strdup (itip_strip_mailto (organizer_sentby));
organizer_sentby_clean = g_strstrip (organizer_sentby_clean);
}
+ g_clear_object (¶m);
}
- if (!(organizer_sentby_clean || organizer_clean))
+ if (!(organizer_sentby_clean || organizer_clean)) {
+ g_object_unref (prop);
return;
+ }
view->priv->from_address = g_strdup (organizer_clean);
- param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER);
+ param = i_cal_property_get_first_parameter (prop, I_CAL_CN_PARAMETER);
if (param)
- view->priv->from_name = g_strdup (icalparameter_get_cn (param));
+ view->priv->from_name = g_strdup (i_cal_parameter_get_cn (param));
+ g_clear_object (¶m);
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
list = e_source_registry_list_enabled (registry, extension_name);
@@ -3554,6 +3570,7 @@ find_from_address (ItipView *view,
g_free (organizer_sentby_clean);
g_free (organizer_clean);
+ g_object_unref (prop);
}
static ECalComponent *
@@ -3581,23 +3598,29 @@ adjust_item (ItipView *view,
real_comp = get_real_item (view);
if (real_comp != NULL) {
- ECalComponentText text;
- const gchar *string;
- GSList *l;
+ ECalComponentText *text;
+ gchar *string;
+ GSList *lst;
- e_cal_component_get_summary (real_comp, &text);
- e_cal_component_set_summary (comp, &text);
- e_cal_component_get_location (real_comp, &string);
+ text = e_cal_component_get_summary (real_comp);
+ e_cal_component_set_summary (comp, text);
+ e_cal_component_text_free (text);
+
+ string = e_cal_component_get_location (real_comp);
e_cal_component_set_location (comp, string);
- e_cal_component_get_description_list (real_comp, &l);
- e_cal_component_set_description_list (comp, l);
- e_cal_component_free_text_list (l);
+ g_free (string);
+
+ lst = e_cal_component_get_descriptions (real_comp);
+ e_cal_component_set_descriptions (comp, lst);
+ g_slist_free_full (lst, e_cal_component_text_free);
g_object_unref (real_comp);
} else {
- ECalComponentText text = {_("Unknown"), NULL};
+ ECalComponentText *text;
- e_cal_component_set_summary (comp, &text);
+ text = e_cal_component_text_new (_("Unknown"), NULL);
+ e_cal_component_set_summary (comp, text);
+ e_cal_component_text_free (text);
}
}
@@ -3615,8 +3638,8 @@ same_attendee_status (ItipView *view,
if (!saved_comp)
return FALSE;
- e_cal_component_get_attendee_list (received_comp, &received_attendees);
- e_cal_component_get_attendee_list (saved_comp, &saved_attendees);
+ received_attendees = e_cal_component_get_attendees (received_comp);
+ saved_attendees = e_cal_component_get_attendees (saved_comp);
same = received_attendees && saved_attendees;
@@ -3636,9 +3659,10 @@ same_attendee_status (ItipView *view,
if (!sattendee)
continue;
- if (rattendee->value && sattendee->value &&
- g_ascii_strcasecmp (rattendee->value, sattendee->value) == 0) {
- same = rattendee->status == sattendee->status;
+ if (e_cal_component_attendee_get_value (rattendee) &&
+ e_cal_component_attendee_get_value (sattendee) &&
+ g_ascii_strcasecmp (e_cal_component_attendee_get_value (rattendee),
e_cal_component_attendee_get_value (sattendee)) == 0) {
+ same = e_cal_component_attendee_get_partstat (rattendee) ==
e_cal_component_attendee_get_partstat (sattendee);
break;
}
}
@@ -3648,8 +3672,8 @@ same_attendee_status (ItipView *view,
same = FALSE;
}
- e_cal_component_free_attendee_list (received_attendees);
- e_cal_component_free_attendee_list (saved_attendees);
+ g_slist_free_full (received_attendees, e_cal_component_attendee_free);
+ g_slist_free_full (saved_attendees, e_cal_component_attendee_free);
g_object_unref (saved_comp);
return same;
@@ -3717,12 +3741,12 @@ itip_view_cal_opened_cb (GObject *source_object,
}
if (e_cal_client_check_recurrences_no_master (E_CAL_CLIENT (client))) {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
gboolean show_recur_check;
- icalcomp = e_cal_component_get_icalcomponent (view->priv->comp);
+ icomp = e_cal_component_get_icalcomponent (view->priv->comp);
- show_recur_check = check_is_instance (icalcomp);
+ show_recur_check = check_is_instance (icomp);
itip_view_set_show_recur_check (view, show_recur_check);
}
@@ -3731,7 +3755,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);
}
@@ -3819,40 +3843,32 @@ itip_comp_older_than_stored (ItipView *view,
ECalComponent *real_comp)
{
gboolean is_older = FALSE;
- gint *psequence = NULL;
+ gint sequence;
ECalComponentId *mail_id, *real_id;
if (!real_comp || !view->priv->comp ||
e_cal_component_get_vtype (view->priv->comp) != E_CAL_COMPONENT_EVENT)
return FALSE;
- e_cal_component_get_sequence (view->priv->comp, &psequence);
- if (!psequence)
+ sequence = e_cal_component_get_sequence (view->priv->comp);
+ if (sequence < 0)
return FALSE;
mail_id = e_cal_component_get_id (view->priv->comp);
- if (!mail_id) {
- e_cal_component_free_sequence (psequence);
+ if (!mail_id)
return FALSE;
- }
real_id = e_cal_component_get_id (real_comp);
- if (real_id && g_strcmp0 (real_id->uid, mail_id->uid) == 0 && g_strcmp0 (real_id->rid, mail_id->rid)
== 0) {
- gint *pint = NULL;
+ if (real_id && e_cal_component_id_equal (real_id, mail_id)) {
+ gint real_sequence;
- e_cal_component_get_sequence (real_comp, &pint);
- if (pint) {
- is_older = *psequence < *pint;
-
- e_cal_component_free_sequence (pint);
- }
+ real_sequence = e_cal_component_get_sequence (real_comp);
+ if (real_sequence >= 0)
+ is_older = sequence < real_sequence;
}
- if (real_id)
- e_cal_component_free_id (real_id);
-
- e_cal_component_free_sequence (psequence);
- e_cal_component_free_id (mail_id);
+ e_cal_component_id_free (real_id);
+ e_cal_component_id_free (mail_id);
return is_older;
}
@@ -3875,12 +3891,12 @@ find_cal_update_ui (FormatItipFindData *fd,
source = cal_client ? e_client_get_source (E_CLIENT (cal_client)) : NULL;
if (cal_client && g_hash_table_lookup (fd->conflicts, cal_client)) {
- GSList *icalcomps = g_hash_table_lookup (fd->conflicts, cal_client);
+ GSList *icomps = g_hash_table_lookup (fd->conflicts, cal_client);
guint ncomps;
- ncomps = g_slist_length (icalcomps);
- if (ncomps == 1 && icalcomps->data) {
- icalcomponent *icalcomp = icalcomps->data;
+ ncomps = g_slist_length (icomps);
+ if (ncomps == 1 && icomps->data) {
+ ICalComponent *icomp = icomps->data;
switch (e_cal_client_get_source_type (cal_client)) {
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -3888,21 +3904,21 @@ find_cal_update_ui (FormatItipFindData *fd,
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("An appointment “%s” in the calendar “%s” conflicts with this
meeting"),
- icalcomponent_get_summary (icalcomp),
+ i_cal_component_get_summary (icomp),
e_source_get_display_name (source));
break;
case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("A task “%s” in the task list “%s” conflicts with this task"),
- icalcomponent_get_summary (icalcomp),
+ i_cal_component_get_summary (icomp),
e_source_get_display_name (source));
break;
case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
itip_view_add_upper_info_item_printf (
view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
_("A memo “%s” in the memo list “%s” conflicts with this memo"),
- icalcomponent_get_summary (icalcomp),
+ i_cal_component_get_summary (icomp),
e_source_get_display_name (source));
break;
}
@@ -3953,7 +3969,7 @@ find_cal_update_ui (FormatItipFindData *fd,
/* FIXME Check sequence number of meeting? */
/* FIXME Do we need to adjust elsewhere for the delegated calendar item? */
/* FIXME Need to update the fields in the view now */
- if (view->priv->method == ICAL_METHOD_REPLY || view->priv->method == ICAL_METHOD_REFRESH)
+ if (view->priv->method == I_CAL_METHOD_REPLY || view->priv->method == I_CAL_METHOD_REFRESH)
adjust_item (view, view->priv->comp);
/* We clear everything because we don't really care
@@ -3984,7 +4000,7 @@ find_cal_update_ui (FormatItipFindData *fd,
g_cancellable_cancel (fd->cancellable);
- if (view->priv->method == ICAL_METHOD_REQUEST &&
+ if (view->priv->method == I_CAL_METHOD_REQUEST &&
itip_comp_older_than_stored (view, g_hash_table_lookup (view->priv->real_comps,
e_source_get_uid (source)))) {
itip_view_set_mode (view, ITIP_VIEW_MODE_HIDE_ALL);
itip_view_add_lower_info_item (
@@ -4006,7 +4022,7 @@ find_cal_update_ui (FormatItipFindData *fd,
* Replies only make sense for events with an organizer.
*/
if ((!view->priv->current_client || !e_cal_client_check_save_schedules
(view->priv->current_client)) &&
- (view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method ==
ICAL_METHOD_REQUEST) &&
+ (view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method ==
I_CAL_METHOD_REQUEST) &&
view->priv->has_organizer) {
rsvp_enabled = TRUE;
}
@@ -4045,9 +4061,9 @@ find_cal_update_ui (FormatItipFindData *fd,
if (view->priv->current_client && view->priv->current_client == cal_client &&
itip_view_get_mode (view) != ITIP_VIEW_MODE_HIDE_ALL) {
if (e_cal_client_check_recurrences_no_master (view->priv->current_client)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (view->priv->comp);
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (view->priv->comp);
- if (check_is_instance (icalcomp))
+ if (check_is_instance (icomp))
itip_view_set_show_recur_check (view, TRUE);
else
itip_view_set_show_recur_check (view, FALSE);
@@ -4055,7 +4071,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);
@@ -4087,7 +4103,7 @@ decrease_find_data (FormatItipFindData *fd)
* Replies only make sense for events with an organizer.
*/
if ((!view->priv->current_client || !e_cal_client_check_save_schedules
(view->priv->current_client)) &&
- (view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method == ICAL_METHOD_REQUEST)
&&
+ (view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method ==
I_CAL_METHOD_REQUEST) &&
view->priv->has_organizer) {
rsvp_enabled = TRUE;
}
@@ -4096,7 +4112,7 @@ decrease_find_data (FormatItipFindData *fd)
/* default is chosen in extract_itip_data() based on content of the VEVENT */
itip_view_set_rsvp (view, !view->priv->no_reply_wanted);
- if ((view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method == ICAL_METHOD_REQUEST)
+ if ((view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method == I_CAL_METHOD_REQUEST)
&& !view->priv->current_client) {
/* Reuse already declared one or rename? */
ESource *source = NULL;
@@ -4172,6 +4188,21 @@ decrease_find_data (FormatItipFindData *fd)
}
}
+static gboolean
+comp_has_subcomponent (ICalComponent *icomp,
+ ICalComponentKind kind)
+{
+ ICalComponent *subcomp;
+
+ subcomp = i_cal_component_get_first_component (icomp, kind);
+ if (subcomp) {
+ g_object_unref (subcomp);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
get_object_without_rid_ready_cb (GObject *source_object,
GAsyncResult *result,
@@ -4179,10 +4210,10 @@ get_object_without_rid_ready_cb (GObject *source_object,
{
ECalClient *cal_client = E_CAL_CLIENT (source_object);
FormatItipFindData *fd = user_data;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *error = NULL;
- e_cal_client_get_object_finish (cal_client, result, &icalcomp, &error);
+ e_cal_client_get_object_finish (cal_client, result, &icomp, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_cancellable_is_cancelled (fd->cancellable)) {
@@ -4194,18 +4225,18 @@ get_object_without_rid_ready_cb (GObject *source_object,
g_clear_error (&error);
- if (icalcomp) {
+ if (icomp) {
ECalComponent *comp;
fd->view->priv->current_client = cal_client;
- fd->keep_alarm_check = (fd->view->priv->method == ICAL_METHOD_PUBLISH ||
fd->view->priv->method == ICAL_METHOD_REQUEST) &&
- (icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XAUDIOALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XDISPLAYALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XPROCEDUREALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XEMAILALARM_COMPONENT));
-
- comp = e_cal_component_new_from_icalcomponent (icalcomp);
+ fd->keep_alarm_check = (fd->view->priv->method == I_CAL_METHOD_PUBLISH ||
fd->view->priv->method == I_CAL_METHOD_REQUEST) &&
+ (comp_has_subcomponent (icomp, I_CAL_VALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XAUDIOALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XDISPLAYALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XPROCEDUREALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XEMAILALARM_COMPONENT));
+
+ comp = e_cal_component_new_from_icalcomponent (icomp);
if (comp) {
ESource *source = e_client_get_source (E_CLIENT (cal_client));
@@ -4228,10 +4259,10 @@ get_object_with_rid_ready_cb (GObject *source_object,
{
ECalClient *cal_client = E_CAL_CLIENT (source_object);
FormatItipFindData *fd = user_data;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *error = NULL;
- e_cal_client_get_object_finish (cal_client, result, &icalcomp, &error);
+ e_cal_client_get_object_finish (cal_client, result, &icomp, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
g_cancellable_is_cancelled (fd->cancellable)) {
@@ -4243,18 +4274,18 @@ get_object_with_rid_ready_cb (GObject *source_object,
g_clear_error (&error);
- if (icalcomp) {
+ if (icomp) {
ECalComponent *comp;
fd->view->priv->current_client = cal_client;
- fd->keep_alarm_check = (fd->view->priv->method == ICAL_METHOD_PUBLISH ||
fd->view->priv->method == ICAL_METHOD_REQUEST) &&
- (icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XAUDIOALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XDISPLAYALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XPROCEDUREALARM_COMPONENT) ||
- icalcomponent_get_first_component (icalcomp, ICAL_XEMAILALARM_COMPONENT));
-
- comp = e_cal_component_new_from_icalcomponent (icalcomp);
+ fd->keep_alarm_check = (fd->view->priv->method == I_CAL_METHOD_PUBLISH ||
fd->view->priv->method == I_CAL_METHOD_REQUEST) &&
+ (comp_has_subcomponent (icomp, I_CAL_VALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XAUDIOALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XDISPLAYALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XPROCEDUREALARM_COMPONENT) ||
+ comp_has_subcomponent (icomp, I_CAL_XEMAILALARM_COMPONENT));
+
+ comp = e_cal_component_new_from_icalcomponent (icomp);
if (comp) {
ESource *source = e_client_get_source (E_CLIENT (cal_client));
@@ -4445,7 +4476,7 @@ find_server (ItipView *view,
list = e_source_registry_list_enabled (
view->priv->registry, extension_name);
- e_cal_component_get_uid (comp, &uid);
+ uid = e_cal_component_get_uid (comp);
rid = e_cal_component_get_recurid_as_string (comp);
/* XXX Not sure what this was trying to do,
@@ -4515,7 +4546,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 */
@@ -4531,7 +4562,7 @@ find_server (ItipView *view,
"(make-time \"%s\")) "
"(not (uid? \"%s\")))",
start, end,
- icalcomponent_get_uid (view->priv->ical_comp));
+ i_cal_component_get_uid (view->priv->ical_comp));
}
g_free (start);
@@ -4553,35 +4584,38 @@ find_server (ItipView *view,
static gboolean
change_status (ESourceRegistry *registry,
- icalcomponent *ical_comp,
- const gchar *address,
- icalparameter_partstat status)
+ ICalComponent *icomp,
+ const gchar *address,
+ ICalParameterPartstat partstat)
{
- icalproperty *prop;
+ ICalProperty *prop;
- prop = find_attendee (ical_comp, address);
+ prop = find_attendee (icomp, address);
if (prop) {
- icalparameter *param;
+ ICalParameter *param;
+
+ i_cal_property_remove_parameter_by_kind (prop, I_CAL_PARTSTAT_PARAMETER);
+ param = i_cal_parameter_new_partstat (partstat);
+ i_cal_property_take_parameter (prop, param);
- icalproperty_remove_parameter_by_kind (prop, ICAL_PARTSTAT_PARAMETER);
- param = icalparameter_new_partstat (status);
- icalproperty_add_parameter (prop, param);
+ g_object_unref (prop);
} else {
- icalparameter *param;
+ ICalParameter *param;
if (address && *address) {
gchar *mailto_uri;
mailto_uri = g_strconcat ("mailto:", itip_strip_mailto (address), NULL);
- prop = icalproperty_new_attendee (mailto_uri);
- icalcomponent_add_property (ical_comp, prop);
+ prop = i_cal_property_new_attendee (mailto_uri);
g_free (mailto_uri);
- param = icalparameter_new_role (ICAL_ROLE_OPTPARTICIPANT);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_role (I_CAL_ROLE_OPTPARTICIPANT);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_partstat (status);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_partstat (partstat);
+ i_cal_property_take_parameter (prop, param);
+
+ i_cal_component_take_property (icomp, prop);
} else {
gchar *default_name = NULL;
gchar *default_address = NULL;
@@ -4591,20 +4625,21 @@ change_status (ESourceRegistry *registry,
registry, &default_name, &default_address);
mailto_uri = g_strconcat ("mailto:", itip_strip_mailto (default_address), NULL);
- prop = icalproperty_new_attendee (mailto_uri);
- icalcomponent_add_property (ical_comp, prop);
+ prop = i_cal_property_new_attendee (mailto_uri);
g_free (mailto_uri);
if (default_name && *default_name && g_strcmp0 (default_name, default_address) != 0) {
- param = icalparameter_new_cn (default_name);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_cn (default_name);
+ i_cal_property_take_parameter (prop, param);
}
- param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_role (I_CAL_ROLE_REQPARTICIPANT);
+ i_cal_property_take_parameter (prop, param);
+
+ param = i_cal_parameter_new_partstat (partstat);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_partstat (status);
- icalproperty_add_parameter (prop, param);
+ i_cal_component_take_property (icomp, prop);
g_free (default_name);
g_free (default_address);
@@ -4799,9 +4834,8 @@ finish_message_delete_with_rsvp (ItipView *view,
if (itip_view_get_rsvp (view)) {
ECalComponent *comp = NULL;
- icalcomponent *ical_comp;
- icalproperty *prop;
- icalvalue *value;
+ ICalComponent *icomp;
+ ICalProperty *prop;
const gchar *attendee;
gchar *comment;
GSList *l, *list = NULL;
@@ -4815,28 +4849,26 @@ finish_message_delete_with_rsvp (ItipView *view,
find_to_address (view, view->priv->ical_comp, NULL);
g_return_if_fail (view->priv->to_address != NULL);
- ical_comp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
/* Remove all attendees except the one we are responding as */
found = FALSE;
- for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
- prop != NULL;
- prop = icalcomponent_get_next_property (ical_comp, 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 *text;
- value = icalproperty_get_value (prop);
- if (!value)
+ attendee = i_cal_property_get_attendee (prop);
+ if (!attendee)
continue;
- attendee = icalvalue_get_string (value);
-
text = g_strdup (itip_strip_mailto (attendee));
text = g_strstrip (text);
/* We do this to ensure there is at most one
* attendee in the response */
if (found || g_ascii_strcasecmp (view->priv->to_address, text))
- list = g_slist_prepend (list, prop);
+ list = g_slist_prepend (list, g_object_ref (prop));
else if (!g_ascii_strcasecmp (view->priv->to_address, text))
found = TRUE;
g_free (text);
@@ -4844,30 +4876,27 @@ finish_message_delete_with_rsvp (ItipView *view,
for (l = list; l; l = l->next) {
prop = l->data;
- icalcomponent_remove_property (ical_comp, prop);
- icalproperty_free (prop);
+ i_cal_component_remove_property (icomp, prop);
}
- g_slist_free (list);
+ g_slist_free_full (list, g_object_unref);
/* Add a comment if there user set one */
comment = itip_view_get_rsvp_comment (view);
if (comment) {
GSList comments;
- ECalComponentText text;
+ ECalComponentText *text;
- text.value = comment;
- text.altrep = NULL;
+ text = e_cal_component_text_new (comment, NULL);
- comments.data = &text;
+ comments.data = text;
comments.next = NULL;
- e_cal_component_set_comment_list (comp, &comments);
+ e_cal_component_set_comments (comp, &comments);
+ e_cal_component_text_free (text);
g_free (comment);
}
- e_cal_component_rescan (comp);
-
if (itip_send_comp_sync (
view->priv->registry,
E_CAL_COMPONENT_METHOD_REPLY,
@@ -5028,21 +5057,6 @@ receive_objects_ready_cb (GObject *ecalclient,
finish_message_delete_with_rsvp (view, client);
}
-static void
-remove_alarms_in_component (icalcomponent *clone)
-{
- icalcomponent *alarm_comp;
- icalcompiter alarm_iter;
-
- alarm_iter = icalcomponent_begin_component (clone, ICAL_VALARM_COMPONENT);
- while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
- icalcompiter_next (&alarm_iter);
-
- icalcomponent_remove_component (clone, alarm_comp);
- icalcomponent_free (alarm_comp);
- }
-}
-
static void
claim_progress_saving_changes (ItipView *view)
{
@@ -5060,19 +5074,40 @@ claim_progress_saving_changes (ItipView *view)
}
}
+static void
+remove_alarms_in_component (ICalComponent *clone)
+{
+ ICalComponent *alarm_comp;
+ ICalCompIter *iter;
+
+ iter = i_cal_component_begin_component (clone, I_CAL_VALARM_COMPONENT);
+ alarm_comp = i_cal_comp_iter_deref (iter);
+ while (alarm_comp) {
+ ICalComponent *next_subcomp;
+
+ next_subcomp = i_cal_comp_iter_next (iter);
+
+ i_cal_component_remove_component (clone, alarm_comp);
+ g_object_unref (alarm_comp);
+ alarm_comp = next_subcomp;
+ }
+
+ g_object_unref (iter);
+}
+
static void
update_item (ItipView *view,
ItipViewResponse response)
{
- struct icaltimetype stamp;
- icalcomponent *toplevel_clone, *clone;
+ ICalTime *stamp;
+ ICalComponent *toplevel_clone, *clone;
gboolean remove_alarms;
ECalComponent *clone_comp;
gchar *str;
claim_progress_saving_changes (view);
- while (e_cal_util_remove_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME")) {
+ while (e_cal_util_component_remove_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME")) {
/* Delete all existing X-MICROSOFT-CDO-REPLYTIME properties first */
}
@@ -5085,15 +5120,16 @@ update_item (ItipView *view,
* information (unless it's being saved to an Exchange folder
* and you then look at it in Outlook).
*/
- stamp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
- str = icaltime_as_ical_string_r (stamp);
- e_cal_util_set_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME", str);
+ stamp = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+ str = i_cal_time_as_ical_string_r (stamp);
+ e_cal_util_component_set_x_property (view->priv->ical_comp, "X-MICROSOFT-CDO-REPLYTIME", str);
+ g_clear_object (&stamp);
g_free (str);
- toplevel_clone = icalcomponent_new_clone (view->priv->top_level);
- clone = icalcomponent_new_clone (view->priv->ical_comp);
- icalcomponent_add_component (toplevel_clone, clone);
- icalcomponent_set_method (toplevel_clone, view->priv->method);
+ toplevel_clone = i_cal_component_new_clone (view->priv->top_level);
+ clone = i_cal_component_new_clone (view->priv->ical_comp);
+ i_cal_component_add_component (toplevel_clone, clone);
+ i_cal_component_set_method (toplevel_clone, view->priv->method);
remove_alarms = !itip_view_get_inherit_alarm_check_state (view);
@@ -5101,19 +5137,19 @@ update_item (ItipView *view,
remove_alarms_in_component (clone);
if (view->priv->with_detached_instances) {
- icalcomponent *icomp;
- icalcomponent_kind use_kind = icalcomponent_isa (view->priv->ical_comp);
+ ICalComponent *icomp;
+ ICalComponentKind use_kind = i_cal_component_isa (view->priv->ical_comp);
- for (icomp = icalcomponent_get_first_component (view->priv->main_comp, use_kind);
+ for (icomp = i_cal_component_get_first_component (view->priv->main_comp, use_kind);
icomp;
- icomp = icalcomponent_get_next_component (view->priv->main_comp, use_kind)) {
- if (icomp != view->priv->ical_comp) {
- icalcomponent *di_clone = icalcomponent_new_clone (icomp);
+ g_object_unref (icomp), icomp = i_cal_component_get_next_component
(view->priv->main_comp, use_kind)) {
+ if (i_cal_object_get_native (I_CAL_OBJECT (icomp)) != i_cal_object_get_native
(I_CAL_OBJECT (view->priv->ical_comp))) {
+ ICalComponent *di_clone = i_cal_component_new_clone (icomp);
if (remove_alarms)
remove_alarms_in_component (di_clone);
- icalcomponent_add_component (toplevel_clone, di_clone);
+ i_cal_component_take_component (toplevel_clone, di_clone);
}
}
}
@@ -5130,19 +5166,20 @@ 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);
+ for (link = alarms; link; link = g_slist_next (link)) {
+ ECalComponentAlarm *alarm;
+
+ alarm = e_cal_component_get_alarm (real_comp, link->data);
if (alarm) {
- ECalComponentAlarm *aclone = e_cal_component_alarm_clone (alarm);
+ ECalComponentAlarm *aclone = e_cal_component_alarm_copy (alarm);
if (aclone) {
e_cal_component_add_alarm (clone_comp, aclone);
@@ -5153,24 +5190,35 @@ update_item (ItipView *view,
}
}
- cal_obj_uid_list_free (alarms);
+ g_slist_free_full (alarms, g_free);
g_object_unref (real_comp);
}
}
- if ((response != ITIP_VIEW_RESPONSE_CANCEL)
- && (response != ITIP_VIEW_RESPONSE_DECLINE)) {
- GSList *attachments = NULL, *new_attachments = NULL, *l;
+ if (response != ITIP_VIEW_RESPONSE_CANCEL &&
+ response != ITIP_VIEW_RESPONSE_DECLINE) {
+ GSList *attachments = NULL, *new_attachments = NULL, *link;
CamelMimeMessage *msg = view->priv->message;
- e_cal_component_get_attachment_list (clone_comp, &attachments);
+ attachments = e_cal_component_get_attachments (clone_comp);
- for (l = attachments; l; l = l->next) {
+ for (link = attachments; link; link = g_slist_next (link)) {
GSList *parts = NULL, *m;
- gchar *uri, *new_uri;
+ const gchar *uri;
+ gchar *new_uri;
CamelMimePart *part;
+ ICalAttach *attach = link->data;
+
+ if (!attach)
+ continue;
- uri = l->data;
+ if (!i_cal_attach_get_is_url (attach)) {
+ /* Preserve existing non-URL attachments */
+ new_attachments = g_slist_prepend (new_attachments, g_object_ref (attach));
+ continue;
+ }
+
+ uri = i_cal_attach_get_url (attach);
if (!g_ascii_strncasecmp (uri, "cid:...", 7)) {
message_foreach_part ((CamelMimePart *) msg, &parts);
@@ -5185,7 +5233,8 @@ update_item (ItipView *view,
new_uri = get_uri_for_part (part);
if (new_uri != NULL)
- new_attachments = g_slist_append (new_attachments, new_uri);
+ new_attachments = g_slist_prepend (new_attachments,
i_cal_attach_new_from_url (new_uri));
+ g_free (new_uri);
}
g_slist_free (parts);
@@ -5195,19 +5244,20 @@ update_item (ItipView *view,
if (part) {
new_uri = get_uri_for_part (part);
if (new_uri != NULL)
- new_attachments = g_slist_append (new_attachments, new_uri);
+ new_attachments = g_slist_prepend (new_attachments,
i_cal_attach_new_from_url (new_uri));
+ g_free (new_uri);
}
-
} else {
/* Preserve existing non-cid ones */
- new_attachments = g_slist_append (new_attachments, g_strdup (uri));
+ new_attachments = g_slist_prepend (new_attachments, g_object_ref (attach));
}
}
- g_slist_foreach (attachments, (GFunc) g_free, NULL);
- g_slist_free (attachments);
+ g_slist_free_full (attachments, g_object_unref);
+
+ e_cal_component_set_attachments (clone_comp, new_attachments);
- e_cal_component_set_attachment_list (clone_comp, new_attachments);
+ g_slist_free_full (new_attachments, g_object_unref);
}
view->priv->update_item_response = response;
@@ -5215,13 +5265,14 @@ update_item (ItipView *view,
e_cal_client_receive_objects (
view->priv->current_client,
toplevel_clone,
+ E_CAL_OPERATION_FLAG_NONE,
view->priv->cancellable,
receive_objects_ready_cb,
view);
cleanup:
g_object_unref (clone_comp);
- icalcomponent_free (toplevel_clone);
+ g_object_unref (toplevel_clone);
}
/* TODO These operations should be available in e-cal-component.c */
@@ -5229,41 +5280,42 @@ static void
set_attendee (ECalComponent *comp,
const gchar *address)
{
- icalproperty *prop;
- icalcomponent *icalcomp;
+ ICalProperty *prop;
+ ICalComponent *icomp;
gboolean found = FALSE;
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
- prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
- const gchar *attendee = icalproperty_get_attendee (prop);
+ 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)) {
+ const gchar *attendee = i_cal_property_get_attendee (prop);
if (!(g_str_equal (itip_strip_mailto (attendee), address)))
- icalcomponent_remove_property (icalcomp, prop);
+ i_cal_component_remove_property (icomp, prop);
else
found = TRUE;
}
if (!found) {
- icalparameter *param;
+ ICalParameter *param;
gchar *temp = g_strdup_printf ("mailto:%s", address);
- prop = icalproperty_new_attendee ((const gchar *) temp);
- icalcomponent_add_property (icalcomp, prop);
+ prop = i_cal_property_new_attendee ((const gchar *) temp);
- param = icalparameter_new_partstat (ICAL_PARTSTAT_NEEDSACTION);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_partstat (I_CAL_PARTSTAT_NEEDSACTION);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_role (I_CAL_ROLE_REQPARTICIPANT);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_cutype (ICAL_CUTYPE_INDIVIDUAL);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_cutype (I_CAL_CUTYPE_INDIVIDUAL);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_rsvp (ICAL_RSVP_TRUE);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_rsvp (I_CAL_RSVP_TRUE);
+ i_cal_property_take_parameter (prop, param);
+
+ i_cal_component_take_property (icomp, prop);
g_free (temp);
}
@@ -5285,15 +5337,15 @@ send_comp_to_attendee (ESourceRegistry *registry,
if (comment) {
GSList comments;
- ECalComponentText text;
+ ECalComponentText *text;
- text.value = comment;
- text.altrep = NULL;
+ text = e_cal_component_text_new (comment, NULL);
- comments.data = &text;
+ comments.data = text;
comments.next = NULL;
- e_cal_component_set_comment_list (send_comp, &comments);
+ e_cal_component_set_comments (send_comp, &comments);
+ e_cal_component_text_free (text);
}
/* FIXME send the attachments in the request */
@@ -5341,28 +5393,27 @@ remove_delegate (ItipView *view,
}
g_free (comment);
-
}
static void
update_x (ECalComponent *view_comp,
ECalComponent *comp)
{
- icalcomponent *itip_icalcomp = e_cal_component_get_icalcomponent (view_comp);
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+ ICalComponent *itip_icomp = e_cal_component_get_icalcomponent (view_comp);
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (comp);
+ ICalProperty *prop;
+
+ for (prop = i_cal_component_get_first_property (itip_icomp, I_CAL_X_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (itip_icomp, I_CAL_X_PROPERTY)) {
+ const gchar *name = i_cal_property_get_x_name (prop);
- icalproperty *prop = icalcomponent_get_first_property (itip_icalcomp, ICAL_X_PROPERTY);
- while (prop) {
- const gchar *name = icalproperty_get_x_name (prop);
- if (!g_ascii_strcasecmp (name, "X-EVOLUTION-IS-REPLY")) {
- icalproperty *new_prop = icalproperty_new_x (icalproperty_get_x (prop));
- icalproperty_set_x_name (new_prop, "X-EVOLUTION-IS-REPLY");
- icalcomponent_add_property (icalcomp, new_prop);
+ if (name && !g_ascii_strcasecmp (name, "X-EVOLUTION-IS-REPLY")) {
+ ICalProperty *new_prop = i_cal_property_new_x (i_cal_property_get_x (prop));
+ i_cal_property_set_x_name (new_prop, "X-EVOLUTION-IS-REPLY");
+ i_cal_component_take_property (icomp, new_prop);
}
- prop = icalcomponent_get_next_property (itip_icalcomp, ICAL_X_PROPERTY);
}
-
- e_cal_component_set_icalcomponent (comp, icalcomp);
}
static void
@@ -5402,75 +5453,83 @@ modify_object_cb (GObject *ecalclient,
}
static void
-update_attendee_status_icalcomp (ItipView *view,
- icalcomponent *icalcomp)
+update_attendee_status_icomp (ItipView *view,
+ ICalComponent *icomp)
{
ECalComponent *comp;
- const gchar *uid = NULL;
- gchar *rid;
GSList *attendees;
+ gboolean is_instance;
- e_cal_component_get_uid (view->priv->comp, &uid);
- rid = e_cal_component_get_recurid_as_string (view->priv->comp);
+ is_instance = e_cal_component_is_instance (view->priv->comp);
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);
itip_view_add_lower_info_item (
view, ITIP_VIEW_INFO_ITEM_TYPE_ERROR,
_("The meeting is invalid and cannot be updated"));
} else {
- icalcomponent *org_icalcomp;
+ ICalComponent *org_icomp;
const gchar *delegate;
- org_icalcomp = e_cal_component_get_icalcomponent (view->priv->comp);
+ org_icomp = e_cal_component_get_icalcomponent (view->priv->comp);
- e_cal_component_get_attendee_list (view->priv->comp, &attendees);
+ attendees = e_cal_component_get_attendees (view->priv->comp);
if (attendees != NULL) {
ECalComponentAttendee *a = attendees->data;
- icalproperty *prop, *del_prop;
+ ICalProperty *prop, *del_prop = NULL, *delto = NULL;
EShell *shell = e_shell_get_default ();
- prop = find_attendee (icalcomp, itip_strip_mailto (a->value));
- if ((a->status == ICAL_PARTSTAT_DELEGATED) && (del_prop = find_attendee
(org_icalcomp, itip_strip_mailto (a->delto))) && !(find_attendee (icalcomp, itip_strip_mailto (a->delto)))) {
+ prop = find_attendee (icomp, itip_strip_mailto (e_cal_component_attendee_get_value
(a)));
+ if ((e_cal_component_attendee_get_partstat (a) == I_CAL_PARTSTAT_DELEGATED) &&
+ (del_prop = find_attendee (org_icomp, itip_strip_mailto
(e_cal_component_attendee_get_delegatedto (a)))) &&
+ !(delto = find_attendee (icomp, itip_strip_mailto
(e_cal_component_attendee_get_delegatedto (a))))) {
gint response;
- delegate = icalproperty_get_attendee (del_prop);
+ delegate = i_cal_property_get_attendee (del_prop);
response = e_alert_run_dialog_for_args (
e_shell_get_active_window (shell),
"org.gnome.itip-formatter:add-delegate",
- itip_strip_mailto (a->value),
+ itip_strip_mailto (e_cal_component_attendee_get_value (a)),
itip_strip_mailto (delegate), NULL);
if (response == GTK_RESPONSE_YES) {
- icalcomponent_add_property (icalcomp, icalproperty_new_clone
(del_prop));
- e_cal_component_rescan (comp);
+ i_cal_component_take_property (icomp, i_cal_property_new_clone
(del_prop));
} else if (response == GTK_RESPONSE_NO) {
- remove_delegate (view, delegate, itip_strip_mailto (a->value), comp);
+ remove_delegate (view, delegate, itip_strip_mailto
(e_cal_component_attendee_get_value (a)), comp);
+ g_clear_object (&del_prop);
+ g_clear_object (&delto);
goto cleanup;
} else {
+ g_clear_object (&del_prop);
+ g_clear_object (&delto);
goto cleanup;
}
}
+ g_clear_object (&del_prop);
+ g_clear_object (&delto);
+
if (prop == NULL) {
+ const gchar *delfrom;
gint response;
- if (a->delfrom && *a->delfrom) {
+ delfrom = e_cal_component_attendee_get_delegatedfrom (a);
+
+ if (delfrom && *delfrom) {
response = e_alert_run_dialog_for_args (
e_shell_get_active_window (shell),
"org.gnome.itip-formatter:add-delegate",
- itip_strip_mailto (a->delfrom),
- itip_strip_mailto (a->value), NULL);
+ itip_strip_mailto (delfrom),
+ itip_strip_mailto (e_cal_component_attendee_get_value (a)),
NULL);
if (response == GTK_RESPONSE_YES) {
/* Already declared in this function */
- icalproperty *prop = find_attendee (icalcomp,
itip_strip_mailto (a->value));
- icalcomponent_add_property (icalcomp,icalproperty_new_clone
(prop));
- e_cal_component_rescan (comp);
+ ICalProperty *prop = find_attendee (icomp, itip_strip_mailto
(e_cal_component_attendee_get_value (a)));
+ i_cal_component_take_property (icomp,
i_cal_property_new_clone (prop));
} else if (response == GTK_RESPONSE_NO) {
remove_delegate (
view,
- itip_strip_mailto (a->value),
- itip_strip_mailto (a->delfrom),
+ itip_strip_mailto (e_cal_component_attendee_get_value
(a)),
+ itip_strip_mailto (delfrom),
comp);
goto cleanup;
} else {
@@ -5484,36 +5543,39 @@ update_attendee_status_icalcomp (ItipView *view,
if (response == GTK_RESPONSE_YES) {
change_status (
- view->priv->registry, icalcomp,
- itip_strip_mailto (a->value),
- a->status);
- e_cal_component_rescan (comp);
+ view->priv->registry, icomp,
+ itip_strip_mailto (e_cal_component_attendee_get_value (a)),
+ e_cal_component_attendee_get_partstat (a));
} else {
goto cleanup;
}
- } else if (a->status == ICAL_PARTSTAT_NONE || a->status == ICAL_PARTSTAT_X) {
+ } else if (e_cal_component_attendee_get_partstat (a) == I_CAL_PARTSTAT_NONE ||
+ e_cal_component_attendee_get_partstat (a) == I_CAL_PARTSTAT_X) {
itip_view_add_lower_info_item (
view, ITIP_VIEW_INFO_ITEM_TYPE_ERROR,
_("Attendee status could not be updated because the status is
invalid"));
+ g_clear_object (&prop);
goto cleanup;
} else {
- if (a->status == ICAL_PARTSTAT_DELEGATED) {
+ if (e_cal_component_attendee_get_partstat (a) == I_CAL_PARTSTAT_DELEGATED) {
/* *prop already declared in this function */
- icalproperty *prop, *new_prop;
+ ICalProperty *subprop, *new_prop;
- prop = find_attendee (icalcomp, itip_strip_mailto (a->value));
- icalcomponent_remove_property (icalcomp, prop);
+ subprop = find_attendee (icomp, itip_strip_mailto
(e_cal_component_attendee_get_value (a)));
+ i_cal_component_remove_property (icomp, subprop);
+ g_clear_object (&subprop);
- new_prop = find_attendee (org_icalcomp, itip_strip_mailto (a->value));
- icalcomponent_add_property (icalcomp, icalproperty_new_clone
(new_prop));
+ new_prop = find_attendee (org_icomp, itip_strip_mailto
(e_cal_component_attendee_get_value (a)));
+ i_cal_component_take_property (icomp, i_cal_property_new_clone
(new_prop));
+ g_clear_object (&new_prop);
} else {
change_status (
- view->priv->registry,icalcomp,
- itip_strip_mailto (a->value),
- a->status);
+ view->priv->registry, icomp,
+ itip_strip_mailto (e_cal_component_attendee_get_value (a)),
+ e_cal_component_attendee_get_partstat (a));
}
- e_cal_component_rescan (comp);
+ g_clear_object (&prop);
}
}
}
@@ -5533,7 +5595,8 @@ update_attendee_status_icalcomp (ItipView *view,
e_cal_client_modify_object (
view->priv->current_client,
- icalcomp, rid ? E_CAL_OBJ_MOD_THIS : E_CAL_OBJ_MOD_ALL,
+ icomp, is_instance ? E_CAL_OBJ_MOD_THIS : E_CAL_OBJ_MOD_ALL,
+ E_CAL_OPERATION_FLAG_NONE,
view->priv->cancellable,
modify_object_cb,
view);
@@ -5549,10 +5612,10 @@ update_attendee_status_get_object_without_rid_cb (GObject *ecalclient,
{
ECalClient *client = E_CAL_CLIENT (ecalclient);
ItipView *view = user_data;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *error = NULL;
- e_cal_client_get_object_finish (client, result, &icalcomp, &error);
+ e_cal_client_get_object_finish (client, result, &icomp, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
@@ -5569,7 +5632,7 @@ update_attendee_status_get_object_without_rid_cb (GObject *ecalclient,
"because the item no longer exists"));
} else {
- update_attendee_status_icalcomp (view, icalcomp);
+ update_attendee_status_icomp (view, icomp);
}
}
@@ -5580,10 +5643,10 @@ update_attendee_status_get_object_with_rid_cb (GObject *ecalclient,
{
ECalClient *client = E_CAL_CLIENT (ecalclient);
ItipView *view = user_data;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GError *error = NULL;
- e_cal_client_get_object_finish (client, result, &icalcomp, &error);
+ e_cal_client_get_object_finish (client, result, &icomp, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_error_free (error);
@@ -5594,7 +5657,7 @@ update_attendee_status_get_object_with_rid_cb (GObject *ecalclient,
g_error_free (error);
- e_cal_component_get_uid (view->priv->comp, &uid);
+ uid = e_cal_component_get_uid (view->priv->comp);
rid = e_cal_component_get_recurid_as_string (view->priv->comp);
if (rid == NULL || *rid == '\0') {
@@ -5618,18 +5681,18 @@ update_attendee_status_get_object_with_rid_cb (GObject *ecalclient,
g_free (rid);
} else {
- update_attendee_status_icalcomp (view, icalcomp);
+ update_attendee_status_icomp (view, icomp);
}
}
static void
update_attendee_status (ItipView *view)
{
- const gchar *uid = NULL;
+ const gchar *uid;
gchar *rid;
/* Obtain our version */
- e_cal_component_get_uid (view->priv->comp, &uid);
+ uid = e_cal_component_get_uid (view->priv->comp);
rid = e_cal_component_get_recurid_as_string (view->priv->comp);
claim_progress_saving_changes (view);
@@ -5704,26 +5767,6 @@ send_item (ItipView *view)
}
}
-static icalcomponent *
-get_next (icalcompiter *iter)
-{
- icalcomponent *ret = NULL;
- icalcomponent_kind kind;
-
- do {
- icalcompiter_next (iter);
- ret = icalcompiter_deref (iter);
- if (ret == NULL)
- break;
- kind = icalcomponent_isa (ret);
- } while (ret != NULL
- && kind != ICAL_VEVENT_COMPONENT
- && kind != ICAL_VTODO_COMPONENT
- && kind != ICAL_VFREEBUSY_COMPONENT);
-
- return ret;
-}
-
static void
attachment_load_finish (EAttachment *attachment,
GAsyncResult *result,
@@ -5801,12 +5844,11 @@ extract_itip_data (ItipView *view,
gboolean *have_alarms)
{
GSettings *settings;
- icalproperty *prop;
- icalcomponent_kind kind = ICAL_NO_COMPONENT;
- icalcomponent *tz_comp;
- icalcompiter tz_iter;
- icalcomponent *alarm_comp;
- icalcompiter alarm_iter;
+ ICalProperty *prop;
+ ICalComponentKind kind = I_CAL_NO_COMPONENT;
+ ICalComponent *tz_comp;
+ ICalComponent *alarm_comp;
+ ICalCompIter *iter;
ECalComponent *comp;
gboolean use_default_reminder;
gint total;
@@ -5823,70 +5865,90 @@ extract_itip_data (ItipView *view,
view->priv->top_level = e_cal_util_new_top_level ();
- view->priv->main_comp = icalparser_parse_string (view->priv->vcalendar);
- if (view->priv->main_comp == NULL || !is_icalcomp_valid (view->priv->main_comp)) {
+ view->priv->main_comp = i_cal_parser_parse_string (view->priv->vcalendar);
+ if (view->priv->main_comp == NULL || !itip_is_component_valid (view->priv->main_comp)) {
set_itip_error (
view,
_("The calendar attached is not valid"),
_("The message claims to contain a calendar, but the calendar is not a valid
iCalendar."),
FALSE);
- if (view->priv->main_comp) {
- icalcomponent_free (view->priv->main_comp);
- view->priv->main_comp = NULL;
- }
+ g_clear_object (&view->priv->main_comp);
return FALSE;
}
- prop = icalcomponent_get_first_property (view->priv->main_comp, ICAL_METHOD_PROPERTY);
+ prop = i_cal_component_get_first_property (view->priv->main_comp, I_CAL_METHOD_PROPERTY);
if (prop == NULL) {
- icalcomponent *subcomp;
+ ICalComponent *subcomp;
- view->priv->method = ICAL_METHOD_PUBLISH;
+ view->priv->method = I_CAL_METHOD_PUBLISH;
/* Search in sub-components for the METHOD property when not found in the VCALENDAR */
- for (subcomp = icalcomponent_get_first_component (view->priv->main_comp, ICAL_ANY_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (view->priv->main_comp,
I_CAL_ANY_COMPONENT);
subcomp;
- subcomp = icalcomponent_get_next_component (view->priv->main_comp, ICAL_ANY_COMPONENT)) {
- kind = icalcomponent_isa (subcomp);
-
- if (kind == ICAL_VEVENT_COMPONENT ||
- kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VJOURNAL_COMPONENT ||
- kind == ICAL_VFREEBUSY_COMPONENT) {
- prop = icalcomponent_get_first_property (subcomp, ICAL_METHOD_PROPERTY);
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component
(view->priv->main_comp, I_CAL_ANY_COMPONENT)) {
+ kind = i_cal_component_isa (subcomp);
+
+ if (kind == I_CAL_VEVENT_COMPONENT ||
+ kind == I_CAL_VTODO_COMPONENT ||
+ kind == I_CAL_VJOURNAL_COMPONENT ||
+ kind == I_CAL_VFREEBUSY_COMPONENT) {
+ prop = i_cal_component_get_first_property (subcomp, I_CAL_METHOD_PROPERTY);
if (prop) {
- view->priv->method = icalproperty_get_method (prop);
+ view->priv->method = i_cal_property_get_method (prop);
+ g_object_unref (subcomp);
+ g_clear_object (&prop);
break;
}
}
}
} else {
- view->priv->method = icalproperty_get_method (prop);
+ view->priv->method = i_cal_property_get_method (prop);
+ g_clear_object (&prop);
}
- tz_iter = icalcomponent_begin_component (view->priv->main_comp, ICAL_VTIMEZONE_COMPONENT);
- while ((tz_comp = icalcompiter_deref (&tz_iter)) != NULL) {
- icalcomponent *clone;
+ iter = i_cal_component_begin_component (view->priv->main_comp, I_CAL_VTIMEZONE_COMPONENT);
+ tz_comp = i_cal_comp_iter_deref (iter);
+ while (tz_comp) {
+ ICalComponent *next_subcomp;
+ ICalComponent *clone;
+
+ next_subcomp = i_cal_comp_iter_next (iter);
- clone = icalcomponent_new_clone (tz_comp);
- icalcomponent_add_component (view->priv->top_level, clone);
+ clone = i_cal_component_new_clone (tz_comp);
+ i_cal_component_take_component (view->priv->top_level, clone);
- icalcompiter_next (&tz_iter);
+ g_object_unref (tz_comp);
+ tz_comp = next_subcomp;
}
- view->priv->iter = icalcomponent_begin_component (view->priv->main_comp, ICAL_ANY_COMPONENT);
- view->priv->ical_comp = icalcompiter_deref (&view->priv->iter);
+ g_clear_object (&iter);
+
+ iter = i_cal_component_begin_component (view->priv->main_comp, I_CAL_ANY_COMPONENT);
+ view->priv->ical_comp = i_cal_comp_iter_deref (iter);
if (view->priv->ical_comp != NULL) {
- kind = icalcomponent_isa (view->priv->ical_comp);
- if (kind != ICAL_VEVENT_COMPONENT
- && kind != ICAL_VTODO_COMPONENT
- && kind != ICAL_VFREEBUSY_COMPONENT
- && kind != ICAL_VJOURNAL_COMPONENT)
- view->priv->ical_comp = get_next (&view->priv->iter);
+ kind = i_cal_component_isa (view->priv->ical_comp);
+ if (kind != I_CAL_VEVENT_COMPONENT &&
+ kind != I_CAL_VTODO_COMPONENT &&
+ kind != I_CAL_VFREEBUSY_COMPONENT &&
+ kind != I_CAL_VJOURNAL_COMPONENT) {
+ do {
+ g_clear_object (&view->priv->ical_comp);
+ view->priv->ical_comp = i_cal_comp_iter_next (iter);
+ if (!view->priv->ical_comp)
+ break;
+ kind = i_cal_component_isa (view->priv->ical_comp);
+ } while (view->priv->ical_comp != NULL &&
+ kind != I_CAL_VEVENT_COMPONENT &&
+ kind != I_CAL_VTODO_COMPONENT &&
+ kind != I_CAL_VFREEBUSY_COMPONENT &&
+ kind != I_CAL_VJOURNAL_COMPONENT);
+ }
}
+ g_clear_object (&iter);
+
if (view->priv->ical_comp == NULL) {
set_itip_error (
view,
@@ -5899,37 +5961,34 @@ extract_itip_data (ItipView *view,
view->priv->with_detached_instances = FALSE;
- total = icalcomponent_count_components (view->priv->main_comp, ICAL_VEVENT_COMPONENT);
- total += icalcomponent_count_components (view->priv->main_comp, ICAL_VTODO_COMPONENT);
- total += icalcomponent_count_components (view->priv->main_comp, ICAL_VFREEBUSY_COMPONENT);
- total += icalcomponent_count_components (view->priv->main_comp, ICAL_VJOURNAL_COMPONENT);
+ total = i_cal_component_count_components (view->priv->main_comp, I_CAL_VEVENT_COMPONENT);
+ total += i_cal_component_count_components (view->priv->main_comp, I_CAL_VTODO_COMPONENT);
+ total += i_cal_component_count_components (view->priv->main_comp, I_CAL_VFREEBUSY_COMPONENT);
+ total += i_cal_component_count_components (view->priv->main_comp, I_CAL_VJOURNAL_COMPONENT);
if (total > 1) {
- icalcomponent *icomp, *master_comp = NULL;
+ ICalComponent *icomp, *master_comp = NULL;
gint orig_total = total;
const gchar *expected_uid = NULL;
- for (icomp = icalcomponent_get_first_component (view->priv->main_comp, ICAL_ANY_COMPONENT);
+ for (icomp = i_cal_component_get_first_component (view->priv->main_comp, I_CAL_ANY_COMPONENT);
icomp;
- icomp = icalcomponent_get_next_component (view->priv->main_comp, ICAL_ANY_COMPONENT)) {
- icalcomponent_kind icomp_kind;
+ g_object_unref (icomp), icomp = i_cal_component_get_next_component
(view->priv->main_comp, I_CAL_ANY_COMPONENT)) {
+ ICalComponentKind icomp_kind;
const gchar *uid;
- icomp_kind = icalcomponent_isa (icomp);
+ icomp_kind = i_cal_component_isa (icomp);
- if (icomp_kind != ICAL_VEVENT_COMPONENT &&
- icomp_kind != ICAL_VJOURNAL_COMPONENT &&
- icomp_kind != ICAL_VTODO_COMPONENT)
+ if (icomp_kind != I_CAL_VEVENT_COMPONENT &&
+ icomp_kind != I_CAL_VJOURNAL_COMPONENT &&
+ icomp_kind != I_CAL_VTODO_COMPONENT)
continue;
- uid = icalcomponent_get_uid (icomp);
+ uid = i_cal_component_get_uid (icomp);
- if (!master_comp) {
- struct icaltimetype rid;
-
- rid = icalcomponent_get_recurrenceid (icomp);
- if (!icaltime_is_valid_time (rid) || icaltime_is_null_time (rid))
- master_comp = icomp;
+ if (!master_comp &&
+ !e_cal_util_component_has_property (icomp, I_CAL_RECURRENCEID_PROPERTY)) {
+ master_comp = g_object_ref (icomp);
}
/* Maybe it's an event with detached instances */
@@ -5939,21 +5998,27 @@ extract_itip_data (ItipView *view,
total--;
} else {
total = orig_total;
+ g_object_unref (icomp);
break;
}
}
view->priv->with_detached_instances = orig_total != total;
- if (view->priv->with_detached_instances && master_comp && master_comp !=
view->priv->ical_comp)
- view->priv->ical_comp = master_comp;
+ if (view->priv->with_detached_instances && master_comp &&
+ i_cal_object_get_native (I_CAL_OBJECT (master_comp)) != i_cal_object_get_native
(I_CAL_OBJECT (view->priv->ical_comp))) {
+ g_clear_object (&view->priv->ical_comp);
+ view->priv->ical_comp = g_object_ref (master_comp);
+ }
+
+ g_clear_object (&master_comp);
}
- switch (icalcomponent_isa (view->priv->ical_comp)) {
- case ICAL_VEVENT_COMPONENT:
+ switch (i_cal_component_isa (view->priv->ical_comp)) {
+ case I_CAL_VEVENT_COMPONENT:
view->priv->type = E_CAL_CLIENT_SOURCE_TYPE_EVENTS;
- view->priv->has_organizer = icalcomponent_get_first_property (view->priv->ical_comp,
ICAL_ORGANIZER_PROPERTY) != NULL;
- if (icalcomponent_get_first_property (view->priv->ical_comp, ICAL_ATTENDEE_PROPERTY) == NULL)
{
- /* no attendees: assume that that this is not a meeting and organizer doesn't want a
reply */
+ view->priv->has_organizer = e_cal_util_component_has_property (view->priv->ical_comp,
I_CAL_ORGANIZER_PROPERTY);
+ if (!e_cal_util_component_has_property (view->priv->ical_comp, I_CAL_ATTENDEE_PROPERTY)) {
+ /* no attendees: assume that this is not a meeting and organizer doesn't want a reply
*/
view->priv->no_reply_wanted = TRUE;
} else {
/*
@@ -5962,10 +6027,10 @@ extract_itip_data (ItipView *view,
*/
}
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
view->priv->type = E_CAL_CLIENT_SOURCE_TYPE_TASKS;
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
view->priv->type = E_CAL_CLIENT_SOURCE_TYPE_MEMOS;
break;
default:
@@ -5992,41 +6057,41 @@ extract_itip_data (ItipView *view,
view->priv->current = 0;
}
- if (icalcomponent_isa (view->priv->ical_comp) != ICAL_VJOURNAL_COMPONENT) {
+ if (i_cal_component_isa (view->priv->ical_comp) != I_CAL_VJOURNAL_COMPONENT) {
gchar *my_address;
prop = NULL;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (view->priv->ical_comp));
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone
(view->priv->ical_comp));
my_address = itip_get_comp_attendee (
view->priv->registry, comp, NULL);
- g_object_unref (comp);
- comp = NULL;
+ g_clear_object (&comp);
- if (!prop)
- prop = find_attendee (view->priv->ical_comp, my_address);
+ prop = find_attendee (view->priv->ical_comp, my_address);
if (!prop)
prop = find_attendee_if_sentby (view->priv->ical_comp, my_address);
if (prop) {
- icalparameter *param;
- const gchar * delfrom;
+ ICalParameter *param;
+ const gchar *delfrom;
- if ((param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER))) {
- delfrom = icalparameter_get_delegatedfrom (param);
+ if ((param = i_cal_property_get_first_parameter (prop,
I_CAL_DELEGATEDFROM_PARAMETER))) {
+ delfrom = i_cal_parameter_get_delegatedfrom (param);
view->priv->delegator_address = g_strdup (itip_strip_mailto (delfrom));
+
+ g_object_unref (param);
}
}
g_free (my_address);
- prop = NULL;
+ g_clear_object (&prop);
/* Determine any delegate sections */
- prop = icalcomponent_get_first_property (view->priv->ical_comp, ICAL_X_PROPERTY);
- while (prop) {
+ for (prop = i_cal_component_get_first_property (view->priv->ical_comp, I_CAL_X_PROPERTY);
+ prop;
+ g_object_unref (prop), i_cal_component_get_next_property (view->priv->ical_comp,
I_CAL_X_PROPERTY)) {
const gchar *x_name, *x_val;
- x_name = icalproperty_get_x_name (prop);
- x_val = icalproperty_get_x (prop);
+ x_name = i_cal_property_get_x_name (prop);
+ x_val = i_cal_property_get_x (prop);
if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-UID"))
view->priv->calendar_uid = g_strdup (x_val);
@@ -6036,27 +6101,35 @@ extract_itip_data (ItipView *view,
view->priv->delegator_address = g_strdup (x_val);
else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-NAME"))
view->priv->delegator_name = g_strdup (x_val);
-
- prop = icalcomponent_get_next_property (view->priv->ical_comp, ICAL_X_PROPERTY);
}
/* Strip out procedural alarms for security purposes */
- alarm_iter = icalcomponent_begin_component (view->priv->ical_comp, ICAL_VALARM_COMPONENT);
- while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
- icalproperty *p;
+ iter = i_cal_component_begin_component (view->priv->ical_comp, I_CAL_VALARM_COMPONENT);
+ alarm_comp = i_cal_comp_iter_deref (iter);
+ while (alarm_comp) {
+ ICalComponent *next_subcomp;
+ ICalProperty *pp;
+
+ next_subcomp = i_cal_comp_iter_next (iter);
- icalcompiter_next (&alarm_iter);
+ pp = i_cal_component_get_first_property (alarm_comp, I_CAL_ACTION_PROPERTY);
+ if (!pp || i_cal_property_get_action (pp) == I_CAL_ACTION_PROCEDURE)
+ i_cal_component_remove_component (view->priv->ical_comp, alarm_comp);
- p = icalcomponent_get_first_property (alarm_comp, ICAL_ACTION_PROPERTY);
- if (!p || icalproperty_get_action (p) == ICAL_ACTION_PROCEDURE)
- icalcomponent_remove_component (view->priv->ical_comp, alarm_comp);
+ g_clear_object (&pp);
- icalcomponent_free (alarm_comp);
+ g_object_unref (alarm_comp);
+ alarm_comp = next_subcomp;
}
+ g_clear_object (&iter);
+
if (have_alarms) {
- alarm_iter = icalcomponent_begin_component (view->priv->ical_comp,
ICAL_VALARM_COMPONENT);
- *have_alarms = icalcompiter_deref (&alarm_iter) != NULL;
+ iter = i_cal_component_begin_component (view->priv->ical_comp,
I_CAL_VALARM_COMPONENT);
+ alarm_comp = i_cal_comp_iter_deref (iter);
+ *have_alarms = alarm_comp != NULL;
+ g_clear_object (&alarm_comp);
+ g_clear_object (&iter);
}
}
@@ -6085,7 +6158,8 @@ extract_itip_data (ItipView *view,
ECalComponentAlarm *acomp;
gint interval;
EDurationType units;
- ECalComponentAlarmTrigger trigger;
+ ICalDuration *duration;
+ ECalComponentAlarmTrigger *trigger;
interval = g_settings_get_int (
settings, "default-reminder-interval");
@@ -6096,30 +6170,31 @@ extract_itip_data (ItipView *view,
e_cal_component_alarm_set_action (acomp, 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 (units) {
case E_DURATION_MINUTES:
- trigger.u.rel_duration.minutes = interval;
+ i_cal_duration_set_minutes (duration, interval);
break;
case E_DURATION_HOURS:
- trigger.u.rel_duration.hours = interval;
+ i_cal_duration_set_hours (duration, interval);
break;
case E_DURATION_DAYS:
- trigger.u.rel_duration.days = interval;
+ i_cal_duration_set_days (duration, interval);
break;
default:
g_warn_if_reached ();
break;
}
- e_cal_component_alarm_set_trigger (acomp, trigger);
+ trigger = e_cal_component_alarm_trigger_new_relative
(E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, duration);
+
+ e_cal_component_alarm_take_trigger (acomp, trigger);
e_cal_component_add_alarm (view->priv->comp, acomp);
e_cal_component_alarm_free (acomp);
+ g_clear_object (&duration);
}
g_object_unref (settings);
@@ -6161,7 +6236,7 @@ view_response_cb (ItipView *view,
gpointer user_data)
{
gboolean status = FALSE;
- icalproperty *prop;
+ ICalProperty *prop;
ECalComponentTransparency trans;
if (response == ITIP_VIEW_RESPONSE_SAVE) {
@@ -6169,20 +6244,20 @@ view_response_cb (ItipView *view,
return;
}
- if (view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method == ICAL_METHOD_REQUEST) {
+ if (view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method == I_CAL_METHOD_REQUEST) {
if (itip_view_get_free_time_check_state (view))
e_cal_component_set_transparency (view->priv->comp,
E_CAL_COMPONENT_TRANSP_TRANSPARENT);
else
e_cal_component_set_transparency (view->priv->comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
} else {
- e_cal_component_get_transparency (view->priv->comp, &trans);
+ trans = e_cal_component_get_transparency (view->priv->comp);
if (trans == E_CAL_COMPONENT_TRANSP_NONE)
e_cal_component_set_transparency (view->priv->comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
}
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);
@@ -6193,9 +6268,9 @@ view_response_cb (ItipView *view,
/* check if it is a recur instance (no master object) and
* add a property */
if (itip_view_get_recur_check_state (view)) {
- prop = icalproperty_new_x ("All");
- icalproperty_set_x_name (prop, "X-GW-RECUR-INSTANCES-MOD-TYPE");
- icalcomponent_add_property (view->priv->ical_comp, prop);
+ prop = i_cal_property_new_x ("All");
+ i_cal_property_set_x_name (prop, "X-GW-RECUR-INSTANCES-MOD-TYPE");
+ i_cal_component_take_property (view->priv->ical_comp, prop);
}
switch (response) {
@@ -6209,7 +6284,6 @@ view_response_cb (ItipView *view,
else
status = TRUE;
if (status) {
- e_cal_component_rescan (view->priv->comp);
update_item (view, response);
}
break;
@@ -6220,7 +6294,6 @@ view_response_cb (ItipView *view,
view->priv->to_address,
ICAL_PARTSTAT_TENTATIVE);
if (status) {
- e_cal_component_rescan (view->priv->comp);
update_item (view, response);
}
break;
@@ -6232,14 +6305,13 @@ view_response_cb (ItipView *view,
view->priv->to_address,
ICAL_PARTSTAT_DECLINED);
else {
- prop = icalproperty_new_x ("1");
- icalproperty_set_x_name (prop, "X-GW-DECLINED");
- icalcomponent_add_property (view->priv->ical_comp, prop);
+ prop = i_cal_property_new_x ("1");
+ i_cal_property_set_x_name (prop, "X-GW-DECLINED");
+ i_cal_component_take_property (view->priv->ical_comp, prop);
status = TRUE;
}
if (status) {
- e_cal_component_rescan (view->priv->comp);
update_item (view, response);
}
break;
@@ -6264,19 +6336,20 @@ view_response_cb (ItipView *view,
}
static gboolean
-check_is_instance (icalcomponent *icalcomp)
+check_is_instance (ICalComponent *icomp)
{
- icalproperty *icalprop;
+ ICalProperty *prop;
- icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- while (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;
- x_name = icalproperty_get_x_name (icalprop);
- if (!strcmp (x_name, "X-GW-RECURRENCE-KEY")) {
+ x_name = i_cal_property_get_x_name (prop);
+ if (!g_strcmp0 (x_name, "X-GW-RECURRENCE-KEY")) {
+ g_object_unref (prop);
return TRUE;
}
- icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
}
return FALSE;
@@ -6338,25 +6411,25 @@ in_proper_folder (CamelFolder *folder)
return res;
}
-static icaltimezone *
+static ICalTimezone *
itip_view_guess_timezone (const gchar *tzid)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
if (!tzid || !*tzid)
return NULL;
- zone = icaltimezone_get_builtin_timezone (tzid);
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
if (zone)
return zone;
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
if (zone)
return zone;
tzid = e_cal_match_tzid (tzid);
if (tzid)
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ zone = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
return zone;
}
@@ -6379,16 +6452,17 @@ itip_view_add_recurring_info (ItipView *view)
void
itip_view_init_view (ItipView *view)
{
- ECalComponentText text;
- ECalComponentOrganizer organizer;
- ECalComponentDateTime datetime;
- icaltimezone *from_zone;
- icaltimezone *to_zone = NULL;
+ ECalComponentText *text;
+ ECalComponentOrganizer *organizer;
+ ECalComponentDateTime *datetime;
+ ICalTimezone *from_zone;
+ ICalTimezone *to_zone = NULL;
GSettings *settings;
GString *gstring = NULL;
GSList *list, *l;
- icalcomponent *icalcomp;
- const gchar *string, *org;
+ ICalComponent *icomp;
+ const gchar *org;
+ gchar *string;
gboolean response_enabled;
gboolean have_alarms = FALSE;
@@ -6408,11 +6482,11 @@ itip_view_init_view (ItipView *view)
} else {
itip_view_set_show_inherit_alarm_check (
view,
- have_alarms && (view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method ==
ICAL_METHOD_REQUEST));
+ have_alarms && (view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method ==
I_CAL_METHOD_REQUEST));
switch (view->priv->method) {
- case ICAL_METHOD_PUBLISH:
- case ICAL_METHOD_REQUEST:
+ case I_CAL_METHOD_PUBLISH:
+ case I_CAL_METHOD_REQUEST:
/*
* Treat meeting request (sent by organizer directly) and
* published evend (forwarded by organizer or attendee) alike:
@@ -6426,29 +6500,29 @@ itip_view_init_view (ItipView *view)
ITIP_VIEW_MODE_REQUEST :
ITIP_VIEW_MODE_PUBLISH);
break;
- case ICAL_METHOD_REPLY:
+ case I_CAL_METHOD_REPLY:
itip_view_set_mode (view, ITIP_VIEW_MODE_REPLY);
break;
- case ICAL_METHOD_ADD:
+ case I_CAL_METHOD_ADD:
itip_view_set_mode (view, ITIP_VIEW_MODE_ADD);
break;
- case ICAL_METHOD_CANCEL:
+ case I_CAL_METHOD_CANCEL:
itip_view_set_mode (view, ITIP_VIEW_MODE_CANCEL);
break;
- case ICAL_METHOD_REFRESH:
+ case I_CAL_METHOD_REFRESH:
itip_view_set_mode (view, ITIP_VIEW_MODE_REFRESH);
break;
- case ICAL_METHOD_COUNTER:
+ case I_CAL_METHOD_COUNTER:
itip_view_set_mode (view, ITIP_VIEW_MODE_COUNTER);
break;
- case ICAL_METHOD_DECLINECOUNTER:
+ case I_CAL_METHOD_DECLINECOUNTER:
itip_view_set_mode (view, ITIP_VIEW_MODE_DECLINECOUNTER);
break;
- case ICAL_METHOD_X :
+ case I_CAL_METHOD_X :
/* Handle appointment requests from Microsoft Live. This is
* a best-at-hand-now handling. Must be revisited when we have
* better access to the source of such meetings */
- view->priv->method = ICAL_METHOD_REQUEST;
+ view->priv->method = I_CAL_METHOD_REQUEST;
itip_view_set_mode (view, ITIP_VIEW_MODE_REQUEST);
break;
default:
@@ -6460,24 +6534,28 @@ itip_view_init_view (ItipView *view)
if (response_enabled) {
switch (view->priv->method) {
- case ICAL_METHOD_REQUEST:
+ case I_CAL_METHOD_REQUEST:
/* FIXME What about the name? */
itip_view_set_delegator (view, view->priv->delegator_name ?
view->priv->delegator_name : view->priv->delegator_address);
/* coverity[fallthrough] */
/* falls through */
- case ICAL_METHOD_PUBLISH:
- case ICAL_METHOD_ADD:
- case ICAL_METHOD_CANCEL:
- case ICAL_METHOD_DECLINECOUNTER:
+ case I_CAL_METHOD_PUBLISH:
+ case I_CAL_METHOD_ADD:
+ case I_CAL_METHOD_CANCEL:
+ case I_CAL_METHOD_DECLINECOUNTER:
itip_view_set_show_update_check (view, FALSE);
/* An organizer sent this */
- e_cal_component_get_organizer (view->priv->comp, &organizer);
- org = organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value);
+ organizer = e_cal_component_get_organizer (view->priv->comp);
+ if (!organizer)
+ break;
+
+ org = e_cal_component_organizer_get_cn (organizer) ?
e_cal_component_organizer_get_cn (organizer) :
+ itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
itip_view_set_organizer (view, org);
- if (organizer.sentby) {
- const gchar *sentby = itip_strip_mailto (organizer.sentby);
+ if (e_cal_component_organizer_get_sentby (organizer)) {
+ const gchar *sentby = itip_strip_mailto
(e_cal_component_organizer_get_sentby (organizer));
if (sentby && *sentby) {
gchar *tmp = NULL;
@@ -6509,37 +6587,44 @@ itip_view_init_view (ItipView *view)
}
if (view->priv->my_address) {
- if (!(organizer.value && !g_ascii_strcasecmp (itip_strip_mailto
(organizer.value), view->priv->my_address))
- && !(organizer.sentby && !g_ascii_strcasecmp
(itip_strip_mailto (organizer.sentby), view->priv->my_address))
- && (view->priv->to_address && g_ascii_strcasecmp
(view->priv->to_address, view->priv->my_address)))
+ if (!(e_cal_component_organizer_get_value (organizer) &&
+ !g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_organizer_get_value (organizer)), view->priv->my_address)) &&
+ !(e_cal_component_organizer_get_sentby (organizer) &&
+ !g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_organizer_get_sentby (organizer)), view->priv->my_address)) &&
+ (view->priv->to_address && g_ascii_strcasecmp
(view->priv->to_address, view->priv->my_address)))
itip_view_set_proxy (view, view->priv->to_name ?
view->priv->to_name : view->priv->to_address);
}
+
+ e_cal_component_organizer_free (organizer);
break;
- case ICAL_METHOD_REPLY:
- case ICAL_METHOD_REFRESH:
- case ICAL_METHOD_COUNTER:
+ case I_CAL_METHOD_REPLY:
+ case I_CAL_METHOD_REFRESH:
+ case I_CAL_METHOD_COUNTER:
itip_view_set_show_update_check (view, TRUE);
/* An attendee sent this */
- e_cal_component_get_attendee_list (view->priv->comp, &list);
+ list = e_cal_component_get_attendees (view->priv->comp);
if (list != NULL) {
ECalComponentAttendee *attendee;
attendee = list->data;
- itip_view_set_attendee (view, attendee->cn ? attendee->cn :
itip_strip_mailto (attendee->value));
+ itip_view_set_attendee (view, e_cal_component_attendee_get_cn
(attendee) ?
+ e_cal_component_attendee_get_cn (attendee) :
itip_strip_mailto (e_cal_component_attendee_get_value (attendee)));
- if (attendee->sentby)
- itip_view_set_attendee_sentby (view, itip_strip_mailto
(attendee->sentby));
+ if (e_cal_component_attendee_get_sentby (attendee))
+ itip_view_set_attendee_sentby (view, itip_strip_mailto
(e_cal_component_attendee_get_sentby (attendee)));
if (view->priv->my_address) {
- if (!(attendee->value && !g_ascii_strcasecmp
(itip_strip_mailto (attendee->value), view->priv->my_address))
- && !(attendee->sentby && !g_ascii_strcasecmp
(itip_strip_mailto (attendee->sentby), view->priv->my_address))
- && (view->priv->from_address && g_ascii_strcasecmp
(view->priv->from_address, view->priv->my_address)))
+ if (!(e_cal_component_attendee_get_value (attendee) &&
+ !g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_attendee_get_value (attendee)), view->priv->my_address)) &&
+ !(e_cal_component_attendee_get_sentby (attendee) &&
+ !g_ascii_strcasecmp (itip_strip_mailto
(e_cal_component_attendee_get_sentby (attendee)), view->priv->my_address)) &&
+ (view->priv->from_address && g_ascii_strcasecmp
(view->priv->from_address, view->priv->my_address)))
itip_view_set_proxy (view, view->priv->from_name ?
view->priv->from_name : view->priv->from_address);
}
- e_cal_component_free_attendee_list (list);
+ g_slist_free_full (list, e_cal_component_attendee_free);
}
break;
default:
@@ -6548,52 +6633,54 @@ itip_view_init_view (ItipView *view)
}
}
- e_cal_component_get_summary (view->priv->comp, &text);
- itip_view_set_summary (view, text.value ? text.value : C_("cal-itip", "None"));
+ text = e_cal_component_get_summary (view->priv->comp);
+ itip_view_set_summary (view, text && e_cal_component_text_get_value (text) ?
e_cal_component_text_get_value (text) : C_("cal-itip", "None"));
+ e_cal_component_text_free (text);
- e_cal_component_get_location (view->priv->comp, &string);
+ string = e_cal_component_get_location (view->priv->comp);
itip_view_set_location (view, string);
+ g_free (string);
/* Status really only applies for REPLY */
- if (response_enabled && view->priv->method == ICAL_METHOD_REPLY) {
- e_cal_component_get_attendee_list (view->priv->comp, &list);
+ if (response_enabled && view->priv->method == I_CAL_METHOD_REPLY) {
+ list = e_cal_component_get_attendees (view->priv->comp);
if (list != NULL) {
ECalComponentAttendee *a = list->data;
- switch (a->status) {
- case ICAL_PARTSTAT_ACCEPTED:
+ switch (e_cal_component_attendee_get_partstat (a)) {
+ case I_CAL_PARTSTAT_ACCEPTED:
itip_view_set_status (view, _("Accepted"));
break;
- case ICAL_PARTSTAT_TENTATIVE:
+ case I_CAL_PARTSTAT_TENTATIVE:
itip_view_set_status (view, _("Tentatively Accepted"));
break;
- case ICAL_PARTSTAT_DECLINED:
+ case I_CAL_PARTSTAT_DECLINED:
itip_view_set_status (view, _("Declined"));
break;
- case ICAL_PARTSTAT_DELEGATED:
+ case I_CAL_PARTSTAT_DELEGATED:
itip_view_set_status (view, _("Delegated"));
break;
default:
itip_view_set_status (view, _("Unknown"));
}
}
- e_cal_component_free_attendee_list (list);
+ g_slist_free_full (list, e_cal_component_attendee_free);
}
- if (view->priv->method == ICAL_METHOD_REPLY
- || view->priv->method == ICAL_METHOD_COUNTER
- || view->priv->method == ICAL_METHOD_DECLINECOUNTER) {
+ if (view->priv->method == I_CAL_METHOD_REPLY ||
+ view->priv->method == I_CAL_METHOD_COUNTER ||
+ view->priv->method == I_CAL_METHOD_DECLINECOUNTER) {
/* FIXME Check spec to see if multiple comments are actually valid */
/* Comments for iTIP are limited to one per object */
- e_cal_component_get_comment_list (view->priv->comp, &list);
+ list = e_cal_component_get_comments (view->priv->comp);
if (list) {
- ECalComponentText *text = list->data;
+ text = list->data;
- if (text->value) {
+ if (text && e_cal_component_text_get_value (text)) {
gchar *html;
html = camel_text_to_html (
- text->value,
+ e_cal_component_text_get_value (text),
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES,
@@ -6604,22 +6691,26 @@ itip_view_init_view (ItipView *view)
g_free (html);
}
}
- e_cal_component_free_text_list (list);
+
+ g_slist_free_full (list, e_cal_component_text_free);
}
itip_view_extract_attendee_info (view);
- e_cal_component_get_description_list (view->priv->comp, &list);
+ list = e_cal_component_get_descriptions (view->priv->comp);
for (l = list; l; l = l->next) {
- ECalComponentText *text = l->data;
+ text = l->data;
+
+ if (!text)
+ continue;
- if (!gstring && text->value)
- gstring = g_string_new (text->value);
- else if (text->value)
- g_string_append_printf (gstring, "\n\n%s", text->value);
+ if (!gstring && e_cal_component_text_get_value (text))
+ gstring = g_string_new (e_cal_component_text_get_value (text));
+ else if (e_cal_component_text_get_value (text))
+ g_string_append_printf (gstring, "\n\n%s", e_cal_component_text_get_value (text));
}
- e_cal_component_free_text_list (list);
+ g_slist_free_full (list, e_cal_component_text_free);
if (gstring) {
gchar *html;
@@ -6647,85 +6738,94 @@ itip_view_init_view (ItipView *view)
location = g_settings_get_string (settings, "timezone");
if (location != NULL) {
- to_zone = icaltimezone_get_builtin_timezone (location);
+ to_zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location);
}
}
if (to_zone == NULL)
- to_zone = icaltimezone_get_utc_timezone ();
+ to_zone = i_cal_timezone_get_utc_timezone ();
g_object_unref (settings);
- e_cal_component_get_dtstart (view->priv->comp, &datetime);
+ datetime = e_cal_component_get_dtstart (view->priv->comp);
view->priv->start_time = 0;
- if (datetime.value) {
+ if (datetime && e_cal_component_datetime_get_value (datetime)) {
+ ICalTime *itt = e_cal_component_datetime_get_value (datetime);
struct tm start_tm;
/* If the timezone is not in the component, guess the local time */
/* Should we guess if the timezone is an olsen name somehow? */
- if (icaltime_is_utc (*datetime.value))
- from_zone = icaltimezone_get_utc_timezone ();
- else if (!icaltime_is_utc (*datetime.value) && datetime.tzid) {
- from_zone = icalcomponent_get_timezone (view->priv->top_level, datetime.tzid);
-
- if (!from_zone)
- from_zone = itip_view_guess_timezone (datetime.tzid);
+ if (i_cal_time_is_utc (itt))
+ from_zone = g_object_ref (i_cal_timezone_get_utc_timezone ());
+ else if (e_cal_component_datetime_get_tzid (datetime)) {
+ from_zone = i_cal_component_get_timezone (view->priv->top_level,
e_cal_component_datetime_get_tzid (datetime));
+
+ if (!from_zone) {
+ from_zone = itip_view_guess_timezone (e_cal_component_datetime_get_tzid
(datetime));
+ if (from_zone)
+ g_object_ref (from_zone);
+ }
} 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 (itt, from_zone, to_zone);
+
+ itip_view_set_start (view, &start_tm, i_cal_time_is_date (itt));
+ view->priv->start_time = i_cal_time_as_timet_with_zone (itt, from_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);
+ g_clear_object (&from_zone);
}
- icalcomp = e_cal_component_get_icalcomponent (view->priv->comp);
+ icomp = e_cal_component_get_icalcomponent (view->priv->comp);
/* Set the recurrence id */
- if (check_is_instance (icalcomp) && datetime.value) {
+ if (check_is_instance (icomp) && datetime && e_cal_component_datetime_get_value (datetime)) {
ECalComponentRange *recur_id;
- struct icaltimetype icaltime = icaltime_convert_to_zone (*datetime.value, to_zone);
+ ICalTime *itt = i_cal_time_convert_to_zone (e_cal_component_datetime_get_value (datetime),
to_zone);
- recur_id = g_new0 (ECalComponentRange, 1);
- recur_id->type = E_CAL_COMPONENT_RANGE_SINGLE;
- recur_id->datetime.value = &icaltime;
- recur_id->datetime.tzid = icaltimezone_get_tzid (to_zone);
+ recur_id = e_cal_component_range_new_take (E_CAL_COMPONENT_RANGE_SINGLE,
+ e_cal_component_datetime_new_take (itt, g_strdup (i_cal_timezone_get_tzid
(to_zone))));
e_cal_component_set_recurid (view->priv->comp, recur_id);
- g_free (recur_id); /* it's ok to call g_free here */
+ e_cal_component_range_free (recur_id);
}
- e_cal_component_free_datetime (&datetime);
+ e_cal_component_datetime_free (datetime);
- e_cal_component_get_dtend (view->priv->comp, &datetime);
+ datetime = e_cal_component_get_dtend (view->priv->comp);
view->priv->end_time = 0;
- if (datetime.value) {
+ if (datetime && e_cal_component_datetime_get_value (datetime)) {
+ ICalTime *itt = e_cal_component_datetime_get_value (datetime);
struct tm end_tm;
/* If the timezone is not in the component, guess the local time */
/* Should we guess if the timezone is an olsen name somehow? */
- if (icaltime_is_utc (*datetime.value))
- from_zone = icaltimezone_get_utc_timezone ();
- else if (!icaltime_is_utc (*datetime.value) && datetime.tzid) {
- from_zone = icalcomponent_get_timezone (view->priv->top_level, datetime.tzid);
-
- if (!from_zone)
- from_zone = itip_view_guess_timezone (datetime.tzid);
+ if (i_cal_time_is_utc (itt))
+ from_zone = g_object_ref (i_cal_timezone_get_utc_timezone ());
+ else if (e_cal_component_datetime_get_tzid (datetime)) {
+ from_zone = i_cal_component_get_timezone (view->priv->top_level,
e_cal_component_datetime_get_tzid (datetime));
+
+ if (!from_zone) {
+ from_zone = itip_view_guess_timezone (e_cal_component_datetime_get_tzid
(datetime));
+ if (from_zone)
+ g_object_ref (from_zone);
+ }
} else
from_zone = NULL;
- if (datetime.value->is_date) {
+ if (i_cal_time_is_date (itt)) {
/* RFC says the DTEND is not inclusive, thus subtract one day
* if we have a date */
- icaltime_adjust (datetime.value, -1, 0, 0, 0);
+ i_cal_time_adjust (itt, -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 (itt, 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);
+ itip_view_set_end (view, &end_tm, i_cal_time_is_date (itt));
+ view->priv->end_time = i_cal_time_as_timet_with_zone (itt, from_zone);
+ g_clear_object (&from_zone);
}
- e_cal_component_free_datetime (&datetime);
+ e_cal_component_datetime_free (datetime);
/* Recurrence info */
itip_view_add_recurring_info (view);
@@ -6735,7 +6835,8 @@ itip_view_init_view (ItipView *view)
G_CALLBACK (view_response_cb), NULL);
if (response_enabled) {
- itip_view_set_show_free_time_check (view, view->priv->type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS
&& (view->priv->method == ICAL_METHOD_PUBLISH || view->priv->method == ICAL_METHOD_REQUEST));
+ itip_view_set_show_free_time_check (view, view->priv->type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS
&&
+ (view->priv->method == I_CAL_METHOD_PUBLISH || view->priv->method ==
I_CAL_METHOD_REQUEST));
if (view->priv->calendar_uid) {
start_calendar_server_by_uid (view, view->priv->calendar_uid, view->priv->type);
diff --git a/src/modules/settings/e-settings-cal-model.c b/src/modules/settings/e-settings-cal-model.c
index a6f10c8107..4891ae3582 100644
--- a/src/modules/settings/e-settings-cal-model.c
+++ b/src/modules/settings/e-settings-cal-model.c
@@ -42,7 +42,7 @@ 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");
@@ -52,12 +52,12 @@ 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);
diff --git a/src/modules/settings/e-settings-client-cache.c b/src/modules/settings/e-settings-client-cache.c
index e99440467b..b29c66d4e5 100644
--- a/src/modules/settings/e-settings-client-cache.c
+++ b/src/modules/settings/e-settings-client-cache.c
@@ -41,7 +41,7 @@ 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");
@@ -51,12 +51,12 @@ 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);
diff --git a/src/modules/settings/e-settings-meeting-store.c b/src/modules/settings/e-settings-meeting-store.c
index dc9a6a44bb..2c47eadd5d 100644
--- a/src/modules/settings/e-settings-meeting-store.c
+++ b/src/modules/settings/e-settings-meeting-store.c
@@ -41,7 +41,7 @@ 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");
@@ -51,12 +51,12 @@ 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);
diff --git a/src/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
b/src/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
index 8cdce57c66..1524fccd7b 100644
--- a/src/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
+++ b/src/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
@@ -995,7 +995,7 @@ static void saveVCalendar (TNEFStruct *tnef, const gchar *tmpdir) {
charptr2 = charptr;
else
charptr2++;
- fprintf (fptr, "ORGANIZER;CN=\"%s\":MAILTO:%s\n",
+ fprintf (fptr, "ORGANIZER;CN=\"%s\":mailto:%s\n",
charptr2, charptr2);
}
@@ -1016,7 +1016,7 @@ static void saveVCalendar (TNEFStruct *tnef, const gchar *tmpdir) {
charptr++;
fprintf (fptr, "ATTENDEE;PARTSTAT=NEEDS-ACTION;");
fprintf (fptr, "ROLE=REQ-PARTICIPANT;RSVP=TRUE;");
- fprintf (fptr, "CN=\"%s\":MAILTO:%s\n",
+ fprintf (fptr, "CN=\"%s\":mailto:%s\n",
charptr, charptr);
charptr = charptr2;
}
@@ -1037,7 +1037,7 @@ static void saveVCalendar (TNEFStruct *tnef, const gchar *tmpdir) {
charptr++;
fprintf (fptr, "ATTENDEE;PARTSTAT=NEEDS-ACTION;");
fprintf (fptr, "ROLE=OPT-PARTICIPANT;RSVP=TRUE;");
- fprintf (fptr, "CN=\"%s\":MAILTO:%s\n",
+ fprintf (fptr, "CN=\"%s\":mailto:%s\n",
charptr, charptr);
charptr = charptr2;
}
@@ -1057,7 +1057,7 @@ static void saveVCalendar (TNEFStruct *tnef, const gchar *tmpdir) {
charptr++;
fprintf (fptr, "ATTENDEE;PARTSTAT=NEEDS-ACTION;");
fprintf (fptr, "ROLE=REQ-PARTICIPANT;RSVP=TRUE;");
- fprintf (fptr, "CN=\"%s\":MAILTO:%s\n",
+ fprintf (fptr, "CN=\"%s\":mailto:%s\n",
charptr, charptr);
charptr = charptr2;
}
diff --git a/src/plugins/mail-to-task/mail-to-task.c b/src/plugins/mail-to-task/mail-to-task.c
index bd954611bd..806cc6f825 100644
--- a/src/plugins/mail-to-task/mail-to-task.c
+++ b/src/plugins/mail-to-task/mail-to-task.c
@@ -106,7 +106,7 @@ set_attendees (ECalComponent *comp,
CamelMimeMessage *message,
const gchar *organizer)
{
- GSList *attendees = NULL, *to_free = NULL;
+ GSList *attendees = NULL;
ECalComponentAttendee *ca;
CamelInternetAddress *from, *to, *cc, *bcc, *arr[4];
gint len, i, j;
@@ -139,37 +139,35 @@ set_attendees (ECalComponent *comp,
continue;
}
- ca = g_new0 (ECalComponentAttendee, 1);
+ ca = e_cal_component_attendee_new ();
- ca->value = temp;
- ca->cn = name;
- ca->cutype = ICAL_CUTYPE_INDIVIDUAL;
- ca->status = ICAL_PARTSTAT_NEEDSACTION;
+ e_cal_component_attendee_set_value (ca, temp);
+ e_cal_component_attendee_set_cn (ca, name);
+ e_cal_component_attendee_set_cutype (ca, I_CAL_CUTYPE_INDIVIDUAL);
+ e_cal_component_attendee_set_partstat (ca, I_CAL_PARTSTAT_NEEDSACTION);
if (j == 0) {
/* From */
- ca->role = ICAL_ROLE_CHAIR;
+ e_cal_component_attendee_set_role (ca, I_CAL_ROLE_CHAIR);
} else if (j == 2) {
/* BCC */
- ca->role = ICAL_ROLE_OPTPARTICIPANT;
+ e_cal_component_attendee_set_role (ca, I_CAL_ROLE_OPTPARTICIPANT);
} else {
/* all other */
- ca->role = ICAL_ROLE_REQPARTICIPANT;
+ e_cal_component_attendee_set_role (ca, I_CAL_ROLE_REQPARTICIPANT);
}
- to_free = g_slist_prepend (to_free, temp);
+ attendees = g_slist_prepend (attendees, ca);
- attendees = g_slist_append (attendees, ca);
+ g_free (temp);
}
}
}
- e_cal_component_set_attendee_list (comp, attendees);
+ attendees = g_slist_reverse (attendees);
- g_slist_foreach (attendees, (GFunc) g_free, NULL);
- g_slist_foreach (to_free, (GFunc) g_free, NULL);
+ e_cal_component_set_attendees (comp, attendees);
- g_slist_free (to_free);
- g_slist_free (attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
static const gchar *
@@ -283,20 +281,18 @@ set_description (ECalComponent *comp,
if (!convert_str && str)
convert_str = e_util_utf8_make_valid (str);
- text = g_new0 (ECalComponentText, 1);
if (convert_str)
- text->value = prepend_from (message, &convert_str);
+ text = e_cal_component_text_new (prepend_from (message, &convert_str), NULL);
else
- text->value = prepend_from (message, &str);
- text->altrep = NULL;
+ text = e_cal_component_text_new (prepend_from (message, &str), NULL);
sl = g_slist_append (sl, text);
- e_cal_component_set_description_list (comp, sl);
+ e_cal_component_set_descriptions (comp, sl);
g_free (str);
if (convert_str)
g_free (convert_str);
- e_cal_component_free_text_list (sl);
+ g_slist_free_full (sl, e_cal_component_text_free);
}
static gchar *
@@ -311,7 +307,6 @@ set_organizer (ECalComponent *comp,
ESourceMailIdentity *extension;
const gchar *extension_name;
const gchar *address, *name;
- ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
gchar *mailto = NULL;
gchar *identity_name = NULL, *identity_address = NULL;
@@ -347,10 +342,15 @@ set_organizer (ECalComponent *comp,
}
if (address && *address) {
+ ECalComponentOrganizer *organizer;
+
mailto = g_strconcat ("mailto:", address, NULL);
- organizer.value = mailto;
- organizer.cn = name;
- e_cal_component_set_organizer (comp, &organizer);
+
+ organizer = e_cal_component_organizer_new ();
+ e_cal_component_organizer_set_value (organizer, mailto);
+ e_cal_component_organizer_set_cn (organizer, name);
+ e_cal_component_set_organizer (comp, organizer);
+ e_cal_component_organizer_free (organizer);
}
g_object_unref (source);
@@ -430,7 +430,7 @@ set_attachments (ECalClient *client,
if (n_parts < 1)
return;
- e_cal_component_get_uid (comp, &comp_uid);
+ comp_uid = e_cal_component_get_uid (comp);
g_return_if_fail (comp_uid != NULL);
tmp = g_strdup (comp_uid);
@@ -492,16 +492,15 @@ set_attachments (ECalClient *client,
/* Transfer the URI strings to the GSList. */
for (ii = 0; cb_data.uris[ii] != NULL; ii++) {
- uri_list = g_slist_prepend (uri_list, cb_data.uris[ii]);
- cb_data.uris[ii] = NULL;
+ uri_list = g_slist_prepend (uri_list, i_cal_attach_new_from_url (cb_data.uris[ii]));
}
e_flag_free (cb_data.flag);
- g_free (cb_data.uris);
+ g_strfreev (cb_data.uris);
- /* XXX Does this take ownership of the list? */
- e_cal_component_set_attachment_list (comp, uri_list);
+ e_cal_component_set_attachments (comp, uri_list);
+ g_slist_free_full (uri_list, g_object_unref);
e_attachment_store_remove_all (store);
g_object_unref (destination);
g_object_unref (store);
@@ -517,11 +516,8 @@ set_priority (ECalComponent *comp,
g_return_if_fail (part != NULL);
prio = camel_medium_get_header (CAMEL_MEDIUM (part), "X-Priority");
- if (prio && atoi (prio) > 0) {
- gint priority = 1;
-
- e_cal_component_set_priority (comp, &priority);
- }
+ if (prio && atoi (prio) > 0)
+ e_cal_component_set_priority (comp, 1);
}
struct _report_error
@@ -560,7 +556,7 @@ struct _manage_comp
{
ECalClient *client;
ECalComponent *comp;
- icalcomponent *stored_comp; /* the one in client already */
+ ICalComponent *stored_comp; /* the one in client already */
GCond cond;
GMutex mutex;
gint mails_count;
@@ -576,8 +572,7 @@ free_manage_comp_struct (struct _manage_comp *mc)
g_object_unref (mc->comp);
g_object_unref (mc->client);
- if (mc->stored_comp)
- icalcomponent_free (mc->stored_comp);
+ g_clear_object (&mc->stored_comp);
g_mutex_clear (&mc->mutex);
g_cond_clear (&mc->cond);
if (mc->editor_title)
@@ -761,14 +756,14 @@ do_manage_comp_idle (struct _manage_comp *mc)
const gchar *ask = get_question_edit_old (source_type);
if (ask) {
- gchar *msg = g_strdup_printf (ask, icalcomponent_get_summary (mc->stored_comp) ?
icalcomponent_get_summary (mc->stored_comp) : _("[No Summary]"));
+ gchar *msg = g_strdup_printf (ask, i_cal_component_get_summary (mc->stored_comp) ?
i_cal_component_get_summary (mc->stored_comp) : _("[No Summary]"));
gint chosen;
chosen = do_ask (msg, TRUE);
if (chosen == GTK_RESPONSE_YES) {
edit_comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (edit_comp, icalcomponent_new_clone
(mc->stored_comp))) {
+ if (!e_cal_component_set_icalcomponent (edit_comp, i_cal_component_new_clone
(mc->stored_comp))) {
g_object_unref (edit_comp);
edit_comp = NULL;
error = g_error_new (
@@ -884,8 +879,8 @@ do_mail_to_event (AsyncData *data)
}
} else {
gint i;
- ECalComponentDateTime dt, dt2;
- struct icaltimetype tt, tt2;
+ ECalComponentDateTime *dt, *dt2;
+ ICalTime *tt, *tt2;
struct _manage_comp *oldmc = NULL;
#define cache_backend_prop(prop) { \
@@ -895,29 +890,27 @@ 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
/* set start day of the event as today, without time - easier than looking for a calendar's
time zone */
- tt = icaltime_today ();
- dt.value = &tt;
- dt.tzid = NULL;
+ tt = i_cal_time_today ();
+ tt2 = i_cal_time_new_clone (tt);
+ i_cal_time_adjust (tt2, 1, 0, 0, 0);
- tt2 = tt;
- icaltime_adjust (&tt2, 1, 0, 0, 0);
- dt2.value = &tt2;
- dt2.tzid = NULL;
+ dt = e_cal_component_datetime_new_take (tt, NULL);
+ dt2 = e_cal_component_datetime_new_take (tt2, NULL);
for (i = 0; i < (uids ? uids->len : 0); i++) {
CamelMimeMessage *message;
ECalComponent *comp;
- ECalComponentText text;
- icalproperty *icalprop;
- icalcomponent *icalcomp;
+ ECalComponentText *text;
+ ICalProperty *prop;
+ ICalComponent *icomp;
struct _manage_comp *mc;
const gchar *message_uid = g_ptr_array_index (uids, i);
@@ -946,28 +939,30 @@ do_mail_to_event (AsyncData *data)
}
e_cal_component_set_uid (comp, camel_mime_message_get_message_id (message));
- e_cal_component_set_dtstart (comp, &dt);
+ e_cal_component_set_dtstart (comp, dt);
if (data->source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS) {
/* make it an all-day event */
- e_cal_component_set_dtend (comp, &dt2);
+ e_cal_component_set_dtend (comp, dt2);
}
/* set the summary */
- text.value = camel_mime_message_get_subject (message);
- text.altrep = NULL;
- e_cal_component_set_summary (comp, &text);
+ text = e_cal_component_text_new (camel_mime_message_get_subject (message), NULL);
+ e_cal_component_set_summary (comp, text);
+ e_cal_component_text_free (text);
/* set all fields */
if (data->selected_text) {
GSList sl;
- text.value = data->selected_text;
- text.altrep = NULL;
+ text = e_cal_component_text_new (data->selected_text, NULL);
+
sl.next = NULL;
- sl.data = &text;
+ sl.data = text;
+
+ e_cal_component_set_descriptions (comp, &sl);
- e_cal_component_set_description_list (comp, &sl);
+ e_cal_component_text_free (text);
} else
set_description (comp, message, data->default_charset, data->forced_charset);
@@ -989,11 +984,11 @@ do_mail_to_event (AsyncData *data)
/* no need to increment a sequence number, this is a new component */
e_cal_component_abort_sequence (comp);
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ icomp = e_cal_component_get_icalcomponent (comp);
- icalprop = icalproperty_new_x ("1");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-MOVE-CALENDAR");
- icalcomponent_add_property (icalcomp, icalprop);
+ prop = i_cal_property_new_x ("1");
+ i_cal_property_set_x_name (prop, "X-EVOLUTION-MOVE-CALENDAR");
+ i_cal_component_take_property (icomp, prop);
mc = g_new0 (struct _manage_comp, 1);
mc->client = g_object_ref (client);
@@ -1022,7 +1017,7 @@ do_mail_to_event (AsyncData *data)
e_cal_client_get_object_sync (
E_CAL_CLIENT (client),
- icalcomponent_get_uid (icalcomp),
+ i_cal_component_get_uid (icomp),
NULL, &mc->stored_comp, NULL, NULL);
/* Prioritize ahead of GTK+ redraws. */
@@ -1044,6 +1039,9 @@ do_mail_to_event (AsyncData *data)
g_mutex_unlock (&oldmc->mutex);
free_manage_comp_struct (oldmc);
}
+
+ e_cal_component_datetime_free (dt);
+ e_cal_component_datetime_free (dt2);
}
/* free memory */
diff --git a/src/plugins/pst-import/pst-importer.c b/src/plugins/pst-import/pst-importer.c
index ed58ec6159..8b029647d4 100644
--- a/src/plugins/pst-import/pst-importer.c
+++ b/src/plugins/pst-import/pst-importer.c
@@ -75,7 +75,7 @@ gchar *foldername_to_utf8 (const gchar *pstname);
gchar *string_to_utf8 (const gchar *string);
void contact_set_date (EContact *contact, EContactField id, FILETIME *date);
static void fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gchar *type);
-struct icaltimetype get_ical_date (FILETIME *date, gboolean is_date);
+ICalTime *get_ical_date (FILETIME *date, gboolean is_date);
gchar *rfc2445_datetime_format (FILETIME *ft);
gboolean org_credativ_evolution_readpst_supported (EPlugin *epl, EImportTarget *target);
@@ -1205,10 +1205,8 @@ pst_process_email (PstImporter *m,
if (item->type == PST_TYPE_SCHEDULE && item->appointment) {
ECalComponent *comp;
- icalcomponent *vcal;
- icalproperty *prop;
- icalvalue *value;
- icalproperty_method method;
+ ICalComponent *vcal;
+ ICalPropertyMethod method;
comp = e_cal_component_new ();
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
@@ -1216,26 +1214,23 @@ pst_process_email (PstImporter *m,
vcal = e_cal_util_new_top_level ();
- method = ICAL_METHOD_PUBLISH;
+ method = I_CAL_METHOD_PUBLISH;
if (item->ascii_type) {
if (g_str_has_prefix (item->ascii_type, "IPM.Schedule.Meeting.Request"))
- method = ICAL_METHOD_REQUEST;
+ method = I_CAL_METHOD_REQUEST;
else if (g_str_has_prefix (item->ascii_type, "IPM.Schedule.Meeting.Canceled"))
- method = ICAL_METHOD_CANCEL;
+ method = I_CAL_METHOD_CANCEL;
else if (g_str_has_prefix (item->ascii_type, "IPM.Schedule.Meeting.Resp."))
- method = ICAL_METHOD_REPLY;
+ method = I_CAL_METHOD_REPLY;
}
- prop = icalproperty_new (ICAL_METHOD_PROPERTY);
- value = icalvalue_new_method (method);
- icalproperty_set_value (prop, value);
- icalcomponent_add_property (vcal, prop);
+ i_cal_component_set_method (vcal, method);
- icalcomponent_add_component (vcal, icalcomponent_new_clone (e_cal_component_get_icalcomponent
(comp)));
+ i_cal_component_take_component (vcal, i_cal_component_new_clone
(e_cal_component_get_icalcomponent (comp)));
- comp_str = icalcomponent_as_ical_string_r (vcal);
+ comp_str = i_cal_component_as_ical_string_r (vcal);
- icalcomponent_free (vcal);
+ g_object_unref (vcal);
g_object_unref (comp);
if (comp_str && !*comp_str) {
@@ -1666,11 +1661,11 @@ pst_process_contact (PstImporter *m,
* @date: time value from libpst
* @is_date: treat as date only (all day event)?
*
- * Convert pst time to icaltimetype
+ * Convert pst time to ICalTime
*
* Returns: converted date
*/
-struct icaltimetype
+ICalTime *
get_ical_date (FILETIME *date,
gboolean is_date)
{
@@ -1678,9 +1673,9 @@ get_ical_date (FILETIME *date,
time_t t;
t = pst_fileTimeToUnixTime (date);
- return icaltime_from_timet_with_zone (t, is_date, NULL);
+ return i_cal_time_from_timet_with_zone (t, is_date, NULL);
} else {
- return icaltime_null_date ();
+ return NULL;
}
}
@@ -1698,7 +1693,7 @@ set_cal_attachments (ECalClient *cal,
return;
}
- e_cal_component_get_uid (ec, &uid);
+ uid = e_cal_component_get_uid (ec);
store_dir = g_filename_from_uri (e_cal_client_get_local_attachment_store (cal), NULL, NULL);
while (attach != NULL) {
@@ -1769,7 +1764,7 @@ set_cal_attachments (ECalClient *cal,
g_object_unref (stream);
uri = g_filename_to_uri (path, NULL, NULL);
- list = g_slist_append (list, g_strdup (uri));
+ list = g_slist_append (list, i_cal_attach_new_from_url (uri));
g_free (uri);
g_object_unref (part);
@@ -1781,7 +1776,8 @@ set_cal_attachments (ECalClient *cal,
g_free (store_dir);
- e_cal_component_set_attachment_list (ec, list);
+ e_cal_component_set_attachments (ec, list);
+ g_slist_free_full (list, g_object_unref);
}
static void
@@ -1792,10 +1788,7 @@ fill_calcomponent (PstImporter *m,
{
pst_item_appointment *a;
pst_item_email *e;
-
- ECalComponentText text;
- struct icaltimetype tt_start, tt_end;
- ECalComponentDateTime dt_start, dt_end;
+ ECalComponentText *text;
a = item->appointment;
e = item->email;
@@ -1803,34 +1796,37 @@ fill_calcomponent (PstImporter *m,
g_return_if_fail (item->appointment != NULL);
if (item->create_date) {
- struct icaltimetype tt;
+ ICalTime *tt;
tt = get_ical_date (item->create_date, FALSE);
- e_cal_component_set_created (ec, &tt);
+ e_cal_component_set_created (ec, tt);
+ g_clear_object (&tt);
}
if (item->modify_date) {
- struct icaltimetype tt;
+ ICalTime *tt;
tt = get_ical_date (item->modify_date, FALSE);
- e_cal_component_set_last_modified (ec, &tt);
+ e_cal_component_set_last_modified (ec, tt);
+ g_clear_object (&tt);
}
if (e) {
if (item->subject.str || e->processed_subject.str) {
+ text = NULL;
if (item->subject.str) {
- text.value = item->subject.str;
+ text = e_cal_component_text_new (item->subject.str, NULL);
} else if (e->processed_subject.str) {
- text.value = e->processed_subject.str;
+ text = e_cal_component_text_new (e->processed_subject.str, NULL);
}
- text.altrep = NULL; /* email->proc_subject? */
- e_cal_component_set_summary (ec, &text);
+ e_cal_component_set_summary (ec, text);
+ e_cal_component_text_free (text);
}
if (item->body.str) {
GSList l;
- text.value = item->body.str;
- text.altrep = NULL;
- l.data = &text;
+ text = e_cal_component_text_new (item->body.str, NULL);
+ l.data = text;
l.next = NULL;
- e_cal_component_set_description_list (ec, &l);
+ e_cal_component_set_descriptions (ec, &l);
+ e_cal_component_text_free (text);
}
} else {
g_warning ("%s without subject / body!", type);
@@ -1841,31 +1837,37 @@ fill_calcomponent (PstImporter *m,
}
if (a->start) {
- tt_start = get_ical_date (a->start, a->all_day);
- dt_start.value = &tt_start;
- dt_start.tzid = a->timezonestring.str;
- e_cal_component_set_dtstart (ec, &dt_start);
+ ECalComponentDateTime *dtstart;
+
+ dtstart = e_cal_component_datetime_new_take (
+ get_ical_date (a->start, a->all_day),
+ g_strdup (a->timezonestring.str));
+ e_cal_component_set_dtstart (ec, dtstart);
+ e_cal_component_datetime_free (dtstart);
}
if (a->end) {
- tt_end = get_ical_date (a->end, a->all_day);
- dt_end.value = &tt_end;
- dt_end.tzid = a->timezonestring.str;
- e_cal_component_set_dtend (ec, &dt_end);
+ ECalComponentDateTime *dtend;
+
+ dtend = e_cal_component_datetime_new_take (
+ get_ical_date (a->end, a->all_day),
+ g_strdup (a->timezonestring.str));
+ e_cal_component_set_dtend (ec, dtend);
+ e_cal_component_datetime_free (dtend);
}
switch (a->showas) {
case PST_FREEBUSY_TENTATIVE:
- e_cal_component_set_status (ec, ICAL_STATUS_TENTATIVE);
+ e_cal_component_set_status (ec, I_CAL_STATUS_TENTATIVE);
break;
case PST_FREEBUSY_FREE:
/* mark as transparent and as confirmed */
e_cal_component_set_transparency (ec, E_CAL_COMPONENT_TRANSP_TRANSPARENT);
- e_cal_component_set_status (ec, ICAL_STATUS_CONFIRMED);
+ e_cal_component_set_status (ec, I_CAL_STATUS_CONFIRMED);
break;
case PST_FREEBUSY_BUSY:
case PST_FREEBUSY_OUT_OF_OFFICE:
- e_cal_component_set_status (ec, ICAL_STATUS_CONFIRMED);
+ e_cal_component_set_status (ec, I_CAL_STATUS_CONFIRMED);
break;
}
switch (a->label) {
@@ -1895,14 +1897,17 @@ fill_calcomponent (PstImporter *m,
if (a->alarm || a->alarm_minutes) {
ECalComponentAlarm *alarm;
- ECalComponentAlarmTrigger trigger;
alarm = e_cal_component_alarm_new ();
if (a->alarm_minutes) {
- trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
- trigger.u.rel_duration = icaldurationtype_from_int (- (a->alarm_minutes) * 60);
- e_cal_component_alarm_set_trigger (alarm, trigger);
+ ECalComponentAlarmTrigger *trigger = NULL;
+ ICalDuration *duration;
+
+ duration = i_cal_duration_from_int (- (a->alarm_minutes) * 60);
+ trigger = e_cal_component_alarm_trigger_new_relative
(E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, duration);
+ e_cal_component_alarm_take_trigger (alarm, trigger);
+ g_object_unref (duration);
}
if (a->alarm) {
@@ -1919,31 +1924,44 @@ fill_calcomponent (PstImporter *m,
}
if (a->recurrence_description.str != PST_APP_RECUR_NONE) {
- struct icalrecurrencetype r;
+ ICalRecurrence *recr;
GSList recur_list;
- icalrecurrencetype_clear (&r);
- r.interval = 1; /* Interval not implemented in libpst */
+ recr = i_cal_recurrence_new ();
+
+ i_cal_recurrence_set_interval (recr, 1); /* Interval not implemented in libpst */
if (a->recurrence_end) {
- r.until = get_ical_date (a->recurrence_end, FALSE);
+ ICalTime *tt;
+
+ tt = get_ical_date (a->recurrence_end, FALSE);
+ if (tt) {
+ i_cal_recurrence_set_until (recr, tt);
+ g_object_unref (tt);
+ }
}
switch (a->recurrence_type) {
case PST_APP_RECUR_DAILY:
- r.freq = ICAL_DAILY_RECURRENCE; break;
+ i_cal_recurrence_set_freq (recr, I_CAL_DAILY_RECURRENCE);
+ break;
case PST_APP_RECUR_WEEKLY:
- r.freq = ICAL_WEEKLY_RECURRENCE; break;
+ i_cal_recurrence_set_freq (recr, I_CAL_WEEKLY_RECURRENCE);
+ break;
case PST_APP_RECUR_MONTHLY:
- r.freq = ICAL_MONTHLY_RECURRENCE; break;
+ i_cal_recurrence_set_freq (recr, I_CAL_MONTHLY_RECURRENCE);
+ break;
case PST_APP_RECUR_YEARLY:
- r.freq = ICAL_YEARLY_RECURRENCE; break;
+ i_cal_recurrence_set_freq (recr, I_CAL_YEARLY_RECURRENCE);
+ break;
default:
- r.freq = ICAL_NO_RECURRENCE;
+ i_cal_recurrence_set_freq (recr, I_CAL_NO_RECURRENCE);
+ break;
}
- recur_list.data = &r;
+ recur_list.data = recr;
recur_list.next = NULL;
- e_cal_component_set_rrule_list (ec, &recur_list);
+ e_cal_component_set_rrules (ec, &recur_list);
+ g_object_unref (recr);
}
if (item->type == PST_TYPE_SCHEDULE && item->email && item->ascii_type) {
@@ -1962,28 +1980,31 @@ fill_calcomponent (PstImporter *m,
}
if (organizer || organizer_addr) {
- ECalComponentOrganizer org = { 0 };
+ ECalComponentOrganizer *org;
- org.value = organizer_addr;
- org.cn = organizer;
+ org = e_cal_component_organizer_new ();
+ e_cal_component_organizer_set_value (org, organizer_addr);
+ e_cal_component_organizer_set_cn (org, organizer);
- e_cal_component_set_organizer (ec, &org);
+ e_cal_component_set_organizer (ec, org);
+ e_cal_component_organizer_free (org);
}
if (attendee || attendee_addr) {
- ECalComponentAttendee att = { 0 };
+ ECalComponentAttendee *att;
GSList *attendees;
- att.value = attendee_addr;
- att.cn = attendee;
- att.cutype = ICAL_CUTYPE_INDIVIDUAL;
- att.status = ICAL_PARTSTAT_NEEDSACTION;
- att.role = ICAL_ROLE_REQPARTICIPANT;
- att.rsvp = TRUE;
-
- attendees = g_slist_append (NULL, &att);
- e_cal_component_set_attendee_list (ec, attendees);
- g_slist_free (attendees);
+ att = e_cal_component_attendee_new ();
+ e_cal_component_attendee_set_value (att, attendee_addr);
+ e_cal_component_attendee_set_cn (att, attendee);
+ e_cal_component_attendee_set_cutype (att, I_CAL_CUTYPE_INDIVIDUAL);
+ e_cal_component_attendee_set_partstat (att, I_CAL_PARTSTAT_NEEDSACTION);
+ e_cal_component_attendee_set_role (att, I_CAL_ROLE_REQPARTICIPANT);
+ e_cal_component_attendee_set_rsvp (att, TRUE);
+
+ attendees = g_slist_append (NULL, att);
+ e_cal_component_set_attendees (ec, attendees);
+ g_slist_free_full (attendees, e_cal_component_attendee_free);
}
}
@@ -2010,7 +2031,7 @@ pst_process_component (PstImporter *m,
e_cal_client_create_object_sync (
cal, e_cal_component_get_icalcomponent (ec),
- NULL, NULL, &error);
+ E_CAL_OPERATION_FLAG_NONE, NULL, NULL, &error);
if (error != NULL) {
g_warning (
diff --git a/src/plugins/publish-calendar/publish-format-fb.c
b/src/plugins/publish-calendar/publish-format-fb.c
index 2640e92cae..3e37bf1a3e 100644
--- a/src/plugins/publish-calendar/publish-format-fb.c
+++ b/src/plugins/publish-calendar/publish-format-fb.c
@@ -42,14 +42,14 @@ write_calendar (const gchar *uid,
ESourceRegistry *registry;
EClient *client = NULL;
GSList *objects = NULL;
- icaltimezone *utc;
+ ICalTimezone *utc;
time_t start = time (NULL), end;
- icalcomponent *top_level;
+ ICalComponent *top_level;
gchar *email = NULL;
GSList *users = NULL;
gboolean success = FALSE;
- utc = icaltimezone_get_utc_timezone ();
+ utc = i_cal_timezone_get_utc_timezone ();
start = time_day_begin_with_zone (start, utc);
switch (dur_type) {
@@ -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);
}
@@ -102,33 +102,33 @@ write_calendar (const gchar *uid,
for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = iter->data;
- icalcomponent *icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent
(comp));
+ ICalComponent *icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent
(comp));
- if (!icalcomp)
+ if (!icomp)
continue;
if (!with_details) {
- icalproperty *prop;
+ ICalProperty *prop;
- for (prop = icalcomponent_get_first_property (icalcomp,
ICAL_FREEBUSY_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp,
I_CAL_FREEBUSY_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (icalcomp,
ICAL_FREEBUSY_PROPERTY)) {
- icalproperty_remove_parameter_by_name (prop, "X-SUMMARY");
- icalproperty_remove_parameter_by_name (prop, "X-LOCATION");
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp,
I_CAL_FREEBUSY_PROPERTY)) {
+ i_cal_property_remove_parameter_by_name (prop, "X-SUMMARY");
+ i_cal_property_remove_parameter_by_name (prop, "X-LOCATION");
}
}
- icalcomponent_add_component (top_level, icalcomp);
+ i_cal_component_take_component (top_level, icomp);
}
- ical_string = icalcomponent_as_ical_string_r (top_level);
+ ical_string = i_cal_component_as_ical_string_r (top_level);
success = g_output_stream_write_all (
stream, ical_string,
strlen (ical_string),
NULL, NULL, error);
- e_cal_client_free_ecalcomp_slist (objects);
+ e_util_free_nullable_object_slist (objects);
g_free (ical_string);
}
@@ -137,7 +137,7 @@ write_calendar (const gchar *uid,
g_free (email);
g_object_unref (client);
- icalcomponent_free (top_level);
+ g_object_unref (top_level);
return success;
}
diff --git a/src/plugins/publish-calendar/publish-format-ical.c
b/src/plugins/publish-calendar/publish-format-ical.c
index ade9e59e8b..72602f264d 100644
--- a/src/plugins/publish-calendar/publish-format-ical.c
+++ b/src/plugins/publish-calendar/publish-format-ical.c
@@ -34,22 +34,22 @@ typedef struct {
} CompTzData;
static void
-insert_tz_comps (icalparameter *param,
+insert_tz_comps (ICalParameter *param,
gpointer cb_data)
{
const gchar *tzid;
CompTzData *tdata = cb_data;
- icaltimezone *zone = NULL;
- icalcomponent *tzcomp;
+ ICalTimezone *zone = NULL;
+ ICalComponent *tzcomp;
GError *error = NULL;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- e_cal_client_get_timezone_sync (
- tdata->client, tzid, &zone, NULL, &error);
+ if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error))
+ zone = NULL;
if (error != NULL) {
g_warning (
@@ -59,16 +59,16 @@ insert_tz_comps (icalparameter *param,
return;
}
- tzcomp = icalcomponent_new_clone (icaltimezone_get_component (zone));
+ tzcomp = i_cal_component_new_clone (i_cal_timezone_get_component (zone));
g_hash_table_insert (tdata->zones, (gpointer) tzid, (gpointer) tzcomp);
}
static void
append_tz_to_comp (gpointer key,
- gpointer value,
- icalcomponent *toplevel)
+ gpointer value,
+ ICalComponent *toplevel)
{
- icalcomponent_add_component (toplevel, (icalcomponent *) value);
+ i_cal_component_take_component (toplevel, (ICalComponent *) value);
}
static gboolean
@@ -81,7 +81,7 @@ write_calendar (const gchar *uid,
ESourceRegistry *registry;
EClient *client = NULL;
GSList *objects = NULL;
- icalcomponent *top_level;
+ ICalComponent *top_level;
gboolean res = FALSE;
shell = e_shell_get_default ();
@@ -119,9 +119,9 @@ write_calendar (const gchar *uid,
tdata.client = E_CAL_CLIENT (client);
for (iter = objects; iter; iter = iter->next) {
- icalcomponent *icalcomp = icalcomponent_new_clone (iter->data);
- icalcomponent_foreach_tzid (icalcomp, insert_tz_comps, &tdata);
- icalcomponent_add_component (top_level, icalcomp);
+ ICalComponent *icomp = i_cal_component_new_clone (iter->data);
+ i_cal_component_foreach_tzid (icomp, insert_tz_comps, &tdata);
+ i_cal_component_take_component (top_level, icomp);
}
g_hash_table_foreach (tdata.zones, (GHFunc) append_tz_to_comp, top_level);
@@ -129,14 +129,14 @@ write_calendar (const gchar *uid,
g_hash_table_destroy (tdata.zones);
tdata.zones = NULL;
- ical_string = icalcomponent_as_ical_string_r (top_level);
+ ical_string = i_cal_component_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);
- icalcomponent_free (top_level);
+ g_object_unref (top_level);
return res;
}
diff --git a/src/plugins/save-calendar/CMakeLists.txt b/src/plugins/save-calendar/CMakeLists.txt
index 6dd30c6e62..da4e6d99d1 100644
--- a/src/plugins/save-calendar/CMakeLists.txt
+++ b/src/plugins/save-calendar/CMakeLists.txt
@@ -1,6 +1,7 @@
add_eplug_file(save-calendar org-gnome-save-calendar.eplug)
set(DEPENDENCIES
+ evolution-calendar
evolution-shell
evolution-util
)
diff --git a/src/plugins/save-calendar/csv-format.c b/src/plugins/save-calendar/csv-format.c
index 9e7d29ca9c..f779ac8231 100644
--- a/src/plugins/save-calendar/csv-format.c
+++ b/src/plugins/save-calendar/csv-format.c
@@ -90,10 +90,10 @@ add_list_to_csv (GString *line,
needquotes = TRUE;
switch (type) {
case ECALCOMPONENTATTENDEE:
- str = ((ECalComponentAttendee *) list->data)->value;
+ str = itip_strip_mailto (e_cal_component_attendee_get_value
(((ECalComponentAttendee *) list->data)));
break;
case ECALCOMPONENTTEXT:
- str = ((ECalComponentText *) list->data)->value;
+ str = e_cal_component_text_get_value (((ECalComponentText *) list->data));
break;
case CONSTCHAR:
default:
@@ -123,7 +123,7 @@ add_list_to_csv (GString *line,
static GString *
add_nummeric_to_csv (GString *line,
- gint *nummeric,
+ gint nummeric,
CsvConfig *config)
{
@@ -132,24 +132,21 @@ add_nummeric_to_csv (GString *line,
* it prepends a 0 if it's < 10 and > -1
*/
- if (nummeric)
- g_string_append_printf (
- line, "%s%d",
- (*nummeric < 10 && *nummeric > -1) ? "0" : "",
- *nummeric);
+ if (nummeric >= 0)
+ g_string_append_printf (line, "%02d", nummeric);
return g_string_append (line, config->delimiter);
}
static GString *
add_time_to_csv (GString *line,
- icaltimetype *time,
+ ICalTime *time,
CsvConfig *config)
{
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
@@ -407,121 +404,108 @@ do_save_calendar_csv (FormatHandler *handler,
ECalComponent *comp = iter->data;
gchar *delimiter_temp = NULL;
const gchar *temp_constchar;
+ gchar *temp_char;
GSList *temp_list;
- ECalComponentDateTime temp_dt;
- struct icaltimetype *temp_time;
- gint *temp_int;
- ECalComponentText temp_comptext;
+ ECalComponentDateTime* temp_dt;
+ ICalTime *temp_time;
+ gint temp_int;
+ ECalComponentText* temp_comptext;
line = g_string_new ("");
/* Getting the stuff */
- e_cal_component_get_uid (comp, &temp_constchar);
+ temp_constchar = e_cal_component_get_uid (comp);
line = add_string_to_csv (line, temp_constchar, config);
- e_cal_component_get_summary (comp, &temp_comptext);
+ temp_comptext = e_cal_component_get_summary (comp);
line = add_string_to_csv (
- line, temp_comptext.value, config);
+ line, temp_comptext ? e_cal_component_text_get_value (temp_comptext) : NULL,
config);
+ e_cal_component_text_free (temp_comptext);
- e_cal_component_get_description_list (comp, &temp_list);
+ temp_list = e_cal_component_get_descriptions (comp);
line = add_list_to_csv (
line, temp_list, config, ECALCOMPONENTTEXT);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- e_cal_component_get_categories_list (comp, &temp_list);
+ temp_list = e_cal_component_get_categories_list (comp);
line = add_list_to_csv (
line, temp_list, config, CONSTCHAR);
- if (temp_list)
- e_cal_component_free_categories_list (temp_list);
+ g_slist_free_full (temp_list, g_free);
- e_cal_component_get_comment_list (comp, &temp_list);
+ temp_list = e_cal_component_get_comments (comp);
line = add_list_to_csv (
line, temp_list, config, ECALCOMPONENTTEXT);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- e_cal_component_get_completed (comp, &temp_time);
+ temp_time = e_cal_component_get_completed (comp);
line = add_time_to_csv (line, temp_time, config);
- if (temp_time)
- e_cal_component_free_icaltimetype (temp_time);
+ g_clear_object (&temp_time);
- e_cal_component_get_created (comp, &temp_time);
+ temp_time = e_cal_component_get_created (comp);
line = add_time_to_csv (line, temp_time, config);
- if (temp_time)
- e_cal_component_free_icaltimetype (temp_time);
+ g_clear_object (&temp_time);
- e_cal_component_get_contact_list (comp, &temp_list);
+ temp_list = e_cal_component_get_contacts (comp);
line = add_list_to_csv (
line, temp_list, config, ECALCOMPONENTTEXT);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- e_cal_component_get_dtstart (comp, &temp_dt);
+ temp_dt = e_cal_component_get_dtstart (comp);
line = add_time_to_csv (
- line, temp_dt.value ?
- temp_dt.value : NULL, config);
- e_cal_component_free_datetime (&temp_dt);
+ line, temp_dt && e_cal_component_datetime_get_value (temp_dt) ?
+ e_cal_component_datetime_get_value (temp_dt) : NULL, config);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_dtend (comp, &temp_dt);
+ temp_dt = e_cal_component_get_dtend (comp);
line = add_time_to_csv (
- line, temp_dt.value ?
- temp_dt.value : NULL, config);
- e_cal_component_free_datetime (&temp_dt);
+ line, temp_dt && e_cal_component_datetime_get_value (temp_dt) ?
+ e_cal_component_datetime_get_value (temp_dt) : NULL, config);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_due (comp, &temp_dt);
+ temp_dt = e_cal_component_get_due (comp);
line = add_time_to_csv (
- line, temp_dt.value ?
- temp_dt.value : NULL, config);
- e_cal_component_free_datetime (&temp_dt);
+ line, temp_dt && e_cal_component_datetime_get_value (temp_dt) ?
+ e_cal_component_datetime_get_value (temp_dt) : NULL, config);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_percent (comp, &temp_int);
+ temp_int = e_cal_component_get_percent_complete (comp);
line = add_nummeric_to_csv (line, temp_int, config);
- e_cal_component_get_priority (comp, &temp_int);
+ temp_int = e_cal_component_get_priority (comp);
line = add_nummeric_to_csv (line, temp_int, config);
- e_cal_component_get_url (comp, &temp_constchar);
- line = add_string_to_csv (line, temp_constchar, config);
+ temp_char = e_cal_component_get_url (comp);
+ line = add_string_to_csv (line, temp_char, config);
+ g_free (temp_char);
if (e_cal_component_has_attendees (comp)) {
- e_cal_component_get_attendee_list (comp, &temp_list);
+ temp_list = e_cal_component_get_attendees (comp);
line = add_list_to_csv (
line, temp_list, config,
ECALCOMPONENTATTENDEE);
- if (temp_list)
- e_cal_component_free_attendee_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_attendee_free);
} else {
line = add_list_to_csv (
line, NULL, config,
ECALCOMPONENTATTENDEE);
}
- e_cal_component_get_location (comp, &temp_constchar);
- line = add_string_to_csv (line, temp_constchar, config);
+ temp_char = e_cal_component_get_location (comp);
+ line = add_string_to_csv (line, temp_char, config);
+ g_free (temp_char);
- e_cal_component_get_last_modified (comp, &temp_time);
+ temp_time = e_cal_component_get_last_modified (comp);
/* Append a newline (record delimiter) */
delimiter_temp = config->delimiter;
config->delimiter = config->newline;
line = add_time_to_csv (line, temp_time, config);
+ g_clear_object (&temp_time);
/* And restore for the next record */
config->delimiter = delimiter_temp;
- /* Important note!
- * The documentation is not requiring this!
- *
- * if (temp_time)
- * e_cal_component_free_icaltimetype (temp_time);
- *
- * Please uncomment and fix documentation if untrue
- * http://www.gnome.org/projects/evolution/
- * developer-doc/libecal/ECalComponent.html
- * #e-cal-component-get-last-modified
- */
g_output_stream_write_all (
stream, line->str, line->len,
NULL, NULL, &error);
@@ -532,7 +516,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/format-handler.h b/src/plugins/save-calendar/format-handler.h
index dd5ec64d1d..61665e41fb 100644
--- a/src/plugins/save-calendar/format-handler.h
+++ b/src/plugins/save-calendar/format-handler.h
@@ -23,6 +23,7 @@
#include <libecal/libecal.h>
#include <e-util/e-util.h>
+#include <calendar/gui/itip-utils.h>
typedef struct _FormatHandler FormatHandler;
diff --git a/src/plugins/save-calendar/ical-format.c b/src/plugins/save-calendar/ical-format.c
index e42ae7f0f7..3f87255d27 100644
--- a/src/plugins/save-calendar/ical-format.c
+++ b/src/plugins/save-calendar/ical-format.c
@@ -47,22 +47,22 @@ typedef struct {
} CompTzData;
static void
-insert_tz_comps (icalparameter *param,
+insert_tz_comps (ICalParameter *param,
gpointer cb_data)
{
const gchar *tzid;
CompTzData *tdata = cb_data;
- icaltimezone *zone = NULL;
- icalcomponent *tzcomp;
+ ICalTimezone *zone = NULL;
+ ICalComponent *tzcomp;
GError *error = NULL;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (g_hash_table_lookup (tdata->zones, tzid))
return;
- e_cal_client_get_timezone_sync (
- tdata->client, tzid, &zone, NULL, &error);
+ if (!e_cal_client_get_timezone_sync (tdata->client, tzid, &zone, NULL, &error))
+ zone = NULL;
if (error != NULL) {
g_warning (
@@ -72,16 +72,16 @@ insert_tz_comps (icalparameter *param,
return;
}
- tzcomp = icalcomponent_new_clone (icaltimezone_get_component (zone));
+ tzcomp = i_cal_component_new_clone (i_cal_timezone_get_component (zone));
g_hash_table_insert (tdata->zones, (gpointer) tzid, (gpointer) tzcomp);
}
static void
append_tz_to_comp (gpointer key,
- gpointer value,
- icalcomponent *toplevel)
+ gpointer value,
+ ICalComponent *toplevel)
{
- icalcomponent_add_component (toplevel, (icalcomponent *) value);
+ i_cal_component_add_component (toplevel, (ICalComponent *) value);
}
static void
@@ -94,7 +94,7 @@ do_save_calendar_ical (FormatHandler *handler,
EClient *source_client;
GError *error = NULL;
GSList *objects = NULL;
- icalcomponent *top_level = NULL;
+ ICalComponent *top_level = NULL;
if (!dest_uri)
return;
@@ -133,10 +133,10 @@ do_save_calendar_ical (FormatHandler *handler,
tdata.client = E_CAL_CLIENT (source_client);
for (iter = objects; iter; iter = iter->next) {
- icalcomponent *icalcomp = icalcomponent_new_clone (iter->data);
+ ICalComponent *icomp = i_cal_component_new_clone (iter->data);
- icalcomponent_foreach_tzid (icalcomp, insert_tz_comps, &tdata);
- icalcomponent_add_component (top_level, icalcomp);
+ i_cal_component_foreach_tzid (icomp, insert_tz_comps, &tdata);
+ i_cal_component_take_component (top_level, icomp);
}
g_hash_table_foreach (tdata.zones, (GHFunc) append_tz_to_comp, top_level);
@@ -148,7 +148,7 @@ do_save_calendar_ical (FormatHandler *handler,
stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))),
dest_uri, &error);
if (stream) {
- gchar *ical_str = icalcomponent_as_ical_string_r (top_level);
+ gchar *ical_str = i_cal_component_as_ical_string_r (top_level);
g_output_stream_write_all (stream, ical_str, strlen (ical_str), NULL, NULL, &error);
g_output_stream_close (stream, NULL, NULL);
@@ -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) {
@@ -169,7 +169,7 @@ do_save_calendar_ical (FormatHandler *handler,
/* terminate */
g_object_unref (source_client);
- icalcomponent_free (top_level);
+ g_object_unref (top_level);
}
FormatHandler *
diff --git a/src/plugins/save-calendar/rdf-format.c b/src/plugins/save-calendar/rdf-format.c
index ee6760ae83..2c7079e12a 100644
--- a/src/plugins/save-calendar/rdf-format.c
+++ b/src/plugins/save-calendar/rdf-format.c
@@ -95,10 +95,10 @@ add_list_to_rdf (xmlNodePtr node,
switch (type) {
case ECALCOMPONENTATTENDEE:
- str = ((ECalComponentAttendee *) list->data)->value;
+ str = itip_strip_mailto (e_cal_component_attendee_get_value
((ECalComponentAttendee *) list->data));
break;
case ECALCOMPONENTTEXT:
- str = ((ECalComponentText *) list->data)->value;
+ str = e_cal_component_text_get_value ((ECalComponentText *) list->data);
break;
case CONSTCHAR:
default:
@@ -116,10 +116,10 @@ add_list_to_rdf (xmlNodePtr node,
static void
add_nummeric_to_rdf (xmlNodePtr node,
const gchar *tag,
- gint *nummeric)
+ gint nummeric)
{
- if (nummeric) {
- gchar *value = g_strdup_printf ("%d", *nummeric);
+ if (nummeric >= 0) {
+ gchar *value = g_strdup_printf ("%d", nummeric);
xmlNodePtr cur_node = xmlNewChild (node, NULL, (guchar *) tag, (guchar *) value);
xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (const guchar
*)"http://www.w3.org/2001/XMLSchema#integer");
g_free (value);
@@ -129,11 +129,11 @@ add_nummeric_to_rdf (xmlNodePtr node,
static void
add_time_to_rdf (xmlNodePtr node,
const gchar *tag,
- icaltimetype *time)
+ ICalTime *time)
{
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;
@@ -254,99 +254,89 @@ do_save_calendar_rdf (FormatHandler *handler,
for (iter = objects; iter; iter = iter->next) {
ECalComponent *comp = iter->data;
const gchar *temp_constchar;
- gchar *tmp_str = NULL;
+ gchar *tmp_str;
GSList *temp_list;
- ECalComponentDateTime temp_dt;
- struct icaltimetype *temp_time;
- gint *temp_int;
- ECalComponentText temp_comptext;
+ ECalComponentDateTime *temp_dt;
+ ICalTime *temp_time;
+ gint temp_int;
+ ECalComponentText *temp_comptext;
xmlNodePtr c_node = xmlNewChild (fnode, NULL, (const guchar *)"component", NULL);
xmlNodePtr node = xmlNewChild (c_node, NULL, (const guchar *)"Vevent", NULL);
/* Getting the stuff */
- e_cal_component_get_uid (comp, &temp_constchar);
+ temp_constchar = e_cal_component_get_uid (comp);
tmp_str = g_strdup_printf ("#%s", temp_constchar);
xmlSetProp (node, (const guchar *)"about", (guchar *) tmp_str);
g_free (tmp_str);
- add_string_to_rdf (node, "uid",temp_constchar);
+ add_string_to_rdf (node, "uid", temp_constchar);
- e_cal_component_get_summary (comp, &temp_comptext);
- add_string_to_rdf (node, "summary", temp_comptext.value);
+ temp_comptext = e_cal_component_get_summary (comp);
+ if (temp_comptext)
+ add_string_to_rdf (node, "summary", e_cal_component_text_get_value
(temp_comptext));
+ e_cal_component_text_free (temp_comptext);
- e_cal_component_get_description_list (comp, &temp_list);
+ temp_list = e_cal_component_get_descriptions (comp);
add_list_to_rdf (node, "description", temp_list, ECALCOMPONENTTEXT);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- e_cal_component_get_categories_list (comp, &temp_list);
+ temp_list = e_cal_component_get_categories_list (comp);
add_list_to_rdf (node, "categories", temp_list, CONSTCHAR);
- if (temp_list)
- e_cal_component_free_categories_list (temp_list);
+ g_slist_free_full (temp_list, g_free);
- e_cal_component_get_comment_list (comp, &temp_list);
+ temp_list = e_cal_component_get_comments (comp);
add_list_to_rdf (node, "comment", temp_list, ECALCOMPONENTTEXT);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
-
- e_cal_component_get_completed (comp, &temp_time);
+ temp_time = e_cal_component_get_completed (comp);
add_time_to_rdf (node, "completed", temp_time);
- if (temp_time)
- e_cal_component_free_icaltimetype (temp_time);
+ g_clear_object (&temp_time);
- e_cal_component_get_created (comp, &temp_time);
+ temp_time = e_cal_component_get_created (comp);
add_time_to_rdf (node, "created", temp_time);
- if (temp_time)
- e_cal_component_free_icaltimetype (temp_time);
+ g_clear_object (&temp_time);
- e_cal_component_get_contact_list (comp, &temp_list);
+ temp_list = e_cal_component_get_contacts (comp);
add_list_to_rdf (node, "contact", temp_list, ECALCOMPONENTTEXT);
- if (temp_list)
- e_cal_component_free_text_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_text_free);
- e_cal_component_get_dtstart (comp, &temp_dt);
- add_time_to_rdf (node, "dtstart", temp_dt.value ? temp_dt.value : NULL);
- e_cal_component_free_datetime (&temp_dt);
+ temp_dt = e_cal_component_get_dtstart (comp);
+ add_time_to_rdf (node, "dtstart", temp_dt && e_cal_component_datetime_get_value
(temp_dt) ?
+ e_cal_component_datetime_get_value (temp_dt) : NULL);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_dtend (comp, &temp_dt);
- add_time_to_rdf (node, "dtend", temp_dt.value ? temp_dt.value : NULL);
- e_cal_component_free_datetime (&temp_dt);
+ temp_dt = e_cal_component_get_dtend (comp);
+ add_time_to_rdf (node, "dtend", temp_dt && e_cal_component_datetime_get_value
(temp_dt) ?
+ e_cal_component_datetime_get_value (temp_dt) : NULL);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_due (comp, &temp_dt);
- add_time_to_rdf (node, "due", temp_dt.value ? temp_dt.value : NULL);
- e_cal_component_free_datetime (&temp_dt);
+ temp_dt = e_cal_component_get_due (comp);
+ add_time_to_rdf (node, "due", temp_dt && e_cal_component_datetime_get_value (temp_dt)
?
+ e_cal_component_datetime_get_value (temp_dt) : NULL);
+ e_cal_component_datetime_free (temp_dt);
- e_cal_component_get_percent (comp, &temp_int);
+ temp_int = e_cal_component_get_percent_complete (comp);
add_nummeric_to_rdf (node, "percentComplete", temp_int);
- e_cal_component_get_priority (comp, &temp_int);
+ temp_int = e_cal_component_get_priority (comp);
add_nummeric_to_rdf (node, "priority", temp_int);
- e_cal_component_get_url (comp, &temp_constchar);
- add_string_to_rdf (node, "URL", temp_constchar);
+ tmp_str = e_cal_component_get_url (comp);
+ add_string_to_rdf (node, "URL", tmp_str);
+ g_free (tmp_str);
if (e_cal_component_has_attendees (comp)) {
- e_cal_component_get_attendee_list (comp, &temp_list);
+ temp_list = e_cal_component_get_attendees (comp);
add_list_to_rdf (node, "attendee", temp_list, ECALCOMPONENTATTENDEE);
- if (temp_list)
- e_cal_component_free_attendee_list (temp_list);
+ g_slist_free_full (temp_list, e_cal_component_attendee_free);
}
- e_cal_component_get_location (comp, &temp_constchar);
- add_string_to_rdf (node, "location", temp_constchar);
+ tmp_str = e_cal_component_get_location (comp);
+ add_string_to_rdf (node, "location", tmp_str);
+ g_free (tmp_str);
- e_cal_component_get_last_modified (comp, &temp_time);
+ temp_time = e_cal_component_get_last_modified (comp);
add_time_to_rdf (node, "lastModified",temp_time);
-
- /* Important note!
- * The documentation is not requiring this!
- *
- * if (temp_time) e_cal_component_free_icaltimetype (temp_time);
- *
- * Please uncomment and fix documentation if untrue
- * http://www.gnome.org/projects/evolution/developer-doc/libecal/ECalComponent.html
- * #e-cal-component-get-last-modified
- */
+ g_clear_object (&temp_time);
}
/* I used a buffer rather than xmlDocDump: I want gio support */
@@ -355,7 +345,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 5eac306c03..68efc672d0 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]