lease complete the changelog entry below
authorColin Leroy <colin@colino.net>
Fri, 18 Apr 2008 16:26:05 +0000 (16:26 +0000)
committerColin Leroy <colin@colino.net>
Fri, 18 Apr 2008 16:26:05 +0000 (16:26 +0000)
2008-04-18 [colin] 3.4.0cvs1

* src/addrduplicates.c
* src/addressbook.c
* src/compose.c
* src/crash.c
* src/editaddress.c
* src/folder.c
* src/image_viewer.c
* src/imap.c
* src/inc.c
* src/main.c
* src/mbox.c
* src/messageview.c
* src/mh.c
* src/msgcache.c
* src/news.c
* src/partial_download.c
* src/pop.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_other.c
* src/prefs_themes.c
* src/procheader.c
* src/procmime.c
* src/procmsg.c
* src/textview.c
* src/wizard.c
* src/common/prefs.c
* src/common/ssl_certificate.c
* src/common/template.c
* src/common/utils.c
* src/common/utils.h
* src/etpan/imap-thread.c
* src/plugins/dillo_viewer/dillo_viewer.c
* src/plugins/pgpcore/sgpgme.c
* src/plugins/pgpinline/pgpinline.c
Add an option to shred temporary files and messages
instead of just removing them. Slows deletions down!

38 files changed:
ChangeLog
PATCHSETS
configure.ac
src/addrduplicates.c
src/addressbook.c
src/common/prefs.c
src/common/ssl_certificate.c
src/common/template.c
src/common/utils.c
src/common/utils.h
src/compose.c
src/crash.c
src/editaddress.c
src/etpan/imap-thread.c
src/folder.c
src/image_viewer.c
src/imap.c
src/inc.c
src/main.c
src/mbox.c
src/messageview.c
src/mh.c
src/msgcache.c
src/news.c
src/partial_download.c
src/plugins/dillo_viewer/dillo_viewer.c
src/plugins/pgpcore/sgpgme.c
src/plugins/pgpinline/pgpinline.c
src/pop.c
src/prefs_common.c
src/prefs_common.h
src/prefs_other.c
src/prefs_themes.c
src/procheader.c
src/procmime.c
src/procmsg.c
src/textview.c
src/wizard.c

index 9c2fe0e..c0a7faa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+lease complete the changelog entry below
+2008-04-18 [colin]     3.4.0cvs1
+
+       * src/addrduplicates.c
+       * src/addressbook.c
+       * src/compose.c
+       * src/crash.c
+       * src/editaddress.c
+       * src/folder.c
+       * src/image_viewer.c
+       * src/imap.c
+       * src/inc.c
+       * src/main.c
+       * src/mbox.c
+       * src/messageview.c
+       * src/mh.c
+       * src/msgcache.c
+       * src/news.c
+       * src/partial_download.c
+       * src/pop.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/prefs_other.c
+       * src/prefs_themes.c
+       * src/procheader.c
+       * src/procmime.c
+       * src/procmsg.c
+       * src/textview.c
+       * src/wizard.c
+       * src/common/prefs.c
+       * src/common/ssl_certificate.c
+       * src/common/template.c
+       * src/common/utils.c
+       * src/common/utils.h
+       * src/etpan/imap-thread.c
+       * src/plugins/dillo_viewer/dillo_viewer.c
+       * src/plugins/pgpcore/sgpgme.c
+       * src/plugins/pgpinline/pgpinline.c
+               Add an option to shred temporary files and messages
+               instead of just removing them. Slows deletions down!
+
 2008-04-18 [paul]      3.4.0
 
        * NEWS
index 930c1bd..c3fc5b9 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.215 -r 1.179.2.216 src/imap.c;  cvs diff -u -r 1.395.2.363 -r 1.395.2.364 src/summaryview.c;  ) > 3.3.1cvs59.patchset
 ( cvs diff -u -r 1.42.2.36 -r 1.42.2.37 po/fr.po;  ) > 3.3.1cvs60.patchset
 ( cvs diff -u -r 1.58.2.37 -r 1.58.2.38 po/de.po;  cvs diff -u -r 1.1.2.17 -r 1.1.2.18 po/fi.po;  cvs diff -u -r 1.34.2.26 -r 1.34.2.27 po/it.po;  cvs diff -u -r 1.50.2.30 -r 1.50.2.31 po/pt_BR.po;  ) > 3.3.1cvs61.patchset
+( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/addrduplicates.c;  cvs diff -u -r 1.60.2.114 -r 1.60.2.115 src/addressbook.c;  cvs diff -u -r 1.382.2.442 -r 1.382.2.443 src/compose.c;  cvs diff -u -r 1.23.2.28 -r 1.23.2.29 src/crash.c;  cvs diff -u -r 1.14.2.48 -r 1.14.2.49 src/editaddress.c;  cvs diff -u -r 1.213.2.180 -r 1.213.2.181 src/folder.c;  cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/image_viewer.c;  cvs diff -u -r 1.179.2.216 -r 1.179.2.217 src/imap.c;  cvs diff -u -r 1.149.2.86 -r 1.149.2.87 src/inc.c;  cvs diff -u -r 1.115.2.193 -r 1.115.2.194 src/main.c;  cvs diff -u -r 1.28.2.42 -r 1.28.2.43 src/mbox.c;  cvs diff -u -r 1.94.2.174 -r 1.94.2.175 src/messageview.c;  cvs diff -u -r 1.79.2.64 -r 1.79.2.65 src/mh.c;  cvs diff -u -r 1.16.2.61 -r 1.16.2.62 src/msgcache.c;  cvs diff -u -r 1.101.2.49 -r 1.101.2.50 src/news.c;  cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/partial_download.c;  cvs diff -u -r 1.56.2.60 -r 1.56.2.61 src/pop.c;  cvs diff -u -r 1.204.2.163 -r 1.204.2.164 src/prefs_common.c;  cvs diff -u -r 1.103.2.105 -r 1.103.2.106 src/prefs_common.h;  cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/prefs_other.c;  cvs diff -u -r 1.3.2.54 -r 1.3.2.55 src/prefs_themes.c;  cvs diff -u -r 1.47.2.47 -r 1.47.2.48 src/procheader.c;  cvs diff -u -r 1.49.2.108 -r 1.49.2.109 src/procmime.c;  cvs diff -u -r 1.150.2.108 -r 1.150.2.109 src/procmsg.c;  cvs diff -u -r 1.96.2.199 -r 1.96.2.200 src/textview.c;  cvs diff -u -r 1.1.2.68 -r 1.1.2.69 src/wizard.c;  cvs diff -u -r 1.5.2.11 -r 1.5.2.12 src/common/prefs.c;  cvs diff -u -r 1.4.2.25 -r 1.4.2.26 src/common/ssl_certificate.c;  cvs diff -u -r 1.2.4.27 -r 1.2.4.28 src/common/template.c;  cvs diff -u -r 1.36.2.136 -r 1.36.2.137 src/common/utils.c;  cvs diff -u -r 1.20.2.60 -r 1.20.2.61 src/common/utils.h;  cvs diff -u -r 1.1.4.98 -r 1.1.4.99 src/etpan/imap-thread.c;  cvs diff -u -r 1.12.2.25 -r 1.12.2.26 src/plugins/dillo_viewer/dillo_viewer.c;  cvs diff -u -r 1.1.2.48 -r 1.1.2.49 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.38 -r 1.1.2.39 src/plugins/pgpinline/pgpinline.c;  ) > 3.4.0cvs1.patchset
index 416d22b..e57d859 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=0
+EXTRA_VERSION=1
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 59fd759..50f8c18 100644 (file)
@@ -871,7 +871,7 @@ gboolean addrduplicates_delete_item_person(ItemPerson *item, AddressDataSource *
        if(item) {
                gchar *filename = addritem_person_get_picture(item);
                if (filename && is_file_exist(filename))
-                       g_unlink(filename);
+                       claws_unlink(filename);
                g_free(filename);
                addritem_free_item_person(item);
        }
index c82f7dd..de591dd 100644 (file)
@@ -1527,7 +1527,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
                                if( item ) {
                                        gchar *filename = addritem_person_get_picture(item);
                                        if (filename && is_file_exist(filename))
-                                               g_unlink(filename);
+                                               claws_unlink(filename);
                                        g_free(filename);
                                        addritem_free_item_person( item );
                                }
@@ -4051,7 +4051,7 @@ static gboolean migrate_addrbook(const gchar *origdir, const gchar *destdir)
                        else {
                                gchar *orig_file = g_strconcat(origdir, G_DIR_SEPARATOR_S, 
                                                d->d_name, NULL);
-                               g_unlink(orig_file);
+                               claws_unlink(orig_file);
                                g_free(orig_file);
                        }
                }
index d4a45cb..6aa24c8 100644 (file)
@@ -164,7 +164,7 @@ gint prefs_file_close(PrefFile *pfile)
        tmppath = g_strconcat(path, ".tmp", NULL);
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(tmppath, "fclose");
-               g_unlink(tmppath);
+               claws_unlink(tmppath);
                g_free(path);
                g_free(tmppath);
                return -1;
@@ -173,11 +173,11 @@ gint prefs_file_close(PrefFile *pfile)
        if (is_file_exist(path)) {
                bakpath = g_strconcat(path, ".bak", NULL);
 #ifdef G_OS_WIN32
-                g_unlink(bakpath);
+                claws_unlink(bakpath);
 #endif
                if (rename(path, bakpath) < 0) {
                        FILE_OP_ERROR(path, "rename");
-                       g_unlink(tmppath);
+                       claws_unlink(tmppath);
                        g_free(path);
                        g_free(tmppath);
                        g_free(bakpath);
@@ -186,11 +186,11 @@ gint prefs_file_close(PrefFile *pfile)
        }
 
 #ifdef G_OS_WIN32
-        g_unlink(path);
+        claws_unlink(path);
 #endif
        if (rename(tmppath, path) < 0) {
                FILE_OP_ERROR(tmppath, "rename");
-               g_unlink(tmppath);
+               claws_unlink(tmppath);
                g_free(path);
                g_free(tmppath);
                g_free(bakpath);
@@ -222,7 +222,7 @@ gint prefs_file_close_revert(PrefFile *pfile)
                tmppath = g_strconcat(pfile->path, ".tmp", NULL);
        fclose(pfile->fp);
        if (pfile->writing) {
-               if (g_unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
+               if (claws_unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
                g_free(tmppath);
        }
        g_free(pfile->path);
index f8d0b02..6d230bd 100644 (file)
@@ -361,7 +361,7 @@ void ssl_certificate_delete_from_disk(SSLCertificate *cert)
        gchar *file;
        buf = g_strdup_printf("%d", cert->port);
        file = get_certificate_path(cert->host, buf, cert->fingerprint);
-       g_unlink (file);
+       claws_unlink (file);
        g_free(file);
        g_free(buf);
 }
index 7d5a1a9..d50c56b 100644 (file)
@@ -197,7 +197,7 @@ if (!(func)) \
 { \
        g_warning("Failed to write template to file\n"); \
        if (fp) fclose(fp); \
-       if (new) g_unlink(new); \
+       if (new) claws_unlink(new); \
        g_free(new); \
        g_free(filename); \
        return; \
@@ -267,7 +267,7 @@ static void template_write_config(GSList *tmpl_list)
                TRY(fclose(fp) != EOF);
 
                if (new) {
-                       g_unlink(filename);
+                       claws_unlink(filename);
                        rename_force(new, filename);
                }
                g_free(new);
@@ -280,7 +280,7 @@ static void template_write_config(GSList *tmpl_list)
                                       itos(tmpl_num), NULL);
                if (is_file_exist(filename)) {
                        debug_print("removing old template %d\n", tmpl_num);
-                       g_unlink(filename);
+                       claws_unlink(filename);
                        g_free(filename);
                } else {
                        g_free(filename);
index 8bd3d60..a574c9b 100644 (file)
@@ -485,7 +485,7 @@ gint file_strip_crs(const gchar *file)
        
        return 0;
 unlinkout:
-       g_unlink(out);
+       claws_unlink(out);
 freeout:
        g_free(out);
        return -1;
@@ -2234,7 +2234,7 @@ gint remove_all_files(const gchar *dir)
        }
 
        while ((dir_name = g_dir_read_name(dp)) != NULL) {
-               if (g_unlink(dir_name) < 0)
+               if (claws_unlink(dir_name) < 0)
                        FILE_OP_ERROR(dir_name, "unlink");
        }
 
@@ -2277,7 +2277,7 @@ gint remove_numbered_files(const gchar *dir, guint first, guint last)
                if (file_no > 0 && first <= file_no && file_no <= last) {
                        if (is_dir_exist(dir_name))
                                continue;
-                       if (g_unlink(dir_name) < 0)
+                       if (claws_unlink(dir_name) < 0)
                                FILE_OP_ERROR(dir_name, "unlink");
                }
        }
@@ -2322,7 +2322,7 @@ gint remove_numbered_files_not_in_list(const gchar *dir, GSList *numberlist)
                        debug_print("removing unwanted file %d from %s\n", file_no, dir);
                        if (is_dir_exist(dir_name))
                                continue;
-                       if (g_unlink(dir_name) < 0)
+                       if (claws_unlink(dir_name) < 0)
                                FILE_OP_ERROR(dir_name, "unlink");
                }
        }
@@ -2359,7 +2359,7 @@ gint remove_dir_recursive(const gchar *dir)
        }
 
        if (!S_ISDIR(s.st_mode)) {
-               if (g_unlink(dir) < 0) {
+               if (claws_unlink(dir) < 0) {
                        FILE_OP_ERROR(dir, "unlink");
                        return -1;
                }
@@ -2402,7 +2402,7 @@ gint remove_dir_recursive(const gchar *dir)
                                return -1;
                        }
                } else {
-                       if (g_unlink(dir_name) < 0)
+                       if (claws_unlink(dir_name) < 0)
                                FILE_OP_ERROR(dir_name, "unlink");
                }
        }
@@ -2433,7 +2433,7 @@ gint rename_force(const gchar *oldpath, const gchar *newpath)
                return -1;
        }
        if (is_file_exist(newpath)) {
-               if (g_unlink(newpath) < 0)
+               if (claws_unlink(newpath) < 0)
                        FILE_OP_ERROR(newpath, "unlink");
        }
 #endif
@@ -2475,7 +2475,7 @@ gint append_file(const gchar *src, const gchar *dest, gboolean keep_backup)
                        g_warning("writing to %s failed.\n", dest);
                        fclose(dest_fp);
                        fclose(src_fp);
-                       g_unlink(dest);
+                       claws_unlink(dest);
                        return -1;
                }
        }
@@ -2491,7 +2491,7 @@ gint append_file(const gchar *src, const gchar *dest, gboolean keep_backup)
        }
 
        if (err) {
-               g_unlink(dest);
+               claws_unlink(dest);
                return -1;
        }
 
@@ -2543,7 +2543,7 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
                        g_warning("writing to %s failed.\n", dest);
                        fclose(dest_fp);
                        fclose(src_fp);
-                       g_unlink(dest);
+                       claws_unlink(dest);
                        if (dest_bak) {
                                if (rename_force(dest_bak, dest) < 0)
                                        FILE_OP_ERROR(dest_bak, "rename");
@@ -2564,7 +2564,7 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
        }
 
        if (err) {
-               g_unlink(dest);
+               claws_unlink(dest);
                if (dest_bak) {
                        if (rename_force(dest_bak, dest) < 0)
                                FILE_OP_ERROR(dest_bak, "rename");
@@ -2574,7 +2574,7 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
        }
 
        if (keep_backup == FALSE && dest_bak)
-               g_unlink(dest_bak);
+               claws_unlink(dest_bak);
 
        g_free(dest_bak);
 
@@ -2597,7 +2597,7 @@ gint move_file(const gchar *src, const gchar *dest, gboolean overwrite)
 
        if (copy_file(src, dest, FALSE) < 0) return -1;
 
-       g_unlink(src);
+       claws_unlink(src);
 
        return 0;
 }
@@ -2661,7 +2661,7 @@ gint copy_file_part(FILE *fp, off_t offset, size_t length, const gchar *dest)
 
        if (err) {
                g_warning("writing to %s failed.\n", dest);
-               g_unlink(dest);
+               claws_unlink(dest);
                return -1;
        }
 
@@ -2754,7 +2754,7 @@ gint canonicalize_file(const gchar *src, const gchar *dest)
                        g_warning("writing to %s failed.\n", dest);
                        fclose(dest_fp);
                        fclose(src_fp);
-                       g_unlink(dest);
+                       claws_unlink(dest);
                        return -1;
                }
        }
@@ -2775,7 +2775,7 @@ gint canonicalize_file(const gchar *src, const gchar *dest)
        }
 
        if (err) {
-               g_unlink(dest);
+               claws_unlink(dest);
                return -1;
        }
 
@@ -2795,7 +2795,7 @@ gint canonicalize_file_replace(const gchar *file)
 
        if (move_file(tmp_file, file, TRUE) < 0) {
                g_warning("can't replace %s .\n", file);
-               g_unlink(tmp_file);
+               claws_unlink(tmp_file);
                g_free(tmp_file);
                return -1;
        }
@@ -2945,7 +2945,7 @@ FILE *my_tmpfile(void)
                return tmpfile();
 
 #ifndef G_OS_WIN32
-       g_unlink(fname);
+       claws_unlink(fname);
        
        /* verify that we can write in the file after unlinking */
        if (write(fd, buf, 1) < 0) {
@@ -3031,13 +3031,13 @@ gint str_write_to_file(const gchar *str, const gchar *file)
        if (fwrite(str, 1, len, fp) != len) {
                FILE_OP_ERROR(file, "fwrite");
                fclose(fp);
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(file, "fclose");
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
@@ -5010,3 +5010,35 @@ size_t fast_strftime(gchar *buf, gint buflen, const gchar *format, struct tm *lt
        *curpos++ = '\0';
        return total_done;
 }
+
+gboolean prefs_common_get_use_shred(void);
+
+int claws_unlink(const gchar *filename) 
+{
+       struct stat s;
+       static int found_shred = -1;
+       static const gchar *args[4];
+
+       if (found_shred == -1) {
+               /* init */
+               args[0] = g_find_program_in_path("shred");
+               debug_print("found shred: %s\n", args[0]);
+               found_shred = (args[0] != NULL) ? 1:0;
+               args[1] = "-f";
+               args[3] = NULL;
+       }
+       if (found_shred == 1 && prefs_common_get_use_shred()) {
+               if (is_file_exist(filename) && g_stat(filename, &s) == 0) {
+                       if (s.st_nlink == 1) {
+                               gint status=0;
+                               args[2] = filename;
+                               g_spawn_sync(NULL, (gchar **)args, NULL, 0,
+                                NULL, NULL, NULL, NULL, &status, NULL);
+                               debug_print("%s %s exited with status %d\n",
+                                       args[0], filename, WEXITSTATUS(status));
+                               truncate(filename, 0);
+                       }
+               }
+       }
+       return g_unlink(filename);
+}
index 12a90be..6754c7b 100644 (file)
@@ -50,7 +50,7 @@
 #define g_mkdir                mkdir
 #define g_stat         stat
 #define g_lstat                lstat
-#define g_unlink       unlink
+#define claws_unlink   unlink
 #define g_remove       remove
 #define g_rmdir                rmdir
 #define g_fopen                fopen
@@ -527,6 +527,8 @@ void mailcap_update_default    (const gchar *type,
 gboolean file_is_email(const gchar *filename);
 gboolean sc_g_list_bigger(GList *list, gint max);
 gboolean sc_g_slist_bigger(GSList *list, gint max);
+
+int claws_unlink(const gchar *filename);
 #ifdef __cplusplus
 }
 #endif
index d14f8d8..a455ac8 100644 (file)
@@ -4823,7 +4823,7 @@ gint compose_send(Compose *compose)
                g_free(msgpath);
        } else {
                val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
-               g_unlink(msgpath);
+               claws_unlink(msgpath);
                g_free(msgpath);
        }
        if (!discard_window) {
@@ -5379,7 +5379,7 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
                FILE_OP_ERROR(file, "fwrite");
                g_free(chars);
                fclose(fp);
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
@@ -5387,7 +5387,7 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
 
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(file, "fclose");
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
        return 0;
@@ -5590,7 +5590,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                        if (!compose_warn_encryption(compose)) {
                                lock = FALSE;
                                fclose(fp);
-                               g_unlink(tmp);
+                               claws_unlink(tmp);
                                g_free(tmp);
                                return -6;
                        }
@@ -5614,7 +5614,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                                 * key selection */
                                lock = FALSE;
                                fclose(fp);
-                               g_unlink(tmp);
+                               claws_unlink(tmp);
                                g_free(tmp);
                                return -5;
                        }
@@ -5658,7 +5658,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                if (compose_redirect_write_to_file(compose, fp) < 0) {
                        lock = FALSE;
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        g_free(tmp);
                        return -2;
                }
@@ -5667,7 +5667,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                if ((result = compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_SEND, TRUE)) < 0) {
                        lock = FALSE;
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        g_free(tmp);
                        return result - 1; /* -2 for a generic error, -3 for signing error, -4 for encoding */
                }
@@ -5675,14 +5675,14 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        if (err == TRUE) {
                g_warning("failed to write queue message\n");
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                lock = FALSE;
                return -2;
        }
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(tmp, "fclose");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                lock = FALSE;
                return -2;
@@ -5695,7 +5695,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        }
        if (!queue) {
                g_warning("can't find queue folder\n");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                lock = FALSE;
                return -1;
@@ -5703,14 +5703,14 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
        folder_item_scan(queue);
        if ((num = folder_item_add_msg(queue, tmp, NULL, FALSE)) < 0) {
                g_warning("can't queue the message\n");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                lock = FALSE;
                return -1;
        }
        
        if (msgpath == NULL) {
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
        } else
                *msgpath = tmp;
@@ -8405,11 +8405,11 @@ static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition,
                compose_insert_file(compose, compose->exteditor_file);
                compose_changed_cb(NULL, compose);
 
-               if (g_unlink(compose->exteditor_file) < 0)
+               if (claws_unlink(compose->exteditor_file) < 0)
                        FILE_OP_ERROR(compose->exteditor_file, "unlink");
        } else if (buf[0] == '1') {     /* failed */
                g_warning("Couldn't exec external editor\n");
-               if (g_unlink(compose->exteditor_file) < 0)
+               if (claws_unlink(compose->exteditor_file) < 0)
                        FILE_OP_ERROR(compose->exteditor_file, "unlink");
        } else if (buf[0] == '2') {
                g_warning("Couldn't write to file\n");
@@ -8852,7 +8852,7 @@ gboolean compose_draft (gpointer data, guint action)
        }
        if (msgnum < 0) {
 warn_err:
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                if (action != COMPOSE_AUTO_SAVE) {
                        if (action != COMPOSE_DRAFT_FOR_EXIT)
@@ -8953,7 +8953,7 @@ void compose_clear_exit_drafts(void)
        gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
                                      DRAFTED_AT_EXIT, NULL);
        if (is_file_exist(filepath))
-               g_unlink(filepath);
+               claws_unlink(filepath);
        
        g_free(filepath);
 }
@@ -9912,7 +9912,7 @@ static void compose_insert_drag_received_cb (GtkWidget            *widget,
                        str_write_to_file(tmpdata, tmpfile);
                        g_free(tmpdata);  
                        compose_insert_file(compose, tmpfile);
-                       g_unlink(tmpfile);
+                       claws_unlink(tmpfile);
                        g_free(tmpfile);
                        gtk_drag_finish(drag_context, TRUE, FALSE, time);
                        compose_beautify_paragraph(compose, NULL, TRUE);
@@ -9972,7 +9972,7 @@ static void compose_insert_drag_received_cb (GtkWidget            *widget,
                gchar *tmpfile = get_tmp_file();
                str_write_to_file((const gchar *)data->data, tmpfile);
                compose_insert_file(compose, tmpfile);
-               g_unlink(tmpfile);
+               claws_unlink(tmpfile);
                g_free(tmpfile);
                gtk_drag_finish(drag_context, TRUE, FALSE, time);
 #endif
index dffe918..a9e8546 100644 (file)
@@ -559,7 +559,7 @@ static void crash_handler(int sig)
 static void crash_cleanup_exit(void)
 {
        const char *filename = claws_get_socket_name();
-       g_unlink(filename);
+       claws_unlink(filename);
 }
 
 #endif
index 4621bbb..f11537e 100644 (file)
@@ -1590,7 +1590,7 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
                        else 
                                name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S, 
                                                current_person->picture, ".png", NULL );
-                       g_unlink(name);
+                       claws_unlink(name);
                        g_free(name);
                }
                name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
index 7596b3e..74254a1 100644 (file)
@@ -2392,7 +2392,7 @@ static void fetch_content_run(struct etpan_thread_op * op)
        close:
                close(fd);
        unlink:
-               g_unlink(param->filename);
+               claws_unlink(param->filename);
        
        free:
                /* mmap_string_unref is a simple free in libetpan
index 1847608..4a8143d 100644 (file)
@@ -3051,7 +3051,7 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
                                lastnum = num;
 
                        if (num >= 0 && remove_source) {
-                               if (g_unlink(fileinfo->file) < 0)
+                               if (claws_unlink(fileinfo->file) < 0)
                                        FILE_OP_ERROR(fileinfo->file, "unlink");
                        }
 
@@ -3728,7 +3728,7 @@ void folder_item_discard_cache(FolderItem *item)
        
        cache = folder_item_get_cache_file(item);
        if (is_file_exist(cache))
-               g_unlink(cache);
+               claws_unlink(cache);
        g_free(cache);
        
 }
index 2035ce1..acf2fc1 100644 (file)
@@ -149,7 +149,7 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
                return;
        }
        image_viewer_load_file(imageviewer, imgfile);
-       g_unlink(imgfile);
+       claws_unlink(imgfile);
        g_free(imgfile);
 }
 
index 6c4cad1..eec26bf 100644 (file)
@@ -1242,7 +1242,7 @@ static void imap_remove_cached_msg(Folder *folder, FolderItem *item, MsgInfo *ms
        g_free(path);
 
        if (is_file_exist(filename)) {
-               g_unlink(filename);
+               claws_unlink(filename);
        }
        g_free(filename);
 }
index e03cc0a..4f38d9a 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1119,7 +1119,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file)
        } else
                inbox = folder_get_default_inbox();
        if (!inbox) {
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
@@ -1129,7 +1129,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file)
        /* add msg file to drop folder */
        if ((msgnum = folder_item_add_msg(
                        dropfolder, file, NULL, TRUE)) < 0) {
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
@@ -1377,7 +1377,7 @@ static gint get_spool(FolderItem *dest, const gchar *mbox, PrefsAccount *account
 
        msgs = proc_mbox(dest, tmp_mbox, account->filter_on_recv, account);
 
-       g_unlink(tmp_mbox);
+       claws_unlink(tmp_mbox);
        if (msgs >= 0) empty_mbox(mbox);
        unlock_mbox(mbox, lockfd, LOCK_FLOCK);
 
index 728678b..023d47f 100644 (file)
@@ -1597,7 +1597,7 @@ static void exit_claws(MainWindow *mainwin)
 #endif
        /* delete crashfile */
        if (!cmd.crash)
-               g_unlink(get_crashfile_name());
+               claws_unlink(get_crashfile_name());
 
        lock_socket_remove();
 
@@ -1991,7 +1991,7 @@ static gint prohibit_duplicate_launch(void)
                x_display = g_strdup(g_getenv("DISPLAY"));
 
        if (uxsock < 0) {
-               g_unlink(path);
+               claws_unlink(path);
                return fd_open_unix(path);
        }
 
@@ -2108,7 +2108,7 @@ static gint lock_socket_remove(void)
        }
        fd_close(lock_socket);
        filename = claws_get_socket_name();
-       g_unlink(filename);
+       claws_unlink(filename);
 #endif
 
        return 0;
index 1bbd0f1..dfe8efe 100644 (file)
@@ -71,7 +71,7 @@
                g_warning("can't write to temporary file\n"); \
                fclose(tmp_fp); \
                fclose(mbox_fp); \
-               g_unlink(tmp_file); \
+               claws_unlink(tmp_file); \
                g_free(tmp_file); \
                return -1; \
        } \
@@ -223,7 +223,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
                        g_warning("malformed mbox: %s: message %d is empty\n", mbox, msgs);
                        fclose(tmp_fp);
                        fclose(mbox_fp);
-                       g_unlink(tmp_file);
+                       claws_unlink(tmp_file);
                        return -1;
                }
 
@@ -231,7 +231,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
                        FILE_OP_ERROR(tmp_file, "fclose");
                        g_warning("can't write to temporary file\n");
                        fclose(mbox_fp);
-                       g_unlink(tmp_file);
+                       claws_unlink(tmp_file);
                        g_free(tmp_file);
                        return -1;
                }
@@ -239,7 +239,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
                if (apply_filter) {
                        if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, NULL, TRUE)) < 0) {
                                fclose(mbox_fp);
-                               g_unlink(tmp_file);
+                               claws_unlink(tmp_file);
                                g_free(tmp_file);
                                return -1;
                        }
@@ -334,7 +334,7 @@ gint lock_mbox(const gchar *base, LockType type)
                        FILE_OP_ERROR(lockfile, "link");
                        if (retry >= 5) {
                                g_warning("can't create %s\n", lockfile);
-                               g_unlink(lockfile);
+                               claws_unlink(lockfile);
                                g_free(lockfile);
                                return -1;
                        }
@@ -344,7 +344,7 @@ gint lock_mbox(const gchar *base, LockType type)
                        retry++;
                        sleep(5);
                }
-               g_unlink(lockfile);
+               claws_unlink(lockfile);
                g_free(lockfile);
        } else if (type == LOCK_FLOCK) {
                gint lockfd;
@@ -409,7 +409,7 @@ gint unlock_mbox(const gchar *base, gint fd, LockType type)
                gchar *lockfile;
 
                lockfile = g_strconcat(base, ".lock", NULL);
-               if (g_unlink(lockfile) < 0) {
+               if (claws_unlink(lockfile) < 0) {
                        FILE_OP_ERROR(lockfile, "unlink");
                        g_free(lockfile);
                        return -1;
@@ -491,7 +491,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
                if (fwrite(buf, 1, n_read, dest_fp) < n_read) {
                        g_warning("writing to %s failed.\n", dest);
                        fclose(dest_fp);
-                       g_unlink(dest);
+                       claws_unlink(dest);
                        return -1;
                }
        }
@@ -508,7 +508,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
        }
 
        if (err) {
-               g_unlink(dest);
+               claws_unlink(dest);
                return -1;
        }
 
index 6ca316e..51864f7 100644 (file)
@@ -770,7 +770,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                    addrp) < 0) {
                g_free(addrp);
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -785,7 +785,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                if (fprintf(fp, "SCF:%s\n", path) < 0) {
                        g_free(path);
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        return -1;
                }
                g_free(path);
@@ -793,7 +793,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
        if (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0) {
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -801,7 +801,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        get_rfc822_date(buf, sizeof(buf));
        if (fprintf(fp, "Date: %s\n", buf) < 0) {
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -812,20 +812,20 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                         strlen("From: "));
                if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0) {
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        return -1;
                }
        } else
                if (fprintf(fp, "From: %s\n", account->address) < 0) {
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        return -1;
                }
 
 
        if (fprintf(fp, "To: %s\n", to) < 0) {
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -834,7 +834,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                                    strlen("Subject: "));
        if (fprintf(fp, "Subject: Disposition notification: %s\n", buf) < 0) {
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -855,7 +855,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
                if (fprintf(fp, "Message-ID: <%s>\n", buf) < 0) {
                        fclose(fp);
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        return -1;
                }
        }
@@ -923,7 +923,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                        msginfo->msgid?msginfo->msgid:"NO MESSAGE ID",
                        boundary) < 0) {
                fclose(fp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(boundary);
                return -1;
        }
@@ -935,7 +935,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(tmp, "fclose");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
 
@@ -944,13 +944,13 @@ static gint disposition_notification_send(MsgInfo *msginfo)
        if (!queue) queue = folder_get_default_queue();
        if (!queue) {
                g_warning("can't find queue folder\n");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
        folder_item_scan(queue);
        if ((num = folder_item_add_msg(queue, tmp, NULL, TRUE)) < 0) {
                g_warning("can't queue the message\n");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                return -1;
        }
                
index c663b49..19debf0 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -626,7 +626,7 @@ static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
        need_scan = mh_scan_required(folder, item);
        last_mtime = item->mtime;
 
-       if (g_unlink(file) < 0) {
+       if (claws_unlink(file) < 0) {
                FILE_OP_ERROR(file, "unlink");
                g_free(file);
                return -1;
@@ -679,7 +679,7 @@ static gint mh_remove_msgs(Folder *folder, FolderItem *item,
                if (file == NULL)
                        continue;
                
-               if (g_unlink(file) < 0) {
+               if (claws_unlink(file) < 0) {
                        g_free(file);
                        continue;
                }
index 635f218..b3e1723 100644 (file)
@@ -1187,7 +1187,7 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
        if (w_err != 0) {
                g_warning("failed to write charset\n");
                fclose(write_fps.cache_fp);
-               g_unlink(new_cache);
+               claws_unlink(new_cache);
                g_free(new_cache);
                g_free(new_mark);
                g_free(new_tags);
@@ -1198,7 +1198,7 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
                DATA_WRITE, NULL, 0);
        if (write_fps.mark_fp == NULL) {
                fclose(write_fps.cache_fp);
-               g_unlink(new_cache);
+               claws_unlink(new_cache);
                g_free(new_cache);
                g_free(new_mark);
                g_free(new_tags);
@@ -1210,8 +1210,8 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
        if (write_fps.tags_fp == NULL) {
                fclose(write_fps.cache_fp);
                fclose(write_fps.mark_fp);
-               g_unlink(new_cache);
-               g_unlink(new_mark);
+               claws_unlink(new_cache);
+               claws_unlink(new_mark);
                g_free(new_cache);
                g_free(new_mark);
                g_free(new_tags);
@@ -1358,9 +1358,9 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
 
 
        if (write_fps.error != 0) {
-               g_unlink(new_cache);
-               g_unlink(new_mark);
-               g_unlink(new_tags);
+               claws_unlink(new_cache);
+               claws_unlink(new_mark);
+               claws_unlink(new_tags);
                g_free(new_cache);
                g_free(new_mark);
                g_free(new_tags);
index 4d906e8..473f043 100644 (file)
@@ -211,7 +211,7 @@ static int news_remove_msg           (Folder        *folder,
        
        filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(msgnum), NULL);
        g_free(path);
-       g_unlink(filename);
+       claws_unlink(filename);
        g_free(filename);
        return 0;
 }
@@ -437,7 +437,7 @@ static void news_remove_cached_msg(Folder *folder, FolderItem *item, MsgInfo *ms
        g_free(path);
 
        if (is_file_exist(filename)) {
-               g_unlink(filename);
+               claws_unlink(filename);
        }
        g_free(filename);
 }
@@ -881,14 +881,14 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
                       buf) < 0) {
                FILE_OP_ERROR(tmp, "fprintf");
                fclose(tmpfp);
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                return -1;
        }
 
        if (fclose(tmpfp) == EOF) {
                FILE_OP_ERROR(tmp, "fclose");
-               g_unlink(tmp);
+               claws_unlink(tmp);
                g_free(tmp);
                return -1;
        }
index dab970d..b31dce5 100644 (file)
@@ -317,7 +317,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
        }
 
        fclose(fp);
-       g_unlink(filename);
+       claws_unlink(filename);
        rename(pathnew, filename);
        g_free(pathnew);
        msginfo->planned_download = download;
index c844944..1399a3e 100644 (file)
@@ -144,7 +144,7 @@ static void dillo_show_mimepart(MimeViewer *_viewer,
        debug_print("dillo_show_mimepart\n");
 
        if (viewer->filename != NULL) {
-               g_unlink(viewer->filename);
+               claws_unlink(viewer->filename);
                g_free(viewer->filename);
        }
 
@@ -198,7 +198,7 @@ static void dillo_destroy_viewer(MimeViewer *_viewer)
        }
 
        gtk_widget_unref(GTK_WIDGET(viewer->widget));
-       g_unlink(viewer->filename);
+       claws_unlink(viewer->filename);
        g_free(viewer->filename);
        g_free(viewer);
 }
index cf70ec0..0fcce59 100644 (file)
@@ -353,7 +353,7 @@ gpgme_data_t sgpgme_data_from_mimeinfo(MimeInfo *mimeinfo)
        debug_print("tmp file %s\n", tmp_file);
        
        err = gpgme_data_new_from_file(&data, tmp_file, 1);
-       g_unlink(tmp_file);
+       claws_unlink(tmp_file);
        g_free(tmp_file);
 
        debug_print("data %p (%d %d)\n", (void *)&data, mimeinfo->offset, mimeinfo->length);
index e4f14d0..dfd6cd0 100644 (file)
@@ -689,7 +689,7 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account)
        if (msgcontent->content == MIMECONTENT_FILE &&
            msgcontent->data.filename != NULL) {
                if (msgcontent->tmp == TRUE)
-                       g_unlink(msgcontent->data.filename);
+                       claws_unlink(msgcontent->data.filename);
                g_free(msgcontent->data.filename);
        }
        msgcontent->data.mem = g_strdup(tmp);
@@ -825,7 +825,7 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
        if (msgcontent->content == MIMECONTENT_FILE &&
            msgcontent->data.filename != NULL) {
                if (msgcontent->tmp == TRUE)
-                       g_unlink(msgcontent->data.filename);
+                       claws_unlink(msgcontent->data.filename);
                g_free(msgcontent->data.filename);
        }
        msgcontent->data.mem = g_strdup(tmp);
index 3ce3eb7..fdb6ff0 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -699,7 +699,7 @@ gint pop3_write_uidl_list(Pop3Session *session)
        }
        fp = NULL;
 #ifdef G_OS_WIN32
-       g_unlink(path);
+       claws_unlink(path);
 #endif
        if (g_rename(tmp_path, path) < 0) {
                FILE_OP_ERROR(path, "rename");
@@ -738,7 +738,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
                if (fprintf(fp, "%s\n", prefix) < 0) {
                        FILE_OP_ERROR(file, "fprintf");
                        fclose(fp);
-                       g_unlink(file);
+                       claws_unlink(file);
                        return -1;
                }
        }
@@ -754,7 +754,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
                        FILE_OP_ERROR(file, "fwrite");
                        g_warning("can't write to file: %s\n", file);
                        fclose(fp);
-                       g_unlink(file);
+                       claws_unlink(file);
                        return -1;
                }
 
@@ -780,7 +780,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
                FILE_OP_ERROR(file, "fwrite");
                g_warning("can't write to file: %s\n", file);
                fclose(fp);
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
        if (data[len - 1] != '\r' && data[len - 1] != '\n') {
@@ -788,14 +788,14 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
                        FILE_OP_ERROR(file, "fputc");
                        g_warning("can't write to file: %s\n", file);
                        fclose(fp);
-                       g_unlink(file);
+                       claws_unlink(file);
                        return -1;
                }
        }
 
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(file, "fclose");
-               g_unlink(file);
+               claws_unlink(file);
                return -1;
        }
 
index 82e5e54..accf92a 100644 (file)
@@ -1097,6 +1097,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"use_networkmanager", "TRUE", &prefs_common.use_networkmanager, P_BOOL,
         NULL, NULL, NULL},
+       {"use_shred", "FALSE", &prefs_common.use_shred, P_BOOL,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -1238,7 +1240,7 @@ static void prefs_common_save_history_to_dir(const gchar *dirname, const gchar *
        }
        fp = NULL;
 #ifdef G_OS_WIN32
-       g_unlink(path);
+       claws_unlink(path);
 #endif
        if (g_rename(tmp_path, path) < 0) {
                FILE_OP_ERROR(path, "rename");
@@ -1526,3 +1528,8 @@ const gchar *prefs_common_get_ext_editor_cmd(void)
        return "xdg-open %s";
 #endif 
 }
+
+gboolean prefs_common_get_use_shred(void)
+{
+       return prefs_common.use_shred;
+}
index a3f4cc4..7c6b8ef 100644 (file)
@@ -485,6 +485,7 @@ struct _PrefsCommon
        gint print_previewwin_height;
        
        gboolean use_networkmanager;
+       gboolean use_shred;
 };
 
 extern PrefsCommon prefs_common;
index adabb51..15abaf6 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _OtherPage
        GtkWidget *spinbtn_iotimeout;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *checkbtn_askonfilter;
+       GtkWidget *checkbtn_use_shred;
        GtkWidget *checkbtn_real_time_sync;
 } OtherPage;
 
@@ -496,7 +497,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *frame_keys;
        GtkWidget *vbox_keys;
        GtkWidget *checkbtn_gtk_can_change_accels;
-       GtkTooltips *gtk_can_change_accels_tooltip;
+       GtkTooltips *tooltips;
        GtkWidget *button_keybind;
 
        GtkWidget *label_iotimeout;
@@ -506,7 +507,9 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *vbox2;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_askonfilter;
+       GtkWidget *checkbtn_use_shred;
        GtkWidget *checkbtn_real_time_sync;
+       gchar *shred_binary = NULL;
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
@@ -537,8 +540,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
                        _("Enable customisable keyboard shortcuts"));
-       gtk_can_change_accels_tooltip = gtk_tooltips_new();
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(gtk_can_change_accels_tooltip),
+       tooltips = gtk_tooltips_new();
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
                        checkbtn_gtk_can_change_accels,
                        _("If checked, you can change the keyboard shortcuts of "
                                "most of the menu items by focusing on the menu "
@@ -587,6 +590,23 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
                           _("Ask about account specific filtering rules when "
                             "filtering manually"));
+       shred_binary = g_find_program_in_path("shred");
+       if (shred_binary) {
+               PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+                                  _("Use secure file deletion if possible"));
+               g_free(shred_binary);
+       } else {
+               PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+                                  _("Use secure file deletion if possible\n"
+                                    "(the 'shred' program is not available)"));
+               gtk_widget_set_sensitive(checkbtn_use_shred, FALSE);
+       }
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
+                       checkbtn_use_shred,
+                       _("Use the 'shred' program to overwrite files with random data before "
+                         "deleting them. This slows down deletion. Be sure to "
+                         "read shred's man page for caveats."),
+                       NULL);
        PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
                           _("Synchronise offline folders as soon as possible"));
 
@@ -608,6 +628,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter), 
                prefs_common.ask_apply_per_account_filtering_rules);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred), 
+               prefs_common.use_shred);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync), 
                prefs_common.real_time_sync);
 
@@ -619,6 +641,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
        prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
        prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
+       prefs_other->checkbtn_use_shred = checkbtn_use_shred;
        prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
 
        prefs_other->page.widget = vbox1;
@@ -648,6 +671,9 @@ static void prefs_other_save(PrefsPage *_page)
        prefs_common.ask_apply_per_account_filtering_rules = 
                gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter)); 
+       prefs_common.use_shred = 
+               gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_use_shred)); 
        prefs_common.real_time_sync = 
                gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync)); 
index da9e7d8..e4a7e0e 100644 (file)
@@ -189,7 +189,7 @@ static void prefs_themes_file_remove(const gchar *filename, gpointer data)
                        g_warning("prefs_themes_file_remove(): subdir in theme dir skipped: '%s'.\n",
                                                base);
        }
-       else if (0 != g_unlink(filename)) {
+       else if (0 != claws_unlink(filename)) {
                (*status) = g_strdup(filename);
        }
        g_free(base);
index f645b07..392b55f 100644 (file)
@@ -1006,7 +1006,7 @@ gint procheader_get_header_from_msginfo(MsgInfo *msginfo, gchar *buf, gint len,
        val = procheader_get_one_field(buf,len, fp, hentry);
        if (fclose(fp) == EOF) {
                FILE_OP_ERROR(file, "fclose");
-               g_unlink(file);
+               claws_unlink(file);
                g_free(file);
                return -1;
        }
index 2c1dfb7..9caa402 100644 (file)
@@ -110,7 +110,7 @@ static gboolean free_func(GNode *node, gpointer data)
        switch (mimeinfo->content) {
        case MIMECONTENT_FILE:
                if (mimeinfo->tmp)
-                       g_unlink(mimeinfo->data.filename);
+                       claws_unlink(mimeinfo->data.filename);
                g_free(mimeinfo->data.filename);
                break;
 
@@ -438,7 +438,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
 
        stat(tmpfilename, &statbuf);
        if (mimeinfo->tmp && (mimeinfo->data.filename != NULL))
-               g_unlink(mimeinfo->data.filename);
+               claws_unlink(mimeinfo->data.filename);
        g_free(mimeinfo->data.filename);
        mimeinfo->data.filename = tmpfilename;
        mimeinfo->tmp = TRUE;
@@ -503,7 +503,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
                                }
                                if ((tmp_fp = g_fopen(tmp_file, "rb")) == NULL) {
                                        FILE_OP_ERROR(tmp_file, "fopen");
-                                       g_unlink(tmp_file);
+                                       claws_unlink(tmp_file);
                                        g_free(tmp_file);
                                        fclose(infp);
                                        return FALSE;
@@ -538,7 +538,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
 
                if (tmp_file) {
                        fclose(tmp_fp);
-                       g_unlink(tmp_file);
+                       claws_unlink(tmp_file);
                        g_free(tmp_file);
                }
        } else if (encoding == ENC_QUOTED_PRINTABLE) {
@@ -579,7 +579,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
 
        if (mimeinfo->content == MIMECONTENT_FILE) {
                if (mimeinfo->tmp && (mimeinfo->data.filename != NULL))
-                       g_unlink(mimeinfo->data.filename);
+                       claws_unlink(mimeinfo->data.filename);
                g_free(mimeinfo->data.filename);
        } else if (mimeinfo->content == MIMECONTENT_MEM) {
                if (mimeinfo->tmp && (mimeinfo->data.mem != NULL))
@@ -643,7 +643,7 @@ gint procmime_get_part(const gchar *outfile, MimeInfo *mimeinfo)
        if (fclose(outfp) == EOF) {
                saved_errno = errno;
                FILE_OP_ERROR(outfile, "fclose");
-               g_unlink(outfile);
+               claws_unlink(outfile);
                return -(saved_errno);
        }
 
@@ -735,7 +735,7 @@ static FILE *procmime_get_text_content(MimeInfo *mimeinfo)
 
        fclose(tmpfp);
        rewind(outfp);
-       g_unlink(tmpfile);
+       claws_unlink(tmpfile);
        g_free(tmpfile);
 
        if (err == TRUE) {
index f1fb163..ba53cee 100644 (file)
@@ -1044,7 +1044,7 @@ static gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
                folder_item_scan(outbox);
                if ((num = folder_item_add_msg(outbox, tmp, &flag, TRUE)) < 0) {
                        g_warning("can't save message\n");
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                        return -1;
                }
        } else {
@@ -1689,7 +1689,7 @@ send_mail:
                                         newsac->nntp_server);
                                }
                        }
-                       g_unlink(tmp);
+                       claws_unlink(tmp);
                }
                g_free(tmp);
        }
@@ -1732,7 +1732,7 @@ send_mail:
        }
 
        if (tmp_enc_file != NULL) {
-               g_unlink(tmp_enc_file);
+               claws_unlink(tmp_enc_file);
                free(tmp_enc_file);
                tmp_enc_file = NULL;
        }
index f4de73c..6219b66 100644 (file)
@@ -955,7 +955,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
                        tmpfp = g_fopen(filename, "rb");
                        textview_show_html(textview, tmpfp, conv);
                        fclose(tmpfp);
-                       g_unlink(filename);
+                       claws_unlink(filename);
                }
                g_free(filename);
        } else if (!g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) {
@@ -966,7 +966,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
                        tmpfp = g_fopen(filename, "rb");
                        textview_show_ertf(textview, tmpfp, conv);
                        fclose(tmpfp);
-                       g_unlink(filename);
+                       claws_unlink(filename);
                }
                g_free(filename);
 #ifndef G_OS_WIN32
index a8f36d9..1cf05d1 100644 (file)
@@ -572,7 +572,7 @@ static void write_welcome_email(WizardWindow *wizard)
        g_free(head);
        g_free(body);
        g_free(msg);
-       g_unlink(file);
+       claws_unlink(file);
 }
 #undef XFACE