diff options
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 51e78b279f..38ae21668f 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -57,6 +57,7 @@ #include "e-day-view-top-item.h" #include "e-day-view-layout.h" #include "e-day-view-main-item.h" +#include "misc.h" /* Images */ #include "art/bell.xpm" @@ -3654,7 +3655,7 @@ e_day_view_delete_event_internal (EDayView *day_view, EDayViewEvent *event) vtype = cal_component_get_vtype (event->comp); - if (delete_component_dialog (event->comp, 1, vtype, + if (delete_component_dialog (event->comp, FALSE, 1, vtype, GTK_WIDGET (day_view))) { const char *uid; @@ -5607,7 +5608,6 @@ e_day_view_on_editing_started (EDayView *day_view, e_day_view_signals[SELECTION_CHANGED]); } - static void e_day_view_on_editing_stopped (EDayView *day_view, GnomeCanvasItem *item) @@ -5658,6 +5658,48 @@ e_day_view_on_editing_stopped (EDayView *day_view, NULL); g_assert (text != NULL); + if (string_is_empty (text)) { + ConfirmDeleteEmptyCompResult result; + + result = cal_comp_confirm_delete_empty_comp (event->comp, day_view->client, + GTK_WIDGET (day_view)); + + switch (result) { + case EMPTY_COMP_REMOVE_LOCALLY: { + const char *uid; + + cal_component_get_uid (event->comp, &uid); + + e_day_view_foreach_event_with_uid (day_view, uid, + e_day_view_remove_event_cb, NULL); + e_day_view_check_layout (day_view); + gtk_widget_queue_draw (day_view->top_canvas); + gtk_widget_queue_draw (day_view->main_canvas); + goto out; } + + case EMPTY_COMP_REMOVED_FROM_SERVER: + goto out; + + case EMPTY_COMP_DO_NOT_REMOVE: + /* But we cannot keep an empty summary, so make the + * canvas item refresh itself from the text that the + * component already had. + */ + + if (day == E_DAY_VIEW_LONG_EVENT) + e_day_view_reshape_long_event (day_view, event_num); + else + e_day_view_update_event_label (day_view, day, event_num); + + goto out; + + default: + g_assert_not_reached (); + } + + g_assert_not_reached (); + } + /* Only update the summary if necessary. */ cal_component_get_summary (event->comp, &summary); if (summary.value && !strcmp (text, summary.value)) { @@ -5675,6 +5717,8 @@ e_day_view_on_editing_stopped (EDayView *day_view, g_message ("e_day_view_on_editing_stopped(): Could not update the object!"); } + out: + g_free (text); gtk_signal_emit (GTK_OBJECT (day_view), |