...
 
Commits (4)
...@@ -286,7 +286,7 @@ pkg_check_modules(GNOME_PLATFORM REQUIRED ...@@ -286,7 +286,7 @@ pkg_check_modules(GNOME_PLATFORM REQUIRED
pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
camel-1.2>=${eds_minimum_version} camel-1.2>=${eds_minimum_version}
libebook-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} libedataserver-1.2>=${eds_minimum_version}
libedataserverui-1.2>=${eds_minimum_version} libedataserverui-1.2>=${eds_minimum_version}
libebackend-1.2>=${eds_minimum_version} libebackend-1.2>=${eds_minimum_version}
...@@ -589,49 +589,6 @@ set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND}) ...@@ -589,49 +589,6 @@ set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
pkg_check_modules(LIBUNITY unity>=${libunity_minimum_version}) pkg_check_modules(LIBUNITY unity>=${libunity_minimum_version})
set(HAVE_LIBUNITY ${LIBUNITY_FOUND}) 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 # gspell
# ****************************** # ******************************
......
...@@ -99,18 +99,6 @@ ...@@ -99,18 +99,6 @@
/* Define if you have libunity */ /* Define if you have libunity */
#cmakedefine HAVE_LIBUNITY 1 #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 */ /* When defined GSpell usage is enabled */
#cmakedefine HAVE_GSPELL 1 #cmakedefine HAVE_GSPELL 1
......
...@@ -4449,7 +4449,7 @@ contact_added_cb (EBookClient *book_client, ...@@ -4449,7 +4449,7 @@ contact_added_cb (EBookClient *book_client,
!error && ce->priv->is_new_contact == FALSE) { !error && ce->priv->is_new_contact == FALSE) {
ecs->new_id = g_strdup (id); ecs->new_id = g_strdup (id);
e_book_client_remove_contact ( 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; return;
} }
...@@ -4556,7 +4556,7 @@ real_save_contact (EContactEditor *ce, ...@@ -4556,7 +4556,7 @@ real_save_contact (EContactEditor *ce,
ce->priv->contact, contact_modified_cb, ecs); ce->priv->contact, contact_modified_cb, ecs);
else else
e_book_client_modify_contact ( 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); contact_modified_ready_cb, ecs);
} }
} }
...@@ -5419,12 +5419,12 @@ e_contact_editor_set_property (GObject *object, ...@@ -5419,12 +5419,12 @@ e_contact_editor_set_property (GObject *object,
e_client_get_backend_property ( e_client_get_backend_property (
E_CLIENT (editor->priv->target_client), E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, E_BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
NULL, supported_fields_cb, editor); NULL, supported_fields_cb, editor);
e_client_get_backend_property ( e_client_get_backend_property (
E_CLIENT (editor->priv->target_client), E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, E_BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
NULL, required_fields_cb, editor); NULL, required_fields_cb, editor);
} }
...@@ -5466,12 +5466,12 @@ e_contact_editor_set_property (GObject *object, ...@@ -5466,12 +5466,12 @@ e_contact_editor_set_property (GObject *object,
e_client_get_backend_property ( e_client_get_backend_property (
E_CLIENT (editor->priv->target_client), E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS, E_BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS,
NULL, supported_fields_cb, editor); NULL, supported_fields_cb, editor);
e_client_get_backend_property ( e_client_get_backend_property (
E_CLIENT (editor->priv->target_client), E_CLIENT (editor->priv->target_client),
BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS, E_BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS,
NULL, required_fields_cb, editor); NULL, required_fields_cb, editor);
if (!editor->priv->is_new_contact) if (!editor->priv->is_new_contact)
......
...@@ -152,7 +152,8 @@ addressbook_selector_merge_next_cb (EBookClient *book_client, ...@@ -152,7 +152,8 @@ addressbook_selector_merge_next_cb (EBookClient *book_client,
/* Remove previous contact from source. */ /* Remove previous contact from source. */
e_book_client_remove_contact ( e_book_client_remove_contact (
merge_context->source_client, 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); addressbook_selector_removed_cb, merge_context);
merge_context->pending_removals++; merge_context->pending_removals++;
} }
......
...@@ -1439,7 +1439,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view, ...@@ -1439,7 +1439,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view,
/* Remove the cards all at once. */ /* Remove the cards all at once. */
e_book_client_remove_contacts ( 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); g_slist_free (ids);
} else { } else {
...@@ -1448,7 +1448,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view, ...@@ -1448,7 +1448,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view,
/* Remove the card. */ /* Remove the card. */
e_book_client_remove_contact ( e_book_client_remove_contact (
book_client, contact, NULL, book_client, contact, E_BOOK_OPERATION_FLAG_NONE, NULL,
remove_contact_cb, NULL); remove_contact_cb, NULL);
} }
} }
......
...@@ -368,7 +368,7 @@ contact_display_link_clicked (EWebView *web_view, ...@@ -368,7 +368,7 @@ contact_display_link_clicked (EWebView *web_view,
} }
length = strlen ("open-map:"); length = strlen ("open-map:");
if (g_str_has_prefix (uri, "open-map:")) { if (g_ascii_strncasecmp (uri, "open-map:", length)) {
SoupURI *suri; SoupURI *suri;
suri = soup_uri_new (uri); suri = soup_uri_new (uri);
......
...@@ -243,11 +243,11 @@ doit (EContactMergingLookup *lookup, ...@@ -243,11 +243,11 @@ doit (EContactMergingLookup *lookup,
{ {
if (lookup->op == E_CONTACT_MERGING_ADD) { if (lookup->op == E_CONTACT_MERGING_ADD) {
if (force_modify) 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 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) } 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 static void
...@@ -339,7 +339,7 @@ remove_contact_ready_cb (GObject *source_object, ...@@ -339,7 +339,7 @@ remove_contact_ready_cb (GObject *source_object,
} }
e_book_client_add_contact ( 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); add_contact_ready_cb, lookup);
} }
...@@ -581,7 +581,7 @@ mergeit (EContactMergingLookup *lookup) ...@@ -581,7 +581,7 @@ mergeit (EContactMergingLookup *lookup)
lookup->contact = g_object_ref (lookup->match); lookup->contact = g_object_ref (lookup->match);
e_book_client_remove_contact ( e_book_client_remove_contact (
lookup->book_client, lookup->book_client,
lookup->match, NULL, lookup->match, E_BOOK_OPERATION_FLAG_NONE, NULL,
remove_contact_ready_cb, lookup); remove_contact_ready_cb, lookup);
value = 1; value = 1;
break; break;
......
...@@ -448,7 +448,7 @@ do_delete_from_source (gpointer data, ...@@ -448,7 +448,7 @@ do_delete_from_source (gpointer data,
g_return_if_fail (book_client != NULL); g_return_if_fail (book_client != NULL);
process->count++; 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 static void
......
...@@ -730,7 +730,7 @@ csv_import_contacts (gpointer d) ...@@ -730,7 +730,7 @@ csv_import_contacts (gpointer d)
gchar *uid = NULL; gchar *uid = NULL;
e_book_client_add_contact_sync ( 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) { if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid); e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid); g_free (uid);
......
...@@ -507,7 +507,7 @@ ldif_import_contacts (gpointer d) ...@@ -507,7 +507,7 @@ ldif_import_contacts (gpointer d)
e_book_client_add_contact_sync ( e_book_client_add_contact_sync (
gci->book_client, gci->book_client,
contact, &uid, NULL, NULL); contact, E_BOOK_OPERATION_FLAG_NONE, &uid, NULL, NULL);
if (uid != NULL) { if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid); e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid); g_free (uid);
...@@ -528,7 +528,7 @@ ldif_import_contacts (gpointer d) ...@@ -528,7 +528,7 @@ ldif_import_contacts (gpointer d)
contact = iter->data; contact = iter->data;
resolve_list_card (gci, contact); resolve_list_card (gci, contact);
e_book_client_add_contact_sync ( 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) { if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid); e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid); g_free (uid);
......
...@@ -214,7 +214,7 @@ vcard_import_contact (VCardImporter *gci, ...@@ -214,7 +214,7 @@ vcard_import_contact (VCardImporter *gci,
/* FIXME Error checking */ /* FIXME Error checking */
e_book_client_add_contact_sync ( 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) { if (uid != NULL) {
e_contact_set (contact, E_CONTACT_UID, uid); e_contact_set (contact, E_CONTACT_UID, uid);
g_free (uid); g_free (uid);
......
...@@ -35,8 +35,8 @@ set(SOURCES ...@@ -35,8 +35,8 @@ set(SOURCES
e-cal-dialogs.c e-cal-dialogs.c
e-cal-event.c e-cal-event.c
e-cal-list-view.c e-cal-list-view.c
e-cal-model-calendar.c
e-cal-model.c e-cal-model.c
e-cal-model-calendar.c
e-cal-model-memos.c e-cal-model-memos.c
e-cal-model-tasks.c e-cal-model-tasks.c
e-cal-ops.c e-cal-ops.c
...@@ -55,11 +55,11 @@ set(SOURCES ...@@ -55,11 +55,11 @@ set(SOURCES
e-comp-editor-property-parts.c e-comp-editor-property-parts.c
e-comp-editor-task.c e-comp-editor-task.c
e-date-time-list.c e-date-time-list.c
e-day-view.c
e-day-view-layout.c e-day-view-layout.c
e-day-view-main-item.c e-day-view-main-item.c
e-day-view-time-item.c e-day-view-time-item.c
e-day-view-top-item.c e-day-view-top-item.c
e-day-view.c
e-meeting-attendee.c e-meeting-attendee.c
e-meeting-list-view.c e-meeting-list-view.c
e-meeting-store.c e-meeting-store.c
...@@ -73,11 +73,11 @@ set(SOURCES ...@@ -73,11 +73,11 @@ set(SOURCES
e-send-options-utils.c e-send-options-utils.c
e-task-table.c e-task-table.c
e-to-do-pane.c e-to-do-pane.c
e-week-view.c
e-week-view-event-item.c e-week-view-event-item.c
e-week-view-layout.c e-week-view-layout.c
e-week-view-main-item.c e-week-view-main-item.c
e-week-view-titles-item.c e-week-view-titles-item.c
e-week-view.c
e-weekday-chooser.c e-weekday-chooser.c
e-timezone-entry.c e-timezone-entry.c
itip-utils.c itip-utils.c
......
...@@ -113,17 +113,17 @@ calendar_config_get_timezone (void) ...@@ -113,17 +113,17 @@ calendar_config_get_timezone (void)
return calendar_config_get_timezone_stored (); return calendar_config_get_timezone_stored ();
} }
icaltimezone * ICalTimezone *
calendar_config_get_icaltimezone (void) calendar_config_get_icaltimezone (void)
{ {
gchar *location; gchar *location;
icaltimezone *zone = NULL; ICalTimezone *zone = NULL;
calendar_config_init (); calendar_config_init ();
location = calendar_config_get_timezone (); location = calendar_config_get_timezone ();
if (location) { if (location) {
zone = icaltimezone_get_builtin_timezone (location); zone = i_cal_timezone_get_builtin_timezone (location);
g_free (location); g_free (location);
} }
...@@ -228,30 +228,33 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed) ...@@ -228,30 +228,33 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
sexp = g_strdup ("(is-completed?)"); sexp = g_strdup ("(is-completed?)");
} else { } else {
gchar *isodate; gchar *isodate;
icaltimezone *zone; ICalTimezone *zone;
struct icaltimetype tt; ICalTime *tt;
time_t t; time_t t;
/* Get the current time, and subtract the appropriate /* Get the current time, and subtract the appropriate
* number of days/hours/minutes. */ * number of days/hours/minutes. */
zone = calendar_config_get_icaltimezone (); zone = calendar_config_get_icaltimezone ();
tt = icaltime_current_time_with_zone (zone); tt = i_cal_time_new_current_with_zone (zone);
switch (units) { switch (units) {
case E_DURATION_DAYS: case E_DURATION_DAYS:
icaltime_adjust (&tt, -value, 0, 0, 0); i_cal_time_adjust (tt, -value, 0, 0, 0);
break; break;
case E_DURATION_HOURS: case E_DURATION_HOURS:
icaltime_adjust (&tt, 0, -value, 0, 0); i_cal_time_adjust (tt, 0, -value, 0, 0);
break; break;
case E_DURATION_MINUTES: case E_DURATION_MINUTES:
icaltime_adjust (&tt, 0, 0, -value, 0); i_cal_time_adjust (tt, 0, 0, -value, 0);
break; break;
default: default:
g_clear_object (&tt);
g_return_val_if_reached (NULL); 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 /* Convert the time to an ISO date string, and build
* the query sub-expression. */ * the query sub-expression. */
...@@ -399,14 +402,14 @@ calendar_config_get_day_second_zone (void) ...@@ -399,14 +402,14 @@ calendar_config_get_day_second_zone (void)
void void
calendar_config_select_day_second_zone (GtkWidget *parent) calendar_config_select_day_second_zone (GtkWidget *parent)
{ {
icaltimezone *zone = NULL; ICalTimezone *zone = NULL;
ETimezoneDialog *tzdlg; ETimezoneDialog *tzdlg;
GtkWidget *dialog; GtkWidget *dialog;
gchar *second_location; gchar *second_location;
second_location = calendar_config_get_day_second_zone (); second_location = calendar_config_get_day_second_zone ();
if (second_location && *second_location) 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); g_free (second_location);
if (!zone) if (!zone)
...@@ -424,10 +427,10 @@ calendar_config_select_day_second_zone (GtkWidget *parent) ...@@ -424,10 +427,10 @@ calendar_config_select_day_second_zone (GtkWidget *parent)
const gchar *location = NULL; const gchar *location = NULL;
zone = e_timezone_dialog_get_timezone (tzdlg); zone = e_timezone_dialog_get_timezone (tzdlg);
if (zone == icaltimezone_get_utc_timezone ()) { if (zone == i_cal_timezone_get_utc_timezone ()) {
location = "UTC"; location = "UTC";
} else if (zone) { } else if (zone) {
location = icaltimezone_get_location (zone); location = i_cal_timezone_get_location (zone);
} }
calendar_config_set_day_second_zone (location); calendar_config_set_day_second_zone (location);
......
...@@ -47,7 +47,7 @@ void calendar_config_remove_notification (CalendarConfigChangedFunc func, gpoint ...@@ -47,7 +47,7 @@ void calendar_config_remove_notification (CalendarConfigChangedFunc func, gpoint
*/ */
/* The current timezone, e.g. "Europe/London". */ /* 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). */ /* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean calendar_config_get_24_hour_format (void); gboolean calendar_config_get_24_hour_format (void);
......
This diff is collapsed.
...@@ -32,24 +32,28 @@ ...@@ -32,24 +32,28 @@
struct _EShell; 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 /* 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 * and DTEND, or if the UTC offsets of the start and end times are the same
* as in the given zone. */ * as in the given zone. */
gboolean cal_comp_util_compare_event_timezones (ECalComponent *comp, gboolean cal_comp_util_compare_event_timezones
ECalClient *client, (ECalComponent *comp,
icaltimezone *zone); ECalClient *client,
ICalTimezone *zone);
/* Returns the number of icons owned by the ECalComponent */ /* 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, gboolean cal_comp_is_on_server_sync (ECalComponent *comp,
ECalClient *client, ECalClient *client,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
gboolean cal_comp_is_icalcomp_on_server_sync gboolean cal_comp_is_icalcomp_on_server_sync
(icalcomponent *icalcomp, (ICalComponent *icomp,
ECalClient *client, ECalClient *client,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
...@@ -79,13 +83,23 @@ ECalComponent * cal_comp_memo_new_with_defaults_sync ...@@ -79,13 +83,23 @@ ECalComponent * cal_comp_memo_new_with_defaults_sync
GCancellable *cancellable, GCancellable *cancellable,
GError **error); 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); void cal_comp_selection_set_string_list
GSList *cal_comp_selection_get_string_list (GtkSelectionData *data); (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_dtstart_with_oldzone
void cal_comp_set_dtend_with_oldzone (ECalClient *client, ECalComponent *comp, const ECalComponentDateTime *pdate); (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 gboolean comp_util_sanitize_recurrence_master_sync
(ECalComponent *comp, (ECalComponent *comp,
...@@ -93,43 +107,39 @@ gboolean comp_util_sanitize_recurrence_master_sync ...@@ -93,43 +107,39 @@ gboolean comp_util_sanitize_recurrence_master_sync
GCancellable *cancellable, GCancellable *cancellable,
GError **error); 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, void cal_comp_get_instance_times (ECalClient *client,
icalcomponent *icalcomp, ICalComponent *icomp,
const icaltimezone *default_zone, const ICalTimezone *default_zone,
time_t *instance_start, ICalTime **out_instance_start,
gboolean *start_is_date, ICalTime **out_instance_end,
time_t *instance_end,
gboolean *end_is_date,
GCancellable *cancellable); GCancellable *cancellable);
time_t cal_comp_gdate_to_timet (const GDate *date, 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, ECalClient *dest_client,
icalcomponent *icalcomp_vcal, ICalComponent *icomp_vcal,
gboolean do_copy, gboolean do_copy,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean cal_comp_transfer_item_to_finish (ECalClient *client, gboolean cal_comp_transfer_item_to_finish(ECalClient *client,
GAsyncResult *result, GAsyncResult *result,
GError **error); 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, ECalClient *dest_client,
icalcomponent *icalcomp_event, ICalComponent *icomp_event,
gboolean do_copy, gboolean do_copy,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
void cal_comp_util_update_tzid_parameter void cal_comp_util_update_tzid_parameter
(icalproperty *prop, (ICalProperty *prop,
const struct icaltimetype tt); const ICalTime *tt);
gint cal_comp_util_compare_time_with_today gint cal_comp_util_compare_time_with_today
(const struct icaltimetype time_tt); (const ICalTime *time_tt);
gboolean cal_comp_util_remove_all_properties
(icalcomponent *component,
icalproperty_kind kind);
gboolean cal_comp_util_have_in_new_attendees gboolean cal_comp_util_have_in_new_attendees
(const GSList *new_attendees_mails, (const GSList *new_attendees_mails,
const gchar *eml); const gchar *eml);
...@@ -139,9 +149,9 @@ void cal_comp_util_copy_new_attendees ...@@ -139,9 +149,9 @@ void cal_comp_util_copy_new_attendees
void cal_comp_util_set_added_attendees_mails void cal_comp_util_set_added_attendees_mails
(ECalComponent *comp, (ECalComponent *comp,
GSList *emails); GSList *emails);
const gchar * cal_comp_util_find_parameter_xvalue gchar * cal_comp_util_dup_parameter_xvalue
(icalproperty *prop, (ICalProperty *prop,
const gchar *name); const gchar *name);
gchar * cal_comp_util_get_attendee_comments gchar * cal_comp_util_get_attendee_comments
(icalcomponent *icalcomp); (ICalComponent *icomp);
#endif #endif
...@@ -246,7 +246,7 @@ free_alarm (ECalComponentAlarm *alarm) ...@@ -246,7 +246,7 @@ free_alarm (ECalComponentAlarm *alarm)
static ECalComponentAlarm * static ECalComponentAlarm *
copy_alarm (const ECalComponentAlarm *alarm) copy_alarm (const ECalComponentAlarm *alarm)
{ {
return e_cal_component_alarm_clone ((ECalComponentAlarm *) alarm); return e_cal_component_alarm_copy ((ECalComponentAlarm *) alarm);
} }
void void
...@@ -355,64 +355,63 @@ e_alarm_list_get_path (GtkTreeModel *tree_model, ...@@ -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. */ /* Builds a string for the duration of the alarm. If the duration is zero, returns NULL. */
static gchar * static gchar *
get_alarm_duration_string (struct icaldurationtype *duration) get_alarm_duration_string (ICalDuration *duration)
{ {
GString *string = g_string_new (NULL); GString *string = g_string_new (NULL);
gchar *ret;
gboolean have_something; gboolean have_something;
guint value;
have_something = FALSE; 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" */ /* 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; 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" */ /* 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; 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" */ /* 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; 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" */ /* 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; 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" */ /* 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; have_something = TRUE;
} }
if (have_something) { return g_string_free (string, !have_something);
ret = string->str;
g_string_free (string, FALSE);
return ret;
} else {
g_string_free (string, TRUE);
return NULL;
}
} }
static gchar * static gchar *
get_alarm_string (ECalComponentAlarm *alarm) get_alarm_string (ECalComponentAlarm *alarm)
{ {
ECalComponentAlarmAction action; ECalComponentAlarmAction action;
ECalComponentAlarmTrigger trigger; ECalComponentAlarmTrigger *trigger;
ICalDuration *duration;
const gchar *base; const gchar *base;
gchar *str = NULL, *dur; gchar *str = NULL, *dur;
e_cal_component_alarm_get_action (alarm, &action); action = e_cal_component_alarm_get_action (alarm);
e_cal_component_alarm_get_trigger (alarm, &trigger); trigger = e_cal_component_alarm_get_trigger (alarm);
switch (action) { switch (action) {
case E_CAL_COMPONENT_ALARM_AUDIO: case E_CAL_COMPONENT_ALARM_AUDIO:
...@@ -440,12 +439,13 @@ get_alarm_string (ECalComponentAlarm *alarm) ...@@ -440,12 +439,13 @@ get_alarm_string (ECalComponentAlarm *alarm)
/* FIXME: This does not look like it will localize correctly. */ /* 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: 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 (dur) {
if (trigger.u.rel_duration.is_neg) if (i_cal_duration_is_neg (duration))
str = g_strdup_printf ( str = g_strdup_printf (
/*Translator: The first %s refers to the base, which would be actions like /*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"*/ * "Play a Sound". Second %s refers to the duration string e.g:"15 minutes"*/
...@@ -467,10 +467,11 @@ get_alarm_string (ECalComponentAlarm *alarm) ...@@ -467,10 +467,11 @@ get_alarm_string (ECalComponentAlarm *alarm)
break; break;
case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END: 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 (dur) {
if (trigger.u.rel_duration.is_neg) if (i_cal_duration_is_neg (duration))
str = g_strdup_printf ( str = g_strdup_printf (
/* Translator: The first %s refers to the base, which would be actions like /* 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" */ * "Play a Sound". Second %s refers to the duration string e.g:"15 minutes" */
...@@ -492,19 +493,19 @@ get_alarm_string (ECalComponentAlarm *alarm) ...@@ -492,19 +493,19 @@ get_alarm_string (ECalComponentAlarm *alarm)
break; break;
case E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE: { case E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE: {
struct icaltimetype itt; ICalTime *itt;
icaltimezone *utc_zone, *current_zone; ICalTimezone *utc_zone, *current_zone;
struct tm tm; struct tm tm;
gchar buf[256]; gchar buf[256];
/* Absolute triggers come in UTC, so convert them to the local timezone */ /* 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 (); 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 (), e_time_format_date_and_time (&tm, calendar_config_get_24_hour_format (),
FALSE, FALSE, buf, sizeof (buf)); FALSE, FALSE, buf, sizeof (buf));
......
...@@ -49,12 +49,12 @@ struct _ECalComponentPreviewPrivate { ...@@ -49,12 +49,12 @@ struct _ECalComponentPreviewPrivate {
* if it didn't change then the preview is not updated */ * if it didn't change then the preview is not updated */
gchar *cal_uid; gchar *cal_uid;
gchar *comp_uid; gchar *comp_uid;
struct icaltimetype comp_last_modified; ICalTime *comp_last_modified;
gint comp_sequence; gint comp_sequence;
ECalClient *client; ECalClient *client;
ECalComponent *comp; ECalComponent *comp;
icaltimezone *timezone; ICalTimezone *timezone;
gboolean use_24_hour_format; gboolean use_24_hour_format;
}; };
...@@ -79,25 +79,22 @@ clear_comp_info (ECalComponentPreview *preview) ...@@ -79,25 +79,22 @@ clear_comp_info (ECalComponentPreview *preview)
priv->cal_uid = NULL; priv->cal_uid = NULL;
g_free (priv->comp_uid); g_free (priv->comp_uid);
priv->comp_uid = NULL; priv->comp_uid = NULL;
priv->comp_last_modified = icaltime_null_time ();
priv->comp_sequence = -1; priv->comp_sequence = -1;
g_clear_object (&priv->comp_last_modified);
g_clear_object (&priv->client); g_clear_object (&priv->client);
g_clear_object (&priv->comp); g_clear_object (&priv->comp);
if (priv->timezone) { g_clear_object (&priv->timezone);
icaltimezone_free (priv->timezone, 1);
priv->timezone = NULL;
}
} }
/* Stores information about actually shown component and /* Stores information about actually shown component and
* returns whether component in the preview changed */ * returns whether component in the preview changed */
static gboolean static gboolean
update_comp_info (ECalComponentPreview *preview, update_comp_info (ECalComponentPreview *preview,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
icaltimezone *zone, ICalTimezone *zone,
gboolean use_24_hour_format) gboolean use_24_hour_format)
{ {
ECalComponentPreviewPrivate *priv; ECalComponentPreviewPrivate *priv;
gboolean changed; gboolean changed;
...@@ -115,32 +112,27 @@ update_comp_info (ECalComponentPreview *preview, ...@@ -115,32 +112,27 @@ update_comp_info (ECalComponentPreview *preview,
const gchar *uid; const gchar *uid;
gchar *cal_uid; gchar *cal_uid;
gchar *comp_uid; gchar *comp_uid;
struct icaltimetype comp_last_modified, *itm = NULL; ICalTime *comp_last_modified;
gint *sequence = NULL;
gint comp_sequence; gint comp_sequence;
source = e_client_get_source (E_CLIENT (client)); source = e_client_get_source (E_CLIENT (client));
cal_uid = g_strdup (e_source_get_uid (source)); 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); comp_uid = g_strdup (uid);
e_cal_component_get_last_modified (comp, &itm); comp_last_modified = e_cal_component_get_last_modified (comp);
if (itm) { comp_sequence = e_cal_component_get_sequence (comp);
comp_last_modified = *itm; if (comp_sequence < 0)
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_sequence = 0; comp_sequence = 0;
changed = !priv->cal_uid || !priv->comp_uid || !cal_uid || !comp_uid || changed = !priv->cal_uid || !priv->comp_uid || !cal_uid || !comp_uid ||
!g_str_equal (priv->cal_uid, cal_uid) || !g_str_equal (priv->cal_uid, cal_uid) ||
!g_str_equal (priv->comp_uid, comp_uid) || !g_str_equal (priv->comp_uid, comp_uid) ||
priv->comp_sequence != comp_sequence || priv->comp_sequence != comp_sequence;
icaltime_compare (priv->comp_last_modified, comp_last_modified) != 0;
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); clear_comp_info (preview);
...@@ -151,7 +143,7 @@ update_comp_info (ECalComponentPreview *preview, ...@@ -151,7 +143,7 @@ update_comp_info (ECalComponentPreview *preview,
priv->comp = g_object_ref (comp); priv->comp = g_object_ref (comp);
priv->client = g_object_ref (client); 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; priv->use_24_hour_format = use_24_hour_format;
} }
...@@ -161,26 +153,30 @@ update_comp_info (ECalComponentPreview *preview, ...@@ -161,26 +153,30 @@ update_comp_info (ECalComponentPreview *preview,
/* Converts a time_t to a string, relative to the specified timezone */ /* Converts a time_t to a string, relative to the specified timezone */
static gchar * static gchar *
timet_to_str_with_zone (ECalComponentDateTime *dt, timet_to_str_with_zone (ECalComponentDateTime *dt,
ECalClient *client, ECalClient *client,
icaltimezone *default_zone) ICalTimezone *default_zone)
{ {
struct icaltimetype itt; ICalTime *itt;
icaltimezone *zone = NULL; ICalTimezone *zone = NULL;
struct tm tm; struct tm tm;
if (dt->tzid != NULL) { if (!dt)
e_cal_client_get_timezone_sync ( return NULL;
client, dt->tzid, &zone, NULL, NULL);
} else if (icaltime_is_utc (*dt->value)) { itt = e_cal_component_datetime_get_value (dt);
zone = icaltimezone_get_utc_timezone ();
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) if (zone != NULL)
icaltimezone_convert_time (&itt, zone, default_zone); i_cal_time_convert_timezone (itt, zone, default_zone);
tm = icaltimetype_to_tm (&itt); 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 static void
...@@ -213,17 +209,18 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -213,17 +209,18 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
{ {
ECalClient *client; ECalClient *client;
ECalComponent *comp; ECalComponent *comp;
icaltimezone *default_zone; ICalTimezone *default_zone;
ECalComponentText text; ECalComponentText *text;
ECalComponentDateTime dt; ECalComponentDateTime *dt;
gchar *str; gchar *str;
GString *string; GString *string;
GSList *list, *iter; GSList *list, *iter;
icalcomponent *icalcomp; ICalComponent *icomp;
icalproperty *icalprop; ICalProperty *prop;
icalproperty_status status; ICalPropertyStatus status;
const gchar *location, *url, *tmp; const gchar *tmp;
gint *priority_value; gchar *location, *url;
gint priority;
gchar *markup; gchar *markup;
client = preview->priv->client; client = preview->priv->client;
...@@ -231,23 +228,24 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -231,23 +228,24 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
default_zone = preview->priv->timezone; default_zone = preview->priv->timezone;
/* write document header */ /* 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, HTML_HEADER);
g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color\">"); 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); markup = g_markup_escape_text (text && e_cal_component_text_get_value (text) ? e_cal_component_text_get_value (text) : _("Untitled"), -1);
if (text.value) if (text && e_cal_component_text_get_value (text))
g_string_append_printf (buffer, "<h2>%s</h2>", markup); g_string_append_printf (buffer, "<h2>%s</h2>", markup);
else else
g_string_append_printf (buffer, "<h2><i>%s</i></h2>", markup); g_string_append_printf (buffer, "<h2><i>%s</i></h2>", markup);
e_cal_component_text_free (text);
g_free (markup); g_free (markup);
g_string_append (buffer, "<table border=\"0\" cellspacing=\"5\">"); g_string_append (buffer, "<table border=\"0\" cellspacing=\"5\">");
/* write icons for the categories */ /* write icons for the categories */
string = g_string_new (NULL); string = g_string_new (NULL);
e_cal_component_get_categories_list (comp, &list); list = e_cal_component_get_categories_list (comp);
if (list != NULL) { if (list != NULL) {
markup = g_markup_escape_text (_("Categories:"), -1); markup = g_markup_escape_text (_("Categories:"), -1);
g_string_append_printf (buffer, "<tr><th>%s</th><td>", markup); g_string_append_printf (buffer, "<tr><th>%s</th><td>", markup);
...@@ -281,43 +279,47 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -281,43 +279,47 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append_printf (buffer, "%s", string->str); g_string_append_printf (buffer, "%s", string->str);
if (list != NULL) if (list != NULL)
g_string_append (buffer, "</td></tr>"); 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); g_string_free (string, TRUE);
/* write location */ /* 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); cal_component_preview_add_table_line (buffer, _("Location:"), location);
g_free (location);
/* write start date */ /* write start date */
e_cal_component_get_dtstart (comp, &dt); dt = e_cal_component_get_dtstart (comp);
if (dt.value != NULL) { if (dt && e_cal_component_datetime_get_value (dt)) {
str = timet_to_str_with_zone (&dt, client, default_zone); str = timet_to_str_with_zone (dt, client, default_zone);
cal_component_preview_add_table_line (buffer, _("Start Date:"), str); cal_component_preview_add_table_line (buffer, _("Start Date:"), str);
g_free (str); g_free (str);
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
/* write end date */ /* write end date */
e_cal_component_get_dtend (comp, &dt); dt = e_cal_component_get_dtend (comp);
if (dt.value != NULL) { if (dt && e_cal_component_datetime_get_value (dt)) {
str = timet_to_str_with_zone (&dt, client, default_zone); str = timet_to_str_with_zone (dt, client, default_zone);
cal_component_preview_add_table_line (buffer, _("End Date:"), str); cal_component_preview_add_table_line (buffer, _("End Date:"), str);
g_free (str); g_free (str);
} }
e_cal_component_free_datetime (&dt); e_cal_component_datetime_free (dt);
/* write Due Date */ /* write Due Date */
e_cal_component_get_due (comp, &dt); dt = e_cal_component_get_due (comp);
if (dt.value != NULL) { if (dt && e_cal_component_datetime_get_value (dt)) {
str = timet_to_str_with_zone (&dt, client, default_zone); str = timet_to_str_with_zone (dt, client, default_zone);
cal_component_preview_add_table_line (buffer, _("Due Date:"), str); cal_component_preview_add_table_line (buffer, _("Due Date:"), str);
g_free (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))) { if (e_cal_util_component_has_recurrences (icomp)) {
str = e_cal_recur_describe_recurrence (e_cal_component_get_icalcomponent (comp), str = e_cal_recur_describe_recurrence (icomp,
calendar_config_get_week_start_day (), E_CAL_RECUR_DESCRIBE_RECURRENCE_FLAG_NONE); calendar_config_get_week_start_day (),
E_CAL_RECUR_DESCRIBE_RECURRENCE_FLAG_NONE);
if (str) { if (str) {
cal_component_preview_add_table_line (buffer, _("Recurs:"), str); cal_component_preview_add_table_line (buffer, _("Recurs:"), str);
...@@ -326,36 +328,36 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -326,36 +328,36 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
} }
/* write status */ /* write status */
icalcomp = e_cal_component_get_icalcomponent (comp); prop = i_cal_component_get_first_property (icomp, I_CAL_STATUS_PROPERTY);
icalprop = icalcomponent_get_first_property ( if (prop) {
icalcomp, ICAL_STATUS_PROPERTY); status = e_cal_component_get_status (comp);
if (icalprop != NULL) {
e_cal_component_get_status (comp, &status);
switch (status) { switch (status) {
case ICAL_STATUS_INPROCESS : case I_CAL_STATUS_INPROCESS :
tmp = _("In Progress"); tmp = _("In Progress");
break; break;
case ICAL_STATUS_COMPLETED : case I_CAL_STATUS_COMPLETED :
tmp = _("Completed"); tmp = _("Completed");
break; break;
case ICAL_STATUS_CANCELLED : case I_CAL_STATUS_CANCELLED :
tmp = _("Cancelled"); tmp = _("Cancelled");
break; break;
case ICAL_STATUS_NONE : case I_CAL_STATUS_NONE :
default : default :
tmp = _("Not Started"); tmp = _("Not Started");
break; break;
} }
cal_component_preview_add_table_line (buffer, _("Status:"), tmp); cal_component_preview_add_table_line (buffer, _("Status:"), tmp);
g_object_unref (prop);
} }
/* write priority */ /* write priority */
e_cal_component_get_priority (comp, &priority_value); priority = e_cal_component_get_priority (comp);
if (priority_value && *priority_value != 0) { if (priority > 0) {
if (*priority_value <= 4) if (priority <= 4)
tmp = _("High"); tmp = _("High");
else if (*priority_value == 5) else if (priority == 5)
tmp = _("Normal"); tmp = _("Normal");
else else
tmp = _("Low"); tmp = _("Low");
...@@ -363,25 +365,22 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -363,25 +365,22 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
cal_component_preview_add_table_line (buffer, _("Priority:"), tmp); 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)) { 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) { if (organizer && e_cal_component_organizer_get_value (organizer) && e_cal_component_organizer_get_value (organizer)[0]) {
const gchar *email = itip_strip_mailto (organizer.value); const gchar *email = itip_strip_mailto (e_cal_component_organizer_get_value (organizer));
if (!email) if (!email)
email = ""; email = "";
markup = g_markup_escape_text (_("Organizer:"), -1); markup = g_markup_escape_text (_("Organizer:"), -1);
g_string_append_printf (buffer, "<tr><th>%s</th>", markup); g_string_append_printf (buffer, "<tr><th>%s</th>", markup);
g_free (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; 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, html = camel_text_to_html (str,
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
...@@ -398,19 +397,21 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -398,19 +397,21 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (str); g_free (str);
} }
} }
e_cal_component_organizer_free (organizer);
} }
if (e_cal_component_has_attendees (comp)) { if (e_cal_component_has_attendees (comp)) {
GSList *attendees = NULL, *a; GSList *attendees = NULL, *a;
gboolean have = FALSE; 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) { for (a = attendees; a; a = a->next) {
ECalComponentAttendee *attnd = a->data; ECalComponentAttendee *attnd = a->data;
const gchar *email; 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; continue;
if (!have) { if (!have) {
...@@ -421,14 +422,14 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -421,14 +422,14 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append (buffer, "<br>"); g_string_append (buffer, "<br>");
} }
email = itip_strip_mailto (attnd->value); email = itip_strip_mailto (e_cal_component_attendee_get_value (attnd));
if (!email) if (!email)
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; 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, html = camel_text_to_html (str,
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
...@@ -451,13 +452,13 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -451,13 +452,13 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
if (have) if (have)
g_string_append (buffer, "</td></tr>"); 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 */ /* write description and URL */
g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>"); 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) { if (list) {
GSList *node; GSList *node;
...@@ -470,9 +471,12 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -470,9 +471,12 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
for (node = list; node != NULL; node = node->next) { for (node = list; node != NULL; node = node->next) {
gchar *html; gchar *html;
text = * (ECalComponentText *) node->data; text = node->data;
if (!text || !e_cal_component_text_get_value (text))
continue;
html = camel_text_to_html ( 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_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
...@@ -486,11 +490,11 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -486,11 +490,11 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_string_append (buffer, "</td></tr>"); g_string_append (buffer, "</td></tr>");
e_cal_component_free_text_list (list); g_slist_free_full (list, e_cal_component_text_free);
} }
/* URL */ /* URL */
e_cal_component_get_url (comp, &url); url = e_cal_component_get_url (comp);
if (url) { if (url) {
gchar *scheme, *header_markup; gchar *scheme, *header_markup;
const gchar *href = url; const gchar *href = url;
...@@ -522,6 +526,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview, ...@@ -522,6 +526,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
g_free (header_markup); g_free (header_markup);
g_free (markup); g_free (markup);
g_free (str); g_free (str);
g_free (url);
} }
g_string_append (buffer, "</table>"); g_string_append (buffer, "</table>");
...@@ -614,7 +619,7 @@ void ...@@ -614,7 +619,7 @@ void
e_cal_component_preview_display (ECalComponentPreview *preview, e_cal_component_preview_display (ECalComponentPreview *preview,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
icaltimezone *zone, ICalTimezone *zone,
gboolean use_24_hour_format) gboolean use_24_hour_format)
{ {
g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview)); g_return_if_fail (E_IS_CAL_COMPONENT_PREVIEW (preview));
......
...@@ -71,7 +71,7 @@ GtkWidget * e_cal_component_preview_new (void); ...@@ -71,7 +71,7 @@ GtkWidget * e_cal_component_preview_new (void);
void e_cal_component_preview_display (ECalComponentPreview *preview, void e_cal_component_preview_display (ECalComponentPreview *preview,
ECalClient *client, ECalClient *client,
ECalComponent *comp, ECalComponent *comp,
icaltimezone *zone, ICalTimezone *zone,
gboolean use_24_hour_format); gboolean use_24_hour_format);
void e_cal_component_preview_clear (ECalComponentPreview *preview); void e_cal_component_preview_clear (ECalComponentPreview *preview);
......
...@@ -31,7 +31,7 @@ e_cal_data_model_subscriber_default_init (ECalDataModelSubscriberInterface *ifac ...@@ -31,7 +31,7 @@ e_cal_data_model_subscriber_default_init (ECalDataModelSubscriberInterface *ifac
* e_cal_data_model_subscriber_component_added: * e_cal_data_model_subscriber_component_added:
* @subscriber: an #ECalDataModelSubscriber * @subscriber: an #ECalDataModelSubscriber
* @client: an #ECalClient, which notifies about the component addition * @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 * Notifies the @subscriber about an added component which belongs
* to the time range used by the @subscriber. * to the time range used by the @subscriber.
......
...@@ -40,7 +40,7 @@ struct _ECalDataModelPrivate { ...@@ -40,7 +40,7 @@ struct _ECalDataModelPrivate {
gboolean skip_cancelled; gboolean skip_cancelled;
gchar *filter; gchar *filter;
gchar *full_filter; /* to be used with views */ gchar *full_filter; /* to be used with views */
icaltimezone *zone; ICalTimezone *zone;
time_t range_start; time_t range_start;
time_t range_end; time_t range_end;
...@@ -91,7 +91,7 @@ typedef struct _ViewData { ...@@ -91,7 +91,7 @@ typedef struct _ViewData {
GHashTable *components; /* ECalComponentId ~> ComponentData */ GHashTable *components; /* ECalComponentId ~> ComponentData */
GHashTable *lost_components; /* ECalComponentId ~> ComponentData; when re-running view, valid till 'complete' is received */ GHashTable *lost_components; /* ECalComponentId ~> ComponentData; when re-running view, valid till 'complete' is received */
gboolean received_complete; gboolean received_complete;
GSList *to_expand_recurrences; /* icalcomponent */ GSList *to_expand_recurrences; /* ICalComponent */
GSList *expanded_recurrences; /* ComponentData */ GSList *expanded_recurrences; /* ComponentData */
gint pending_expand_recurrences; /* how many is waiting to be processed */ gint pending_expand_recurrences; /* how many is waiting to be processed */
...@@ -138,8 +138,8 @@ static gboolean ...@@ -138,8 +138,8 @@ static gboolean
component_data_equal (ComponentData *comp_data1, component_data_equal (ComponentData *comp_data1,
ComponentData *comp_data2) ComponentData *comp_data2)
{ {
icalcomponent *icomp1, *icomp2; ICalComponent *icomp1, *icomp2;
struct icaltimetype tt1, tt2; ICalTime *tt1, *tt2;
gchar *as_str1, *as_str2; gchar *as_str1, *as_str2;
gboolean equal; gboolean equal;
...@@ -157,28 +157,40 @@ component_data_equal (ComponentData *comp_data1, ...@@ -157,28 +157,40 @@ component_data_equal (ComponentData *comp_data1,
icomp2 = e_cal_component_get_icalcomponent (comp_data2->component); icomp2 = e_cal_component_get_icalcomponent (comp_data2->component);
if (!icomp1 || !icomp2 || if (!icomp1 || !icomp2 ||
icalcomponent_get_sequence (icomp1) != icalcomponent_get_sequence (icomp2) || i_cal_component_get_sequence (icomp1) != i_cal_component_get_sequence (icomp2)