2007-07-02 Armin Burgmeier <armin@openismus.com>
authorArmin Burgmeier <armin@openismus.com>
Mon, 2 Jul 2007 21:16:20 +0000 (21:16 +0000)
committerArmin Burgmeier <armin@openismus.com>
Mon, 2 Jul 2007 21:16:20 +0000 (21:16 +0000)
* 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
src/maemo/easysetup/modest-easysetup-wizard.c

index fbea86d..8cd38dd 100644 (file)
@@ -1,3 +1,9 @@
+2007-07-02  Armin Burgmeier  <armin@openismus.com>
+
+       * 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  <murrayc@murrayc.com>
 
        * src/modest-tny-account.h:
index cfc3449..95b36ae 100644 (file)
@@ -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 (