[gtk+] GtkFileChooserNativeQuartz: improve support for file filters



commit bc2f125f1cc2bed03c04b1787b17dad947b62fbc
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date:   Mon Jul 31 21:26:47 2017 +0100

    GtkFileChooserNativeQuartz: improve support for file filters
    
    Instead of using conditional compilation, use respondsToSelector to
    check at runtime for setAccessoryViewDisclosed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785306

 gtk/gtkfilechoosernativequartz.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c
index d573248..f210c1d 100644
--- a/gtk/gtkfilechoosernativequartz.c
+++ b/gtk/gtkfilechoosernativequartz.c
@@ -208,6 +208,10 @@ filechooser_quartz_data_free (FileChooserQuartzData *data)
   g_free (data);
 }
 
+@protocol CanSetAccessoryViewDisclosed
+- (void)setAccessoryViewDisclosed:(BOOL)val;
+@end
+
 static gboolean
 filechooser_quartz_launch (FileChooserQuartzData *data)
 {
@@ -325,14 +329,11 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
         }
       [data->filter_combo_box setToolTip:[NSString stringWithUTF8String:_("Select which types of files are 
shown")]];
       [data->panel setAccessoryView:data->filter_combo_box];
-#ifdef AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
-      if (!data->save)
+      if ([data->panel isKindOfClass:[NSOpenPanel class]] && [data->panel 
respondsToSelector:@selector(setAccessoryViewDisclosed:)])
         {
-          [(NSOpenPanel *) data->panel setAccessoryViewDisclosed:YES];
+          [(id<CanSetAccessoryViewDisclosed>) data->panel setAccessoryViewDisclosed:YES];
         }
-#endif
     }
-
   data->response = GTK_RESPONSE_CANCEL;
 
   


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]