From b0f3e49d487a61c657f3a08a558fc754e9546b10 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Mon, 1 Jun 2009 12:00:03 +0200 Subject: [PATCH] ** Sets the proper parent to a dialog. This could cause apparent "freezes" when changing between applications, because the dialog won't be shown in its proper place when coming back to modest * Fixes NB#119715, set the proper parent to the "replace file" confirmation dialog when saving attachments --- src/hildon2/modest-msg-view-window.c | 19 +++++++++---------- src/maemo/modest-msg-view-window.c | 14 ++++++-------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index 48836f0..b901177 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -2660,7 +2660,7 @@ typedef struct static void save_mime_part_info_free (SaveMimePartInfo *info, gboolean with_struct); static gboolean idle_save_mime_part_show_result (SaveMimePartInfo *info); static gpointer save_mime_part_to_file (SaveMimePartInfo *info); -static void save_mime_parts_to_file_with_checks (SaveMimePartInfo *info); +static void save_mime_parts_to_file_with_checks (GtkWindow *parent, SaveMimePartInfo *info); static void save_mime_part_info_free (SaveMimePartInfo *info, gboolean with_struct) @@ -2742,7 +2742,8 @@ save_mime_part_to_file (SaveMimePartInfo *info) } static void -save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) +save_mime_parts_to_file_with_checks (GtkWindow *parent, + SaveMimePartInfo *info) { gboolean is_ok = TRUE; gint replaced_files = 0; @@ -2756,7 +2757,7 @@ save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) } } if (replaced_files) { - GtkWidget *confirm_overwrite_dialog; + gint response; if (replaced_files == 1) { SaveMimePartPair *pair = files->data; @@ -2767,17 +2768,15 @@ save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) message = g_strdup_printf ("%s\n%s", _FM("docm_nc_replace_file"), (escaped_basename) ? escaped_basename : ""); - confirm_overwrite_dialog = hildon_note_new_confirmation (NULL, message); + response = modest_platform_run_confirmation_dialog (parent, message); g_free (message); g_free (escaped_basename); } else { - confirm_overwrite_dialog = hildon_note_new_confirmation (NULL, - _FM("docm_nc_replace_multiple")); + response = modest_platform_run_confirmation_dialog (parent, + _FM("docm_nc_replace_multiple")); } - if (gtk_dialog_run (GTK_DIALOG (confirm_overwrite_dialog)) != GTK_RESPONSE_OK) + if (response != GTK_RESPONSE_OK) is_ok = FALSE; - - gtk_widget_destroy (confirm_overwrite_dialog); } if (!is_ok) { @@ -2854,7 +2853,7 @@ save_attachments_response (GtkDialog *dialog, SaveMimePartInfo *info = g_slice_new0 (SaveMimePartInfo); info->pairs = files_to_save; info->result = TRUE; - save_mime_parts_to_file_with_checks (info); + save_mime_parts_to_file_with_checks ((GtkWindow *) dialog, info); } end: diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 907159b..5cdcf2c 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -2759,7 +2759,7 @@ typedef struct static void save_mime_part_info_free (SaveMimePartInfo *info, gboolean with_struct); static gboolean idle_save_mime_part_show_result (SaveMimePartInfo *info); static gpointer save_mime_part_to_file (SaveMimePartInfo *info); -static void save_mime_parts_to_file_with_checks (SaveMimePartInfo *info); +static void save_mime_parts_to_file_with_checks (GtkWindow *parent, SaveMimePartInfo *info); static void save_mime_part_info_free (SaveMimePartInfo *info, gboolean with_struct) @@ -2836,7 +2836,7 @@ save_mime_part_to_file (SaveMimePartInfo *info) } static void -save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) +save_mime_parts_to_file_with_checks (GtkWindow *parent, SaveMimePartInfo *info) { gboolean is_ok = TRUE; gint replaced_files = 0; @@ -2850,14 +2850,12 @@ save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) } } if (replaced_files) { - GtkWidget *confirm_overwrite_dialog; + gint response; const gchar *message = (replaced_files == 1) ? _FM("docm_nc_replace_file") : _FM("docm_nc_replace_multiple"); - confirm_overwrite_dialog = hildon_note_new_confirmation (NULL, message); - if (gtk_dialog_run (GTK_DIALOG (confirm_overwrite_dialog)) != GTK_RESPONSE_OK) { + response = modest_platform_run_confirmation_dialog (parent, message); + if (response != GTK_RESPONSE_OK) is_ok = FALSE; - } - gtk_widget_destroy (confirm_overwrite_dialog); } if (!is_ok) { @@ -2925,7 +2923,7 @@ save_attachments_response (GtkDialog *dialog, SaveMimePartInfo *info = g_slice_new0 (SaveMimePartInfo); info->pairs = files_to_save; info->result = TRUE; - save_mime_parts_to_file_with_checks (info); + save_mime_parts_to_file_with_checks ((GtkWindow*) dialog, info); } end: -- 1.7.9.5