Infinite Undo in Tasks

Posted by Ross Burton on September 18, 2007

Yesterday I landed in Subversion a branch of Tasks I've been working on to remove all confirmation dialogs and replace them with infinite undo/redo. I'm really pleased with the end result, there are no more dialogs getting in the way and every action is undoable. To implement this I adapted MarlinUndoManager from Marlin by the most excellent Iain Holmes.

The basic design is that the application has a global undo context. When an operation which should be undoable occurs, you start the context, add as many undoables as required, and then end the context. Allowing a single undoable action to consist of multiple undoables lets the application reuse fine-grained logic to build coarse user-level actions (in Tasks this is used to build the Remove Completed action from multiple Delete Task actions). To make integrating this into applications even easier, I wrote a GtkAction which reflects the state of an undo context, so it is trivial to add redo/undo to the interface.

There is one remaining task left before this is ready to be released: undo support in the edit dialog entries. Once this is done, the next release of Tasks will be announced. I also plan to work with Iain on cleaning up this code and submitting it for inclusion into GTK+.

NP: Money Jungle, Duke Ellington, Charles Mingus, Max Roach

tags: tasks, tech