[GSoC 22] [undo] Add 'undo' for file operations
This is an issue to keep track of general discussion on the addition of 'undo' for file operations (requested in #191). It is a part of my proposal for GSoC 22. # Implementation brief The implementation relies on the addition of a new type, `ThunarJobOperation` to keep track of the latest operation(s) performed and allow for undoing them by calculating the inverse operation and executing it. Later additions would introduce a `GList` of such operations, and performing an undo should undo the latest operation, move the HEAD (pointer to the current state) backwards in history after undoing that operation. This would allow for 'redo' as well to be easily implemented by simply moving the head forward in history and executing the operation at the HEAD. # TODO The following MRs for each partial feature have to be added: - [x] Undo for the single latest copy operation (!266) - [x] Undo for single latest operation out of each of the following: move, rename, trash, link, create - [x] Move (!281) - [x] Rename (!288) - [x] Trash (!289) - [x] File creation (https://gitlab.xfce.org/xfce/thunar/-/commit/928e59c4868623f49cc08e192cdaa8ab691231c9) - [x] Link (https://gitlab.xfce.org/xfce/thunar/-/commit/ff927e816e52135969aa56104e5801c4836df2bb) - [x] Undo **and** redo for the single latest operation (https://gitlab.xfce.org/xfce/thunar/-/commit/98bc16cc641da75af30ae11b121a57514a272f6f) - [x] Multi level undo/redo (https://gitlab.xfce.org/xfce/thunar/-/commit/98bc16cc641da75af30ae11b121a57514a272f6f) - [X] Limit `job_operation_list` to e.g. 5 elements, so it does not grow indefinitely (configurable via xfconf prop) (!299) - [x] Introduce mutex to protect `job_operation_list` and undo/redo pointers, since the variables can be accessed from within multiple threads (!305) - [x] Add toolbar icons for undo/redo (!298) - [x] Open separate issues for things mentioned in https://gitlab.xfce.org/xfce/thunar/-/issues/819#note_51642 - [X] small popup informing the user what operation they just undid (#903) - [~] Allow users to access and view the recorded operation history in some way.
issue