diff options
author | Dan Winship <danw@src.gnome.org> | 2003-02-06 02:12:34 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-02-06 02:12:34 +0800 |
commit | 05020b82c39a859834995723d5726e026b82de75 (patch) | |
tree | 94c86a378b27e5b3da840e4d961b827785fdb58c /calendar/pcs/cal-backend-file.c | |
parent | a066cf216e1768a2a709613fea72b369f33fd41d (diff) | |
download | gsoc2013-evolution-05020b82c39a859834995723d5726e026b82de75.tar.gz gsoc2013-evolution-05020b82c39a859834995723d5726e026b82de75.tar.zst gsoc2013-evolution-05020b82c39a859834995723d5726e026b82de75.zip |
array of localized month day names ("1st" - "31st")
* cal-util/cal-recur.c (cal_recur_nth): array of localized month
day names ("1st" - "31st")
* gui/dialogs/recurrence-page.c (make_recur_month_num_submenu,
make_recur_month_num_menu, month_num_menu_selection_done_cb): Use
the new cal_recur_nth[] array. The way this was done before didn't
localize properly.
* gui/alarm-notify/notify-main.c (main):
s/glade_gnome_init/glade_init/
From evolution-1-2-branch:
* gui/e-itip-control.c (write_recurrence_piece): Describe
recurrences, if we can. #30993
(set_date_label): If the meeting has recurrences, call
write_recurrence_piece after writing the start and end dates.
(write_label_piece): Wrap the timezone in <font size=-1> to
de-emphasize it a bit and try to keep the timestamp on a single
line even with big Outlook timezone names. Add an option to show
just the date, for describing the end of recurrences (since the
time in the UNTIL is the *beginning* of the last instance, which
would confuse people).
(update_item): Set the VCALENDAR's METHOD.
(ok_clicked_cb): Use update_item, not remove_item, to process a
cancelation. Part of #33875.
* pcs/cal-backend-file.c (cal_backend_file_cancel_object): New,
handle an ICAL_METHOD_CANCEL update.
(cal_backend_file_update_objects): Call
cal_backend_file_update_object or cal_backend_file_cancel_object
as appropriate.
svn path=/trunk/; revision=19763
Diffstat (limited to 'calendar/pcs/cal-backend-file.c')
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index f73ab66874..dc253c0001 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -1529,7 +1529,31 @@ cal_backend_file_update_object (CalBackendFile *cbfile, return comp_uid; } +static const char* +cal_backend_file_cancel_object (CalBackendFile *cbfile, + icalcomponent *icalcomp) +{ + CalComponent *old_comp; + icalproperty *uid; + const char *comp_uid; + + /* Get the UID, and check it isn't empty. */ + uid = icalcomponent_get_first_property (icalcomp, ICAL_UID_PROPERTY); + if (!uid) + return NULL; + comp_uid = icalproperty_get_uid (uid); + if (!comp_uid || !comp_uid[0]) + return NULL; + + /* Find the old version of the component. */ + old_comp = lookup_component (cbfile, comp_uid); + if (!old_comp) + return NULL; + /* And remove it */ + remove_component (cbfile, old_comp); + return comp_uid; +} /* Update_objects handler for the file backend. */ static CalBackendResult @@ -1539,9 +1563,10 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj) CalBackendFilePrivate *priv; icalcomponent *toplevel_comp, *icalcomp = NULL; icalcomponent_kind kind; + icalproperty_method method; icalcomponent *subcomp; CalBackendResult retval = CAL_BACKEND_RESULT_SUCCESS; - GList *comp_uid_list = NULL, *elem; + GList *updated_uids = NULL, *removed_uids = NULL, *elem; cbfile = CAL_BACKEND_FILE (backend); priv = cbfile->priv; @@ -1573,6 +1598,8 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj) return CAL_BACKEND_RESULT_INVALID_OBJECT; } + method = icalcomponent_get_method (toplevel_comp); + /* Step throught the VEVENT/VTODOs being added, create CalComponents for them, and add them to our cache. */ subcomp = icalcomponent_get_first_component (toplevel_comp, @@ -1586,18 +1613,20 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj) || child_kind == ICAL_VJOURNAL_COMPONENT) { const char *comp_uid; - comp_uid = cal_backend_file_update_object (cbfile, - subcomp); - if (comp_uid) { - /* We add a copy of the UID to a list, so we - can emit notification signals later. We do - a g_strdup() in case any of the components - get removed while we are emitting - notification signals. */ - comp_uid_list = g_list_prepend (comp_uid_list, - g_strdup (comp_uid)); + if (method == ICAL_METHOD_CANCEL) { + comp_uid = cal_backend_file_cancel_object (cbfile, subcomp); + if (comp_uid) { + removed_uids = g_list_prepend (removed_uids, + g_strdup (comp_uid)); + } else + retval = CAL_BACKEND_RESULT_NOT_FOUND; } else { - retval = CAL_BACKEND_RESULT_INVALID_OBJECT; + comp_uid = cal_backend_file_update_object (cbfile, subcomp); + if (comp_uid) { + updated_uids = g_list_prepend (updated_uids, + g_strdup (comp_uid)); + } else + retval = CAL_BACKEND_RESULT_INVALID_OBJECT; } } subcomp = icalcomponent_get_next_component (toplevel_comp, @@ -1613,12 +1642,19 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj) /* Now emit notification signals for all of the added components. We do this after adding them all to make sure the calendar is in a stable state before emitting signals. */ - for (elem = comp_uid_list; elem; elem = elem->next) { + for (elem = updated_uids; elem; elem = elem->next) { char *comp_uid = elem->data; cal_backend_notify_update (backend, comp_uid); g_free (comp_uid); } - g_list_free (comp_uid_list); + g_list_free (updated_uids); + + for (elem = removed_uids; elem; elem = elem->next) { + char *comp_uid = elem->data; + cal_backend_notify_remove (backend, comp_uid); + g_free (comp_uid); + } + g_list_free (removed_uids); return retval; } |