Re: gtk_print_operation_run() blocks and ignores callback



On Thu, Jul 4, 2013 at 9:22 PM, Satz Klauer <satzklauer googlemail com> wrote:
I want to print out some vectordata using GTK/Linux. That's what I already have:


GtkPrintOperation *op;

op = gtk_print_operation_new();
gtk_print_operation_set_n_pages(op, 1);
gtk_print_operation_set_unit (op,GTK_UNIT_POINTS);
g_signal_connect (op, "draw_page", G_CALLBACK(draw_page), NULL);
if (data->config.m_printparams==1) gtk_print_operation_run(op,
GTK_PRINT_OPERATION_ACTION_PRINT,NULL, NULL);
else gtk_print_operation_run (op,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,NULL, NULL);

I think what you are missing here is
   gtk_print_operation_set_allow_async()

Otherwise I would expect that the print operation runs it's own
main loop and synchronously runs the operation blocking any
other events until the operation completes.

Note, I have not tried using GtkPrintOperation myself, I could
be misguided, but this seems like an obvious bet ;-)

Cheers,
    -Tristan


draw_page() of course exists as well:

static void draw_page (GtkPrintOperation *operation,GtkPrintContext
*context,int page_nr)
{
   GtkPrintSettings *settings;

   cairo_t *cr = gtk_print_context_get_cairo_context (context);
   settings = gtk_print_operation_get_print_settings (operation);
   ...do my printing stuff here...
}

Unfortunately it does not work, gtk_print_operation_run() blocks
forever and draw_page() is never called. Any ideas what could be
wrong?

Thanks!
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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