Skip to content
Snippets Groups Projects
Commit 00122061 authored by Alexander Schwinn's avatar Alexander Schwinn
Browse files

Revert "Prevent deletion of modified files by undo (#1027)"

This reverts commit a038f5ed.
parent aee2df8b
No related branches found
No related tags found
No related merge requests found
......@@ -206,10 +206,12 @@ thunar_job_operation_history_commit (ThunarJobOperation *job_operation)
_thunar_return_if_fail (THUNAR_IS_JOB_OPERATION (job_operation));
/* set the timestamp for the operation, in seconds. g_get_real_time gives
* us the time in microseconds, so we need to divide by 1e6. */
thunar_job_operation_set_end_timestamp (job_operation, g_get_real_time () / (gint64) 1e6);
if (thunar_job_operation_get_kind (job_operation) == THUNAR_JOB_OPERATION_KIND_TRASH)
{
/* set the timestamp for the operation, in seconds. g_get_real_time gives
* us the time in microseconds, so we need to divide by 1e6. */
thunar_job_operation_set_end_timestamp (job_operation, g_get_real_time () / (gint64) 1e6);
}
g_mutex_lock (&job_operation_history->job_operation_list_mutex);
......@@ -452,7 +454,7 @@ thunar_job_operation_history_redo (void)
thunar_job_operation_execute (operation_marker, &err);
if (err == NULL)
thunar_notify_redo (operation_marker);
thunar_notify_redo (operation_marker);
g_mutex_unlock (&job_operation_history->job_operation_list_mutex);
......
......@@ -50,7 +50,10 @@ struct _ThunarJobOperation
/* Files overwritten as a part of an operation */
GList *overwritten_files;
/** timestamps (in seconds) which tell when the operation was started and ended. */
/**
* Optional timestamps (in seconds) which tell when the operation was started and ended.
* Only used for trash/restore operations.
**/
gint64 start_timestamp;
gint64 end_timestamp;
};
......@@ -365,9 +368,6 @@ thunar_job_operation_new_invert (ThunarJobOperation *job_operation)
break;
}
inverted_operation->start_timestamp = job_operation->start_timestamp;
inverted_operation->end_timestamp = job_operation->end_timestamp;
return inverted_operation;
}
......@@ -391,8 +391,6 @@ thunar_job_operation_execute (ThunarJobOperation *job_operation,
GFile *parent_dir;
gchar *display_name;
GFile *template_file;
guint64 changed_stamp;
gboolean warn_permanent_delete = FALSE;
_thunar_return_if_fail (THUNAR_IS_JOB_OPERATION (job_operation));
......@@ -424,16 +422,12 @@ thunar_job_operation_execute (ThunarJobOperation *job_operation,
continue;
}
/* If nothing changed, we can just bring back the file with undo/redo
* Though if any file was modified, we need to ask if deletion is ok */
changed_stamp = thunar_file_get_date (thunar_file, THUNAR_FILE_DATE_MODIFIED);
if (changed_stamp > (guint64) job_operation->end_timestamp)
warn_permanent_delete = TRUE;
thunar_file_list = g_list_append (thunar_file_list, thunar_file);
}
thunar_application_unlink_files (application, NULL, thunar_file_list, TRUE, warn_permanent_delete, THUNAR_OPERATION_LOG_OPERATIONS);
/* perform permanent deletion without warning, because we can bring back the file with
* an undo or a redo (depending on whether a redo or an undo caused the deletion) */
thunar_application_unlink_files (application, NULL, thunar_file_list, TRUE, FALSE, THUNAR_OPERATION_LOG_OPERATIONS);
thunar_g_list_free_full (thunar_file_list);
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment