Fixed a modality issue, use the window manager to set the signature dialog as modal
[modest] / src / maemo / modest-account-settings-dialog.c
index b7a5bb3..04b7e16 100644 (file)
@@ -137,9 +137,6 @@ modest_account_settings_dialog_finalize (GObject *object)
        if (self->account_manager)
                g_object_unref (G_OBJECT (self->account_manager));
                
-       if (self->specific_window)
-               gtk_widget_destroy (self->specific_window);
-               
        if (self->signature_dialog)
                gtk_widget_destroy (self->signature_dialog);
 
@@ -432,7 +429,8 @@ static void
 on_button_signature (GtkButton *button, gpointer user_data)
 {
        ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
-       
+       gint response;
+
        /* Create the window, if necessary: */
        if (!(self->signature_dialog)) {
                self->signature_dialog = GTK_WIDGET (modest_signature_editor_dialog_new ());
@@ -450,19 +448,19 @@ on_button_signature (GtkButton *button, gpointer user_data)
        }
 
        /* Show the window: */  
-       gtk_window_set_transient_for (GTK_WINDOW (self->signature_dialog), GTK_WINDOW (self));
-       gtk_window_set_modal (GTK_WINDOW (self->signature_dialog), TRUE);
-    const gint response = gtk_dialog_run (GTK_DIALOG (self->signature_dialog));
-    gtk_widget_hide (self->signature_dialog);
-    if (response != GTK_RESPONSE_OK) {
-       /* Destroy the widget now, and its data: */
-       gtk_widget_destroy (self->signature_dialog);
-       self->signature_dialog = NULL;
-    }
-    else {
-       /* Mark modified, so we use the dialog's data later: */
-       self->modified = TRUE;  
-    }
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+                                    GTK_WINDOW (self->signature_dialog));
+
+       response = gtk_dialog_run (GTK_DIALOG (self->signature_dialog));
+       gtk_widget_hide (self->signature_dialog);
+       if (response != GTK_RESPONSE_OK) {
+               /* Destroy the widget now, and its data: */
+               gtk_widget_destroy (self->signature_dialog);
+               self->signature_dialog = NULL;
+       } else {
+               /* Mark modified, so we use the dialog's data later: */
+               self->modified = TRUE;  
+       }
 }
 
 static GtkWidget*
@@ -718,18 +716,15 @@ static void
 on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
 {
        ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
-       
+       ModestConnectionSpecificSmtpWindow *smtp_win;
+
        /* Create the window if necessary: */
-       if (!(self->specific_window)) {
-               self->specific_window = GTK_WIDGET (modest_connection_specific_smtp_window_new ());
-               modest_connection_specific_smtp_window_fill_with_connections (
-                       MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (self->specific_window), self->account_manager);
-       }
+       smtp_win = modest_connection_specific_smtp_window_new ();
+       modest_connection_specific_smtp_window_fill_with_connections (smtp_win, self->account_manager);
 
        /* Show the window: */  
-       gtk_window_set_transient_for (GTK_WINDOW (self->specific_window), GTK_WINDOW (self));
-       gtk_window_set_modal (GTK_WINDOW (self->specific_window), TRUE);
-       gtk_widget_show (self->specific_window);
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (smtp_win));
+       gtk_widget_show (GTK_WIDGET (smtp_win));
        self->modified = TRUE;
 }
 
@@ -1547,13 +1542,7 @@ save_configuration (ModestAccountSettingsDialog *dialog)
        if (account_name != NULL)
                modest_account_mgr_save_account_settings (dialog->account_manager, dialog->settings);
 
-       if (dialog->specific_window) {
-               return modest_connection_specific_smtp_window_save_server_accounts (
-                       MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (dialog->specific_window));
-       } else {
-               return TRUE;
-       }
-
+       return TRUE;
 }
 
 static gboolean entry_is_empty (GtkWidget *entry)
@@ -1643,8 +1632,8 @@ modest_account_settings_dialog_check_allow_changes (ModestAccountSettingsDialog
        /* Enable or disable widgets */
        gtk_widget_set_sensitive (self->entry_user_username, !username_known);
        gtk_widget_set_sensitive (self->entry_incomingserver, !username_known);
-       gtk_widget_set_sensitive (self->entry_outgoingserver, !username_known);
-       gtk_widget_set_sensitive (self->entry_outgoing_username, !username_known);
+       /* gtk_widget_set_sensitive (self->entry_outgoingserver, !username_known); */
+       /* gtk_widget_set_sensitive (self->entry_outgoing_username, !username_known); */
        gtk_widget_set_sensitive (self->entry_incoming_port, !username_known);
 /*     gtk_widget_set_sensitive (self->entry_outgoing_port, !username_known); */
        gtk_widget_set_sensitive (self->combo_incoming_security, !username_known);