gi-gtk4-4.0.12: Gtk 4.x bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.FileDialog

Description

Asynchronous API to present a file chooser dialog.

GtkFileDialog collects the arguments that are needed to present the dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with fileDialogOpen, fileDialogSave, etc.

Since: 4.10

Synopsis

Exported types

newtype FileDialog Source #

Memory-managed wrapper type.

Instances

Instances details
Eq FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

GObject FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

ManagedPtrNewtype FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

TypedObject FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

Methods

glibType :: IO GType #

HasParentTypes FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

IsGValue (Maybe FileDialog) Source #

Convert FileDialog to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.FileDialog

type ParentTypes FileDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

type ParentTypes FileDialog = '[Object]

class (GObject o, IsDescendantOf FileDialog o) => IsFileDialog o Source #

Type class for types which can be safely cast to FileDialog, for instance with toFileDialog.

Instances

Instances details
(GObject o, IsDescendantOf FileDialog o) => IsFileDialog o Source # 
Instance details

Defined in GI.Gtk.Objects.FileDialog

toFileDialog :: (MonadIO m, IsFileDialog o) => o -> m FileDialog Source #

Cast to FileDialog, for types for which this is known to be safe. For general casts, use castTo.

Methods

getAcceptLabel

fileDialogGetAcceptLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe Text)

Returns: the label shown on the file chooser's accept button

Retrieves the text used by the dialog on its accept button.

Since: 4.10

getDefaultFilter

fileDialogGetDefaultFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe FileFilter)

Returns: the default filter

Gets the filter that will be selected by default in the file chooser dialog.

Since: 4.10

getFilters

fileDialogGetFilters Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe ListModel)

Returns: the filters, as a list model of FileFilter

Gets the filters that will be offered to the user in the file chooser dialog.

Since: 4.10

getInitialFile

fileDialogGetInitialFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe File)

Returns: the file

Gets the file that will be initially selected in the file chooser dialog.

Since: 4.10

getInitialFolder

fileDialogGetInitialFolder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe File)

Returns: the folder

Gets the folder that will be set as the initial folder in the file chooser dialog.

Since: 4.10

getInitialName

fileDialogGetInitialName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m (Maybe Text)

Returns: the name

Gets the filename that will be initially selected.

Since: 4.10

getModal

fileDialogGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m Bool

Returns: true if the file chooser dialog is modal

Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.

Since: 4.10

getTitle

fileDialogGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> m Text

Returns: the title

Returns the title that will be shown on the file chooser dialog.

Since: 4.10

new

fileDialogNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m FileDialog

Returns: the new GtkFileDialog

Creates a new GtkFileDialog object.

Since: 4.10

open

fileDialogOpen Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to select a single file.

The callback will be called when the dialog is dismissed.

Since: 4.10

openFinish

fileDialogOpenFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe File)

Returns: the file that was selected (Can throw GError)

Finishes the fileDialogOpen call.

Since: 4.10

openMultiple

fileDialogOpenMultiple Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to select multiple files.

The file chooser dialog will initially be opened in the directory FileDialog:initialFolder.

The callback will be called when the dialog is dismissed.

Since: 4.10

openMultipleFinish

fileDialogOpenMultipleFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe ListModel)

Returns: the files that were selected, as a list model of File (Can throw GError)

Finishes the fileDialogOpen call.

Since: 4.10

openMultipleTextFiles

fileDialogOpenMultipleTextFiles Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to select multiple files.

The file chooser dialog will initially be opened in the directory FileDialog:initialFolder.

In contrast to fileDialogOpen, this function lets the user select the text encoding for the files, if possible.

The callback will be called when the dialog is dismissed.

Since: 4.18

openMultipleTextFilesFinish

fileDialogOpenMultipleTextFilesFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe ListModel, Text)

Returns: the files that were selected, as a list model of File (Can throw GError)

Finishes the fileDialogOpen call.

Since: 4.18

openTextFile

fileDialogOpenTextFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a GtkFileDialog

-> Maybe b

parent: the parent GtkWindow

-> Maybe c

cancellable: a GCancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Initiates a file selection operation by presenting a file chooser dialog to the user.

In contrast to fileDialogOpen, this function lets the user select the text encoding for the file, if possible.

The callback will be called when the dialog is dismissed.

Since: 4.18

openTextFileFinish

fileDialogOpenTextFileFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe File, Text)

Returns: the file that was selected (Can throw GError)

Finishes the fileDialogOpenTextFile call and returns the resulting file and text encoding.

If the user has explicitly selected a text encoding to use for the file, then encoding will be set to a codeset name that is suitable for passing to iconv_open(). Otherwise, it will be NULL.

Since: 4.18

save

fileDialogSave Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be save mode.

The callback will be called when the dialog is dismissed.

Since: 4.10

saveFinish

fileDialogSaveFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe File)

Returns: the file that was selected (Can throw GError)

Finishes the fileDialogSave call.

Since: 4.10

saveTextFile

fileDialogSaveTextFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a GtkFileDialog

-> Maybe b

parent: the parent GtkWindow

-> Maybe c

cancellable: a GCancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Initiates a file save operation by presenting a file chooser dialog to the user.

In contrast to fileDialogSave, this function lets the user select the text encoding and line endings for the text file, if possible.

The callback will be called when the dialog is dismissed.

Since: 4.18

saveTextFileFinish

fileDialogSaveTextFileFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe File, Text, Text)

Returns: the file that was selected. Otherwise, NULL is returned and error is set (Can throw GError)

Finishes the fileDialogSaveTextFile call and returns the resulting file, text encoding and line endings.

If the user has explicitly selected a text encoding to use for the file, then encoding will be set to a codeset name that is suitable for passing to iconv_open(). Otherwise, it will be NULL.

The lineEnding will be set to one of "\n", "\r\n", "\r" or "", where the latter means to preserve existing line endings.

Since: 4.18

selectFolder

fileDialogSelectFolder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to select a single folder.

If you pass initialFolder, the file chooser dialog will initially be opened in the parent directory of that folder, otherwise, it will be in the directory FileDialog:initialFolder.

The callback will be called when the dialog is dismissed.

Since: 4.10

selectFolderFinish

fileDialogSelectFolderFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe File)

Returns: the folder that was selected (Can throw GError)

Finishes the fileDialogSelectFolder call.

Since: 4.10

selectMultipleFolders

fileDialogSelectMultipleFolders Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsWindow b, IsCancellable c) 
=> a

self: a file dialog

-> Maybe b

parent: the parent window

-> Maybe c

cancellable: a cancellable to cancel the operation

-> Maybe AsyncReadyCallback

callback: a callback to call when the operation is complete

-> m () 

Presents a file chooser dialog to the user.

The file chooser dialog will be set up to allow selecting multiple folders.

The file chooser dialog will initially be opened in the directory FileDialog:initialFolder.

The callback will be called when the dialog is dismissed.

Since: 4.10

selectMultipleFoldersFinish

fileDialogSelectMultipleFoldersFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsAsyncResult b) 
=> a

self: a file dialog

-> b

result: the result

-> m (Maybe ListModel)

Returns: the folders that were selected, as a list model of File (Can throw GError)

Finishes the fileDialogSelectMultipleFolders call.

Since: 4.10

setAcceptLabel

fileDialogSetAcceptLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> Maybe Text

acceptLabel: the new accept label

-> m () 

Sets the label shown on the file chooser's accept button.

Leaving the accept label unset or setting it as NULL will fall back to a default label, depending on what API is used to launch the file dialog.

Since: 4.10

setDefaultFilter

fileDialogSetDefaultFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsFileFilter b) 
=> a

self: a file dialog

-> Maybe b

filter: the file filter

-> m () 

Sets the filter that will be selected by default in the file chooser dialog.

If set to NULL, the first item in FileDialog:filters will be used as the default filter. If that list is empty, the dialog will be unfiltered.

Since: 4.10

setFilters

fileDialogSetFilters Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsListModel b) 
=> a

self: a file dialog

-> Maybe b

filters: a list model of FileFilter

-> m () 

Sets the filters that will be offered to the user in the file chooser dialog.

Since: 4.10

setInitialFile

fileDialogSetInitialFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsFile b) 
=> a

self: a file dialog

-> Maybe b

file: a file

-> m () 

Sets the file that will be initially selected in the file chooser dialog.

This function is a shortcut for calling both fileDialogSetInitialFolder and fileDialogSetInitialName with the directory and name of file, respectively.

Since: 4.10

setInitialFolder

fileDialogSetInitialFolder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a, IsFile b) 
=> a

self: a file dialog

-> Maybe b

folder: a file

-> m () 

Sets the folder that will be set as the initial folder in the file chooser dialog.

Since: 4.10

setInitialName

fileDialogSetInitialName Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> Maybe Text

name: a string

-> m () 

Sets the filename that will be initially selected.

For save dialogs, name will usually be pre-entered into the name field.

If a file with this name already exists in the directory set via FileDialog:initialFolder, the dialog will preselect it.

Since: 4.10

setModal

fileDialogSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> Bool

modal: the new value

-> m () 

Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.

Since: 4.10

setTitle

fileDialogSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileDialog a) 
=> a

self: a file dialog

-> Text

title: the new title

-> m () 

Sets the title that will be shown on the file chooser dialog.

Since: 4.10

Properties

acceptLabel

Label for the file chooser's accept button.

Since: 4.10

clearFileDialogAcceptLabel :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “accept-label” property to Nothing. When overloading is enabled, this is equivalent to

clear #acceptLabel

constructFileDialogAcceptLabel :: (IsFileDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “accept-label” property. This is rarely needed directly, but it is used by new.

getFileDialogAcceptLabel :: (MonadIO m, IsFileDialog o) => o -> m (Maybe Text) Source #

Get the value of the “accept-label” property. When overloading is enabled, this is equivalent to

get fileDialog #acceptLabel

setFileDialogAcceptLabel :: (MonadIO m, IsFileDialog o) => o -> Text -> m () Source #

Set the value of the “accept-label” property. When overloading is enabled, this is equivalent to

set fileDialog [ #acceptLabel := value ]

defaultFilter

The default filter.

This filter is initially active in the file chooser dialog.

If the default filter is NULL, the first filter of FileDialog:filters is used as the default filter. If that property contains no filter, the dialog will be unfiltered.

If FileDialog:filters is not NULL, the default filter should be part of the list. If it is not, the dialog may choose to not make it available.

Since: 4.10

clearFileDialogDefaultFilter :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “default-filter” property to Nothing. When overloading is enabled, this is equivalent to

clear #defaultFilter

constructFileDialogDefaultFilter :: (IsFileDialog o, MonadIO m, IsFileFilter a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “default-filter” property. This is rarely needed directly, but it is used by new.

getFileDialogDefaultFilter :: (MonadIO m, IsFileDialog o) => o -> m (Maybe FileFilter) Source #

Get the value of the “default-filter” property. When overloading is enabled, this is equivalent to

get fileDialog #defaultFilter

setFileDialogDefaultFilter :: (MonadIO m, IsFileDialog o, IsFileFilter a) => o -> a -> m () Source #

Set the value of the “default-filter” property. When overloading is enabled, this is equivalent to

set fileDialog [ #defaultFilter := value ]

filters

The list of filters.

See FileDialog:defaultFilter about how these two properties interact.

Since: 4.10

clearFileDialogFilters :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “filters” property to Nothing. When overloading is enabled, this is equivalent to

clear #filters

constructFileDialogFilters :: (IsFileDialog o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “filters” property. This is rarely needed directly, but it is used by new.

getFileDialogFilters :: (MonadIO m, IsFileDialog o) => o -> m (Maybe ListModel) Source #

Get the value of the “filters” property. When overloading is enabled, this is equivalent to

get fileDialog #filters

setFileDialogFilters :: (MonadIO m, IsFileDialog o, IsListModel a) => o -> a -> m () Source #

Set the value of the “filters” property. When overloading is enabled, this is equivalent to

set fileDialog [ #filters := value ]

initialFile

The initial file.

This file is initially selected in the file chooser dialog

This is a utility property that sets both FileDialog:initialFolder and FileDialog:initialName.

Since: 4.10

clearFileDialogInitialFile :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “initial-file” property to Nothing. When overloading is enabled, this is equivalent to

clear #initialFile

constructFileDialogInitialFile :: (IsFileDialog o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “initial-file” property. This is rarely needed directly, but it is used by new.

getFileDialogInitialFile :: (MonadIO m, IsFileDialog o) => o -> m (Maybe File) Source #

Get the value of the “initial-file” property. When overloading is enabled, this is equivalent to

get fileDialog #initialFile

setFileDialogInitialFile :: (MonadIO m, IsFileDialog o, IsFile a) => o -> a -> m () Source #

Set the value of the “initial-file” property. When overloading is enabled, this is equivalent to

set fileDialog [ #initialFile := value ]

initialFolder

The initial folder.

This is the directory that is initially opened in the file chooser dialog.

Since: 4.10

clearFileDialogInitialFolder :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “initial-folder” property to Nothing. When overloading is enabled, this is equivalent to

clear #initialFolder

constructFileDialogInitialFolder :: (IsFileDialog o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “initial-folder” property. This is rarely needed directly, but it is used by new.

getFileDialogInitialFolder :: (MonadIO m, IsFileDialog o) => o -> m (Maybe File) Source #

Get the value of the “initial-folder” property. When overloading is enabled, this is equivalent to

get fileDialog #initialFolder

setFileDialogInitialFolder :: (MonadIO m, IsFileDialog o, IsFile a) => o -> a -> m () Source #

Set the value of the “initial-folder” property. When overloading is enabled, this is equivalent to

set fileDialog [ #initialFolder := value ]

initialName

The initial name.

This is the name of the file that is initially selected in the file chooser dialog.

Since: 4.10

clearFileDialogInitialName :: (MonadIO m, IsFileDialog o) => o -> m () Source #

Set the value of the “initial-name” property to Nothing. When overloading is enabled, this is equivalent to

clear #initialName

constructFileDialogInitialName :: (IsFileDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “initial-name” property. This is rarely needed directly, but it is used by new.

getFileDialogInitialName :: (MonadIO m, IsFileDialog o) => o -> m (Maybe Text) Source #

Get the value of the “initial-name” property. When overloading is enabled, this is equivalent to

get fileDialog #initialName

setFileDialogInitialName :: (MonadIO m, IsFileDialog o) => o -> Text -> m () Source #

Set the value of the “initial-name” property. When overloading is enabled, this is equivalent to

set fileDialog [ #initialName := value ]

modal

Whether the file chooser dialog is modal.

Since: 4.10

constructFileDialogModal :: (IsFileDialog o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “modal” property. This is rarely needed directly, but it is used by new.

getFileDialogModal :: (MonadIO m, IsFileDialog o) => o -> m Bool Source #

Get the value of the “modal” property. When overloading is enabled, this is equivalent to

get fileDialog #modal

setFileDialogModal :: (MonadIO m, IsFileDialog o) => o -> Bool -> m () Source #

Set the value of the “modal” property. When overloading is enabled, this is equivalent to

set fileDialog [ #modal := value ]

title

A title that may be shown on the file chooser dialog.

Since: 4.10

constructFileDialogTitle :: (IsFileDialog o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “title” property. This is rarely needed directly, but it is used by new.

getFileDialogTitle :: (MonadIO m, IsFileDialog o) => o -> m Text Source #

Get the value of the “title” property. When overloading is enabled, this is equivalent to

get fileDialog #title

setFileDialogTitle :: (MonadIO m, IsFileDialog o) => o -> Text -> m () Source #

Set the value of the “title” property. When overloading is enabled, this is equivalent to

set fileDialog [ #title := value ]