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 file chooser.
Files can be filtered based on their name with the gtk:file-filter-add-pattern and gtk:file-filter-add-suffix 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 file chooser, see the gtk:file-dialog-filters 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-06-06