2009-04-24 [colin] 3.7.1cvs45
authorColin Leroy <colin@colino.net>
Fri, 24 Apr 2009 10:30:14 +0000 (10:30 +0000)
committerColin Leroy <colin@colino.net>
Fri, 24 Apr 2009 10:30:14 +0000 (10:30 +0000)
* src/compose.c
Ask before sending if an attached file has
disappeared.

ChangeLog
PATCHSETS
configure.ac
src/compose.c

index da56cd0..e358319 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-24 [colin]     3.7.1cvs45
+
+       * src/compose.c
+               Ask before sending if an attached file has
+               disappeared.
+
 2009-04-19 [paul]      3.7.1cvs44
 
        * src/prefs_common.c
index 8e7e4ff..309cdfe 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.49.2.129 -r 1.49.2.130 src/procmime.c;  ) > 3.7.1cvs42.patchset
 ( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 tools/csv2addressbook.pl;  ) > 3.7.1cvs43.patchset
 ( cvs diff -u -r 1.204.2.189 -r 1.204.2.190 src/prefs_common.c;  cvs diff -u -r 1.103.2.123 -r 1.103.2.124 src/prefs_common.h;  cvs diff -u -r 1.4.2.74 -r 1.4.2.75 src/gtk/about.c;  ) > 3.7.1cvs44.patchset
+( cvs diff -u -r 1.382.2.506 -r 1.382.2.507 src/compose.c;  ) > 3.7.1cvs45.patchset
index 9400d2a..213b55c 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=44
+EXTRA_VERSION=45
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3c3cf4a..7dbc4b6 100644 (file)
@@ -282,7 +282,7 @@ static gint compose_queue_sub                       (Compose        *compose,
                                                 gchar          **msgpath,
                                                 gboolean       check_subject,
                                                 gboolean       remove_reedit_target);
-static void compose_add_attachments            (Compose        *compose,
+static int compose_add_attachments             (Compose        *compose,
                                                 MimeInfo       *parent);
 static gchar *compose_get_header               (Compose        *compose);
 
@@ -5358,7 +5358,8 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
                g_node_append(mimempart->node, mimetext->node);
                g_node_append(mimemsg->node, mimempart->node);
 
-               compose_add_attachments(compose, mimempart);
+               if (compose_add_attachments(compose, mimempart) < 0)
+                       return -1;
        } else
                g_node_append(mimemsg->node, mimetext->node);
 
@@ -5783,7 +5784,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        return 0;
 }
 
-static void compose_add_attachments(Compose *compose, MimeInfo *parent)
+static int compose_add_attachments(Compose *compose, MimeInfo *parent)
 {
        AttachInfo *ainfo;
        GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist);
@@ -5796,12 +5797,22 @@ static void compose_add_attachments(Compose *compose, MimeInfo *parent)
        model = gtk_tree_view_get_model(tree_view);
        
        if (!gtk_tree_model_get_iter_first(model, &iter))
-               return;
+               return 0;
        do {
                gtk_tree_model_get(model, &iter,
                                   COL_DATA, &ainfo,
                                   -1);
-                                                          
+               
+               if (!is_file_exist(ainfo->file)) {
+                       gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file);
+                       AlertValue val = alertpanel_full(_("Warning"), msg, _("Cancel sending"), _("Ignore attachment"),
+                                     NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT);
+                       g_free(msg);
+                       if (val == G_ALERTDEFAULT) {
+                               return -1;
+                       }
+                       continue;
+               }
                mimepart = procmime_mimeinfo_new();
                mimepart->content = MIMECONTENT_FILE;
                mimepart->data.filename = g_strdup(ainfo->file);
@@ -5850,6 +5861,8 @@ static void compose_add_attachments(Compose *compose, MimeInfo *parent)
 
                g_node_append(parent->node, mimepart->node);
        } while (gtk_tree_model_iter_next(model, &iter));
+       
+       return 0;
 }
 
 #define IS_IN_CUSTOM_HEADER(header) \