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 784723 - macOS: native file chooser dialog
macOS: native file chooser dialog
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
3.22.x
Other Mac OS
: Normal enhancement
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-07-09 17:31 UTC by Tom Schoonjans
Modified: 2017-07-18 19:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkFileChooserNativeQuartz patch (32.11 KB, patch)
2017-07-09 17:31 UTC, Tom Schoonjans
none Details | Review
GtkFileChooserNative Quartz and Win32 patches (42.56 KB, patch)
2017-07-14 11:39 UTC, Tom Schoonjans
committed Details | Review

Description Tom Schoonjans 2017-07-09 17:31:53 UTC
Created attachment 355212 [details] [review]
GtkFileChooserNativeQuartz patch

Hi,


I have written the necessary code to implement support for native file chooser dialogs on macOS, drawing inspiration from the Win32 code as well as the custom dialogs offered by gedit. Support is provided for filters with patterns, mime types and pixbuf formats. A GtkLabel instance can be passed as an extra widget in which case its text will be used as 'message'.

The patch I am attaching was written against the gtk-3-22 branch, but I am confident it can also be applied to master with possibly no further work needed apart from updating the meson build file.

Let me know if more work is needed before this will be considered for inclusion into the codebase.
Comment 1 Matthias Clasen 2017-07-10 14:35:09 UTC
Review of attachment 355212 [details] [review]:

Thanks a lot for working on this!

I have no way of testing it right now, but if it works well for you, we should just land this.
Comment 2 Matthias Clasen 2017-07-10 14:35:34 UTC
Review of attachment 355212 [details] [review]:

Thanks a lot for working on this!

I have no way of testing it right now, but if it works well for you, we should just land this.
Comment 3 Tom Schoonjans 2017-07-10 15:51:21 UTC
I appreciate the confidence, but this needs proper testing and code review IMHO.

For instance, it's possible that I am creating some memory leaks when releasing the Objective-C instances and I would be grateful if an experienced Objective-C coder would have a look at this.
Comment 4 Tom Schoonjans 2017-07-11 15:07:07 UTC
I noticed that gtk_file_chooser_set_filter and gtk_file_chooser_get_filter (and possibly others) are not implemented in gtkfilechoosernative.c or the delegate in gtkfilechooserutils.c.

Was this done intentionally?

I would gladly look into adding support for these features in the quartz dialog.
Comment 5 Tom Schoonjans 2017-07-11 15:54:52 UTC
Sorry for my ignorant comment in the previous post, didn't see that they were implemented in gtkfilechooser.c.  Didn't know that it was allowed to provide proper implementations of the interfaces in the interface source file (too much Java lately...)

Either way, there is no code in the win32 or quartz native dialog to update the filter property of GtkFileChooser, so both gtk_file_chooser_set_filter and gtk_file_chooser_get_filter are effectively ignored, which seems unfortunate to me.
Comment 6 Tom Schoonjans 2017-07-14 11:38:15 UTC
I have updated my patches: now gtk_file_chooser_get_filter() and gtk_file_chooser_set_filter() work for the Quartz and Win32 native dialogs.
Comment 7 Tom Schoonjans 2017-07-14 11:39:40 UTC
Created attachment 355589 [details] [review]
GtkFileChooserNative Quartz and Win32 patches
Comment 8 Matthias Clasen 2017-07-18 14:48:57 UTC
thanks so much! I'll look at the patches this week
Comment 9 Tom Schoonjans 2017-07-18 19:12:22 UTC
wow that was fast!

Many thanks for merging this in!