File chooser Gtk 4 image preview

According to @ebassi:

It sounds to me like features were removed from the new gtk4 version of the file chooser? or how are applications supposed to show a preview in the File Chooser now?

Applications were providing the preview widget themselves; the only thing that GTK was providing was automatically emitting a signal when the selected file changed, and a slot in the widget itself.

Application developers can reimplement the same functionality using a GtkFileChooserWidget inside a GtkDialog, and adding the same preview widget directly to the dialog; then they can listen to the selection changes on the file chooser widget to update the preview, just like the old preview widget did.

The main issue is that this functionality has never been available when using native file chooser dialogs, because those are either native dialogs that are not using GTK (on Windows and macOS), or they are executed out of process, and cannot share the same process space.

1 Like

Noted, thanks bud! :grin:

@ebassi They seem to think it has more to do with my “xdg-desktop-portal backend”. So that would bring it back here to xdg-desktop-portal-gnome right? Does it make sense to you?

Yes; the GTK3 version of the xdg-desktop-portal provided a preview on its own, so if you want the GTK4 portal to do the same, you have to implement it there.

1 Like

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