Saving and Loading Settings

Elias Ojala edited this page Apr 17, 2017 · 3 revisions

This page provides information on how Pinta saves and restores user settings, and also describes how to do this from your code.

Where Are The Settings Stored?

Pinta stores its settings in a file called settings.xml, which is located in the application data directory for your system. On Windows, you'll find it under %AppData%\Roaming\Pinta, and on Linux it's located under ~/.config/Pinta.

Saving Settings

To save a value, call PintaCore.Settings.PutSetting with a string identifier (for example, "jpg-quality") and the value that you are storing. You should ensure that the string identifier is as specific as possible in order to avoid accidentally overwriting other settings. In particular, any settings saved by add-ins should be prefixed with the name of the add-in.

When you call PutSetting, Pinta stores the setting in memory, but does not immediately write the settings to disk. Pinta will automatically save the settings before closing, but if you're paranoid you can call PintaCore.Settings.SaveSettings () to immediately update the settings file.

Loading a Setting

At startup, Pinta will parse the settings file and load the settings into memory. As such, any modifications to settings.xml while Pinta is running will have no effect.

To load a setting, call PintaCore.Settings.GetSetting<T> with your string identifier and a default value. If the setting does not exist, the default value will be returned.


For an example of saving and loading settings, see the WebP Add-in.