Skip to content

Add autosave support

Gaël Bonithon requested to merge Tamaranch/mousepad:autosave into master

Closes #32 (closed), new step towards #3 (closed) after !108 (merged).

Description of the main features added, from commit:

"Add autosave support":

Any document open in a MousepadWindow is automatically saved when modified, in a temporary file located in g_get_user_data_dir()/Mousepad and named autosave-N where N is a unique id, with a delay of preferences.file.autosave-timer seconds. Setting this parameter to 0 disables the feature.

When a document is regularly saved by the user, the temporary file associated with it is automatically deleted.

These automatic save and delete operations are asynchronous. The GApplication use count is used to ensure that they have time to finish correctly.

"Adapt settings to include new restore options" :

The following restore options are offered to the user:

  • "never": Disables session restore and set preferences.file.autosave-timer to 0. This can be used for privacy purposes, since no more data is stored and all previous data are cleared.
  • "after a crash": This is the default: all the backup and restore machinery is in place, but it only has a visible effect in case of a problem. This is included in all the following choices.
  • "unsaved documents": Unsaved documents are always restored, and the user is no longer asked for saving modified documents when quitting, i.e. when closing the last window or calling "app.quit". He is still asked for saving when closing a tab.
  • "saved documents": Saved documents are always restored: this is the behavior before this MR when session restore is enabled.
  • "always": This is the addition of the three previous choices.
Edited by Gaël Bonithon

Merge request reports