** Select the proper attachment to show the "replace file" confirmation dialog
authorSergio Villar Senin <svillar@igalia.com>
Tue, 2 Jun 2009 09:38:06 +0000 (11:38 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 2 Jun 2009 09:38:06 +0000 (11:38 +0200)
* Fixes NB#120155, wrong filename in replace existing file confirmation dialog

src/hildon2/modest-msg-view-window.c

index b901177..78f6f97 100644 (file)
@@ -2748,19 +2748,21 @@ save_mime_parts_to_file_with_checks (GtkWindow *parent,
        gboolean is_ok = TRUE;
         gint replaced_files = 0;
         const GList *files = info->pairs;
-        const GList *iter;
+        const GList *iter, *to_replace;
 
         for (iter = files; (iter != NULL) && (replaced_files < 2); iter = g_list_next(iter)) {
                 SaveMimePartPair *pair = iter->data;
                 if (modest_utils_file_exists (pair->filename)) {
                        replaced_files++;
+                       if (replaced_files == 1)
+                               to_replace = iter;
                 }
         }
        if (replaced_files) {
                gint response;
 
                if (replaced_files == 1) {
-                       SaveMimePartPair *pair = files->data;
+                       SaveMimePartPair *pair = to_replace->data;
                        const gchar *basename = strrchr (pair->filename, G_DIR_SEPARATOR) + 1;
                        gchar *escaped_basename, *message;