Added method save_settings to force from plugin code update of easysetup
[modest] / src / hildon2 / modest-easysetup-wizard-dialog.c
index 694b37d..c81aa90 100644 (file)
@@ -139,6 +139,7 @@ struct _ModestEasysetupWizardDialogPrivate
 
 static void save_to_settings (ModestEasysetupWizardDialog *self);
 static void real_enable_buttons (ModestWizardDialog *dialog, gboolean enable_next);
+static void on_save_settings (ModestWizardDialog *dialog);
 static GList* check_for_supported_auth_methods (ModestEasysetupWizardDialog* self);
 static gboolean check_has_supported_auth_methods(ModestEasysetupWizardDialog* self);
 
@@ -1414,6 +1415,9 @@ create_subsequent_pages (ModestEasysetupWizardDialog *self)
        picker = MODEST_PROVIDER_PICKER (priv->account_serviceprovider_picker);
        id_type = modest_provider_picker_get_active_id_type (picker);
        g_object_get (self, "wizard-notebook", &notebook, NULL);
+       modest_wizard_dialog_set_response_override_handler (MODEST_WIZARD_DIALOG (self),
+                                                           NULL);
+       
 
        if (id_type == MODEST_PROVIDER_PICKER_ID_OTHER) {
                /* "Other..." was selected: */
@@ -1471,12 +1475,17 @@ create_subsequent_pages (ModestEasysetupWizardDialog *self)
                                ModestPairList *tabs;
                                GSList *tmp;
                                gboolean first_page = TRUE;
+                               ModestWizardDialogResponseOverrideFunc response_override;
 
                                /* Remember the last selected plugin protocol */
                                priv->last_plugin_protocol_selected = proto_type;
 
                                /* Get tabs */
                                tabs = modest_account_protocol_get_easysetupwizard_tabs (MODEST_ACCOUNT_PROTOCOL (protocol));
+                               response_override = modest_account_protocol_get_wizard_response_override 
+                                       (MODEST_ACCOUNT_PROTOCOL (protocol));
+                               modest_wizard_dialog_set_response_override_handler (MODEST_WIZARD_DIALOG (self),
+                                                                                   response_override);
                                tmp = (GSList *) tabs;
                                while (tmp) {
                                        ModestPair *pair = (ModestPair *) tmp->data;
@@ -1490,12 +1499,14 @@ create_subsequent_pages (ModestEasysetupWizardDialog *self)
                                        }
 
                                        /* Connect signals */
-                                       priv->missing_data_signals = 
-                                               modest_signal_mgr_connect (priv->missing_data_signals, 
-                                                                          G_OBJECT (pair->second), 
-                                                                          "missing-mandatory-data",
-                                                                          G_CALLBACK (on_missing_mandatory_data), 
-                                                                          self);
+                                       if (MODEST_IS_EASYSETUP_WIZARD_PAGE (pair->second)) {
+                                               priv->missing_data_signals = 
+                                                       modest_signal_mgr_connect (priv->missing_data_signals, 
+                                                                                  G_OBJECT (pair->second), 
+                                                                                  "missing-mandatory-data",
+                                                                                  G_CALLBACK (on_missing_mandatory_data), 
+                                                                                  self);
+                                       }
 
                                        g_free (pair->first);
                                        tmp = g_slist_next (tmp);
@@ -1843,6 +1854,7 @@ modest_easysetup_wizard_dialog_class_init (ModestEasysetupWizardDialogClass *kla
        ModestWizardDialogClass *base_klass = (ModestWizardDialogClass*)(klass);
        base_klass->before_next = on_before_next;
        base_klass->enable_buttons = on_enable_buttons;
+       base_klass->save_settings = on_save_settings;
 }
 
 /**
@@ -2071,18 +2083,20 @@ save_to_settings (ModestEasysetupWizardDialog *self)
 
        g_object_unref (transport_settings);
        g_free (transport_hostname);
-       
+
        fullname = hildon_entry_get_text (HILDON_ENTRY (priv->entry_user_name));
        email_address = hildon_entry_get_text (HILDON_ENTRY (priv->entry_user_email));
        modest_account_settings_set_fullname (priv->settings, fullname);
        modest_account_settings_set_email_address (priv->settings, email_address);
        /* we don't set retrieve type to preserve advanced settings if
           any. By default account settings are set to headers only */
-       
+
        /* Save the connection-specific SMTP server accounts. */
-        modest_account_settings_set_use_connection_specific_smtp 
-               (priv->settings, 
-                hildon_check_button_get_active(HILDON_CHECK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
+       if (priv->checkbox_outgoing_smtp_specific) {
+               modest_account_settings_set_use_connection_specific_smtp
+                       (priv->settings,
+                        hildon_check_button_get_active(HILDON_CHECK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
+       }
 
        display_name = get_entered_account_title (self);
        modest_account_settings_set_display_name (priv->settings, display_name);
@@ -2090,6 +2104,16 @@ save_to_settings (ModestEasysetupWizardDialog *self)
        g_free (provider_id);
 }
 
+
+static void
+on_save_settings (ModestWizardDialog *dialog)
+{
+       ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (dialog);
+       save_to_settings (self);
+
+}
+
+
 static GList*
 check_for_supported_auth_methods (ModestEasysetupWizardDialog* self)
 {