Settings

There are two main design patterns to store settings for an applet:

  • Global settings: those are settings that should be shared among all instances of the same applets. For instance, the preferred unit for temperature is something that the user will want to set only one. The way to store those settings is in no way specific to the Panel Applet library, as it should work like in any other application.

  • Per-applet instance settings: those are settings that might be different depending on the instance of an applet. For instance, an applet whose goal is to display a picture should make it possible for the user to choose a different picture for each instance of the applet. The Panel Applet library provides API to help with this.

There is actually a third case, which is rather rare, though: per-screen settings. It might be that some applets control some per-screen settings, like the layout of the workspaces. There is currently no API to help with this as it is a very specific case that you will probably never have to deal with for a usual applet.

Per Instance Settings

In order to store per instance settings for an applet it is recommended to use GSettings. The Panel Applet Library privides a function named panel_applet_settings_new() for this purpose. You need to provide a GSettings schema file for your applet and the Panel Applet library will setup the GSettings object for you.

TODO: describe settings-oriented API in more detail and give an example for per instance settings.