File chooser Gtk 4 image preview

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