WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
165298
[GTK] Minibrowser: Add printing support
https://bugs.webkit.org/show_bug.cgi?id=165298
Summary
[GTK] Minibrowser: Add printing support
Tomas Popela
Reported
2016-12-02 02:36:50 PST
It would be nice to have a possibility of showing a print dialog when pressing a Ctrl + P shortcut.
Attachments
Patch
(2.76 KB, patch)
2016-12-02 02:39 PST
,
Tomas Popela
no flags
Details
Formatted Diff
Diff
Patch
(2.57 KB, patch)
2017-01-04 04:45 PST
,
Tomas Popela
mcatanzaro
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Tomas Popela
Comment 1
2016-12-02 02:39:59 PST
Created
attachment 295936
[details]
Patch
Michael Catanzaro
Comment 2
2016-12-02 08:18:09 PST
Comment on
attachment 295936
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=295936&action=review
Maybe we should add a toolbar button for it...?
> Tools/MiniBrowser/gtk/BrowserWindow.c:533 > + if (webkit_print_operation_run_dialog(printOperation, GTK_WINDOW(window)) != WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL) > + g_signal_connect(printOperation, "failed", G_CALLBACK(webKitPrintOperationFailedCallback), window);
Does this error path actually work? Did you test it? The "failed" signal is emitted after the dialog is closed, so you don't need to connect in advance?
Michael Catanzaro
Comment 3
2016-12-02 08:18:52 PST
I think if that actually works, then we need better documentation for WebKitPrintOperation, because that's not what I'd expect.
Carlos Garcia Campos
Comment 4
2016-12-02 08:34:04 PST
Comment on
attachment 295936
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=295936&action=review
I've always used javascript:print() in the url bar to test printing with MiniBrowser, but I'm ok with adding CTRL + P too.
> Tools/MiniBrowser/gtk/BrowserWindow.c:519 > +static void webKitPrintOperationFailedCallback(WebKitPrintOperation *printOperation, GError *error, BrowserWindow *window)
BrowserWindow is unused, you could just pas NULL as user_data
> Tools/MiniBrowser/gtk/BrowserWindow.c:524 > + g_warning("Print failed without error set");
Is this really possible? I think this should be a bug, failed callback should always provide a valid GError.
Michael Catanzaro
Comment 5
2016-12-02 09:19:54 PST
Ah yeah, if there's no GError set then you should just crash by dereferencing it. :) As a rule, functions that can fail must always set the GError when returning FALSE; that convention should apply to our signal here too.
Tomas Popela
Comment 6
2016-12-05 03:01:43 PST
(In reply to
comment #4
)
> Is this really possible? I think this should be a bug, failed callback > should always provide a valid GError.
I added it there "just to be sure". I will remove it.
Tomas Popela
Comment 7
2016-12-05 03:26:54 PST
(In reply to
comment #3
)
> I think if that actually works, then we need better documentation for > WebKitPrintOperation, because that's not what I'd expect.
No, it does not work. I actually don't know how to make the print to fail.
Michael Catanzaro
Comment 8
2016-12-05 03:49:51 PST
(In reply to
comment #7
)
> (In reply to
comment #3
) > > I think if that actually works, then we need better documentation for > > WebKitPrintOperation, because that's not what I'd expect. > > No, it does not work. I actually don't know how to make the print to fail.
To test it, modify GTK+ so that the operation does nothing but fail.
Tomas Popela
Comment 9
2017-01-04 04:45:01 PST
Created
attachment 298004
[details]
Patch
Michael Catanzaro
Comment 10
2017-01-04 09:26:08 PST
Comment on
attachment 298004
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=298004&action=review
> Tools/MiniBrowser/gtk/BrowserWindow.c:521 > + g_warning("Print failed with: '%s'", error->message);
Remove the word "with"
Tomas Popela
Comment 11
2017-01-05 04:08:42 PST
Committed
r210324
: <
http://trac.webkit.org/changeset/210324
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug