Package ch.bailu.gtk.gtk
Klasse FileFilter
- Alle implementierten Schnittstellen:
PointerInterface
Filters files by name or mime type.
`GtkFileFilter` can be used to restrict the files being shown in a
file chooser. Files can be filtered based on their name (with
[method@Gtk.FileFilter.add_pattern] or [method@Gtk.FileFilter.add_suffix])
or on their mime type (with [method@Gtk.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 file chooser
(see [method@Gtk.FileDialog.set_filters]), but it is also possible to
manually use a file filter on any [class@Gtk.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
[method@Gtk.FileFilter.add_mime_type] or
[method@Gtk.FileFilter.add_pattern] or
[method@Gtk.FileFilter.add_suffix].
An example of a UI definition fragment specifying `GtkFileFilter`
rules:
```xml
<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>
```
`GtkFileFilter` can be used to restrict the files being shown in a
file chooser. Files can be filtered based on their name (with
[method@Gtk.FileFilter.add_pattern] or [method@Gtk.FileFilter.add_suffix])
or on their mime type (with [method@Gtk.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 file chooser
(see [method@Gtk.FileDialog.set_filters]), but it is also possible to
manually use a file filter on any [class@Gtk.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
[method@Gtk.FileFilter.add_mime_type] or
[method@Gtk.FileFilter.add_pattern] or
[method@Gtk.FileFilter.add_suffix].
An example of a UI definition fragment specifying `GtkFileFilter`
rules:
```xml
<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>
```
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gtk.Filter
Filter.OnChanged
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gtk.Filter
SIGNAL_ON_CHANGED
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreates a new `GtkFileFilter` with no rules added to it.FileFilter
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addMimeType
(Str mime_type) Adds a rule allowing a given mime type.void
addMimeType
(String mime_type) Adds a rule allowing a given mime type.void
addPattern
(Str pattern) Adds a rule allowing a shell style glob pattern.void
addPattern
(String pattern) Adds a rule allowing a shell style glob pattern.void
Adds a rule allowing image files in the formats supported by `GdkPixbuf`.void
Adds a suffix match rule to a filter.void
Adds a suffix match rule to a filter.Implements interfaceBuildable
.Gets the attributes that need to be filled in for the `GFileInfo`
passed to this filter.static ClassHandler
static int
getName()
Gets the human-readable name for the filter.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
static FileFilter
newFromGvariantFileFilter
(Variant variant) Deserialize a file filter from a `GVariant`.void
Sets a human-readable name of the filter.void
Sets a human-readable name of the filter.Serialize a file filter to an `a{sv}` variant.Von Klasse geerbte Methoden ch.bailu.gtk.gtk.Filter
changed, getStrictness, match, onChanged
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
FileFilter
-
FileFilter
public FileFilter()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],
[method@Gtk.FileFilter.add_pattern],
[method@Gtk.FileFilter.add_suffix] or
[method@Gtk.FileFilter.add_pixbuf_formats].
To create a filter that accepts any file, use:
```c
GtkFileFilter *filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (filter, "*");
```
-
-
Methodendetails
-
getClassHandler
-
newFromGvariantFileFilter
Deserialize a file filter from a `GVariant`.
The variant must be in the format produced by
[method@Gtk.FileFilter.to_gvariant].- Parameter:
variant
- an `a{sv}` `GVariant`- Gibt zurück:
- a new `GtkFileFilter` object
-
addMimeType
Adds a rule allowing a given mime type.- Parameter:
mime_type
- name of a MIME type
-
addMimeType
Adds a rule allowing a given mime type.- Parameter:
mime_type
- name of a MIME type
-
addPattern
Adds a rule allowing a shell style glob pattern.
Note that it depends on the platform whether pattern
matching ignores case or not. On Windows, it does, on
other platforms, it doesn't.- Parameter:
pattern
- a shell style glob pattern
-
addPattern
Adds a rule allowing a shell style glob pattern.
Note that it depends on the platform whether pattern
matching ignores case or not. On Windows, it does, on
other platforms, it doesn't.- Parameter:
pattern
- a shell style glob pattern
-
addPixbufFormats
public void addPixbufFormats()Adds a rule allowing image files in the formats supported by `GdkPixbuf`.
This is equivalent to calling [method@Gtk.FileFilter.add_mime_type]
for all the supported mime types. -
addSuffix
Adds a suffix match rule to a filter.
This is similar to adding a match for the pattern "*.@suffix"
An exaple to filter files with the suffix ".sub":
```c
gtk_file_filter_add_suffix (filter, "sub");
```
Filters with multiple dots are allowed.
In contrast to pattern matches, suffix matches
are *always* case-insensitive.- Parameter:
suffix
- filename suffix to match
-
addSuffix
Adds a suffix match rule to a filter.
This is similar to adding a match for the pattern "*.@suffix"
An exaple to filter files with the suffix ".sub":
```c
gtk_file_filter_add_suffix (filter, "sub");
```
Filters with multiple dots are allowed.
In contrast to pattern matches, suffix matches
are *always* case-insensitive.- Parameter:
suffix
- filename suffix to match
-
getAttributes
Gets the attributes that need to be filled in for the `GFileInfo`
passed to this filter.
This function will not typically be used by applications;
it is intended for use in file chooser implementation.- Gibt zurück:
- the attributes
-
getName
Gets the human-readable name for the filter.
See [method@Gtk.FileFilter.set_name].- Gibt zurück:
- the human-readable name of the filter
-
setName
Sets a human-readable name of the filter.
This is the string that will be displayed in the user interface
if there is a selectable list of filters.- Parameter:
name
- the human-readable name for the filter
-
setName
Sets a human-readable name of the filter.
This is the string that will be displayed in the user interface
if there is a selectable list of filters.- Parameter:
name
- the human-readable name for the filter
-
toGvariant
Serialize a file filter to an `a{sv}` variant.- Gibt zurück:
- a new, floating, `GVariant`
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Gibt zurück:
Buildable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-