Open kelnos opened 2 years ago
Support for implementing FileChooser
is not implemented in the bindings yet. You'd have to implement IsImplementable
for that in the bindings and also add a FileChooserImpl
, etc., similar to the other interfaces.
Ah, I see! Ok, I'll take a crack at that. Thanks for the quick reply!
There is an implementation in gtk4-rs, you can look at it for inspiration.
Hmm, gtk4-rs doesn't seem to have FileChooserImpl
either, but it does have impls for interfaces, unlike gtk3-rs, so I'll take a look.
One thing I'm noticing that I don't quite understand is that some of the *Impl
and *ImplExt
traits use ObjectImpl
as a trait bound, and others use ObjectSubclass
. What is the reason for using one or the other?
Hmm, gtk4-rs doesn't seem to have FileChooserImpl either, but it does have impls for interfaces, unlike gtk3-rs, so I'll take a look.
Ah yeah never mind, I was confused for a bit and thought of FontChooser.
One thing I'm noticing that I don't quite understand is that some of the Impl and ImplExt traits use ObjectImpl as a trait bound, and others use ObjectSubclass. What is the reason for using one or the other?
Impl is the trait you implement in your application, ImplExt provides a way for you to chain up to the parent implementation
The Impl trait is something the end user will be implementing and it does enforce the requirements while the ImplExt is implemented on the bindings side for each type T that implements the Impl trait, hence it is already indirectly enforcing the requirement that is defined for Impl trait.
Ok, I think I understand.
But I am now not sure this is doable. It looks like GtkFileChooserIface
is defined in gtk/gtkfilechooserprivate.h
. So the autogenerated bindings in the gtk-sys
crate don't pick it up. Digging through their commit history, it looks like the interface refers to GtkFileSystem
, which isn't public, so that's why they moved it into a private header. Bummer.
I'm trying to build my own widget and have it implement the
GtkFileChooser
interface. To myObjectSubclass
impl, I've added:However, I get the following error:
This seems to be correct; I don't see an
IsImplementable
implementation forFileChooser
. There also isn't aFileChooserImpl
trait to implement like I'd expect (though there isFileChooserExt
, but my -- perhaps incorrect -- understanding is that is for consumers, not subclassers). Am I missing something here, or is this feature not implemented?