From 092fe34f03c3165f87be7e09877bb614c468590f Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Tue, 12 Aug 2008 15:55:59 +0000 Subject: [PATCH] * Fixes NB#87456, close "remove attachment" dialog with its parent pmo-trunk-r5291 --- src/maemo/modest-msg-edit-window.c | 9 ++++----- src/maemo/modest-msg-view-window.c | 9 ++------- src/maemo/modest-platform.c | 35 +++++++++++++++-------------------- src/modest-tny-account.c | 3 ++- 4 files changed, 23 insertions(+), 33 deletions(-) diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 35b656a..954c222 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -2428,7 +2428,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; @@ -2457,11 +2456,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; } diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 95fcb90..7c1d972 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -2747,10 +2747,11 @@ save_attachments_response (GtkDialog *dialog, gchar *chooser_uri; GList *files_to_save = NULL; + mime_parts = TNY_LIST (user_data); + if (arg1 != GTK_RESPONSE_OK) goto end; - mime_parts = TNY_LIST (user_data); chooser_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog)); if (!modest_utils_folder_writable (chooser_uri)) { @@ -2905,7 +2906,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); @@ -2968,10 +2968,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)) { @@ -2979,7 +2975,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); } diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 474f624..a13b8e3 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -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 (); } @@ -827,10 +834,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; } @@ -853,10 +857,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; } @@ -875,10 +876,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; } @@ -900,10 +898,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", @@ -1730,7 +1725,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; @@ -1765,7 +1760,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), diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index 9ee4e85..04bc796 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -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) ) { -- 1.7.9.5