GtkFileChooserNativeQuartz: add support for Mountain Lion and Mavericks

https://bugzilla.gnome.org/show_bug.cgi?id=784723 introduced support for
native file chooser dialogs on macOS, but due to the use of generics in
the patch, there will be compilation errors on pre-Xcode 7 platforms,
such as Mountain Lion and Mavericks.

I strongly recommend to revert this patch when the oldest supported
macOS release is bumped to Yosemite (10.10).

https://bugzilla.gnome.org/show_bug.cgi?id=785306
This commit is contained in:
Tom Schoonjans 2017-07-23 09:37:26 +01:00 committed by Matthias Clasen
parent 44e1c19b42
commit 798ea02440
3 changed files with 11 additions and 11 deletions

View File

@ -67,8 +67,8 @@ typedef struct {
GFile *current_file;
char *current_name;
NSMutableArray<NSArray<NSString *> *> *filters;
NSMutableArray<NSString *> *filter_names;
NSMutableArray *filters;
NSMutableArray *filter_names;
NSComboBox *filter_combo_box;
GSList *files;
@ -94,7 +94,7 @@ typedef struct {
- (void)comboBoxSelectionDidChange:(NSNotification *)notification
{
NSInteger selected_index = [data->filter_combo_box indexOfSelectedItem];
NSArray<NSString *> *filter = [data->filters objectAtIndex:selected_index];
NSArray *filter = [data->filters objectAtIndex:selected_index];
// check for empty strings in filter -> indicates all filetypes should be allowed!
if ([filter containsObject:@""])
[data->panel setAllowedFileTypes:nil];
@ -400,11 +400,11 @@ strip_mnemonic (const gchar *s)
static gboolean
file_filter_to_quartz (GtkFileFilter *file_filter,
NSMutableArray<NSArray<NSString *> *> *filters,
NSMutableArray<NSString *> *filter_names)
NSMutableArray *filters,
NSMutableArray *filter_names)
{
const char *name;
NSArray<NSString *> *pattern_nsstrings;
NSArray *pattern_nsstrings;
pattern_nsstrings = _gtk_file_filter_get_as_pattern_nsstrings (file_filter);
if (pattern_nsstrings == NULL)
@ -462,9 +462,9 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
n_filters = g_slist_length (filters);
if (n_filters > 0)
{
data->filters = [NSMutableArray<NSArray<NSString *> *> arrayWithCapacity:n_filters];
data->filters = [NSMutableArray arrayWithCapacity:n_filters];
[data->filters retain];
data->filter_names = [NSMutableArray<NSString *> arrayWithCapacity:n_filters];
data->filter_names = [NSMutableArray arrayWithCapacity:n_filters];
[data->filter_names retain];
for (l = filters, i = 0; l != NULL; l = l->next, i++)

View File

@ -596,9 +596,9 @@ gtk_file_filter_get_needed (GtkFileFilter *filter)
#import <Foundation/Foundation.h>
NSArray<NSString *> * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
{
NSMutableArray<NSString *> *array = [[NSMutableArray alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
GSList *tmp_list;
for (tmp_list = filter->rules; tmp_list; tmp_list = tmp_list->next)

View File

@ -31,7 +31,7 @@ G_BEGIN_DECLS
char ** _gtk_file_filter_get_as_patterns (GtkFileFilter *filter);
#ifdef GDK_WINDOWING_QUARTZ
NSArray<NSString *> * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter);
NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter);
#endif