FileFilter
open class FileFilter : GLibObject.InitiallyUnowned, FileFilterProtocol
A GtkFileFilter can be used to restrict the files being shown in a
GtkFileChooser. Files can be filtered based on their name (with
gtk_file_filter_add_pattern()), on their mime type (with
gtk_file_filter_add_mime_type()), or by a custom filter function
(with gtk_file_filter_add_custom()).
Filtering by mime types 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 GtkFileFilter 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 GtkFileChooser,
see gtk_file_chooser_add_filter(), but it is also possible
to manually use a filter on a file with gtk_file_filter_filter().
GtkFileFilter as GtkBuildable
The GtkFileFilter 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> or <pattern> has the same effect as as calling
gtk_file_filter_add_mime_type() or gtk_file_filter_add_pattern().
An example of a UI definition fragment specifying GtkFileFilter rules:
<object class="GtkFileFilter">
<mime-types>
<mime-type>text/plain</mime-type>
<mime-type>image/ *</mime-type>
</mime-types>
<patterns>
<pattern>*.txt</pattern>
<pattern>*.png</pattern>
</patterns>
</object>
The FileFilter type acts as a reference-counted owner of an underlying GtkFileFilter instance.
It provides the methods that can operate on this data type through FileFilterProtocol conformance.
Use FileFilter as a strong reference or owner of a GtkFileFilter 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
FileFilterinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkFileFilter>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkFileFilter>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkFileFilter>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkFileFilter>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkFileFilter. i.e., ownership is transferred to theFileFilterinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkFileFilter>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
FileFilterProtocolWill retainGtkFileFilter.Declaration
Swift
@inlinable public init<T>(fileFilter other: T) where T : FileFilterProtocolParameters
otheran instance of a related type that implements
FileFilterProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)Parameters
praw 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
FileFilterProtocol.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
FileFilterProtocol.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable 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
FileFilterProtocol.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable 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
FileFilterProtocol.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)Parameters
popaque 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
FileFilterProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new
GtkFileFilterwith no rules added to it. Such a filter doesn’t accept any files, so is not particularly useful until you add rules withgtk_file_filter_add_mime_type(),gtk_file_filter_add_pattern(), orgtk_file_filter_add_custom(). To create a filter that accepts any file, use: (C Language Example):GtkFileFilter *filter = gtk_file_filter_new (); gtk_file_filter_add_pattern (filter, "*");Declaration
Swift
@inlinable public init() -
Deserialize a file filter from an a{sv} variant in the format produced by
gtk_file_filter_to_gvariant().Declaration
Swift
@inlinable public init<VariantT>(gvariant variant: VariantT) where VariantT : VariantProtocol -
Deserialize a file filter from an a{sv} variant in the format produced by
gtk_file_filter_to_gvariant().Declaration
Swift
@inlinable public static func newFromG<VariantT>(gvariant variant: VariantT) -> FileFilter! where VariantT : VariantProtocol
View on GitHub
Install in Dash
FileFilter Class Reference