[GTK] Add an API to add a custom tab into the print dialog
authortpopela@redhat.com <tpopela@redhat.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 14:14:36 +0000 (14:14 +0000)
committertpopela@redhat.com <tpopela@redhat.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2017 14:14:36 +0000 (14:14 +0000)
commite81d712c2b8d06876f2e2dc2545ee9f068b0e8a7
tree33bec37576767bf7ad3d5846599ca67dfc233cab
parent348804aa6e8c034ac025224b741d8f1d419d69b0
[GTK] Add an API to add a custom tab into the print dialog
https://bugs.webkit.org/show_bug.cgi?id=151998

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

Add a new create-custom-widget signal to the WebKitPrintOperation. The
signal is emitted before the dialog is displayed and it gives an
opportunity to embed a custom widget in the dialog. You can do so by
creating a new WebKitPrintCustomWidget and returning it from the
create-custom-widget signal handler. The WebKitPrintCustomWidget is
emitting two signals:
  - update - emitted when the currently selected printer is changed,
             to be able to actualize the custom widget based on the
             current printer
  - apply - emitted when the dialog is closed, just before the
            printing will start, to be able e.g. to change content
            based on the custom widget state.

* PlatformGTK.cmake:
* UIProcess/API/gtk/WebKitAutocleanups.h:
* UIProcess/API/gtk/WebKitPrintCustomWidget.cpp: Added.
(webkitPrintCustomWidgetSetProperty):
(webkit_print_custom_widget_class_init):
(webkit_print_custom_widget_new):
(webkit_print_custom_widget_get_widget):
(webkit_print_custom_widget_get_title):
(webkitPrintCustomWidgetEmitCustomWidgetApplySignal):
(webkitPrintCustomWidgetEmitUpdateCustomWidgetSignal):
* UIProcess/API/gtk/WebKitPrintCustomWidget.h: Added.
* UIProcess/API/gtk/WebKitPrintCustomWidgetPrivate.h: Added.
* UIProcess/API/gtk/WebKitPrintOperation.cpp:
(webkitPrintOperationAccumulatorObjectHandled):
(webkit_print_operation_class_init):
(notifySelectedPrinterCallback):
(webkitPrintOperationRunDialog):
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/gtk/webkit2.h:

Tools:

Add a new WebKitPrintOperation/custom-widget test in TestPrinting
that is testing a newly added API.

* TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp:
(testPrintCustomWidget):
(beforeAll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h
Source/WebKit2/UIProcess/API/gtk/WebKitPrintCustomWidget.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitPrintCustomWidget.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitPrintCustomWidgetPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0.types
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
Source/WebKit2/UIProcess/API/gtk/webkit2.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestPrinting.cpp