Re: Adding new keys to GSettings registry during runtime.



Ok, I found a simple solution.

I simply defined a string array for each device type. The key is the device type (enum value).

    <!-- From audio-sources.h -->
    <!-- DeviceType: NOT_DEFINED 0x0-->
    <key name="device-type-0" type="as">
      <default>[]</default>
    </key>

    <!-- DeviceType: DEFAULT_DEVICE 0x1 -->
    <key name="device-type-1" type="as">
      <default>[]</default>
    </key>

    <!-- DeviceType: AUDIO_SINK 0x2 -->
    <key name="device-type-2" type="as">
      <default>[]</default>
    </key>

    ...
  </schema>

It's not very elegant but works just fine.
I could have used enumeration <enum id="myenum" ...> but I need the string array type (type="as") to store a list of device ids that come from pulseaudio/gstreamer.

Ref: http://www.futuredesktop.com/tmp/org.gnome.audio-recorder.gschema.xml

So long.
// Osmo Antero


On 09/24/2011 10:26 AM, Osmo Antero wrote:
Typo:
The final question should be:

IS IT possible to add new keys to schema (and GSettings) during runtime?
Is the predefined schema the only way to handle the keys?



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