* Merged revision 5291 from trunk
authorSergio Villar Senin <svillar@igalia.com>
Tue, 19 Aug 2008 14:41:42 +0000 (14:41 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 19 Aug 2008 14:41:42 +0000 (14:41 +0000)
pmo-diablo-r5330

src/maemo/modest-msg-edit-window.c
src/maemo/modest-msg-view-window.c
src/maemo/modest-platform.c
src/modest-tny-account.c

index eef3774..ff09fdd 100644 (file)
@@ -2420,7 +2420,6 @@ modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window,
        if (tny_list_get_length (att_list) == 0) {
                hildon_banner_show_information (NULL, NULL, _("TODO: no attachments selected to remove"));
        } else {
-               GtkWidget *confirmation_dialog = NULL;
                gboolean dialog_response;
                gchar *message = NULL;
                gchar *filename = NULL;
@@ -2449,11 +2448,11 @@ modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window,
                message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments",
                                                    tny_list_get_length (att_list)), filename);
                g_free (filename);
-               confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message);
+
+               dialog_response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window), message);
                g_free (message);
-               dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK);
-               gtk_widget_destroy (confirmation_dialog);
-               if (!dialog_response) {
+
+               if (dialog_response != GTK_RESPONSE_OK) {
                        g_object_unref (att_list);
                        return;
                }
index a2144a3..c02665d 100644 (file)
@@ -2653,7 +2653,6 @@ save_mime_parts_to_file_with_checks (SaveMimePartInfo *info)
 
 }
 
-
 void
 modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts)
 {
@@ -2799,7 +2798,6 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
        gint n_attachments;
        TnyMsg *msg;
        TnyIterator *iter;
-/*     TnyFolder *folder; */
 
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
@@ -2862,10 +2860,6 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
        }
 
        priv->purge_timeout = g_timeout_add (2000, show_remove_attachment_information, window);
-/*     folder = tny_msg_get_folder (msg); */
-/*     tny_msg_uncache_attachments (msg); */
-/*     tny_folder_refresh (folder, NULL); */
-/*     g_object_unref (folder); */
        
        iter = tny_list_create_iterator (mime_parts);
        while (!tny_iterator_is_done (iter)) {
@@ -2873,7 +2867,6 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
 
                part = (TnyMimePart *) tny_iterator_get_current (iter);
                tny_mime_part_set_purged (TNY_MIME_PART (part));
-/*             modest_msg_view_remove_attachment (MODEST_MSG_VIEW (priv->msg_view), node->data); */
                g_object_unref (part);
                tny_iterator_next (iter);
        }
index 4519e0f..734611e 100644 (file)
@@ -965,9 +965,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 ();
 }
@@ -985,10 +992,7 @@ modest_platform_run_confirmation_dialog (GtkWindow *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;
 }
@@ -1011,10 +1015,7 @@ modest_platform_run_confirmation_dialog_with_buttons (GtkWindow *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;
 }
@@ -1033,10 +1034,7 @@ modest_platform_run_yes_no_dialog (GtkWindow *parent_window,
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
        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;
 }
@@ -1057,10 +1055,7 @@ modest_platform_run_information_dialog (GtkWindow *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", 
@@ -1265,7 +1260,7 @@ modest_platform_run_sort_dialog (GtkWindow *parent_window,
        }
        
        /* Free */
-       on_destroy_dialog (GTK_DIALOG(dialog));
+       on_destroy_dialog (dialog);
 }
 
 
@@ -1873,7 +1868,7 @@ modest_platform_run_certificate_confirmation_dialog (const gchar* server_name,
                                     GTK_WINDOW (note));
        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;
@@ -1908,7 +1903,7 @@ modest_platform_run_alert_dialog (const gchar* prompt,
                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), 
index 9ee4e85..04bc796 100644 (file)
@@ -364,7 +364,8 @@ update_tny_account (TnyAccount *tny_account,
                        break;
                }
                
-               tny_account_set_secure_auth_mech (tny_account, auth_mech_name);
+               if (auth_mech_name)
+                       tny_account_set_secure_auth_mech (tny_account, auth_mech_name);
                
                if (modest_protocol_info_protocol_is_store(protocol) && 
                        (protocol == MODEST_PROTOCOL_STORE_IMAP) ) {