A filter for selecting a subset of recently used files
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
gtk-recent-filter-add-pattern
), on their mime type (with
gtk-file-filter-add-mime-type
), on the application that has registered
them (with gtk-recent-filter-add-application
), or by a custom filter
function (with 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
gtk-recent-chooser-add-filter
, but it is also possible to manually use a
filter on a file with gtk-recent-filter-filter
.
Recently used files are supported since GTK+ 2.10.
<gtk-recent-filter>
)Creates a new
<gtk-recent-filter>
with no rules added to it. Such filter does not accept any recently used resources, so is not particularly useful until you add rules withgtk-recent-filter-add-pattern
,gtk-recent-filter-add-mime-type
,gtk-recent-filter-add-application
,gtk-recent-filter-add-age
. To create a filter that accepts any recently used resource, use:GtkRecentFilter *filter = gtk_recent_filter_new (); gtk_recent_filter_add_pattern (filter, "*");
- ret
- a new
<gtk-recent-filter>
Since 2.10
<gtk-recent-filter>
) ⇒ (ret mchars
)Gets the human-readable name for the filter. See
gtk-recent-filter-set-name
.
- filter
- a
<gtk-recent-filter>
- ret
- the name of the filter, or ‘
#f
’. The returned string is owned by the filter object and should not be freed.Since 2.10
<gtk-recent-filter>
) (name mchars
)Sets the human-readable name of the filter; this is the string that will be displayed in the recently used resources selector user interface if there is a selectable list of filters.
- filter
- a
<gtk-recent-filter>
- name
- then human readable name of filter
Since 2.10
<gtk-recent-filter>
) (mime_type mchars
)Adds a rule that allows resources based on their registered MIME type.
- filter
- a
<gtk-recent-filter>
- mime-type
- a MIME type
Since 2.10
<gtk-recent-filter>
) (pattern mchars
)Adds a rule that allows resources based on a pattern matching their display name.
- filter
- a
<gtk-recent-filter>
- pattern
- a file pattern
Since 2.10
<gtk-recent-filter>
) (application mchars
)Adds a rule that allows resources based on the name of the application that has registered them.
- filter
- a
<gtk-recent-filter>
- application
- an application name
Since 2.10
<gtk-recent-filter>
) (group mchars
)Adds a rule that allows resources based on the name of the group to which they belong
- filter
- a
<gtk-recent-filter>
- group
- a group name
Since 2.10
<gtk-recent-filter>
) (days int
)Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.
- filter
- a
<gtk-recent-filter>
- days
- number of days
Since 2.10
<gtk-recent-filter>
) ⇒ (ret <gtk-recent-filter-flags>
)Gets the fields that need to be filled in for the structure passed to
gtk-recent-filter-filter
This function will not typically be used by applications; it is intended principally for use in the implementation of
<gtk-recent-chooser>
.
- filter
- a
<gtk-recent-filter>
- ret
- bitfield of flags indicating needed fields when calling
gtk-recent-filter-filter
Since 2.10