diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-10-28 08:22:10 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-10-28 08:22:10 +0800 |
commit | b4e9733bdc207d7a9100575abf053a22aabf1601 (patch) | |
tree | 8d63c5a8ef2b9fb896d8d0d70f5aef851e9ff7cd /calendar/gui/e-day-view.c | |
parent | aa4757662d15ce38041ca8850a0b60b1f8e361d1 (diff) | |
download | gsoc2013-evolution-b4e9733bdc207d7a9100575abf053a22aabf1601.tar.gz gsoc2013-evolution-b4e9733bdc207d7a9100575abf053a22aabf1601.tar.zst gsoc2013-evolution-b4e9733bdc207d7a9100575abf053a22aabf1601.zip |
Cancel editing if the user presses Escape.
2001-10-27 Federico Mena Quintero <federico@ximian.com>
* gui/e-day-view.c (e_day_view_on_text_item_event): Cancel editing
if the user presses Escape.
* gui/e-week-view.c (e_week_view_on_text_item_event): Likewise.
* gui/cal-search-bar.c: #include <string.h>
svn path=/trunk/; revision=14245
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 38ae21668f..6fbbbd4fb5 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -5522,6 +5522,36 @@ e_day_view_stop_editing_event (EDayView *day_view) } +/* Cancels the current edition by resetting the appointment's text to its original value */ +static void +cancel_editing (EDayView *day_view) +{ + int day, event_num; + EDayViewEvent *event; + CalComponentText summary; + + day = day_view->editing_event_day; + event_num = day_view->editing_event_num; + + g_assert (day != -1); + + if (day == E_DAY_VIEW_LONG_EVENT) + event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); + else + event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); + + /* Reset the text to what was in the component */ + + cal_component_get_summary (event->comp, &summary); + gtk_object_set (GTK_OBJECT (event->canvas_item), + "text", summary.value ? summary.value : "", + NULL); + + /* Stop editing */ + e_day_view_stop_editing_event (day_view); +} + + static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *event, @@ -5539,6 +5569,10 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event"); return TRUE; + } else if (event->key.keyval == GDK_Escape) { + cancel_editing (day_view); + gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event"); + return TRUE; } break; case GDK_2BUTTON_PRESS: |