If you’re willing to make explicit calls to the portal API, you could integrate support into a GTK 2 application. The libportal library would be a good place to start with:
There is header-only integration with GTK 3 and GTK 4 for handling parent window IDs (used to associate out of process dialogs), but it looks like the GTK 3 version may work with GTK 2:
https://github.com/flatpak/libportal/blob/master/libportal/portal-gtk3.h
The print API consists of two async APIs that you might be able to integrate:
https://github.com/flatpak/libportal/blob/master/libportal/print.h
An optional prepare_print()
call that will pop up a print dialog, and return page setup details if the user decides to continue, and a second print_file()
call that will complete the job.
If you don’t care about the page setup details, the prepare call can be omitted. In this case, the print_file()
will instead show a print dialog to let the user confirm the job.