FileFilterRef
public struct FileFilterRef : FileFilterProtocol, GWeakCapturing
GtkFileFilter filters files by name or mime type.
GtkFileFilter can be used to restrict the files being shown in a
GtkFileChooser. Files can be filtered based on their name (with
[methodGtk.FileFilter.add_pattern] or [methodGtk.FileFilter.add_suffix])
or on their mime type (with [methodGtk.FileFilter.add_mime_type]).
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, file filters are used by adding them to a GtkFileChooser
(see [methodGtk.FileChooser.add_filter]), but it is also possible to
manually use a file filter on any [classGtk.FilterListModel] containing
GFileInfo objects.
GtkFileFilter as GtkBuildable
The GtkFileFilter implementation of the GtkBuildable interface
supports adding rules using the <mime-types> and <patterns> and
<suffixes> elements and listing the rules within. Specifying a
<mime-type> or <pattern> or <suffix> has the same effect as
as calling
[methodGtk.FileFilter.add_mime_type] or
[methodGtk.FileFilter.add_pattern] or
[methodGtk.FileFilter.add_suffix].
An example of a UI definition fragment specifying GtkFileFilter
rules:
<object class="GtkFileFilter">
<property name="name" translatable="yes">Text and Images</property>
<mime-types>
<mime-type>text/plain</mime-type>
<mime-type>image/ *</mime-type>
</mime-types>
<patterns>
<pattern>*.txt</pattern>
</patterns>
<suffixes>
<suffix>png</suffix>
</suffixes>
</object>
The FileFilterRef type acts as a lightweight Swift reference to an underlying GtkFileFilter instance.
It exposes methods that can operate on this data type through FileFilterProtocol conformance.
Use FileFilterRef only as an unowned reference to an existing GtkFileFilter instance.
-
Untyped pointer to the underlying `GtkFileFilter` instance.For type-safe access, use the generated, typed pointer
file_filter_ptrproperty instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkFileFilter>) -
Designated initialiser from a constant pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkFileFilter>) -
Conditional initialiser from an optional pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkFileFilter>?) -
Conditional initialiser from an optional, non-mutable pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkFileFilter>?) -
Conditional initialiser from an optional
gpointerDeclaration
Swift
@inlinable init!(gpointer g: gpointer?) -
Conditional initialiser from an optional, non-mutable
gconstpointerDeclaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?) -
Reference intialiser for a related type that implements
FileFilterProtocolDeclaration
Swift
@inlinable init<T>(_ other: T) where T : FileFilterProtocol -
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> FileFilterRef where T : FileFilterProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>) -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable init(mutating 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 init(raw: UnsafeMutableRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
FileFilterProtocol.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer) -
Creates a new `GtkFileFilter` with no rules added to it.Such a filter doesn’t accept any files, so is not particularly useful until you add rules with [method
Gtk.FileFilter.add_mime_type], [methodGtk.FileFilter.add_pattern], [methodGtk.FileFilter.add_suffix] or [methodGtk.FileFilter.add_pixbuf_formats].To create a filter that accepts any file, use:
GtkFileFilter *filter = gtk_file_filter_new (); gtk_file_filter_add_pattern (filter, "*");Declaration
Swift
@inlinable init() -
Deserialize a file filter from a
GVariant.The variant must be in the format produced by [method
Gtk.FileFilter.to_gvariant].Declaration
Swift
@inlinable init<VariantT>(gvariant variant: VariantT) where VariantT : VariantProtocol -
Deserialize a file filter from a
GVariant.The variant must be in the format produced by [method
Gtk.FileFilter.to_gvariant].Declaration
Swift
@inlinable static func newFromG<VariantT>(gvariant variant: VariantT) -> FileFilterRef! where VariantT : VariantProtocol
View on GitHub
Install in Dash
FileFilterRef Structure Reference