Class

GtkRecentFilter

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">
  <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>

Hierarchy

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

Implements

Constructors

gtk_recent_filter_new

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

gtk_recent_filter_add_age

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

gtk_recent_filter_add_application

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

since: 2.10

gtk_recent_filter_add_custom

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

gtk_recent_filter_add_group

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

since: 2.10

gtk_recent_filter_add_mime_type

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

since: 2.10

gtk_recent_filter_add_pattern

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

since: 2.10

gtk_recent_filter_add_pixbuf_formats

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

since: 2.10

gtk_recent_filter_filter

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

gtk_recent_filter_get_name

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

since: 2.10

gtk_recent_filter_get_needed

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

since: 2.10

gtk_recent_filter_set_name

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)
gtk_buildable_add_child

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

since: 2.12

gtk_buildable_construct_child

Constructs a child of buildable with the name name.

since: 2.12

gtk_buildable_custom_finished

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

since: 2.12

gtk_buildable_custom_tag_end

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

since: 2.12

gtk_buildable_custom_tag_start

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

since: 2.12

gtk_buildable_get_internal_child

Get the internal child called childname of the buildable object.

since: 2.12

gtk_buildable_get_name

Gets the name of the buildable object.

since: 2.12

gtk_buildable_parser_finished

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

gtk_buildable_set_buildable_property

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

since: 2.12

gtk_buildable_set_name

Sets the name of the buildable object.

since: 2.12

Signals

Signals inherited from GObject (1)
GObject::notify

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.