diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-01-21 18:07:35 -0500 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-01-21 18:07:35 -0500 |
commit | c063418e66ed0fdc40b4fd48bc5bd29c0cbefa09 (patch) | |
tree | d2f5db27d45aaaf5831e0a92ef7e868a87b37a4b /libnautilus-private | |
parent | bf38d260d1011c08f5e36f3d7d78e10244627e16 (diff) | |
download | nautilus-c063418e66ed0fdc40b4fd48bc5bd29c0cbefa09.tar.gz |
undo: fix undo move to trash
We were querying the mtime of the trashed file after it was already
trashed, and we were also overflowing the guint64 assigning -1 to it.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index e8a858a10..1f355f0d5 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -1781,6 +1781,19 @@ trash_files (CommonJob *job, GList *files, int *files_skipped) file = l->data; error = NULL; + mtime = 0; + + if (job->undo_info != NULL) { + info = g_file_query_info (file, + G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, NULL); + + if (info != NULL) { + mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + g_object_unref (info); + } + } if (!g_file_trash (file, job->cancellable, &error)) { if (job->skip_all_error) { @@ -1829,19 +1842,7 @@ trash_files (CommonJob *job, GList *files, int *files_skipped) } else { nautilus_file_changes_queue_file_removed (file); - if (job->undo_info != NULL) { - info = g_file_query_info (file, - G_FILE_ATTRIBUTE_TIME_MODIFIED, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, - NULL, NULL); - - if (info != NULL) { - mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); - g_object_unref (info); - } else { - mtime = -1; - } - + if (job->undo_info != NULL && mtime != 0) { nautilus_file_undo_info_trash_add_file (NAUTILUS_FILE_UNDO_INFO_TRASH (job->undo_info), file, mtime); } |