Fixes NB#125952, "lose changes confirmation dialog" is now modal do easysetup wizard...
[modest] / src / maemo / easysetup / modest-easysetup-wizard-dialog.c
index ef5f7ad..84ae7e9 100644 (file)
@@ -579,6 +579,39 @@ create_page_account_details (ModestEasysetupWizardDialog *self)
        return GTK_WIDGET (box);
 }
 
+static void
+on_user_username_changed(GtkWidget* widget, ModestEasysetupWizardDialog *self)
+{
+       ModestEasysetupWizardDialogPrivate* priv;
+       gchar* provider_id = NULL;
+       EasysetupProviderComboBox *combo;
+
+       priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+
+       /* Work out the user email address */
+       combo = EASYSETUP_PROVIDER_COMBO_BOX (priv->combo_account_serviceprovider);
+       provider_id = easysetup_provider_combo_box_get_active_provider_id (combo);
+
+       if (provider_id) {
+               gchar *email_address;
+               gchar *domain_name = modest_presets_get_domain (priv->presets, provider_id);
+
+               email_address = g_strdup_printf ("%s@%s",
+                                                gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username)),
+                                                domain_name);
+
+               /* Update the email address */
+               gtk_entry_set_text (GTK_ENTRY (priv->entry_user_email), email_address);
+
+               g_free (email_address);
+               g_free (domain_name);
+               g_free (provider_id);
+       }
+
+       /* Update state */
+       on_easysetup_changed(widget, self);
+}
+
 static GtkWidget*
 create_page_user_details (ModestEasysetupWizardDialog *self)
 {
@@ -634,7 +667,7 @@ create_page_user_details (ModestEasysetupWizardDialog *self)
        gtk_widget_show (priv->entry_user_username);
        gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
        g_signal_connect(G_OBJECT(priv->entry_user_username), "changed", 
-                        G_CALLBACK(on_easysetup_changed), self);
+                        G_CALLBACK(on_user_username_changed), self);
        gtk_widget_show (caption);
        
        /* Prevent the use of some characters in the username, 
@@ -1106,12 +1139,17 @@ on_response_before (ModestWizardDialog *wizard_dialog,
                /* This is mostly copied from
                 * src/maemo/modest-account-settings-dialog.c */
                if (priv->dirty) {
-                       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. */
+                       gint dialog_response;
+                       GtkWidget *dialog;
+
+                       dialog = hildon_note_new_confirmation ((GtkWindow *) self,
+                                                              _("imum_nc_wizard_confirm_lose_changes"));
+
+                       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+                                                    (GtkWindow *) dialog,
+                                                    (GtkWindow *) wizard_dialog);
 
-                       const gint dialog_response = gtk_dialog_run (dialog);
+                       dialog_response = gtk_dialog_run ((GtkDialog *) dialog);
                        gtk_widget_destroy (GTK_WIDGET (dialog));
 
                        if (dialog_response != GTK_RESPONSE_OK) {