On Sat, Nov 28, 2009 at 12:18 AM, Emmanuele Bassi <eba...@gmail.com> wrote:

> you can add multiple rules to a filter, but in this case I'd check the
> OS you're running on to decide what to use, e.g.:
>
>  if ($^O eq 'MSWin32') {
>      $filter->add_pattern('*.mp3');
>  }
>  else {
>      $filter->add_mime_type('audio/mp3');
>  }
>

This is probably the best solution.


> or, since add_mime_type() is ignored on Windows:
>
>  # default to MIME type...
>  $filter->add_mime_type('audio/mp3');
>  # ... and add the extension matching on Windows
>  $filter->add_pattern('*.mp3') if $^O eq 'MSWin32';
>

>From what I've seen mime-type rules are not ignored in windows[1] , instead
they get stored and processed as if there was no difference [2] (but there's
a difference). What happens later is that g_content_type_is_a will assumes
that it's arguments are not mime-types under windows. In the case of
Gtk2::FileFilter this results in no matches under windows as
g_content_type_is_a is expecting extensions and gets mime-types which don't
match. At the end this is not too intuitive as the documentation of
gtk_file_chooser_add_mime_type doesn't warn us about this behaviour.

[1] http://git.gnome.org/cgit/gtk+/tree/gtk/gtkfilefilter.c#n217
[2] http://git.gnome.org/cgit/gtk+/tree/gtk/gtkfilefilter.c#n378
-- 
Emmanuel Rodriguez
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to