Package: gtk

Class gtk-recent-filter

Superclasses

gtk-buildable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

None

Details

A gtk-recent-filter object can be used to restrict the files being shown in a gtk-recent-chooser widget. Files can be filtered based on their name with the gtk-recent-filter-add-pattern function, on their MIME type with the gtk-file-filter-add-mime-type function, on the application that has registered them with the gtk-recent-filter-add-application function, or by a custom filter function with the gtk-recent-filter-add-custom function.

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 the gtk-recent-filter object 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 widget, see the gtk-recent-chooser-add-filter function, but it is also possible to manually use a filter on a file with the gtk-recent-filter-filter function.

GtkRecentFilter as GtkBuildable

The 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 gtk-recent-filter-add-mime-type, gtk-recent-filter-add-pattern or gtk-recent-filter-add-application functions.

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

See also

2021-12-27