Description [src]

final class Gtk.RecentFilter : GObject.InitiallyUnowned
  implements Gtk.Buildable {
  /* No available fields */

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().

Recently used files are supported since GTK+ 2.10.

GtkRecentFilter as GtkBuildable

The GtkRecentFilter implementation of the GtkBuildable interface supports adding rules using the <mime-types>, <patterns> and <applications> elements and listing the rules within. Specifying a <mime-type>, <pattern> or <application> has the same effect as calling gtk_recent_filter_add_mime_type(), gtk_recent_filter_add_pattern() or gtk_recent_filter_add_application().

An example of a UI definition fragment specifying GtkRecentFilter rules:

<object class="GtkRecentFilter">


hierarchy this GtkRecentFilter implements_0 GtkBuildable this--implements_0 ancestor_0 GInitiallyUnowned ancestor_0--this ancestor_1 GObject ancestor_1--ancestor_0




Creates a new GtkRecentFilter with no rules added to it. Such filter does not accept any recently used resources, so is not particularly useful until you add rules with gtk_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, "*");

since: 2.10

Instance methods


Adds a rule that allows resources based on their age - that is, the number of days elapsed since they were last modified.

since: 2.10


Adds a rule that allows resources based on the name of the application that has registered them.

since: 2.10


Adds a rule to a filter that allows resources based on a custom callback function. 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.

since: 2.10


Adds a rule that allows resources based on the name of the group to which they belong.

since: 2.10


Adds a rule that allows resources based on their registered MIME type.

since: 2.10


Adds a rule that allows resources based on a pattern matching their display name.

since: 2.10


Adds a rule allowing image files in the formats supported by GdkPixbuf.

since: 2.10


Tests whether a file should be displayed according to filter. The GtkRecentFilterInfo filter_info should include the fields returned from gtk_recent_filter_get_needed(), and must set the GtkRecentFilterInfo.contains field of filter_info to indicate which fields have been set.

since: 2.10


Gets the human-readable name for the filter. See gtk_recent_filter_set_name().

since: 2.10


Gets the fields that need to be filled in for the GtkRecentFilterInfo passed to gtk_recent_filter_filter()

since: 2.10


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.

since: 2.10

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GtkBuildable (10)

Adds a child to buildable. type is an optional string describing how the child should be added.

since: 2.12


Constructs a child of buildable with the name name.

since: 2.12


This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

since: 2.12


This is called at the end of each custom element handled by the buildable.

since: 2.12


This is called for each unknown element under <child>.

since: 2.12


Get the internal child called childname of the buildable object.

since: 2.12


Gets the name of the buildable object.

since: 2.12


Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

since: 2.12


Sets the property name name to value on the buildable object.

since: 2.12


Sets the name of the buildable object.

since: 2.12


Signals inherited from GObject (1)

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.