From 3662d9bca108622527746d8e9ce1117d584cab00 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 15 Mar 2004 11:29:30 +0000 Subject: Fixes #35577 2004-03-15 Rodrigo Moya Fixes #35577 * gui/e-cal-view.c (e_calendar_view_delete_selected_occurrence): if the component is an instance, pass the recurrence ID to e_cal_remove_object_with_mod. Also, make the user confirm the deletion, and send the cancellation message for meetings. svn path=/trunk/; revision=25066 --- calendar/gui/e-cal-view.c | 28 ++++++++++++++++++++++------ calendar/gui/e-calendar-view.c | 28 ++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index b02b51e6ff..bb33b9bfc4 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -944,8 +944,9 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) { ECalendarViewEvent *event; GList *selected; - const char *uid; + const char *uid, *rid; GError *error = NULL; + ECalComponent *comp; selected = e_calendar_view_get_selected_events (cal_view); if (!selected) @@ -953,15 +954,30 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) event = (ECalendarViewEvent *) selected->data; - uid = icalcomponent_get_uid (event->comp_data->icalcomp); - /* FIXME: use 'rid' argument */ - e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error); + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + e_cal_component_get_uid (comp, &uid); + if (e_cal_component_is_instance (comp)) + rid = e_cal_component_get_recur_id_as_string (comp); + else + rid = ""; + + if (delete_component_dialog (comp, FALSE, 1, e_cal_component_get_vtype (comp), GTK_WIDGET (cal_view))) { + + if (itip_organizer_is_user (comp, event->comp_data->client) + && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), + event->comp_data->client, + comp, TRUE)) + itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL); - delete_error_dialog (error, E_CAL_COMPONENT_EVENT); - g_clear_error (&error); + e_cal_remove_object_with_mod (event->comp_data->client, uid, rid, CALOBJ_MOD_THIS, &error); + delete_error_dialog (error, E_CAL_COMPONENT_EVENT); + g_clear_error (&error); + } /* free memory */ g_list_free (selected); + g_object_unref (comp); } static void diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index b02b51e6ff..bb33b9bfc4 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -944,8 +944,9 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) { ECalendarViewEvent *event; GList *selected; - const char *uid; + const char *uid, *rid; GError *error = NULL; + ECalComponent *comp; selected = e_calendar_view_get_selected_events (cal_view); if (!selected) @@ -953,15 +954,30 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) event = (ECalendarViewEvent *) selected->data; - uid = icalcomponent_get_uid (event->comp_data->icalcomp); - /* FIXME: use 'rid' argument */ - e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_THIS, &error); + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + e_cal_component_get_uid (comp, &uid); + if (e_cal_component_is_instance (comp)) + rid = e_cal_component_get_recur_id_as_string (comp); + else + rid = ""; + + if (delete_component_dialog (comp, FALSE, 1, e_cal_component_get_vtype (comp), GTK_WIDGET (cal_view))) { + + if (itip_organizer_is_user (comp, event->comp_data->client) + && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), + event->comp_data->client, + comp, TRUE)) + itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL); - delete_error_dialog (error, E_CAL_COMPONENT_EVENT); - g_clear_error (&error); + e_cal_remove_object_with_mod (event->comp_data->client, uid, rid, CALOBJ_MOD_THIS, &error); + delete_error_dialog (error, E_CAL_COMPONENT_EVENT); + g_clear_error (&error); + } /* free memory */ g_list_free (selected); + g_object_unref (comp); } static void -- cgit