From beb604cfc9d916ac238f726189cbd3b017bbcfc8 Mon Sep 17 00:00:00 2001 From: Charles Zhang Date: Tue, 23 Sep 2003 08:19:56 +0000 Subject: connect to "key_press_event" signal with key_press_event_callback. 2003-09-23 Charles Zhang * e-shell-startup-wizard.c (e_shell_startup_wizard_create): connect to "key_press_event" signal with key_press_event_callback. (key_press_event): Handle `ESC` key press event. [#48145] svn path=/trunk/; revision=22657 --- shell/ChangeLog | 6 ++++++ shell/e-shell-startup-wizard.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/shell/ChangeLog b/shell/ChangeLog index 8e55cef2d3..c4adc5c9b5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2003-09-23 Charles Zhang + + * e-shell-startup-wizard.c (e_shell_startup_wizard_create): connect + to "key_press_event" signal with key_press_event_callback. + (key_press_event): Handle `ESC` key press event. [#48145] + 2003-09-22 Hans Petter Jansson * Makefile.am (evolution_LDADD): libical.la -> libical-evolution.la diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c index 95b4c03629..63460cc68b 100644 --- a/shell/e-shell-startup-wizard.c +++ b/shell/e-shell-startup-wizard.c @@ -758,6 +758,40 @@ startup_wizard_delete (GnomeDruid *druid, return FALSE; } +static gboolean +key_press_event_callback (GtkWidget *widget, + GdkEventKey *keyev, + SWData *data) +{ + if (keyev->keyval == GDK_Escape) { + GtkWidget *confirm_dialog; + int returnvalue; + char *confirmations; + + confirmations = _("If you quit the Evolution Setup Assistant now, all of the information that " + "you have entered will be forgotten. You will need to run this assistant again " + "before using Evolution.\n\nDo you want to quit using the Assistant now?"); + + confirm_dialog = gtk_message_dialog_new (data->dialog, + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_NONE, + confirmations); + + gtk_dialog_add_button (confirm_dialog, _("Cancel"), GTK_RESPONSE_CANCEL); + gtk_dialog_add_button (confirm_dialog, _("Quit Assistant"), GTK_RESPONSE_OK); + + returnvalue = gtk_dialog_run (GTK_DIALOG (confirm_dialog)); + gtk_widget_destroy (confirm_dialog); + + if (returnvalue == GTK_RESPONSE_OK) { + startup_wizard_cancel (data->druid, data); + return TRUE; + } + } + return FALSE; +} + gboolean e_shell_startup_wizard_create (void) { @@ -798,6 +832,9 @@ e_shell_startup_wizard_create (void) g_signal_connect (data->druid, "cancel", G_CALLBACK (startup_wizard_cancel), data); + g_signal_connect (data->dialog, "key_press_event", + G_CALLBACK (key_press_event_callback), data); + data->start = glade_xml_get_widget (data->wizard, "start-page"); data->finish = glade_xml_get_widget (data->wizard, "done-page"); g_return_val_if_fail (data->start != NULL, FALSE); -- cgit