Re: Gtk2::FileFilter by mime type

On Sat, Nov 28, 2009 at 12:18 AM, Emmanuele Bassi <ebassi 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') {
Âelse {

This is probably the best solution.
or, since add_mime_type() is ignored on Windows:

Â# default to MIME type...
Â# ... 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.

Emmanuel Rodriguez

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