Ubuntu – Can commercial applications use Gsettings

application-developmentgsettings

According to specified technical requirements, a commercial application must be self‑contained in a single directory (which I agree is a good requirement), and use ~/.config/<app-name> for its configuration data (good requirement too). However, Gsettings requires to have a schema file installed inside of some subdirectory of $XDG_DATA_DIRS. Do I have to understand commercial applications can't make use of GSettings?

Update

I've found another page, which seems to suggest requirements are not exactly that restrictive. The latter mention installation of an icon file in /usr/share/icons/ and a desktop file in /usr/share/applications/. If that's OK, may be that's OK too, to install a GSettings schema in /usr/share/glib-2.0/schemas/? That would still be better to have confirmation. I feel the first mentioned link, lacks precisions.

Best Answer

You don't need to install schema files into /usr/share/glib-2.0/schemas/, they can be installed into any ${XDG_DATA_DIRS}/glib-2.0/schemas/.

So you can install your schema to /opt/<yourapp>/share/glib-2.0/schemas, then have your binary add /opt/<yourapp>/share to the XDG_DATA_DIR environment variable before you try to use GSettings.

This is what we do for Quickly apps being installed into /opt/extra.ubuntu.com/<appname>/