diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-10-28 06:13:20 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-10-28 06:13:20 +0800 |
commit | 54634a1357884543f64d00aa135bf8bc9a525880 (patch) | |
tree | 44d33eb65ea05b6dba7fff9877948f5967d0fa22 /calendar/gui/e-day-view.c | |
parent | 18f549eefbc0922c33de0e57095229413ef951f3 (diff) | |
download | gsoc2013-evolution-54634a1357884543f64d00aa135bf8bc9a525880.tar.gz gsoc2013-evolution-54634a1357884543f64d00aa135bf8bc9a525880.tar.zst gsoc2013-evolution-54634a1357884543f64d00aa135bf8bc9a525880.zip |
Delete appointments with empty summaries. Fixes Ximian bug #780.
2001-10-27 Federico Mena Quintero <federico@ximian.com>
* gui/e-day-view.c (e_day_view_on_editing_stopped): Delete
appointments with empty summaries. Fixes Ximian bug #780.
* gui/e-week-view.c (e_week_view_on_editing_stopped): Likewise.
* gui/dialogs/delete-comp.c (delete_component_dialog): Added an
argument to specify whether we unconditionally want single
components to be considered as not having a summary.
* gui/comp-util.c (cal_comp_confirm_delete_empty_comp): New
function.
* gui/misc.[ch]: New files with miscellaneous utility functions;
moved string_is_empty() over from calendar-model.c.
* gui/calendar-model.c: Use the string_is_empty()
function from misc.c.
* gui/Makefile.am (evolution_calendar_SOURCES): Added misc.[ch] to
the list of sources.
svn path=/trunk/; revision=14233
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), |