diff options
Diffstat (limited to 'calendar/gncal-full-day.c')
-rw-r--r-- | calendar/gncal-full-day.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index ce64db9173..8c3bf31db2 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -331,13 +331,27 @@ child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data) /* Notify calendar of change */ - fullday = gtk_object_get_user_data (GTK_OBJECT (widget)); + fullday = GNCAL_FULL_DAY (widget->parent); gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_SUMMARY); return FALSE; } +static gint +child_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data) +{ + if (event->keyval != GDK_Escape) + return FALSE; + + /* If user pressed Esc, un-focus the child by focusing the fullday widget */ + + gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event"); + gtk_widget_grab_focus (widget->parent); + + return FALSE; +} + static Child * child_new (GncalFullDay *fullday, iCalObject *ico) { @@ -353,8 +367,6 @@ child_new (GncalFullDay *fullday, iCalObject *ico) child->width = 0; child->height = 0; - gtk_object_set_user_data (GTK_OBJECT (child->widget), fullday); - child_range_changed (fullday, child); /* We set the i-beam cursor and the initial summary text upon realization */ @@ -371,6 +383,10 @@ child_new (GncalFullDay *fullday, iCalObject *ico) (GtkSignalFunc) child_focus_out, child); + gtk_signal_connect (GTK_OBJECT (child->widget), "key_press_event", + (GtkSignalFunc) child_key_press, + child); + /* Finish setup */ gtk_text_set_editable (GTK_TEXT (child->widget), TRUE); |