In GTK3, FileChooser emitted the “selection-changed” and “file-activated” signals, however in GTK4 they were removed. What signals do I connect to instead to listen to the user selecting a different file?
Bumping, I have not yet found a workaround. It seems to me that the selection-changed signal was removed without replacement unless I’m missing something obvious
I probably forgot that we had to remove the selection-changed signal because it exposed internal details of the file chooser that could not possibly work across native widgets.
So it turns out I was wrong: you cannot implement a preview widget with the file chooser in GTK4. Luckily, GtkFileChooserhas been deprecated entirely, and for GTK 4.10 we are planning to provide an icon grid with larger thumbnails that will make the preview unnecessary to begin with.
I ended up implementing the preview by adding atick_callback to the widget and just checking every frame if the selection changed and then emitting my own signal. Obviously this is terrible style and goes against the signal architecture but it will have to do for now, as I needed the custom preview to display information about a custom file-type that’s specific to my application.