GNOME Bugzilla – Bug 637069
Custom print settings set in custom-widget-apply are lost
Last modified: 2010-12-20 20:12:36 UTC
The problem is in gtkprintoperation-unix.c (handle_print_response). When operation is apply:
1.- a new settings object is created by gtk_print_unix_dialog_get_settings(),
2.- custom-widget-apply is emitted, in the callback we get the current settings from the print operation object to save our custom settings.
At this point we have two different settings, the new one with the options selected by the user in the print dialog, and the old one with the custom settings.
3.- finish_print() calls gtk_print_operation_set_print_settings() with the new settings, so that current print operation settings are lost.
We have this problem in Evince, see bug 616883, and I found the issue when implemented custom options in poppler print demo, see http://cgit.freedesktop.org/poppler/poppler/tree/glib/demo/print.c#n76
Created attachment 176277 [details] [review]
Set new print operation settings before emitting custom-widget-apply signal
We can just set the print operation settings before emitting the custom-widget-apply signal. Since finish_print() can be called from other places we can still set the settings there, gtk_print_operation_set_print_settings() checks whether priv->settings == settings, so calling it multiple times with the same settings is not a problem.
Looks ok to me.
Pushed to both gtk-2-24 and master branches.