From 33c3eb5090ad317e0a565578f4eff4c7ead35a11 Mon Sep 17 00:00:00 2001 From: Armin Burgmeier Date: Mon, 2 Jul 2007 21:16:20 +0000 Subject: [PATCH] 2007-07-02 Armin Burgmeier * src/maemo/easysetup/modest-easysetup-wizard.c: Added a confirmation note when trying to cancel the wizard. This fixes projects.maemo.org bug NB#60946. pmo-trunk-r2543 --- ChangeLog2 | 6 +++++ src/maemo/easysetup/modest-easysetup-wizard.c | 34 ++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ChangeLog2 b/ChangeLog2 index fbea86d..8cd38dd 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,9 @@ +2007-07-02 Armin Burgmeier + + * src/maemo/easysetup/modest-easysetup-wizard.c: Added a confirmation + note when trying to cancel the wizard. This fixes projects.maemo.org + bug NB#60946. + 2007-07-02 Murray Cumming * src/modest-tny-account.h: diff --git a/src/maemo/easysetup/modest-easysetup-wizard.c b/src/maemo/easysetup/modest-easysetup-wizard.c index cfc3449..95b36ae 100644 --- a/src/maemo/easysetup/modest-easysetup-wizard.c +++ b/src/maemo/easysetup/modest-easysetup-wizard.c @@ -936,18 +936,42 @@ on_response (ModestWizardDialog *wizard_dialog, gpointer user_data) { ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (wizard_dialog); - if (response_id == GTK_RESPONSE_CANCEL) { /* Remove any temporarily-saved account that will not actually be needed: */ if (self->saved_account_name) { modest_account_mgr_remove_account (self->account_manager, self->saved_account_name, FALSE); - } + } } - + invoke_enable_buttons_vfunc (self); } +static void +on_response_before (ModestWizardDialog *wizard_dialog, + gint response_id, + gpointer user_data) +{ + ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (wizard_dialog); + if (response_id == GTK_RESPONSE_CANCEL) { + /* This is mostly copied from + * src/maemo/modest-account-settings-dialog.c */ + GtkDialog *dialog = GTK_DIALOG (hildon_note_new_confirmation (GTK_WINDOW (self), + _("imum_nc_wizard_confirm_lose_changes"))); + /* TODO: These button names will be ambiguous, and not specified in the UI specification. */ + + const gint dialog_response = gtk_dialog_run (dialog); + gtk_widget_destroy (GTK_WIDGET (dialog)); + + if (dialog_response != GTK_RESPONSE_OK) + { + /* This is a nasty hack. murrayc. */ + /* Don't let the dialog close */ + g_signal_stop_emission_by_name (wizard_dialog, "response"); + } + } +} + static void modest_easysetup_wizard_dialog_init (ModestEasysetupWizardDialog *self) { @@ -1021,6 +1045,10 @@ modest_easysetup_wizard_dialog_init (ModestEasysetupWizardDialog *self) g_signal_connect_after (G_OBJECT (self), "response", G_CALLBACK (on_response), self); + /* This is to show a confirmation dialog when the user hits cancel */ + g_signal_connect (G_OBJECT (self), "response", + G_CALLBACK (on_response_before), self); + /* When this window is shown, hibernation should not be possible, * because there is no sensible way to save the state: */ modest_window_mgr_prevent_hibernation_while_window_is_shown ( -- 1.7.9.5