GNOME Bugzilla – Bug 344925
Further printing API updates
Last modified: 2006-06-30 12:46:17 UTC
* gtk/src/gtk_methods.defs: Regenerated with h2defs.py. * gtk/src/gtk_signals.defs: Updated the whole section for PrintOperation. Added defs for PrintOperationPreview: ready and got_page_size. Added accepts_pdf ans accepts_ps properties for Printer. * gtk/src/gtk_vfuncs.defs: Added a section for PrintOperationPreview with render_page, end_preview and is_selected. * gtk/src/printer.hg: New functions (properties likewise): accepts_pdf() and accepts_ps(). * gtk/src/printjob.ccg: Include gtktypebuiltins.h. * gtk/src/printjob.hg: New enum: PrintCapabilities. * gtk/src/printoperation.ccg: * gtk/src/printoperation.hg: Added a version of run() without the Window parameter. Added a commented done signal with TODO. Other new signals: create_custom_widget, custom_widget_apply, and preview (with a TODO). Renamed properties: number_of_pages and pdf_target. Added n_pages and export_filename instead, and custom_tab_label. * gtk/src/printoperationpreview.ccg: * gtk/src/printoperationpreview.hg: New files. * gtk/gtkmm.h: * gtk/src/Makefile_list_of_hg.am_fragment: Include the new files. * gtk/src/printunixdialog.hg: New functions: add_custom_tab and set_manual_capabilities. * tools/m4/convert_gtk.m4: Added new conversions. ----- What's not done yet is the "done" signal in printoperation. In the C API the user is supposed to check the status enum and then call get_error() is necessary. A solution should somehow provide normal exception handling.
Created attachment 67366 [details] patch and printingoperationpreview files
Now I understand that this done signal is for asynchronous use: The program does not need to block while the printing happens. So I don't think that's so bad. It certainly can't be wrapped by an exception unless we used a blocking method. I suppose it might be slightly better if the error, if any, was passed directly by the signal, so we don't need to call get_error() separately. But that wouldn't be a huge advantage.
- PrintOperationPreview::is_selected() should be const. (and is_selected_vfunc too, if that works.) - For PrintOperation:run() maybe we can provide a default value for "PrintOperationAction action". Maybe PRINT_OPERATION_ACTION_PRINT_DIALOG. - Regarding "// TODO: is it a pointer or a RefPtr to PrintOperationPreview in the "preview" signal?", I guess if this is always a widget (for instance, a window) then it must be a regular pointer. - In "_WRAP_PROPERTY("export_filename", Glib::ustring)", filenames should be used via std::string. Then anyone should feel free to commit this. Sorry for the delay.
Created attachment 67656 [details] updated patch and new files Please Murray commit this one, I got the account in the meantime but I'm paranoid about re-checking out everything before this is in the repo. I updated the above, except for the default value of "PrintOperationAction action" in run() - all parameters after the one with a default value must also have default values, and there can't be a default for std::auto_ptr<Glib::Error>& and Window&.
Great. Anyone should feel free to commit this. > I updated the above, except for the default value of "PrintOperationAction > action" in run() - all parameters after the one with a default value must also > have default values, and there can't be a default for > std::auto_ptr<Glib::Error>& and Window&. But we can have it for the version that has no std::auto_ptr<Glib::Error>. Some extra things I noticed: - In printoperation.hg, please avoid including gtk/gtkprintoperation.h. It doesn't seem necessary. - In _WRAP_SIGNAL("preview"), it might be safer to pass the parent parameter by pointer. I guess it might sometimes be null. - printunixdialog.hg: void add_custom_tab(): Maybe we can add an overload that takes a ustring for the label. - In printoperationpreview.hg, with the signals, you probably don't want to use "no_default_handler". I generally only use that to avoid breaking ABI when adding new signals to an existing class. Feel free to make those changes directly in cvs.
Resetting status, etc. I'm not sure how that was changed.
Marko, are you waiting for anything from me for this? If not, could you make the changes and commit, please?
Ok, this is resolved now. You committed my patch from comment #4 on 20/06, and made the changes you pointed out in #5 right after, except the default parameter to PrintOperation::run(), which I've just committed: 2006-06-30 Marko Anastasov <marko@marko.anastasov.name> * gtk/src/printoperation.hg: Added a default value of PRINT_OPERATION_ACTION_PRINT_DIALOG to the version of run() without std::auto_ptr<Glib::Error>.