Unknown type name "GtkFileChooserIface"

OS: Arch Linux 6.0.12
GTK: 4.8.2
Vala: 0.56.3

When I try to implement the Gtk.FileChooser interface, I get the following error when compiling:

error: unknown type name ‘GtkFileChooserIface’
   60 | static GtkFileChooserIface * app_custom_file_chooser_gtk_file_chooser_parent_iface = NULL;
      |        ^~~~~~~~~~~~~~~~~~~
CustomFileChooser.c:319:65: error: unknown type name ‘GtkFileChooserIface’; did you mean ‘GtkFontChooserIface’?

That interface is private and cannot be implemented outside gtk. What is your use case for it?

I want to make a wrapper for kdialog.

That should already be handled by GtkFileChooserNative, it will show the KDE dialogs if you are using KDE Plasma.

You almost certainly don’t want to invoke kdialog from gtk programs. That is meant for shell scripts to use for simple prompts, not for applications.

FileChooserNative probably works fine when using flatpak, but on normal launch in KDE it shows the GNOME dialog.
I have tried installing the xdg-desktop-portal-kde package and GTK_USE_PORTAL=1 but it doesn’t work.
I also tried using GDK_DEBUG=portals but that didn’t work either.
Thank you for saying that the FileChooser interface is private, I did not find this in the documentation.

With the new GtkFileDialog API in gtk 4.10, it should default to always using portals if they are available. (See gtk#5026.) But you will have to wait apps to port to this new API.

And along with that, FileChooser and FileChooserNative will be deprecated in 4.10.

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