Automatically generate missing thumbnails in the new GTK4 FileChooser's grid icon view
A new FileChooser view mode has been implemented in issue #233 (closed) to make 2023 the Year of the Linux Desktop, and there is much rejoicing.
When available, it currently displays existing thumbnails from the FreeDesktop thumbnails specification on Linux. However, it does not generate them when they are missing from the thumbnails cache. Ideally, it should (otherwise users will need to visit the folder with Nautilus or GThumb beforehand); I also remember the thumbnails cache sometimes pruning some of its least-used items over time, so while this is a bit of a corner case, it's likely that users will run into some situations where only icons are shown instead of thumbnails when trying to use the FileChooser.
The only tricky part is to ensure thumbnails generation is implemented in a performant way, at least multi-threaded so that it can leverage all the CPU cores. This is a problem that has been encountered elsewhere, so I'll just mention these in case this can be useful as reference or cross-project inspiration/cooperation:
- The slow thumbnailing performance issue in Nautilus; there is a WIP branch over there to try to make it multithreaded, but perhaps that is not the only performance problem it has been hitting with thumbnailing.
- Recent versions of GThumb, for example, already do multithreaded thumbnailing, as I learned in that ticket.