GNOME Bugzilla – Bug 784723
macOS: native file chooser dialog
Last modified: 2017-07-18 19:12:22 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.
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.
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.
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.
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.
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.
Created attachment 355589 [details] [review] GtkFileChooserNative Quartz and Win32 patches
thanks so much! I'll look at the patches this week
wow that was fast! Many thanks for merging this in!