Commit c063418e authored by Cosimo Cecchi's avatar Cosimo Cecchi

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.
parent bf38d260
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment