aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-10-28 08:22:10 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-10-28 08:22:10 +0800
commitb4e9733bdc207d7a9100575abf053a22aabf1601 (patch)
tree8d63c5a8ef2b9fb896d8d0d70f5aef851e9ff7cd /calendar/gui/e-week-view.c
parentaa4757662d15ce38041ca8850a0b60b1f8e361d1 (diff)
downloadgsoc2013-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-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 9b2a9fa40a..090db420eb 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2886,6 +2886,34 @@ e_week_view_stop_editing_event (EWeekView *week_view)
}
+/* Cancels the current edition by resetting the appointment's text to its original value */
+static void
+cancel_editing (EWeekView *week_view)
+{
+ int event_num, span_num;
+ EWeekViewEvent *event;
+ EWeekViewEventSpan *span;
+ CalComponentText summary;
+
+ event_num = week_view->editing_event_num;
+ span_num = week_view->editing_span_num;
+
+ g_assert (event_num != -1);
+
+ event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+ span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
+
+ /* Reset the text to what was in the component */
+
+ cal_component_get_summary (event->comp, &summary);
+ gtk_object_set (GTK_OBJECT (span->text_item),
+ "text", summary.value ? summary.value : "",
+ NULL);
+
+ /* Stop editing */
+ e_week_view_stop_editing_event (week_view);
+}
+
static gboolean
e_week_view_on_text_item_event (GnomeCanvasItem *item,
GdkEvent *gdkevent,
@@ -2910,6 +2938,10 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
gtk_signal_emit_stop_by_name (GTK_OBJECT (item),
"event");
return TRUE;
+ } else if (gdkevent->key.keyval == GDK_Escape) {
+ cancel_editing (week_view);
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
+ return TRUE;
}
break;
case GDK_2BUTTON_PRESS: