From 7259b1726d060d9f37f7f1d1a6cf3b55f4e65319 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 26 May 2004 06:13:34 +0000 Subject: (key_press_event): look for escape press and destroy dialog. svn path=/trunk/; revision=26093 --- calendar/gui/dialogs/calendar-setup.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 517804f34e..e50f1f7f47 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -653,6 +654,17 @@ source_group_changed_sensitive (SourceDialog *source_dialog) general_update_dialog (source_dialog); } +static gboolean +key_press_event (GtkWidget *widget, GdkEventKey *event) +{ + if (event->keyval == GDK_Escape) { + gtk_widget_destroy (widget); + return TRUE; + } + + return FALSE; +} + static void new_calendar_cancel (SourceDialog *source_dialog) { @@ -687,6 +699,7 @@ calendar_setup_new_calendar (GtkWindow *parent) } source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-calendar-window"); + g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); g_signal_connect_swapped (source_dialog->name_entry, "changed", @@ -782,6 +795,8 @@ calendar_setup_edit_calendar (GtkWindow *parent, ESource *source) source_dialog->source = source; g_object_ref (source); + g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); + source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); g_signal_connect_swapped (source_dialog->name_entry, "changed", G_CALLBACK (general_entry_modified), source_dialog); @@ -889,6 +904,7 @@ calendar_setup_new_task_list (GtkWindow *parent) } source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-task-list-window"); + g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); g_signal_connect_swapped (source_dialog->name_entry, "changed", @@ -985,6 +1001,8 @@ calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) source_dialog->source = source; g_object_ref (source); + g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); + source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); g_signal_connect_swapped (source_dialog->name_entry, "changed", G_CALLBACK (general_entry_modified), source_dialog); -- cgit