diamondburned/gotk4

gio.Settings is missing constructors `new_full`, `new_with_backend` and `new_with_backend_and_path`

pojntfx opened this issue · 3 comments

While trying to add a GSettings schema, I noticed that while the new and new_with_path contructors of the Settings class are implemented (see https://pkg.go.dev/github.com/diamondburned/gotk4/pkg/gio/v2#NewSettings), there are some missing (new_full, new_with_backend and new_with_backend_and_path). Would it be possible to also add bindings for these?

I'm not sure what use that would add, since it seems like Gio.SettingsBackend itself is excluded from generation. The reason for this seems to be listed in Gio.SettingsBackend's documentation:

The GSettingsBackend API is exported to allow third-party implementations, but does not carry the same stability guarantees as the public GIO API. For this reason, you have to define the C preprocessor symbol G_SETTINGS_ENABLE_BACKEND before including gio/gsettingsbackend.h.

I'm not too sure how I should go about implementing this. Perhaps a new package in pkg/core/gsettingsbackend maybe?

Oh I see! The reason I'd like to use it this way is so I could use a custom SchemaSource to load GSettings schemas from a custom directory - if possible, a package in pkg/core/gsettingsbackend would be great!

if possible, a package in pkg/core/gsettingsbackend would be great!

I actually don't think such a package would be very useful just yet. Looking more at the docs, Gio.SettingsBackend is an abstract class, and gotk4 currently does not have code to connect Go objects to GObjects, unfortunately.

I'm still in the process of even figuring out how to do that. gotk4 already generates all the boilerplate callback to wire up a Go object to be called from GLib; it's just that the functions that I know of to do this are all deprecated, and documentation on this is practically non-existent.

so I could use a custom SchemaSource to load GSettings schemas from a custom directory

Does gio.SettingsSchemaSource.new_from_directory not do this?

Also, what API are you using that would require Gio.Settings?