Re: How to make filefilter's patterns case insensitive?



On Thu, Aug 26, 2010 at 6:34 PM, phan <phanyx o2 pl> wrote:
> Hello,
>
> Let's say, that I need to provide a Gtk::FileFilter to Gtk::FileChooserDialog, that will show all files with extension .abc, but also .ABC and .aBc etc., and I cannot provide filefilter with mime-type. Is there any simple way to make filefilter pattern (provided with 'void add_pattern (const Glib::ustring& pattern)') case insensitive?
>
> I tried sth like this:
>        Glib::ustring tmp = "*.abc";
>        fileFilter.add_pattern (tmp.casefold ());
> but with no luck.
>
> For now I did:
>        fileFilter.add_pattern ("*.[Aa][Bb][Cc]");
> but it's kind of inconvenient.
>
> It would be great and intuitive, if the add_pattern method was like:
>        void add_pattern (const Glib::ustring& pattern, bool caseSensitive=FALSE);
> but well, maybe there's even simpler method, that I'm not aware of?

taking an arbitrary regular expression and using it for non-case
sensitive-matching is non-trivial. if you want this, just use a
suitable regular expression, otherwise, you're asking for a more
powerful regular expression engine than i believe glib offers. i could
be wrong.

--p


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