Re: How to set custom Gtk::FileFilter
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: Mathias Müller <mueller physik uni-kiel de>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: How to set custom Gtk::FileFilter
- Date: Tue, 27 Aug 2013 16:46:22 +0200
No, it does not use regex. If it did, the pattern would have been
".*\.dat" instead of "*.dat".
The description,
https://developer.gnome.org/gtkmm/stable/classGtk_1_1FileFilter.html#a9b49e4a03afffc2806d17abf33b26cad
or, if you use gtkmm 2
https://developer.gnome.org/gtkmm/2.24/classGtk_1_1FileFilter.html#a9b49e4a03afffc2806d17abf33b26cad
says "Adds a rule allowing a shell style glob to a filter."
Kjell
2013-08-27 11:59, Mathias Müller skrev:
This works pretty well :-) Thanks!!
I thought it just works with a custom filter, but this simple pattern (does it use regex?) does it.
Tak
/M
On 0, Kjell Ahlstedt <kjell ahlstedt bredband net> wrote:
2013-08-27 08:46, mueller physik uni-kiel de skrev:
Hi,
I recently started with gtkmm and I have to admit that the documentation is pretty good. However, sometimes
it lacks some details or examples.
Maybe I find some help in this gtkmm mailing list.
I am using the Gtk::FileFilter with mimetypes. My aim is to allow only csv/txt/dat files to be shown in the
filebrowser. Unfortunatelly,
only csv and txt file extensions are covered with a mimetype definition. The documentation says there is a
function called add_custom()
but I really cannot imagine how it should be applied. Could you please help with a minimal example how to set
a custom filter?
May current code looks like this:
(Browser is a Gtk::FileChooserWidget)
Gtk::FileFilter * filter = new Gtk::FileFilter ;
filter->set_name( "CSV Files" ) ;
filter->add_mime_type( "text/csv" ) ;
UI_DATA->Browser->set_filter( *filter ) ;
Many thanks,
/M
_______________________________________________
Do you really need a custom filter? Can't you use
filter->add_pattern("*.dat");
Kjell
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]