Portability | portable (depends on GHC) |
---|---|
Stability | provisional |
Maintainer | gtk2hs-users@lists.sourceforge.net |
Graphics.UI.Gtk.Selectors.FileChooser
Contents
Description
File chooser interface used by FileChooserWidget
and
FileChooserDialog
- Module available since Gtk+ version 2.4
- data FileChooser
- class GObjectClass o => FileChooserClass o
- castToFileChooser :: GObjectClass obj => obj -> FileChooser
- gTypeFileChooser :: GType
- toFileChooser :: FileChooserClass o => o -> FileChooser
- data FileChooserAction
- data FileChooserError
- data FileChooserConfirmation
- 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 key-binding 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 Source
class GObjectClass o => FileChooserClass o Source
castToFileChooser :: GObjectClass obj => obj -> FileChooserSource
toFileChooser :: FileChooserClass o => o -> FileChooserSource
data FileChooserAction Source
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
data FileChooserError Source
These identify the various errors that can occur while calling
FileChooser
functions.
Constructors
FileChooserErrorNonexistent | |
FileChooserErrorBadFilename | |
FileChooserErrorAlreadyExists | |
FileChooserErrorIncompleteHostname |
Instances
data FileChooserConfirmation Source
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
Methods
Arguments
:: FileChooserClass self | |
=> self | |
-> FileChooserAction |
|
-> 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 FileChooserActionSource
Gets the type of operation that the file chooser is performing; see
fileChooserSetAction
.
fileChooserSetLocalOnly :: FileChooserClass self => self -> Bool -> IO ()Source
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 BoolSource
Gets whether only local files can be selected in the file selector. See
fileChooserSetLocalOnly
fileChooserSetSelectMultiple :: FileChooserClass self => self -> Bool -> IO ()Source
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 BoolSource
Gets whether multiple files can be selected in the file selector. See
fileChooserSetSelectMultiple
.
fileChooserSetCurrentNameSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> 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.
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe FilePath) | returns The currently selected filename, or
|
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.
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> IO Bool | returns |
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
fileChooserSelectFilenameSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> IO Bool | returns |
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
.
fileChooserUnselectFilenameSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> 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 ()Source
Selects all the files in the current folder of a file chooser.
fileChooserUnselectAll :: FileChooserClass self => self -> IO ()Source
Unselects all the files in the current folder of a file chooser.
fileChooserGetFilenames :: FileChooserClass self => self -> IO [FilePath]Source
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
)
fileChooserSetCurrentFolderSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> IO Bool | returns |
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.
fileChooserGetCurrentFolderSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe FilePath) | returns the full path of the current folder, or
|
Gets the current folder of the chooser as a local filename. See
fileChooserSetCurrentFolder
.
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe String) | returns The currently selected URI, or |
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.
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> IO Bool | returns |
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
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> IO Bool | returns |
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
.
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> 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]Source
Lists all the selected files and subfolders in the current folder of the chooser. The returned names are full absolute URIs.
fileChooserSetCurrentFolderURISource
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> IO Bool | returns |
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.
fileChooserGetCurrentFolderURISource
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
.
fileChooserSetPreviewWidgetSource
Arguments
:: (FileChooserClass self, WidgetClass previewWidget) | |
=> self | |
-> previewWidget |
|
-> 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.
fileChooserGetPreviewWidgetSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe Widget) | returns the current preview widget, or |
Gets the current preview widget; see fileChooserSetPreviewWidget
.
fileChooserSetPreviewWidgetActiveSource
Arguments
:: FileChooserClass self | |
=> self | |
-> Bool |
|
-> 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.
fileChooserGetPreviewWidgetActiveSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO Bool | returns |
Gets whether the preview widget set by fileChooserSetPreviewWidget
should be shown for the current filename. See
fileChooserSetPreviewWidgetActive
.
fileChooserSetUsePreviewLabelSource
Arguments
:: FileChooserClass self | |
=> self | |
-> Bool |
|
-> 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
fileChooserGetUsePreviewLabelSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO Bool | returns |
Gets whether a stock label should be drawn with the name of the previewed
file. See fileChooserSetUsePreviewLabel
.
fileChooserGetPreviewFilenameSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe FilePath) | returns the filename to preview, or |
Gets the filename that should be previewed in a custom preview widget.
See fileChooserSetPreviewWidget
.
fileChooserGetPreviewURISource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe String) | returns the URI for the file to preview, or
|
Gets the URI that should be previewed in a custom preview widget. See
fileChooserSetPreviewWidget
.
fileChooserSetExtraWidgetSource
Arguments
:: (FileChooserClass self, WidgetClass extraWidget) | |
=> self | |
-> extraWidget |
|
-> IO () |
Sets an application-supplied widget to provide extra options to the user.
fileChooserGetExtraWidgetSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe Widget) | returns the current extra widget, or |
Gets the current preview widget; see fileChooserSetExtraWidget
.
fileChooserAddFilter :: FileChooserClass self => self -> FileFilter -> IO ()Source
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 ()Source
Removes the filter from the list of filters that the user can select between.
fileChooserListFilters :: FileChooserClass self => self -> IO [FileFilter]Source
Lists the current set of user-selectable filters; see
fileChooserAddFilter
, fileChooserRemoveFilter
.
fileChooserSetFilter :: FileChooserClass self => self -> FileFilter -> IO ()Source
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.
Arguments
:: FileChooserClass self | |
=> self | |
-> IO (Maybe FileFilter) | returns the current filter, or |
Gets the current filter; see fileChooserSetFilter
.
fileChooserAddShortcutFolderSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> 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.
fileChooserRemoveShortcutFolderSource
Arguments
:: FileChooserClass self | |
=> self | |
-> FilePath |
|
-> 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]Source
Queries the list of shortcut folders in the file chooser, as set by
fileChooserAddShortcutFolder
.
fileChooserAddShortcutFolderURISource
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> 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.
fileChooserRemoveShortcutFolderURISource
Arguments
:: FileChooserClass self | |
=> self | |
-> String |
|
-> IO () |
Removes a folder URI from a file chooser's list of shortcut folders.
fileChooserListShortcutFolderURIs :: FileChooserClass self => self -> IO [String]Source
Queries the list of shortcut folders in the file chooser, as set by
fileChooserAddShortcutFolderURI
.
fileChooserSetShowHiddenSource
Arguments
:: FileChooserClass self | |
=> self | |
-> Bool |
|
-> IO () |
Sets whether hidden files and folders are displayed in the file selector.
Available since Gtk+ version 2.6
fileChooserGetShowHiddenSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO Bool | returns |
Gets whether hidden files and folders are displayed in the file selector.
See fileChooserSetShowHidden
.
- Available since Gtk+ version 2.6
fileChooserSetDoOverwriteConfirmationSource
Arguments
:: FileChooserClass self | |
=> self | |
-> Bool |
|
-> 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
fileChooserGetDoOverwriteConfirmationSource
Arguments
:: FileChooserClass self | |
=> self | |
-> IO Bool | returns |
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 BoolSource
'usePreviewLabel' property. See fileChooserGetUsePreviewLabel
and
fileChooserSetUsePreviewLabel
fileChooserShowHidden :: FileChooserClass self => Attr self BoolSource
'showHidden' property. See fileChooserGetShowHidden
and
fileChooserSetShowHidden
Since Gtk 2.6.
fileChooserSelectMultiple :: FileChooserClass self => Attr self BoolSource
'selectMultiple' property. See fileChooserGetSelectMultiple
and
fileChooserSetSelectMultiple
fileChooserPreviewWidgetActive :: FileChooserClass self => Attr self BoolSource
'previewWidgetActive' property. See fileChooserGetPreviewWidgetActive
and fileChooserSetPreviewWidgetActive
fileChooserPreviewWidget :: (FileChooserClass self, WidgetClass previewWidget) => ReadWriteAttr self (Maybe Widget) previewWidgetSource
'previewWidget' property. See fileChooserGetPreviewWidget
and
fileChooserSetPreviewWidget
fileChooserLocalOnly :: FileChooserClass self => Attr self BoolSource
'localOnly' property. See fileChooserGetLocalOnly
and
fileChooserSetLocalOnly
fileChooserFilter :: FileChooserClass self => ReadWriteAttr self (Maybe FileFilter) FileFilterSource
'filter' property. See fileChooserGetFilter
and
fileChooserSetFilter
fileChooserExtraWidget :: (FileChooserClass self, WidgetClass extraWidget) => ReadWriteAttr self (Maybe Widget) extraWidgetSource
'extraWidget' property. See fileChooserGetExtraWidget
and
fileChooserSetExtraWidget
fileChooserDoOverwriteConfirmation :: FileChooserClass self => Attr self BoolSource
'doOverwriteConfirmation' property. See
fileChooserGetDoOverwriteConfirmation
and
fileChooserSetDoOverwriteConfirmation
fileChooserAction :: FileChooserClass self => Attr self FileChooserActionSource
'action' property. See fileChooserGetAction
and
fileChooserSetAction
Signals
onCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)Source
afterCurrentFolderChanged :: FileChooserClass self => self -> IO () -> IO (ConnectId self)Source
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)Source
afterFileActivated :: FileChooserClass self => self -> IO () -> IO (ConnectId self)Source
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)Source
afterUpdatePreview :: FileChooserClass self => self -> IO () -> IO (ConnectId self)Source
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)Source
afterConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self)Source
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
confirm-overwrite 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.