Commit 47de7921 authored by Milan Crha's avatar Milan Crha

Port to libecal-2.0 and adapt to libebook API changes

Related to GNOME/evolution-data-server#33
parent 2dd75ea3
......@@ -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
......
......@@ -46,6 +46,10 @@
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-34" role="3.34">
<title>Index of new symbols in 3.34</title>
<xi:include href="xml/api-index-3.34.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-30" role="3.30">
<title>Index of new symbols in 3.30</title>
<xi:include href="xml/api-index-3.30.xml"><xi:fallback /></xi:include>
......
......@@ -41,6 +41,10 @@
<title>Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-34" role="3.34">
<title>Index of new symbols in 3.34</title>
<xi:include href="xml/api-index-3.34.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-32" role="3.32">
<title>Index of new symbols in 3.32</title>
<xi:include href="xml/api-index-3.32.xml"><xi:fallback /></xi:include>
......
......@@ -324,6 +324,10 @@
<title>Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-34" role="3.34">
<title>Index of new symbols in 3.34</title>
<xi:include href="xml/api-index-3.34.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-32" role="3.32">
<title>Index of new symbols in 3.32</title>
<xi:include href="xml/api-index-3.32.xml"><xi:fallback /></xi:include>
......
......@@ -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);
}
}
......
......@@ -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 (