Re: [gedit-list] First pass hack of gedit and gtksourceview port to gtkprintoperation


> Adding a specific "print current selection" feature should be quite
> easy, although it will require some work to implement the win32 side i
> think. However, how do you propose a generic mechanism for this would
> work? (That also would work in the native print dialogs on win32 and
> OSX.)

I have started working on the implementation, but looking at the code of
gtkprintoperation.c I have seen that the real problem is not pagination,
but the fact the printing is always mostly a sync operation also when
gtk_print_operation_run_async is used.

What I mean is that the real printing is done in the print_pages
function. In that function a "draw_page" signal is emitted for each page
and in order to not block the UI the "while (gtk_events_pending ())
gtk_main_iteration ();" trick is used (may be it is me, but I don't like
very much the main loop iteration stuff )

What about modifying the print_page function in order to install a "idle
handler" that prints a single page and remove the handler when there are
no more pages to print?

In this way we could also implement "print canceling" (at least in the
async way).


P.S. It is not clear to me how the "request_page_setup" signal is
supposed to be used.

P.P.S. May be "draw_page" should return a boolean so we can print
without knowing a priori the number of pages. 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]