This patch is a modification of the work done by aiwarrior and mr Yang. It has some more logic for deciding on where to save autosaves, and keeps track of other running instances of Xournal (without trying to 'restore' their current autosaves).
Autosaves are now stored "along side" the .xoj file, with a .xoj.autosave~ suffix. If the file has no filename yet, an autosave is made in the user's homedir. Additionally, a table of all running xournal instances, together with their autosave filenames, is maintained in ~/.xournal/autosaves. On startup, xournal checks if any of these table entries have been 'orphaned' and prompts the user before restoring.
Furthermore, when opening a file, xournal checks if there exists a corresponding .autosave~ file, and restores it if it is newer.
Applies against Xournal 0.4.5.