Implement g_settings_bind_with_mapping and handle range/flag __setitem__
Submitted by dal..@..com.hk
Created attachment 300247 fix patch
g_settings_bind is a function that binds an object property with a settings key. This is available in the python binding.
g_settings_bind_with_mapping allows users to assign a mapping that converts the settings value to the desired widget value and vice versa, eg. when the widget value should be twice the settings value. This is not available in the python binding (possibly due to the difficulty in introspecting functions). This patch implements this function in the gi overrides.
Implementing this requires properly implementing the setitem override. The setitem override allows users to access schema values through
settings = Gio.Settings.new(schema) value = settings[key]
However, this is only implemented for key types "type" and "enum". Attempting to use it for the other types "range" and "flags" will raise a NotImplementedError. So this patch implements this functionality for all possible key types.
For reference, support for "enum" was implemented here: https://bugzilla.gnome.org/show_bug.cgi?id=685947
Patch 300247, "fix patch":