After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344925 - Further printing API updates
Further printing API updates
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.9.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2006-06-14 22:35 UTC by Marko Anastasov
Modified: 2006-06-30 12:46 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
patch and printingoperationpreview files (6.96 KB, application/x-compressed-tar)
2006-06-14 22:36 UTC, Marko Anastasov
Details
updated patch and new files (7.06 KB, application/x-compressed-tar)
2006-06-19 22:35 UTC, Marko Anastasov
Details

Description Marko Anastasov 2006-06-14 22:35:50 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.
Comment 1 Marko Anastasov 2006-06-14 22:36:31 UTC
Created attachment 67366 [details]
patch and printingoperationpreview files
Comment 2 Murray Cumming 2006-06-19 07:34:23 UTC
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.
Comment 3 Murray Cumming 2006-06-19 07:44:29 UTC
- 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.

Comment 4 Marko Anastasov 2006-06-19 22:35:43 UTC
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&.
Comment 5 Murray Cumming 2006-06-20 06:52:32 UTC
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. 


Comment 6 Murray Cumming 2006-06-20 17:06:21 UTC
Resetting status, etc. I'm not sure how that was changed.
Comment 7 Murray Cumming 2006-06-30 08:29:42 UTC
Marko, are you waiting for anything from me for this? If not, could you make the changes and commit, please?
Comment 8 Marko Anastasov 2006-06-30 12:44:41 UTC
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>.