Gio.Settings::bind_with_mapping "not directly available for language bindings"

Hi, is there common sensus / default approach for doing bind_with_mapping in Python and other languages? I see why it is not available, as get callback is done via pointers, but I guess we have to use control signal callback along with setting value in GSettings. Just wondering, thanks for any ideas.

1 Like

This can be used but someone must manually write a binding to that function and contribute it to pygobject. “Not directly available” just means the function does something that is beyond the automatic capabilities of gobject-introspection.

2 Likes

If I had some in-depth knowledge, I would definitely take a dive at it. At the moment a bit busy with other code :frowning:

Said that, I wanted to share my current approach in case someone else tries it:

ActionRow.connect(“notify::selected”, on_action_row_selected)
def on_action_row_selected(widget, spec):
value = widget.props.selected
settings.set_int(“settings-key”, value)

1 Like

I’m presently trying to wrap g_settings_bind_with_mapping() in C++ code in glibmm.
It’s possible, but it’s one of the more complicated glib functions to wrap in C++.

There are similarities between wrapping g_settings_bind_with_mapping() and
wrapping g_object_bind_property_full(). If there is a Python binding of
g_object_bind_property_full(), you can probably get some hints there.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.