Second of all: GtkFileChooserDialog is deprecated with GTK 4.10, and it does not work in a sandboxed environment. You either want to use GtkFileChooserNative (which has also been deprecated in 4.10), or better GtkFileDialog.
The view-type key was added in GTK 4.10, but it seems you’re trying to run your code against an older version of GTK.
How did you install GTK? Which version is available on your system? How are you building your application?
My gtk4 installation comes with ubuntu. I used to compile my own until gtk4 came with the distribution.
Yes, I am aware of that “proper” documentation but I have never been able to get anything useful out of it. At least I got a fairly large application using the old documentation, at least until now.
My build relies on pkg-config --cflags gtk4 and related (–libs and glib-2.0 or course).
According to dpkg:
ii libgtk-4-1:amd64 4.10.3+ds-0ubuntu1 amd64 GTK graphical user interface library
ii libgtk-4-bin 4.10.3+ds-0ubuntu1 amd64 programs for the GTK graphical user interface library
ii libgtk-4-common 4.10.3+ds-0ubuntu1 all common files for the GTK graphical user interface library
ii libgtk-4-dev:amd64 4.10.3+ds-0ubuntu1 amd64 development files for the GTK library
That’s immaterial: the old developer docs are a snapshot, and they won’t ever be updated. This means you’re looking at a snapshot of how GTK 4 looked like 3 years ago, when 4.0.3 was released. There have been 5 minor releases since then.
DId you build GTK4 at any point? Do you have a previous GTK4 installation in /usr/local?
I guess it is a problem for me then because I cannot get anything useful out of the current doc.
I still do have my old build but its hidden in a very non-standard place (/opt/local) specifically for the purpose to not find it by accident. There is nothing in /usr/local/lib/x86_64-linux-gnu and nothing in ld.so.conf or ld.so.conf.d points to /opt/localc. ldd only points to the proper libraries.
Do you have anything under /usr/local/share/glib-2.0/schemas? Do you have any gschemas.compiled somewhere that is not /usr/share/glib-2.0/schemas? Did you use glib-compile-schemas on your system? Are you overriding GSETTINGS_SCHEMADIR, XDG_DATA_DIRS, or XDG_DATA_HOME in your environment?
The library has really nothing to do with schemas: they are shipped by the library, and “compiled” on the system by your package manager. If Ubuntu is shipping GTK 4.10, then the schema should have the view-type key, and installing the package should have compiled the correct schema.
There was actually something in /usr/local/share/glib-2.0/schemas. I found another org.gtk.gtk4.Settings.FileChooser.gschema.xml which did not contain “view-type”.
I do seem to overwrite XDG_DATA_DIR: XDG_DATA_DIRS=/usr/share/gnome-xorg:/usr/share/gnome:/home/jarek/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop, but not the others.
I have no clue about schemas and what it is. I don’t remember ever dealing with that before so I doubt I ever compiled “one”.
I think I will try to get the gtk_file_dialog thingy to cooperate anyway.
I see now that I use gtk_file_dialog_save(), I get exactly the same crash. Moving /usr/local/share/glib-2.0 to something else solves this. The rest of the errors are obviously on me. Do I really need the stuff under /usr/local/share? I don’t even know where it comes from.