I have an Adw.ComboRow and I am using Gtk.StringList as its model. I want to bind its selection to a GSettings key so that when I select something from the ComboRow, the GSettings key also gets updated and when the GSettings key changes, appropriate item in the ComboRow gets selected.
Or you may need to use bind_with_mapping() depending on how you store your settings. then you can translate uint->whatever you store in gsettings and back.
Sorry! I forgot to mention, the GSettings key is an enum. g_settings_bind takes it as a string. So, g_settings_bind doesn’t work with ‘selected’ property (which is of int type) of Adw.ComboRow.
I tried to read the docs but I could not understand how to use g_settings_bind_with_mapping in python or otherwise.
It will be very helpful if someone could provide an example.
I don’t have Python examples, but you provide functions that translate uint->string and string->uint. Then they will be automatically called every time the property and/or gsettings key change.
A C example (this is likely much simpler in Python though):