aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-day-view.c34
-rw-r--r--calendar/gui/e-week-view.c32
3 files changed, 75 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ab973ec6d1..ee314f4445 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,14 @@
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>
+
+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.
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:
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: