[webkit-gtk] Print preview in WebKit2
Gustavo Noronha Silva
gns at gnome.org
Wed Feb 29 16:27:25 PST 2012
On Mon, 2012-02-27 at 12:32 +0100, Carlos Garcia Campos wrote:
> There's another option that would require some more changes, but might
> solve all the problems. We could turn evince-previewer into a D-Bus
> service org.gtk.PrintPreview (or something like that) that launches
> evince-previewer for a given pdf file and exposes a print signal so that
> apps can connect to it and start the print when emitted. When we
> implemented this in GTK+ GDBus didn't exist so it wasn't possible to use
> DBus inside GTK+. This would also remove the hard dependency on evince,
> since any app implementing org.gtk.PrintPreview could be used as
> previewer. If we agree on this approach and it works for us, I will
> propose to use it inside GTK+ too. This will also resolve the problem of
> who is responsible of removing the temporary file (we currently use a
> command line option for evince-previewer to indicate whether it should
> delete the file or not).
I was going to say that we should just do whatever GTK+ does to be
consistent, but if you think this could be a good testing ground for the
future (gtk+4? ;D) API, then I think it's worth pursuing!
One thing is unrelated to this specific new API but got me wondering
recently was the _dialog_run() that we have for the print dialog. GTK+
is deprecating its _dialog_run() calls, trying to do away with recursive
main loops as much as possible, I think we should keep that trend in
mind and take it into consideration when reviewing this API.
> Regarding the API, we can just add a 'preview' signal to
> WebKitPrintOperation and a preview() method to be able to generate a
> preview without using the print dialog.
> - WebKitPrintOperation *operation
> - GInputStream *preview_stream
> The default implementation if this signal is not handled would save the
> pdf into a temporary file and launch the previewer using the DBus
> interface. If the user prints the document from the previewer, a D-Bus
> signal is emitted and we justr call webkit_print_operation_print() to
> print the document without showing the print dialog again.
Sounds great to me! It's great to be able to rely on DBus for this kind
of stuff now, isn't it?
Gustavo Noronha Silva <gns at gnome.org>
More information about the webkit-gtk