Adding new keys to GSettings registry during runtime.


I want to convert my application to use GSettings (and dconf) instead of GConf2.

In the old GConf it was possible to add new keys and values during runtime. Eg. I could recklessly write

conf_save_int_value("a_new_key", 1234);

and GCond simply created "a_new_key" and saved the value in the registry. No complains or errors, it just worked. And it was good.

The old GConf-based code is here:

GSettings seems to be different.
All keys and their types must be *strictly pre-defined* in a xml schema file. And the schema must be compiled and installed to /usr/share/glib-2.0/schemas/ directory.

Ok, I have successfully defined and installed my schema file.
Ref: (a simple test).

And I can read/write the values via the GSettings object. That's fine!

But sometimes my code gets a new key (eg. a device name), and I want to store it and its value to GSettings registry.

?It's impossible to add new keys to schema (and GSettings) during runtime? Is the predefined schema the only way?


// Osmo Antero

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]