Does GtkFileChooserNative implements name="Buildable"

We have a recent request for GtkBuilder support for GtkFileChooserNative, see

I am wondering why the GtkFileChooserNative is missing, while most other buildable widgets are supported automatically by our generator script.

In https://developer.gnome.org/gtk4/stable/GtkFileChooserNative.html buildable seems to be not mentioned.

And from the gir files we get:

grep -C24 GtkFileChooserNative /usr/share/gir-1.0/Gtk-3.0.gir | grep implements
      <implements name="FileChooser"/>
[1]+  Done                    gedit /usr/share/gir-1.0/Gtk-3.0.gir
salewski@nuc ~/gintrotest/tests $ grep -C24 GtkFileChooser /usr/share/gir-1.0/Gtk-3.0.gir | grep implements
      <implements name="Atk.ImplementorIface"/>
      <implements name="Actionable"/>
      <implements name="Activatable"/>
      <implements name="Buildable"/>
implements the #GtkFileChooser interface unless you are trying to
file.  It implements the #GtkFileChooser interface.  Visually, it is a
      <implements name="Atk.ImplementorIface"/>
      <implements name="Buildable"/>
      <implements name="FileChooser"/>
      <implements name="Orientable"/>
implements the #GtkFileChooser interface and must not have
      <implements name="Atk.ImplementorIface"/>
      <implements name="Buildable"/>
      <implements name="FileChooser"/>
      <implements name="FileChooser"/>
      <implements name="Atk.ImplementorIface"/>
      <implements name="Buildable"/>
      <implements name="FileChooser"/>
      <implements name="Orientable"/>

So may there be a good reason that buildable is not supported?

Seems to be not an easy question :frowning:

My first idea was to just assume that all GTK Widgets are buildable and so have Glade support, so I was going to add missing builder support for GtkFileChooserNative manually. Same as it is done automatically for other widgets.

But from https://developer.gnome.org/gtk4/unstable/GtkBuildable.html there seems to be indeed no support for native widgets. (Well I assume he is still using GTK3 and wants to use Glade for a GtkFileChooserNative.)

So shall I just tell him that he should forget using GtkFileChooserNative with Glade and close the issue?

[EDIT]

On the other hand, from Description in GtkBuildable.html:

The GtkBuildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK.

So maybe my initial idea is good, so just add it to the bindings and wait for crashes…

GtkBuilder can build any GObject and GtkFileChooserNative is a GObject

Of could the greater question is why do you want to do this

Of could the greater question is why do you want to do this

A customer of the Nim gobject-introspection based GTK bindings seems to want to do that, he opened an issue for that.

And I hesitated to add it manually as it was not advertised automatically by gobject-introspection. We generally avoid adding untested code manually which may then crash. But I think I will add it for him, he can test himself.

Huh? Add what to what manually?

Or to be more clear: GtkFileChooserNative does not implement GtkBuildable and you can’t just add that in the bindings. That’s not going to work.

The main question here is probably how you want to actually use a GtkFileChooserNative that would implement GtkBuildable.

1 Like

There’s a fundamental misunderstanding, here.

GtkBuilder can deserialise any object type out of the box.

The GtkBuildable interface is implemented by object types that need to parse custom properties or custom elements in the XML. It is not required to be implemented by every object type that needs to be deserialised from XML.

3 Likes