diff --git a/ChangeLog b/ChangeLog index 4f8dd47a311e44235e9042b63609ea59f118e697..d51bd9aa89af885aa7c4a947e867c828eb637175 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-09-09 Benedikt Meurer <benny@xfce.org> + + * configure.in.in, thunar-vfs/thunar-vfs-io-local-xfer.c: Keep the + modification time when copying files. Bug #2244. + * thunar-vfs/thunar-vfs-io-local-xfer.c + (_thunar_vfs_io_local_xfer_next_path): Further reduce the number + of relocations. + 2006-09-09 Benedikt Meurer <benny@xfce.org> * configure.in.in: Add missing check for setmntent(). diff --git a/configure.in.in b/configure.in.in index 73b0ad7ed86cf401e4e5cbbfac6fb9647f9978f6..3e5e18077f7f465da52e6423009e662a8bec0153 100644 --- a/configure.in.in +++ b/configure.in.in @@ -113,7 +113,7 @@ dnl ************************************ dnl *** Check for standard functions *** dnl ************************************ AC_FUNC_MMAP() -AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr getdents getfsspec getfsstat \ +AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr futimes getdents getfsspec getfsstat \ lchmod localeconv localtime_r mbrtowc mkdtemp mkfifo \ posix_madvise pread pwrite readdir_r sched_yield setgroupent \ setmntent setpassent setpriority statfs statvfs statvfs1 \ diff --git a/thunar-vfs/thunar-vfs-io-local-xfer.c b/thunar-vfs/thunar-vfs-io-local-xfer.c index 5cc92b8a7b43a7e44b1271984def46bd992bf4a3..db1d370ff86f1c3dcf5e344c9f5b134d9b0e99a7 100644 --- a/thunar-vfs/thunar-vfs-io-local-xfer.c +++ b/thunar-vfs/thunar-vfs-io-local-xfer.c @@ -43,6 +43,9 @@ #ifdef HAVE_SYS_STATVFS_H #include <sys/statvfs.h> #endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif @@ -144,14 +147,17 @@ tvilx_copy_regular (const gchar *source_absolute_path, gpointer callback_data, GError **error) { - mode_t mode; - gchar *display_name; - gchar *buffer; - gsize bufsize; - gsize completed; - gint source_fd; - gint target_fd; - gint n, m, l; +#ifdef HAVE_FUTIMES + struct timeval times[2]; +#endif + mode_t mode; + gchar *display_name; + gchar *buffer; + gsize bufsize; + gsize completed; + gint source_fd; + gint target_fd; + gint n, m, l; /* try to open the source file for reading */ source_fd = g_open (source_absolute_path, O_RDONLY, 0000); @@ -308,6 +314,18 @@ end2: /* release the transfer buffer */ g_free (buffer); } + /* set the access/modification time of the target to that of + * the source: http://bugzilla.xfce.org/show_bug.cgi?id=2244 + */ +#ifdef HAVE_FUTIMES + /* set access and modifications using the source_statb */ + times[0].tv_sec = source_statb->st_atime; times[0].tv_usec = 0; + times[1].tv_sec = source_statb->st_mtime; times[1].tv_usec = 0; + + /* apply the new times to the file (ignoring errors here) */ + futimes (target_fd, times); +#endif + /* close the file descriptors */ close (target_fd); end1: @@ -340,7 +358,7 @@ _thunar_vfs_io_local_xfer_next_path (const ThunarVfsPath *source_path, ThunarVfsIOLocalXferMode mode, GError **error) { - static const gchar * const NAMES[3][2] = + static const gchar const NAMES[3][2][19] = { { N_ ("copy of %s"),