A filter for selecting a subset of recently used files
Class GtkRecentFilter
A GtkRecentFilter can be used to restrict the files being shown in a GtkRecentChooser. 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 GtkRecentFilter 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 GtkRecentChooser, see gtk_recent_chooser_add_filter(), but it is also possible to manually use a filter on a file with gtk_recent_filter_filter().
| Methods | |
| add_age | Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified. |
| add_application | Adds a rule that allows resources based on the name of the application that has registered them. |
| add_custom | Adds a rule to a filter that allows resources based on a custom callback function. |
| add_group | Adds a rule that allows resources based on the name of the group to which they belong |
| add_mime_type | Adds a rule that allows resources based on their registered MIME type. |
| add_pattern | Adds a rule that allows resources based on a pattern matching their display name. |
| add_pixbuf_formats | Adds a rule allowing image files in the formats supported by GdkPixbuf. |
| filter | Tests whether a file should be displayed according to filter. |
| get_name | Gets the human-readable name for the filter. |
| get_needed | Gets the fields that need to be filled in for the structure passed to gtk_recent_filter_filter() |
| set_name | Sets the human-readable name of the filter. |
Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.
GtkRecentFilter.add_age( age )
| age | number of days |
Adds a rule that allows resources based on the name of the application that has registered them.
GtkRecentFilter.add_application( application )
| application | an application name |
Adds a rule to a filter that allows resources based on a custom callback function.
GtkRecentFilter.add_custom( needed, func, data )
| needed | bitfield of flags (GtkRecentFilterFlags) indicating the information that the custom filter function needs. |
| func | callback function; if the function returns TRUE, then the file will be displayed. |
| data | data to pass to func, or nil |
The bitfield needed which is passed in provides information about what sorts of information that the filter function needs; this allows GTK+ to avoid retrieving expensive information when it isn't needed by the filter.
Adds a rule that allows resources based on the name of the group to which they belong
GtkRecentFilter.add_group( group )
| group | a group name |
Adds a rule that allows resources based on their registered MIME type.
GtkRecentFilter.add_mime_type( mime_type )
| mime_type | a MIME type |
Adds a rule that allows resources based on a pattern matching their display name.
GtkRecentFilter.add_pattern( pattern )
| pattern | a file pattern |
Adds a rule allowing image files in the formats supported by GdkPixbuf.
GtkRecentFilter.add_pixbuf_formats()
Tests whether a file should be displayed according to filter.
GtkRecentFilter.filter( filter_info )
| filter_info | a GtkRecentFilterInfo structure containing information about a recently used resource |
| Return | TRUE if the file should be displayed |
The GtkRecentFilterInfo structure filter_info should include the fields returned from gtk_recent_filter_get_needed().
This function will not typically be used by applications; it is intended principally for use in the implementation of GtkRecentChooser.
Gets the human-readable name for the filter.
GtkRecentFilter.get_name()
| Return | the name of the filter, or NULL. |
Gets the fields that need to be filled in for the structure passed to gtk_recent_filter_filter()
GtkRecentFilter.get_needed()
| Return | bitfield of flags indicating needed fields when calling gtk_recent_filter_filter() |
This function will not typically be used by applications; it is intended principally for use in the implementation of GtkRecentChooser.
Sets the human-readable name of the filter.
GtkRecentFilter.set_name( name )
| name | the human readable name of 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.