Closed tillkamppeter closed 3 years ago
This is the source of the PostScript Printer Application: system_cb calls ps_setup(), ps_setup() builds the driver list and registers it calling papplSystemSetDrivers(). ps-printer-app.c.txt
@tillkamppeter Sounds like a reasonable solution, will make the change.
[master b03bdb5] Allow mainloop to set drivers from system callback (Issue #42)
Thank you very much. It works now.
Is your feature request related to a problem? Please describe. I am creating a PostScript Printer Application which should support all PostScript printers which were supported in the Linux distributions. This means that it will contain the 1000s of manufacturer-supplied PostScript PPD files ("foomatic-db" package), each one being a driver in PAPPL terms. So a list of 1000s of drivers has to be built, where easily errors can happen. Therefore I want the Printer Application to start logging before the building of the driver list starts and to start logging I have to call
papplMainloop()
. I call it without driver list (0 drivers, no callback) and callpapplSystemSetDrivers()
from within the system_cb. Problem is thatpapplMainloop()
calls the system_cb in the beginning and afterwards it callspapplSystemSetDrivers()
with the empty driver list it got supplied. It should omit thepapplSystemSetDrivers()
call with an empty/invalid driver list, this way one can "manually" callpapplSystemSetDrivers()
somewhere else, like for example in system_cb.Describe the solution you'd like The following patch solves the problem. Driver registration (
papplSystemSetDrivers()
) is only called if thepapplMainloop()
call actually specifies a driver list and a driver callback. If omitting these, one can register the drivers later and so build the driver list with the system available and so the possibility to log the list building process. Pre-defining the driverlist before starting the main loop and specifying the driver list and callback in thepapplMainloop()
is still possible.