Hi, I have problems using the printing feature with this GTK 2.x code: ----8<--------8<--------8<--------8<--------8<---- GtkPrintOperation *print; GtkPrintOperationResult res; print = gtk_print_operation_new (); if (settings != NULL) gtk_print_operation_set_print_settings (print, settings); g_signal_connect (print, "status-changed", G_CALLBACK (print_status_changed), NULL); g_signal_connect (print, "begin-print", G_CALLBACK (begin_print), NULL); g_signal_connect (print, "request-page-setup", G_CALLBACK (print_request_page_setup), NULL); g_signal_connect (print, "done", G_CALLBACK (print_done), NULL); g_signal_connect (print, "end-print", G_CALLBACK (print_end), NULL); g_signal_connect (print, "paginate", G_CALLBACK (print_paginate), NULL); g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), NULL); gtk_print_operation_set_allow_async(print, FALSE); gtk_print_operation_set_job_name(operation, "myprog"); gtk_print_operation_set_n_pages(operation, n_pages); gtk_print_operation_set_use_full_page (operation, TRUE); gtk_print_operation_set_unit (operation, GTK_UNIT_POINTS); res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (main_window), NULL); printf("on_button5_clicked gtk_print_operation_run result: %d\n", res); ----8<--------8<--------8<--------8<--------8<---- The problem is that my code only receives the "status-changed" event twice, once with GTK_PRINT_STATUS_INITIAL
and then with GTK_PRINT_STATUS_PREPARING . At
this point,the printer dialog disappears but my code doesn't receive any other printing event or the result of gtk_print_operation_run(). I have used gtk_print_operation_set_allow_async(print, FALSE); since I want the printing to be synchronous, at least up to spooling the print job. The same happens without gtk_print_operation_set_allow_async(), I guess this is the default. The printing events progress further only when I press Ctrl-C in the terminal from where I started this program. Only then I receive these in order: - begin-print - paginate - status-change with status = GTK_PRINT_STATUS_GENERATING_DATA - request-page-setup with page_nr 0- draw-page with page_nr 0 - end-print - status-change with status = GTK_PRINT_STATUS_SENDING_DATA - status-change with status = GTK_PRINT_STATUS_PRINTING - done with result = GTK_PRINT_OPERATION_RESULT_APPLY Do I have to do something special in the status-changed callback to drive the printing further? I am on Fedora 17/x86_64 if that's interesting. Thanks in advance, Zoltán Böszörményi |