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.FileChooser

Contents

- Detail
  - File Names and Encodings
  - Adding a Preview Widget
  - Adding Extra Widgets
  - Key Bindings
- Class Hierarchy
- Types
- Methods
- Attributes
- Signals

Description

File chooser interface used by `FileChooserWidget` and `FileChooserDialog`

- Module available since Gtk+ version 2.4

Synopsis

- data FileChooser
- class GObjectClass o => FileChooserClass o
- castToFileChooser :: GObjectClass obj => obj -> FileChooser
- gTypeFileChooser :: GType
- toFileChooser :: FileChooserClass o => o -> FileChooser
- data FileChooserAction
  - = FileChooserActionOpen
  - | FileChooserActionSave
  - | FileChooserActionSelectFolder
  - | FileChooserActionCreateFolder
- data FileChooserError
  - = FileChooserErrorNonexistent
  - | FileChooserErrorBadFilename
  - | FileChooserErrorAlreadyExists
  - | FileChooserErrorIncompleteHostname
- data FileChooserConfirmation
  - = FileChooserConfirmationConfirm
  - | FileChooserConfirmationAcceptFilename
  - | FileChooserConfirmationSelectAgain
- fileChooserSetAction :: FileChooserClass self => self -> FileChooserAction -> IO ()
- fileChooserGetAction :: FileChooserClass self => self -> IO FileChooserAction
- fileChooserSetLocalOnly :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetLocalOnly :: FileChooserClass self => self -> IO Bool
- fileChooserSetSelectMultiple :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetSelectMultiple :: FileChooserClass self => self -> IO Bool
- fileChooserSetCurrentName :: FileChooserClass self => self -> FilePath -> IO ()
- fileChooserGetFilename :: FileChooserClass self => self -> IO (Maybe FilePath)
- fileChooserSetFilename :: FileChooserClass self => self -> FilePath -> IO Bool
- fileChooserSelectFilename :: FileChooserClass self => self -> FilePath -> IO Bool
- fileChooserUnselectFilename :: FileChooserClass self => self -> FilePath -> IO ()
- fileChooserSelectAll :: FileChooserClass self => self -> IO ()
- fileChooserUnselectAll :: FileChooserClass self => self -> IO ()
- fileChooserGetFilenames :: FileChooserClass self => self -> IO [FilePath]
- fileChooserSetCurrentFolder :: FileChooserClass self => self -> FilePath -> IO Bool
- fileChooserGetCurrentFolder :: FileChooserClass self => self -> IO (Maybe FilePath)
- fileChooserGetURI :: FileChooserClass self => self -> IO (Maybe String)
- fileChooserSetURI :: FileChooserClass self => self -> String -> IO Bool
- fileChooserSelectURI :: FileChooserClass self => self -> String -> IO Bool
- fileChooserUnselectURI :: FileChooserClass self => self -> String -> IO ()
- fileChooserGetURIs :: FileChooserClass self => self -> IO [String]
- fileChooserSetCurrentFolderURI :: FileChooserClass self => self -> String -> IO Bool
- fileChooserGetCurrentFolderURI :: FileChooserClass self => self -> IO String
- fileChooserSetPreviewWidget :: (FileChooserClass self, WidgetClass previewWidget) => self -> previewWidget -> IO ()
- fileChooserGetPreviewWidget :: FileChooserClass self => self -> IO (Maybe Widget)
- fileChooserSetPreviewWidgetActive :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetPreviewWidgetActive :: FileChooserClass self => self -> IO Bool
- fileChooserSetUsePreviewLabel :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetUsePreviewLabel :: FileChooserClass self => self -> IO Bool
- fileChooserGetPreviewFilename :: FileChooserClass self => self -> IO (Maybe FilePath)
- fileChooserGetPreviewURI :: FileChooserClass self => self -> IO (Maybe String)
- fileChooserSetExtraWidget :: (FileChooserClass self, WidgetClass extraWidget) => self -> extraWidget -> IO ()
- fileChooserGetExtraWidget :: FileChooserClass self => self -> IO (Maybe Widget)
- fileChooserAddFilter :: FileChooserClass self => self -> FileFilter -> IO ()
- fileChooserRemoveFilter :: FileChooserClass self => self -> FileFilter -> IO ()
- fileChooserListFilters :: FileChooserClass self => self -> IO [FileFilter]
- fileChooserSetFilter :: FileChooserClass self => self -> FileFilter -> IO ()
- fileChooserGetFilter :: FileChooserClass self => self -> IO (Maybe FileFilter)
- fileChooserAddShortcutFolder :: FileChooserClass self => self -> FilePath -> IO ()
- fileChooserRemoveShortcutFolder :: FileChooserClass self => self -> FilePath -> IO ()
- fileChooserListShortcutFolders :: FileChooserClass self => self -> IO [String]
- fileChooserAddShortcutFolderURI :: FileChooserClass self => self -> String -> IO ()
- fileChooserRemoveShortcutFolderURI :: FileChooserClass self => self -> String -> IO ()
- fileChooserListShortcutFolderURIs :: FileChooserClass self => self -> IO [String]
- fileChooserErrorDomain :: GErrorDomain
- fileChooserSetShowHidden :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetShowHidden :: FileChooserClass self => self -> IO Bool
- fileChooserSetDoOverwriteConfirmation :: FileChooserClass self => self -> Bool -> IO ()
- fileChooserGetDoOverwriteConfirmation :: FileChooserClass self => self -> IO Bool
- fileChooserUsePreviewLabel :: FileChooserClass self => Attr self Bool
- fileChooserShowHidden :: FileChooserClass self => Attr self Bool
- fileChooserSelectMultiple :: FileChooserClass self => Attr self Bool
- fileChooserPreviewWidgetActive :: FileChooserClass self => Attr self Bool
- fileChooserPreviewWidget :: (FileChooserClass self, WidgetClass previewWidget) => ReadWriteAttr self (Maybe Widget) previewWidget
- fileChooserLocalOnly :: FileChooserClass self => Attr self Bool
- fileChooserFilter :: FileChooserClass self => ReadWriteAttr self (Maybe FileFilter) FileFilter
- fileChooserExtraWidget :: (FileChooserClass self, WidgetClass extraWidget) => ReadWriteAttr self (Maybe Widget) extraWidget
- fileChooserDoOverwriteConfirmation :: FileChooserClass self => Attr self Bool
- fileChooserAction :: FileChooserClass self => Attr self FileChooserAction
- onCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- afterCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- onFileActivated :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- afterFileActivated :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- onUpdatePreview :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- afterUpdatePreview :: FileChooserClass self => self -> IO () -> IO (ConnectId self)
- onConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self)
- afterConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self)

# Detail

`FileChooser` is an interface that can be implemented by file selection widgets. In Gtk+, the main objects that implement this interface are `FileChooserWidget`, `FileChooserDialog`, and `FileChooserButton`. You do not need to write an object that implements the `FileChooser` interface unless you are trying to adapt an existing file selector to expose a standard programming interface.

`FileChooser` allows for shortcuts to various places in the filesystem. In the default implementation these are displayed in the left pane. It may be a bit confusing at first taht these shortcuts come from various sources and in various flavours, so lets explain the terminology here:

## File Names and Encodings

When the user is finished selecting files in a `FileChooser`, your program can get the selected names either as filenames or as URIs. For URIs, the normal escaping rules are applied if the URI contains non-ASCII characters. However, filenames are always returned in the character set specified by the G_FILENAME_ENCODING environment variable. Please see the Glib documentation for more details about this variable.

## Adding a Preview Widget

You can add a custom preview widget to a file chooser and then get notification about when the preview needs to be updated. To install a preview widget, use `fileChooserSetPreviewWidget`. Then, connect to the updatePreview signal to get notified when you need to update the contents of the preview.

Your callback should use `fileChooserGetPreviewFilename` to see what needs previewing. Once you have generated the preview for the corresponding file, you must call `fileChooserSetPreviewWidgetActive` with a boolean flag that indicates whether your callback could successfully generate a preview.

## Adding Extra Widgets

You can add extra widgets to a file chooser to provide options that are not present in the default design. For example, you can add a toggle button to give the user the option to open a file in read-only mode. You can use `fileChooserSetExtraWidget` to insert additional widgets in a file chooser.

## Key Bindings

Internally, Gtk+ implements a file chooser's graphical user interface with the private GtkFileChooserDefaultClass. This widget has several key bindings and their associated signals. This section describes the available key binding signals.

- GtkFileChooser key binding example

The default keys that activate the `keyBinding` signals in GtkFileChooserDefaultClass are as follows:

Signal name
  Key
location-popup
  Control-L
up-folder
  Alt-Up
down-folder
  Alt-Down
home-folder
  Alt-Home

To change these defaults to something else, you could include the following fragment in your .gtkrc-2.0 file:

     binding "my-own-gtkfilechooser-bindings" {
     bind "AltShiftl" {
     "location-popup" ()
     }
     bind "AltShiftUp" {
     "up-folder" ()
     }
     bind "AltShiftDown" {
     "down-folder" ()
     }
     bind "AltShiftHome" {
     "home-folder-folder" ()
     }
     }

     class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings"

# Class Hierarchy

     | GInterface
     | +----FileChooser

# Types

data FileChooser

Instances

Eq FileChooser |
Ord FileChooser |
GObjectClass FileChooser |
FileChooserClass FileChooser |

class GObjectClass o => FileChooserClass o

Instances

FileChooserClass FileChooser |
FileChooserClass FileChooserButton |
FileChooserClass FileChooserWidget |
FileChooserClass FileChooserDialog |

castToFileChooser :: GObjectClass obj => obj -> FileChooser

gTypeFileChooser :: GType

toFileChooser :: FileChooserClass o => o -> FileChooser

data FileChooserAction

Describes whether a `FileChooser` is being used to open existing files or to save to a possibly new file.

Constructors

FileChooserActionOpen |
FileChooserActionSave |
FileChooserActionSelectFolder |
FileChooserActionCreateFolder |

Instances

Enum FileChooserAction |

data FileChooserError

These identify the various errors that can occur while calling `FileChooser` functions.

Constructors

FileChooserErrorNonexistent |
FileChooserErrorBadFilename |
FileChooserErrorAlreadyExists |
FileChooserErrorIncompleteHostname |

Instances

Enum FileChooserError |
GErrorClass FileChooserError |

data FileChooserConfirmation

Used as a return value of handlers for the `onConfirmOverwrite` signal of a `FileChooser`.

- This value determines whether the file chooser will present the stock confirmation dialog, accept the user's choice of a filename, or let the user choose another filename.

Since Gtk 2.8.

Constructors

FileChooserConfirmationConfirm |
FileChooserConfirmationAcceptFilename |
FileChooserConfirmationSelectAgain |

Instances

Enum FileChooserConfirmation |

# Methods

fileChooserSetAction

Arguments

:: FileChooserClass self |
=> self |
-> FileChooserAction | `action` - the action that the file selector is performing
-> IO () |

Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action. For example, an option to create a new folder might be shown if the action is `FileChooserActionSave` but not if the action is `FileChooserActionOpen`.

fileChooserGetAction :: FileChooserClass self => self -> IO FileChooserAction

Gets the type of operation that the file chooser is performing; see `fileChooserSetAction`.

fileChooserSetLocalOnly :: FileChooserClass self => self -> Bool -> IO ()

Sets whether only local files can be selected in the file selector. If `localOnly` is `True` (the default), then the selected file are files are guaranteed to be accessible through the operating systems native file file system and therefore the application only needs to worry about the filename functions in `FileChooser`, like `fileChooserGetFilename`, rather than the URI functions like `fileChooserGetURI`,

fileChooserGetLocalOnly :: FileChooserClass self => self -> IO Bool

Gets whether only local files can be selected in the file selector. See `fileChooserSetLocalOnly`

fileChooserSetSelectMultiple :: FileChooserClass self => self -> Bool -> IO ()

Sets whether multiple files can be selected in the file selector. This is only relevant if the action is set to be `FileChooserActionOpen` or `FileChooserActionSave`. It cannot be set with either of the folder actions.

fileChooserGetSelectMultiple :: FileChooserClass self => self -> IO Bool

Gets whether multiple files can be selected in the file selector. See `fileChooserSetSelectMultiple`.

fileChooserSetCurrentName

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `name` - the filename to use, as a Unicode string
-> IO () |

Sets the current name in the file selector, as if entered by the user. Note that the name passed in here is a Unicode string rather than a filename. This function is meant for such uses as a suggested name in a "Save As..." dialog.

If you want to preselect a particular existing file, you should use `fileChooserSetFilename` or `fileChooserSetURI` instead. Please see the documentation for those functions for an example of using `fileChooserSetCurrentName` as well.

fileChooserGetFilename

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe FilePath) | returns The currently selected filename, or `Nothing` if no file is selected, or the selected file can't be represented with a local filename.

Gets the filename for the currently selected file in the file selector. If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

fileChooserSetFilename

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `filename` - the filename to set as current
-> IO Bool | returns `True` if both the folder could be changed and the file was selected successfully, `False` otherwise.

Sets `filename` as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list. If the `chooser` is in `FileChooserActionSave` mode, the file's base name will also appear in the dialog's file name entry.

If the file name isn't in the current folder of `chooser`, then the current folder of `chooser` will be changed to the folder containing `filename`. This is equivalent to a sequence of `fileChooserUnselectAll` followed by `fileChooserSelectFilename`.

Note that the file must exist, or nothing will be done except for the directory change.

If you are implementing a File/Save As... dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does File/Save As... on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:

     if documentIsNew
     then do -- the user just created a new document
     fileChooserSetCurrentFolder chooser defaultFolderForSaving
     fileChooserSetCurrentName chooser "Untitled document"
     else do --the user edited an existing document
     fileChooserSetFilename chooser existingFilename

fileChooserSelectFilename

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `filename` - the filename to select
-> IO Bool | returns `True` if both the folder could be changed and the file was selected successfully, `False` otherwise.

Selects a filename. If the file name isn't in the current folder of the chooser, then the current folder of the chooser will be changed to the folder containing `filename`.

fileChooserUnselectFilename

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `filename` - the filename to unselect
-> IO () |

Unselects a currently selected filename. If the filename is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

fileChooserSelectAll :: FileChooserClass self => self -> IO ()

Selects all the files in the current folder of a file chooser.

fileChooserUnselectAll :: FileChooserClass self => self -> IO ()

Unselects all the files in the current folder of a file chooser.

fileChooserGetFilenames :: FileChooserClass self => self -> IO [FilePath]

Lists all the selected files and subfolders in the current folder of the chooser. The returned names are full absolute paths. If files in the current folder cannot be represented as local filenames they will be ignored. (See `fileChooserGetURIs`)

fileChooserSetCurrentFolder

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `filename` - the full path of the new current folder
-> IO Bool | returns `True` if the folder could be changed successfully, `False` otherwise.

Sets the current folder for the chooser from a local filename. The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

fileChooserGetCurrentFolder

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe FilePath) | returns the full path of the current folder, or `Nothing` if the current path cannot be represented as a local filename.

Gets the current folder of the chooser as a local filename. See `fileChooserSetCurrentFolder`.

fileChooserGetURI

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe String) | returns The currently selected URI, or `Nothing` if no file is selected.

Gets the URI for the currently selected file in the file selector. If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

fileChooserSetURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - the URI to set as current
-> IO Bool | returns `True` if both the folder could be changed and the URI was selected successfully, `False` otherwise.

Sets the file referred to by `uri` as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list. If the `chooser` is `FileChooserActionSave` mode, the URI's base name will also appear in the dialog's file name entry.

If the URI isn't in the current folder of `chooser`, then the current folder of `chooser` will be changed to the folder containing `uri`. This is equivalent to a sequence of `fileChooserUnselectAll` followed by `fileChooserSelectURI`.

Note that the URI must exist, or nothing will be done except for the directory change. If you are implementing a File/Save As... dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does File/Save As... on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:

     if documentIsNew
     then do -- the user just created a new document
     fileChooserSetCurrentFolderURI chooser defaultFolderForSaving
     fileChooserSetCurrentName chooser "Untitled document"
     else do --the user edited an existing document
     fileChooserSetURI chooser existingURI

fileChooserSelectURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - the URI to select
-> IO Bool | returns `True` if both the folder could be changed and the URI was selected successfully, `False` otherwise.

Selects the file to by `uri`. If the URI doesn't refer to a file in the current folder of the chooser, then the current folder of the chooser will be changed to the folder containing `filename`.

fileChooserUnselectURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - the URI to unselect
-> IO () |

Unselects the file referred to by `uri`. If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.

fileChooserGetURIs :: FileChooserClass self => self -> IO [String]

Lists all the selected files and subfolders in the current folder of the chooser. The returned names are full absolute URIs.

fileChooserSetCurrentFolderURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - the URI for the new current folder
-> IO Bool | returns `True` if the folder could be changed successfully, `False` otherwise.

Sets the current folder for the chooser from an URI. The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.

fileChooserGetCurrentFolderURI

Arguments

:: FileChooserClass self |
=> self |
-> IO String | returns the URI for the current folder.

Gets the current folder of the chooser as an URI. See `fileChooserSetCurrentFolderURI`.

fileChooserSetPreviewWidget

Arguments

:: (FileChooserClass self, WidgetClass previewWidget) |
=> self |
-> previewWidget | `previewWidget` - widget for displaying preview.
-> IO () |

Sets an application-supplied widget to use to display a custom preview of the currently selected file. To implement a preview, after setting the preview widget, you connect to the UpdatePreview signal, and call `fileChooserGetPreviewFilename` or `fileChooserGetPreviewURI` on each change. If you can display a preview of the new file, update your widget and set the preview active using `fileChooserSetPreviewWidgetActive`. Otherwise, set the preview inactive.

When there is no application-supplied preview widget, or the application-supplied preview widget is not active, the file chooser may display an internally generated preview of the current file or it may display no preview at all.

fileChooserGetPreviewWidget

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe Widget) | returns the current preview widget, or `Nothing`

Gets the current preview widget; see `fileChooserSetPreviewWidget`.

fileChooserSetPreviewWidgetActive

Arguments

:: FileChooserClass self |
=> self |
-> Bool | `active` - whether to display the user-specified preview widget
-> IO () |

Sets whether the preview widget set by `fileChooserSetPreviewWidget` should be shown for the current filename. When `active` is set to false, the file chooser may display an internally generated preview of the current file or it may display no preview at all. See `fileChooserSetPreviewWidget` for more details.

fileChooserGetPreviewWidgetActive

Arguments

:: FileChooserClass self |
=> self |
-> IO Bool | returns `True` if the preview widget is active for the current filename.

Gets whether the preview widget set by `fileChooserSetPreviewWidget` should be shown for the current filename. See `fileChooserSetPreviewWidgetActive`.

fileChooserSetUsePreviewLabel

Arguments

:: FileChooserClass self |
=> self |
-> Bool | `useLabel` - whether to display a stock label with the name of the previewed file
-> IO () |

Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is `True`. Applications that want to draw the whole preview area themselves should set this to `False` and display the name themselves in their preview widget.

See also: `fileChooserSetPreviewWidget`

fileChooserGetUsePreviewLabel

Arguments

:: FileChooserClass self |
=> self |
-> IO Bool | returns `True` if the file chooser is set to display a label with the name of the previewed file, `False` otherwise.

Gets whether a stock label should be drawn with the name of the previewed file. See `fileChooserSetUsePreviewLabel`.

fileChooserGetPreviewFilename

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe FilePath) | returns the filename to preview, or `Nothing` if no file is selected, or if the selected file cannot be represented as a local filename.

Gets the filename that should be previewed in a custom preview widget. See `fileChooserSetPreviewWidget`.

fileChooserGetPreviewURI

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe String) | returns the URI for the file to preview, or `Nothing` if no file is selected.

Gets the URI that should be previewed in a custom preview widget. See `fileChooserSetPreviewWidget`.

fileChooserSetExtraWidget

Arguments

:: (FileChooserClass self, WidgetClass extraWidget) |
=> self |
-> extraWidget | `extraWidget` - widget for extra options
-> IO () |

Sets an application-supplied widget to provide extra options to the user.

fileChooserGetExtraWidget

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe Widget) | returns the current extra widget, or `Nothing`

Gets the current preview widget; see `fileChooserSetExtraWidget`.

fileChooserAddFilter :: FileChooserClass self => self -> FileFilter -> IO ()

Adds the filter to the list of filters that the user can select between. When a filter is selected, only files that are passed by that filter are displayed.

fileChooserRemoveFilter :: FileChooserClass self => self -> FileFilter -> IO ()

Removes the filter from the list of filters that the user can select between.

fileChooserListFilters :: FileChooserClass self => self -> IO [FileFilter]

Lists the current set of user-selectable filters; see `fileChooserAddFilter`, `fileChooserRemoveFilter`.

fileChooserSetFilter :: FileChooserClass self => self -> FileFilter -> IO ()

Sets the current filter; only the files that pass the filter will be displayed. If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.

fileChooserGetFilter

Arguments

:: FileChooserClass self |
=> self |
-> IO (Maybe FileFilter) | returns the current filter, or `Nothing`

Gets the current filter; see `fileChooserSetFilter`.

fileChooserAddShortcutFolder

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `folder` - filename of the folder to add
-> IO () |

Adds a folder to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "/usr/share/mydrawprogram/Clipart" folder to the volume list.

If the folder can not be added successfully an exception will be thrown.

fileChooserRemoveShortcutFolder

Arguments

:: FileChooserClass self |
=> self |
-> FilePath | `folder` - filename of the folder to remove
-> IO () |

Removes a folder from a file chooser's list of shortcut folders.

If the folder can not be removed successfully an exception will be thrown.

fileChooserListShortcutFolders :: FileChooserClass self => self -> IO [String]

Queries the list of shortcut folders in the file chooser, as set by `fileChooserAddShortcutFolder`.

fileChooserAddShortcutFolderURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - URI of the folder to add
-> IO () |

Adds a folder URI to be displayed with the shortcut folders in a file chooser. Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "file:///usr/share/mydrawprogram/Clipart" folder to the volume list.

If the folder can not be added successfully an exception will be thrown.

fileChooserRemoveShortcutFolderURI

Arguments

:: FileChooserClass self |
=> self |
-> String | `uri` - URI of the folder to remove
-> IO () |

Removes a folder URI from a file chooser's list of shortcut folders.

fileChooserListShortcutFolderURIs :: FileChooserClass self => self -> IO [String]

Queries the list of shortcut folders in the file chooser, as set by `fileChooserAddShortcutFolderURI`.

fileChooserErrorDomain :: GErrorDomain

fileChooserSetShowHidden

Arguments

:: FileChooserClass self |
=> self |
-> Bool | `showHidden` - `True` if hidden files and folders should be displayed.
-> IO () |

Sets whether hidden files and folders are displayed in the file selector.

Available since Gtk+ version 2.6

fileChooserGetShowHidden

Arguments

:: FileChooserClass self |
=> self |
-> IO Bool | returns `True` if hidden files and folders are displayed.

Gets whether hidden files and folders are displayed in the file selector. See `fileChooserSetShowHidden`.

- Available since Gtk+ version 2.6

fileChooserSetDoOverwriteConfirmation

Arguments

:: FileChooserClass self |
=> self |
-> Bool | `doOverwriteConfirmation` - whether to confirm overwriting in save mode
-> IO () |

Sets whether a file chooser in `FileChooserActionSave` mode will present a confirmation dialog if the user types a file name that already exists. This is `False` by default.

Regardless of this setting, the `chooser` will emit the "confirm-overwrite" signal when appropriate.

If all you need is the stock confirmation dialog, set this property to `True`. You can override the way confirmation is done by actually handling the "confirm-overwrite" signal; please refer to its documentation for the details.

Available since Gtk+ version 2.8

fileChooserGetDoOverwriteConfirmation

Arguments

:: FileChooserClass self |
=> self |
-> IO Bool | returns `True` if the file chooser will present a confirmation dialog; `False` otherwise.

Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.

- Available since Gtk+ version 2.8

# Attributes

fileChooserUsePreviewLabel :: FileChooserClass self => Attr self Bool

'usePreviewLabel' property. See `fileChooserGetUsePreviewLabel` and `fileChooserSetUsePreviewLabel`

fileChooserShowHidden :: FileChooserClass self => Attr self Bool

'showHidden' property. See `fileChooserGetShowHidden` and `fileChooserSetShowHidden`

Since Gtk 2.6.

fileChooserSelectMultiple :: FileChooserClass self => Attr self Bool

'selectMultiple' property. See `fileChooserGetSelectMultiple` and `fileChooserSetSelectMultiple`

fileChooserPreviewWidgetActive :: FileChooserClass self => Attr self Bool

'previewWidgetActive' property. See `fileChooserGetPreviewWidgetActive` and `fileChooserSetPreviewWidgetActive`

fileChooserPreviewWidget :: (FileChooserClass self, WidgetClass previewWidget) => ReadWriteAttr self (Maybe Widget) previewWidget

'previewWidget' property. See `fileChooserGetPreviewWidget` and `fileChooserSetPreviewWidget`

fileChooserLocalOnly :: FileChooserClass self => Attr self Bool

'localOnly' property. See `fileChooserGetLocalOnly` and `fileChooserSetLocalOnly`

fileChooserFilter :: FileChooserClass self => ReadWriteAttr self (Maybe FileFilter) FileFilter

'filter' property. See `fileChooserGetFilter` and `fileChooserSetFilter`

fileChooserExtraWidget :: (FileChooserClass self, WidgetClass extraWidget) => ReadWriteAttr self (Maybe Widget) extraWidget

'extraWidget' property. See `fileChooserGetExtraWidget` and `fileChooserSetExtraWidget`

fileChooserDoOverwriteConfirmation :: FileChooserClass self => Attr self Bool

'doOverwriteConfirmation' property. See `fileChooserGetDoOverwriteConfirmation` and `fileChooserSetDoOverwriteConfirmation`

fileChooserAction :: FileChooserClass self => Attr self FileChooserAction

'action' property. See `fileChooserGetAction` and `fileChooserSetAction`

# Signals

onCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when the current folder in a `FileChooser` changes. This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser.

Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing.

See also: `fileChooserSetCurrentFolder`, `fileChooserGetCurrentFolder`, `fileChooserSetCurrentFolderURI`, `fileChooserGetCurrentFolderURI`.

afterCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when the current folder in a `FileChooser` changes. This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser.

Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing.

See also: `fileChooserSetCurrentFolder`, `fileChooserGetCurrentFolder`, `fileChooserSetCurrentFolderURI`, `fileChooserGetCurrentFolderURI`.

onFileActivated :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when the user "activates" a file in the file chooser. This can happen by double-clicking on a file in the file list, or by pressing Enter.

Normally you do not need to connect to this signal. It is used internally by `FileChooserDialog` to know when to activate the default button in the dialog.

See also: `fileChooserGetFilename`, `fileChooserGetFilenames`, `fileChooserGetURI`, `fileChooserGetURIs`.

afterFileActivated :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when the user "activates" a file in the file chooser. This can happen by double-clicking on a file in the file list, or by pressing Enter.

Normally you do not need to connect to this signal. It is used internally by `FileChooserDialog` to know when to activate the default button in the dialog.

See also: `fileChooserGetFilename`, `fileChooserGetFilenames`, `fileChooserGetURI`, `fileChooserGetURIs`.

onUpdatePreview :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when there is a change in the set of selected files in a `FileChooser`. This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection.

Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below.

See also: `fileChooserSelectFilename`, `fileChooserUnselectFilename`, `fileChooserGetFilename`, `fileChooserGetFilenames`, `fileChooserSelectURI`, `fileChooserUnselectURI`, `fileChooserGetURI`, `fileChooserGetURIs`.

onSelectionChanged, afterSelectionChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self) onSelectionChanged = connect_NONE__NONE selection-changed False afterSelectionChanged = connect_NONE__NONE selection-changed True

This signal is emitted when the preview in a file chooser should be regenerated. For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget.

Once you have installed a preview widget with `fileChooserSetPreviewWidget`, you should update it when this signal is emitted. You can use the functions `fileChooserGetPreviewFilename` or `fileChooserGetPreviewURI` to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your callback must call `fileChooserSetPreviewWidgetActive` to inform the file chooser about whether the preview was generated successfully or not.

See also: `fileChooserSetPreviewWidget`, `fileChooserSetPreviewWidgetActive`, `fileChooserSetUsePreviewLabel`, `fileChooserGetPreviewFilename`, `fileChooserGetPreviewURI`.

afterUpdatePreview :: FileChooserClass self => self -> IO () -> IO (ConnectId self)

This signal is emitted when there is a change in the set of selected files in a `FileChooser`. This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection.

Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below.

See also: `fileChooserSelectFilename`, `fileChooserUnselectFilename`, `fileChooserGetFilename`, `fileChooserGetFilenames`, `fileChooserSelectURI`, `fileChooserUnselectURI`, `fileChooserGetURI`, `fileChooserGetURIs`.

onSelectionChanged, afterSelectionChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self) onSelectionChanged = connect_NONE__NONE selection-changed False afterSelectionChanged = connect_NONE__NONE selection-changed True

This signal is emitted when the preview in a file chooser should be regenerated. For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget.

Once you have installed a preview widget with `fileChooserSetPreviewWidget`, you should update it when this signal is emitted. You can use the functions `fileChooserGetPreviewFilename` or `fileChooserGetPreviewURI` to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your callback must call `fileChooserSetPreviewWidgetActive` to inform the file chooser about whether the preview was generated successfully or not.

See also: `fileChooserSetPreviewWidget`, `fileChooserSetPreviewWidgetActive`, `fileChooserSetUsePreviewLabel`, `fileChooserGetPreviewFilename`, `fileChooserGetPreviewURI`.

onConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self)

This signal gets emitted whenever it is appropriate to present a confirmation dialog when the user has selected a file name that already exists. The signal only gets emitted when the file chooser is in `FileChooserActionSave` mode.

Most applications just need to turn on the do-overwrite-confirmation property (or call the `fileChooserSetDoOverwriteConfirmation` function), and they will automatically get a stock confirmation dialog. Applications which need to customize this behavior should do that, and also connect to the `confirmOverwrite` signal.

A signal handler for this signal must return a `FileChooserConfirmation` value, which indicates the action to take. If the handler determines that the user wants to select a different filename, it should return `FileChooserConfirmationSelectAgain`. If it determines that the user is satisfied with his choice of file name, it should return `FileChooserConfirmationAcceptFilename`. On the other hand, if it determines that the stock confirmation dialog should be used, it should return `FileChooserConfirmationConfirm`.

Since Gtk 2.8.

afterConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self)

This signal gets emitted whenever it is appropriate to present a confirmation dialog when the user has selected a file name that already exists. The signal only gets emitted when the file chooser is in `FileChooserActionSave` mode.

Most applications just need to turn on the do-overwrite-confirmation property (or call the `fileChooserSetDoOverwriteConfirmation` function), and they will automatically get a stock confirmation dialog. Applications which need to customize this behavior should do that, and also connect to the `confirmOverwrite` signal.

A signal handler for this signal must return a `FileChooserConfirmation` value, which indicates the action to take. If the handler determines that the user wants to select a different filename, it should return `FileChooserConfirmationSelectAgain`. If it determines that the user is satisfied with his choice of file name, it should return `FileChooserConfirmationAcceptFilename`. On the other hand, if it determines that the stock confirmation dialog should be used, it should return `FileChooserConfirmationConfirm`.

Since Gtk 2.8.