* Remove cancel button in connection specific smtp edit window.
[modest] / src / maemo / modest-platform.c
index 474f624..6c47d9d 100644 (file)
@@ -716,7 +716,7 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
        gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), 
                            hbox, FALSE, FALSE, 0);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
-                                    GTK_WINDOW (dialog));
+                                    GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
        gtk_widget_show_all (GTK_WIDGET(dialog));
                
        result = gtk_dialog_run (GTK_DIALOG(dialog));
@@ -807,9 +807,16 @@ modest_platform_run_rename_folder_dialog (GtkWindow *parent_window,
 
 
 static void
-on_destroy_dialog (GtkDialog *dialog)
+on_destroy_dialog (GtkWidget *dialog)
 {
-       gtk_widget_destroy (GTK_WIDGET(dialog));
+       /* This could happen when the dialogs get programatically
+          hidden or destroyed (for example when closing the
+          application while a dialog is being shown) */
+       if (!GTK_IS_WIDGET (dialog))
+               return;
+
+       gtk_widget_destroy (dialog);
+
        if (gtk_events_pending ())
                gtk_main_iteration ();
 }
@@ -823,14 +830,11 @@ modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
        
        dialog = hildon_note_new_confirmation (parent_window, message);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
-                                    GTK_WINDOW (dialog));
+                                    GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-       on_destroy_dialog (GTK_DIALOG(dialog));
-       
-       while (gtk_events_pending ())
-               gtk_main_iteration ();
+       on_destroy_dialog (dialog);
 
        return response;
 }
@@ -849,14 +853,11 @@ modest_platform_run_confirmation_dialog_with_buttons (GtkWindow *parent_window,
                                                           button_cancel, GTK_RESPONSE_CANCEL,
                                                           NULL);
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
-                                    GTK_WINDOW (dialog));
+                                    GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-       on_destroy_dialog (GTK_DIALOG(dialog));
-       
-       while (gtk_events_pending ())
-               gtk_main_iteration ();
+       on_destroy_dialog (dialog);
 
        return response;
 }
@@ -872,13 +873,11 @@ modest_platform_run_yes_no_dialog (GtkWindow *parent_window,
                                                           _("mcen_bd_yes"), GTK_RESPONSE_YES,
                                                           _("mcen_bd_no"), GTK_RESPONSE_NO,
                                                           NULL);
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
+                                    GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
        response = gtk_dialog_run (GTK_DIALOG (dialog));
        
-       on_destroy_dialog (GTK_DIALOG(dialog));
-
-       while (gtk_events_pending ())
-               gtk_main_iteration ();
+       on_destroy_dialog (dialog);
 
        return response;
 }
@@ -895,15 +894,12 @@ modest_platform_run_information_dialog (GtkWindow *parent_window,
        note = hildon_note_new_information (parent_window, message);
        if (block)
                modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
-                                            GTK_WINDOW (note));
+                                            GTK_WINDOW (note), GTK_WINDOW (parent_window));
        
        if (block) {
                gtk_dialog_run (GTK_DIALOG (note));
        
-               on_destroy_dialog (GTK_DIALOG (note));
-
-               while (gtk_events_pending ())
-                       gtk_main_iteration ();
+               on_destroy_dialog (note);
        } else {
                g_signal_connect_swapped (note,
                                          "response", 
@@ -1727,10 +1723,10 @@ modest_platform_run_certificate_confirmation_dialog (const gchar* server_name,
                          (gpointer) certificate);
        
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
-                                    GTK_WINDOW (note));
+                                    GTK_WINDOW (note), (GtkWindow *) main_win);
        response = gtk_dialog_run(GTK_DIALOG(note));
 
-       on_destroy_dialog (GTK_DIALOG(note));
+       on_destroy_dialog (note);
        g_free (question);
        
        return response == GTK_RESPONSE_OK;
@@ -1760,12 +1756,12 @@ modest_platform_run_alert_dialog (const gchar* prompt,
                GtkWidget *dialog = GTK_WIDGET (hildon_note_new_confirmation (GTK_WINDOW (main_win), 
                                                                              prompt));
                modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
-                                            GTK_WINDOW (dialog));
+                                            GTK_WINDOW (dialog), (GtkWindow *) main_win);
                
                const int response = gtk_dialog_run (GTK_DIALOG (dialog));
                retval = (response == GTK_RESPONSE_YES) || (response == GTK_RESPONSE_OK);
                
-               on_destroy_dialog (GTK_DIALOG(dialog));         
+               on_destroy_dialog (dialog);             
        } else {
                /* Just show the error text and use the default response: */
                modest_platform_run_information_dialog (GTK_WINDOW (main_win), 
@@ -2070,15 +2066,6 @@ modest_platform_double_connect_and_perform (GtkWindow *parent_window,
 }
 
 GtkWidget *
-modest_platform_get_account_settings_dialog (ModestAccountSettings *settings)
-{
-       ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
-
-       modest_account_settings_dialog_set_account (dialog, settings);
-       return GTK_WIDGET (dialog);
-}
-
-GtkWidget *
 modest_platform_get_account_settings_wizard (void)
 {
        ModestEasysetupWizardDialog *dialog = modest_easysetup_wizard_dialog_new ();