GNOME Bugzilla – Bug 683017
API for accessing GSettings Schema metadata
Last modified: 2013-10-28 18:32:29 UTC
Right now, GSettings can only be used to read the saved settings data. I would also like to be able to access schema metadata, such as description, summary, range, default value, and so forth. To do this presently, I must find the .gschema.xml file and parse it manually.
Created attachment 258233 [details] [review] GSettingsSchemaKey: getters for type and default Add getters for the type of the key and the default value.
Created attachment 258234 [details] [review] GsettingsSchemaKey: add range operations Add g_settings_schema_key_get_range() and g_settings_schema_key_range_check(), deprecating the equivalent APIs on GSettings. Also: expose g_settings_schema_has_key(), which already existed.
Review of attachment 258233 [details] [review]: Ok. ::: gio/gsettingsschema.c @@ +1511,3 @@ +const GVariantType * +g_settings_schema_key_get_value_type (GSettingsSchemaKey *key) +{ key != NULL @@ +1530,3 @@ +GVariant * +g_settings_schema_key_get_default_value (GSettingsSchemaKey *key) +{ key != NULL
Review of attachment 258234 [details] [review]: ::: gio/gsettings.c @@ +2903,3 @@ g_settings_action_get_state_hint (GAction *action) { + return NULL; Why not implement this with the new g_settings_schema_key_get_range()? ::: gio/gsettingsschema.c @@ +1513,3 @@ + + if (!value) + value = key->default_value; This is missing a g_variant_ref()
Created attachment 258253 [details] [review] GSettingsSchemaKey: add introspection APIs Add g_settings_schema_has_key() and _get_range(), _range_check(), _get_value_type(), _get_default_value() methods on GSettingsSchemaKey. Deprecate the equivalent APIs on GSettings.
Review of attachment 258253 [details] [review]: Ok, thanks.
Attachment 258253 [details] pushed as bcb030a - GSettingsSchemaKey: add introspection APIs pushed, with the state hint code restored (as mentioned in person). thanks!