RecentFilter
open class RecentFilter : GLibObject.InitiallyUnowned, RecentFilterProtocol
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>
The RecentFilter
type acts as a reference-counted owner of an underlying GtkRecentFilter
instance.
It provides the methods that can operate on this data type through RecentFilterProtocol
conformance.
Use RecentFilter
as a strong reference or owner of a GtkRecentFilter
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
RecentFilter
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkRecentFilter>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkRecentFilter>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkRecentFilter>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkRecentFilter>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type. Will retainGtkRecentFilter
. i.e., ownership is transferred to theRecentFilter
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkRecentFilter>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
RecentFilterProtocol
Will retainGtkRecentFilter
.Declaration
Swift
@inlinable public init<T>(recentFilter other: T) where T : RecentFilterProtocol
Parameters
other
an instance of a related type that implements
RecentFilterProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
RecentFilterProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
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 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: (C Language Example):GtkRecentFilter *filter = gtk_recent_filter_new (); gtk_recent_filter_add_pattern (filter, "*");
Declaration
Swift
@inlinable public init()