WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
169278
[GTK] Use GtkFileChooserNative for open/save dialogs
https://bugs.webkit.org/show_bug.cgi?id=169278
Summary
[GTK] Use GtkFileChooserNative for open/save dialogs
Adrian Perez
Reported
2017-03-07 06:25:59 PST
Starting with GTK+ 3.20 there is a new GtkFileChooserNative file chooser dialog implementation:
https://developer.gnome.org/gtk3/stable/gtk3-GtkFileChooserNative.html
It would be interesting to use it if possible, when building with GTK+ 3.20+ because it allows for a few niceties which better integrate applications using WebKitGTK+ into the running environment: - When an application is running on a desktop environment which does not use GTK+, the desktop environment could set up things to use its native open/save dialogs (e.g. the Epiphany running on KDE could use Qt dialogs). - When an application is running inside a sandboxed environment (for example with Flatpak —
http://flatpak.org
), “portals” may be used automatically to allow for selection of files from outside of the sandboxed environment. - Using platform-specific open/save dialogs where available (e.g. in Mac OS; at the moment it is not possible to build a recent WebKitGTK+ for Windows, but the code would be ready to use Windows systems dialogs if somebody would add the other missing pieces). Note that GtkFileChooserNative has a few shortcomings when compared to GtkFileChooserDialog, so part of the work is to evaluate whether the current uses of the latter can be replaced with GtkFileChooserNative.
Attachments
Patch
(4.62 KB, patch)
2017-03-07 08:10 PST
,
Adrian Perez
no flags
Details
Formatted Diff
Diff
Patch
(4.46 KB, patch)
2017-03-08 09:53 PST
,
Adrian Perez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Michael Catanzaro
Comment 1
2017-03-07 06:37:30 PST
Looks pretty easy, just need to update webkitWebViewRunFileChooser in WebKitWebView.cpp. Looks like it has no support for MIME types filter, though? That's a shame.
Adrian Perez
Comment 2
2017-03-07 07:00:29 PST
(In reply to
comment #1
)
> Looks pretty easy, just need to update webkitWebViewRunFileChooser in > WebKitWebView.cpp. > > Looks like it has no support for MIME types filter, though? That's a shame.
I am already making a test build with locally with the needed changes applied; I will attach it to the bug soon. Regarding the filters, from the documentation (linked in the bug description) my interpretation is that: - MIME-type based filters are supported by the Flatpak portal chooser implementation. We are only using this kind of filter in WebKitGTK+ (good!). - No filters at all are supported in the Windows implementation. When using filters GtkFileChooserNative automatically falls-back to using GtkFileChooserDialog. Not like we care right now, as we are lacking in the Windows support department, but if somebody made WebKitGTK+ work in Windows, it seems reasonable to use GtkFileChooserNative and let it trigger the fall-back code path when needed. TL;DR: We will be fine as we are only using MIME-type based filters.
Adrian Perez
Comment 3
2017-03-07 08:10:45 PST
Created
attachment 303653
[details]
Patch
WebKit Commit Bot
Comment 4
2017-03-07 08:12:28 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See
http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Michael Catanzaro
Comment 5
2017-03-07 11:01:16 PST
Comment on
attachment 303653
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=303653&action=review
LGTM. Carlos Garcia will want to review it as well.
> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:569 > + // XXX: Using a filter based on MIME types does not work in Windows. If such a filter is > + // set, GtkFileChooserNative automatically falls-back to using GtkFileChooserDialog.
That's not our problem. We don't even support Windows. You can remove this comment.
Michael Catanzaro
Comment 6
2017-03-07 11:01:37 PST
Note: this is required for our goal to release Flatpaks.
Adrian Perez
Comment 7
2017-03-08 09:53:22 PST
Created
attachment 303817
[details]
Patch
Adrian Perez
Comment 8
2017-03-08 09:54:10 PST
(In reply to
comment #5
)
> Comment on
attachment 303653
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=303653&action=review
> > LGTM. Carlos Garcia will want to review it as well. > > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:569 > > + // XXX: Using a filter based on MIME types does not work in Windows. If such a filter is > > + // set, GtkFileChooserNative automatically falls-back to using GtkFileChooserDialog. > > That's not our problem. We don't even support Windows. You can remove this > comment.
Comment removed. It should be good to go now :-)
WebKit Commit Bot
Comment 9
2017-03-09 05:42:42 PST
Comment on
attachment 303817
[details]
Patch Clearing flags on attachment: 303817 Committed
r213637
: <
http://trac.webkit.org/changeset/213637
>
WebKit Commit Bot
Comment 10
2017-03-09 05:42:46 PST
All reviewed patches have been landed. Closing bug.
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