gtk-gtkfilefilter {RGtk2} | R Documentation

## GtkFileFilter

### Description

A filter for selecting a file subset

### Methods and Functions

`gtkFileFilterNew()`
`gtkFileFilterSetName(object, name)`
`gtkFileFilterGetName(object)`
`gtkFileFilterAddMimeType(object, mime.type)`
`gtkFileFilterAddPattern(object, pattern)`
`gtkFileFilterAddPixbufFormats(object)`
`gtkFileFilterAddCustom(object, needed, func, data = NULL)`
`gtkFileFilterGetNeeded(object)`
`gtkFileFilterFilter(object, filter.info)`
`gtkFileFilter()`

### Hierarchy

    GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkFileFilter

### Detailed Description

A GtkFileFilter can be used to restrict the files being shown in a `GtkFileChooser`. Files can be filtered based on their name (with `gtkFileFilterAddPattern`), on their mime type (with `gtkFileFilterAddMimeType`), or by a custom filter function (with `gtkFileFilterAddCustom`).

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 `gtkFileChooserAddFilter`, but it is also possible to manually use a filter on a file with `gtkFileFilterFilter`.

### Structures

`GtkFileFilter`

  The `GtkFileFilter` struct contains only private fields and should not be directly accessed.

`GtkFileFilterInfo`

  A `GtkFileFilterInfo` struct is used to pass information about the tested file to `gtkFileFilterFilter`. `GtkFileFilterInfo` is a transparent-type.

  `contains`

    [`GtkFileFilterFlags`] Flags indicating which of the following fields need are filled

  `filename`

    [character] the filename of the file being tested

  `uri`

    [character] the URI for the file being tested

  `displayName`

    [character] the string that will be used to display the file in the file chooser

  `mimeType`

    [character] the mime type of the file

### Convenient Construction

`gtkFileFilter` is the equivalent of `gtkFileFilterNew`.

### Enums and Flags

`GtkFileFilterFlags`

  These flags indicate what parts of a `GtkFileFilterInfo` struct are filled or need to be filled.

  `filename`

    the filename of the file being tested

  `uri`

    the URI for the file being tested

  `display-name`

    the string that will be used to display the file in the file chooser

  `mime-type`

    the mime type of the file

### User Functions

`GtkFileFilterFunc(filter.info, data)`

  The type of function that is used with custom filters, see `gtkFileFilterAddCustom`.

  `filter.info`

    a `GtkFileFilterInfo` that is filled according to the `needed` flags passed to `gtkFileFilterAddCustom`

  `data`

    user data passed to `gtkFileFilterAddCustom`

  Returns: [logical] `TRUE` if the file should be displayed

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://developer.gnome.org/gtk2/stable/gtk2-gtkfilefilter.html

### See Also

`GtkFileChooser`

[Package RGtk2 version 2.20.36.3 Index]