Graphics.UI.Gtk.Selectors.FileFilter

gtk-0.12.4: Binding to the Gtk+ graphical user interface library.

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net
Safe Haskell | None

Graphics.UI.Gtk.Selectors.FileFilter

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes

Description

A filter for selecting a file subset

- Module available since Gtk+ version 2.4

Synopsis

- data FileFilter
- class ObjectClass o => FileFilterClass o
- castToFileFilter :: GObjectClass obj => obj -> FileFilter
- gTypeFileFilter :: GType
- toFileFilter :: FileFilterClass o => o -> FileFilter
- data FileFilterFlags
  - = FileFilterFilename
  - | FileFilterUri
  - | FileFilterDisplayName
  - | FileFilterMimeType
- fileFilterNew :: IO FileFilter
- fileFilterSetName :: FileFilter -> String -> IO ()
- fileFilterGetName :: FileFilter -> IO String
- fileFilterAddMimeType :: FileFilter -> String -> IO ()
- fileFilterAddPattern :: FileFilter -> String -> IO ()
- fileFilterAddCustom :: FileFilter -> [FileFilterFlags] -> (Maybe String -> Maybe String -> Maybe String -> Maybe String -> IO Bool) -> IO ()
- fileFilterAddPixbufFormats :: FileFilter -> IO ()
- fileFilterName :: Attr FileFilter String

# Detail

A `FileFilter` can be used to restrict the files being shown in a `FileChooser`. Files can be filtered based on their name (with `fileFilterAddPattern`), on their mime type (with `fileFilterAddMimeType`), or by a custom filter function (with `fileFilterAddCustom`).

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 `FileFilter` 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 `FileChooser`, see `fileChooserAddFilter`.

# Class Hierarchy

     | GObject
     | +----Object
     | +----FileFilter

# Types

data FileFilter

Instances

Eq FileFilter |
Ord FileFilter |
GObjectClass FileFilter |
FileFilterClass FileFilter |
ObjectClass FileFilter |

class ObjectClass o => FileFilterClass o

Instances

FileFilterClass FileFilter |

castToFileFilter :: GObjectClass obj => obj -> FileFilter

gTypeFileFilter :: GType

toFileFilter :: FileFilterClass o => o -> FileFilter

data FileFilterFlags

Constructors

FileFilterFilename |
FileFilterUri |
FileFilterDisplayName |
FileFilterMimeType |

Instances

Bounded FileFilterFlags |
Enum FileFilterFlags |
Eq FileFilterFlags |
Show FileFilterFlags |
Flags FileFilterFlags |

# Constructors

fileFilterNew :: IO FileFilter

Creates a new `FileFilter` with no rules added to it. Such a filter doesn't accept any files, so is not particularly useful until you add rules with `fileFilterAddMimeType`, `fileFilterAddPattern`, or `fileFilterAddCustom`.

# Methods

fileFilterSetName

Arguments

:: FileFilter |
-> String | `name` - the human-readable-name for the filter
-> IO () |

Sets the human-readable name of the filter; this is the string that will be displayed in the file selector user interface if there is a selectable list of filters.

fileFilterGetName

Arguments

:: FileFilter |
-> IO String | returns The human-readable name of the filter

Gets the human-readable name for the filter. See `fileFilterSetName`.

fileFilterAddMimeType

Arguments

:: FileFilter |
-> String | `mimeType` - name of a MIME type
-> IO () |

Adds a rule allowing a given mime type to `filter`.

fileFilterAddPattern

Arguments

:: FileFilter |
-> String | `pattern` - a shell style glob
-> IO () |

Adds a rule allowing a shell style glob to a filter.

fileFilterAddCustom

Arguments

:: FileFilter |
-> [FileFilterFlags] | `needed` - list of flags indicating the information that the custom filter function needs.
-> (Maybe String -> Maybe String -> Maybe String -> Maybe String -> IO Bool) | `(filename uri displayName mimeType -> ...)` - filter function; if the function returns `True`, then the file will be displayed.
-> IO () |

Adds rule to a filter that allows files based on a custom callback function. The list of flags `needed` which is passed in provides information about what sorts of information that the filter function needs; this allows Gtk+ to avoid retrieving expensive information when it isn't needed by the filter.

fileFilterAddPixbufFormats :: FileFilter -> IO ()

Adds a rule allowing image files in the formats supported by `Pixbuf`.

- Available since Gtk+ version 2.6

# Attributes

fileFilterName :: Attr FileFilter String

'name' property. See `fileFilterGetName` and `fileFilterSetName`