Re: How to set custom Gtk::FileFilter



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]