I have the following GSchema:
<schemalist gettext-domain="example">
<enum id="com.example.unit.temperature">
<value nick="Celsius" value="0"/>
<value nick="Fahrenheit" value="1"/>
</enum>
<schema id="com.example.corefreqgtk" path="/com/example/">
<key name="unit-of-temperature" enum="com.example.corefreqgtk.unit.temperature">
<default>'Celsius'</default>
<summary>Unit of temperature</summary>
<description>The unit of temperature used across the app</description>
</key>
</schema>
</schemalist>
And I'm looking for a way to get the nick
s and value
s of the enum com.example.unit.temperature
programmatically.
What I would like to do is to bind the unit-of-temperature
key to a ComboBoxText
to allow the user to select the unit of temperature, but I would like to avoid to define twice the enum inside the GScheme and in code.
My goal would be to initialize the ComboBoxText
reading the possible values directly form the GSettings
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…