Package: gtk
Class gtk:file-filter
SuperclassesDocumented Subclasses
None
Direct SlotsDetails The gtk:file-filter object can be used to restrict the files being shown in a gtk:file-chooser widget.
Files can be filtered based on their name with the gtk:file-filter-add-pattern function or on their MIME type with the gtk:file-filter-add-mime-type function. Filtering by MIME types handles aliasing and subclassing of MIME types. For example, 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 the gtk:file-filter object allows wildcards for the subtype of a MIME type, so you can, for example, filter for image/*. Normally, file filters are used by adding them to a gtk:file-chooser widget, see the gtk:file-chooser-add-filter function, but it is also possible to manually use a file filter on any gtk:filter-list-model object containing g:file-info objects. GtkFileFilter as GtkBuildableExamples<object class="GtkFileFilter"> <property name="name" translatable="yes">Text and Images</property> <mime-types> <mime-type>text/plain</mime-type> <mime-type>image/ *</mime-type> </mime-types> <patterns> <pattern>*.txt</pattern> </patterns> <suffixes> <suffix>png</suffix> </suffixes> </object> | Returned bySlot Access FunctionsInherited Slot Access FunctionsSee also |
2025-3-13