...
 
Commits (4)
......@@ -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
# ******************************
......
......@@ -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
......
......@@ -4449,7 +4449,7 @@ contact_added_cb (EBookClient *book_client,
!error && ce->priv->is_new_contact == FALSE) {
ecs->new_id = g_strdup (id);
e_book_client_remove_contact (
ce->priv->source_client, ce->priv->contact, NULL, contact_removed_cb, ecs);
ce->priv->source_client, ce->priv->contact, E_BOOK_OPERATION_FLAG_NONE, NULL, contact_removed_cb, ecs);
return;
}
......@@ -4556,7 +4556,7 @@ real_save_contact (EContactEditor *ce,
ce->priv->contact, contact_modified_cb, ecs);
else
e_book_client_modify_contact (
ce->priv->target_client, ce->priv->contact, NULL,
ce->priv->target_client, ce->priv->contact, E_BOOK_OPERATION_FLAG_NONE, NULL,
contact_modified_ready_cb, ecs);
}
}
......@@ -5419,12 +5419,12 @@ e_contact_editor_set_property (GObject *object,
e_client_get_backend_property (
E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
E_BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
NULL, supported_fields_cb, editor);
e_client_get_backend_property (
E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
E_BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
NULL, required_fields_cb, editor);
}
......@@ -5466,12 +5466,12 @@ e_contact_editor_set_property (GObject *object,
e_client_get_backend_property (
E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
E_BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
NULL, supported_fields_cb, editor);
e_client_get_backend_property (
E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
E_BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
NULL, required_fields_cb, editor);
if (!editor->priv->is_new_contact)
......
......@@ -152,7 +152,8 @@ addressbook_selector_merge_next_cb (EBookClient *book_client,
/* Remove previous contact from source. */
e_book_client_remove_contact (
merge_context->source_client,
merge_context->current_contact, NULL,
merge_context->current_contact,
E_BOOK_OPERATION_FLAG_NONE, NULL,
addressbook_selector_removed_cb, merge_context);
merge_context->pending_removals++;
}
......
......@@ -1439,7 +1439,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view,
/* Remove the cards all at once. */
e_book_client_remove_contacts (
book_client, ids, NULL, remove_contacts_cb, NULL);
book_client, ids, E_BOOK_OPERATION_FLAG_NONE, NULL, remove_contacts_cb, NULL);
g_slist_free (ids);
} else {
......@@ -1448,7 +1448,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view,
/* Remove the card. */
e_book_client_remove_contact (
book_client, contact, NULL,
book_client, contact, E_BOOK_OPERATION_FLAG_NONE, NULL,
remove_contact_cb, NULL);
}
}
......
......@@ -368,7 +368,7 @@ contact_display_link_clicked (EWebView *web_view,
}
length = strlen ("open-map:");
if (g_str_has_prefix (uri, "open-map:")) {
if (g_ascii_strncasecmp (uri, "open-map:", length)) {
SoupURI *suri;
suri = soup_uri_new (uri);
......
......@@ -243,11 +243,11 @@ doit (EContactMergingLookup *lookup,
{
if (lookup->op == E_CONTACT_MERGING_ADD) {
if (force_modify)
e_book_client_modify_contact (lookup->book_client, lookup->contact, NULL, modify_contact_ready_cb, lookup);
e_book_client_modify_contact (lookup->book_client, lookup->contact, E_BOOK_OPERATION_FLAG_NONE, NULL, modify_contact_ready_cb, lookup);
else
e_book_client_add_contact (lookup->book_client, lookup->contact, NULL, add_contact_ready_cb, lookup);
e_book_client_add_contact (lookup->book_client, lookup->contact, E_BOOK_OPERATION_FLAG_NONE, NULL, add_contact_ready_cb, lookup);
} else if (lookup->op == E_CONTACT_MERGING_COMMIT)
e_book_client_modify_contact (lookup->book_client, lookup->contact, NULL, modify_contact_ready_cb, lookup);
e_book_client_modify_contact (lookup->book_client, lookup->contact, E_BOOK_OPERATION_FLAG_NONE, NULL, modify_contact_ready_cb, lookup);
}
static void
......@@ -339,7 +339,7 @@ remove_contact_ready_cb (GObject *source_object,
}
e_book_client_add_contact (
book_client, lookup->contact, NULL,
book_client, lookup->contact, E_BOOK_OPERATION_FLAG_NONE, NULL,
add_contact_ready_cb, lookup);
}
......@@ -581,7 +581,7 @@ mergeit (EContactMergingLookup *lookup)
lookup->contact = g_object_ref (lookup->match);
e_book_client_remove_contact (
lookup->book_client,
lookup->match, NULL,
lookup->match, E_BOOK_OPERATION_FLAG_NONE, NULL,
remove_contact_ready_cb, lookup);
value = 1;
break;
......
......@@ -448,7 +448,7 @@ do_delete_from_source (gpointer data,
g_return_if_fail (book_client != NULL);
process->count++;
e_book_client_remove_contact_by_uid (book_client, id, NULL, remove_contact_ready_cb, process);
e_book_client_remove_contact_by_uid (book_client, id, E_BOOK_OPERATION_FLAG_NONE, NULL, remove_contact_ready_cb, process);
}
static void
......
......@@ -730,7 +730,7 @@ csv_import_contacts (gpointer d)
gchar *uid = NULL;
e_book_client_add_contact_sync (
gci->book_client, contact, &uid, NULL, NULL);
gci->book_client, contact, E_BOOK_OPERATION_FLAG_NONE, &uid, NULL, NULL);
if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid);
......
......@@ -507,7 +507,7 @@ ldif_import_contacts (gpointer d)
e_book_client_add_contact_sync (
gci->book_client,
contact, &uid, NULL, NULL);
contact, E_BOOK_OPERATION_FLAG_NONE, &uid, NULL, NULL);
if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid);
......@@ -528,7 +528,7 @@ ldif_import_contacts (gpointer d)
contact = iter->data;
resolve_list_card (gci, contact);
e_book_client_add_contact_sync (
gci->book_client, contact, &uid, NULL, NULL);
gci->book_client, contact, E_BOOK_OPERATION_FLAG_NONE, &uid, NULL, NULL);
if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid);
......
......@@ -214,7 +214,7 @@ vcard_import_contact (VCardImporter *gci,
/* FIXME Error checking */
e_book_client_add_contact_sync (
gci->book_client, contact, &uid, NULL, NULL);
gci->book_client, contact, E_BOOK_OPERATION_FLAG_NONE, &uid, NULL, NULL);
if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid);
......
......@@ -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
......
......@@ -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_new_current_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);
......
......@@ -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);
......
This diff is collapsed.
......@@ -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
......@@ -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));
......
......@@ -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,30 @@ 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)) {
if (!e_cal_client_get_timezone_sync (client, e_cal_component_datetime_get_tzid (dt), &zone, NULL, NULL))
zone = 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_time_convert_timezone (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 +209,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 +228,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 +279,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 +328,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 +365,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 +397,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 +422,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 +452,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 +471,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 +490,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 +526,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 +619,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));
......
......@@ -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);
......
......@@ -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.
......
......@@ -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 (icomp1);
as_str2 = i_cal_component_as_ical_string (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;
}