Re: How to make filefilter's patterns case insensitive?
- From: Murray Cumming <murrayc murrayc com>
- To: Paul Davis <paul linuxaudiosystems com>
- Cc: phan <phanyx o2 pl>, gtkmm-list gnome org
- Subject: Re: How to make filefilter's patterns case insensitive?
- Date: Tue, 31 Aug 2010 09:06:22 +0200
On Mon, 2010-08-30 at 21:02 -0400, Paul Davis wrote:
> 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.
Well, it would be nice if we could say filter.add_extension("abc"),
maybe with a bool case_sensitive parameter. That feels doable.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]