A gtk-recent-filter can be used to restrict the files being shown in a gtk-recent-chooser. Files can be filtered based on their name with the function gtk-recent-filter-add-pattern, on their mime type with the function gtk-file-filter-add-mime-type, on the application that has registered them with the function gtk-recent-filter-add-application, or by a custom filter function with the function gtk-recent-filter-add-custom.
Filtering by mime type handles aliasing and subclassing of mime types; e. g. a filter for text/plain also matches a file with mime type application/rtf, since application/rtf is a subclass of text/plain. Note that gtk-recent-filter allows wildcards for the subtype of a mime type, so you can e. g. filter for image/*.
Normally, filters are used by adding them to a gtk-recent-chooser, see the function gtk-recent-chooser-add-filter, but it is also possible to manually use a filter on a file with the function gtk-recent-filter-filter.
Recently used files are supported since GTK+ 2.10.
GtkRecentFilter as GtkBuildableThe gtk-recent-filter implementation of the gtk-buildable interface supports adding rules using the <mime-types>, <patterns> and <applications> elements and listing the rules within. Specifying a <mime-type>, <pattern> or <application> is the same as calling the functions gtk-recent-filter-add-mime-type, gtk-recent-filter-add-pattern or gtk-recent-filter-add-application.
Example: A UI definition fragment specifying gtk-recent-filter rules
<object class="GtkRecentFilter"> <mime-types> <mime-type>text/plain</mime-type> <mime-type>image/png</mime-type> </mime-types> <patterns> <pattern>*.txt</pattern> <pattern>*.png</pattern> </patterns> <applications> <application>gimp</application> <application>gedit</application> <application>glade</application> </applications> </object>
Inherited Slot Access Functions