How to set custom Gtk::FileFilter




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


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