aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-component.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 58e82057cd..33ffe9a0d9 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -301,14 +301,23 @@ delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
_("Calendar '%s' will be removed. Are you sure you want to continue?"),
e_source_peek_name (selected_source));
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector),
- selected_source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector),
- selected_source);
+ ECal *cal;
+ char *uri;
+
+ /* first, ask the backend to remove the calendar */
+ uri = e_source_get_uri (selected_source);
+ cal = e_cal_model_get_client_for_uri (gnome_calendar_get_calendar_model (priv->calendar), uri);
+ g_free (uri);
+ if (cal) {
+ if (e_cal_remove_calendar (cal, NULL)) {
+ if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector),
+ selected_source))
+ e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector),
+ selected_source);
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
-
- /* FIXME: remove the calendar.ics file and the directory */
+ e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
+ }
+ }
}
gtk_widget_destroy (dialog);