gi-gtk-4.0.8: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.FileDialog

Description

A GtkFileDialog object collects the arguments that are needed to present a file chooser 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. These APIs follow the GIO async pattern, and the result can be obtained by calling the corresponding finish function, for example fileDialogOpenFinish.

Since: 4.10

Synopsis

Exported types

newtype FileDialog Source #

Memory-managed wrapper type.

Constructors

FileDialog (ManagedPtr FileDialog) 

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

Methods

toManagedPtr :: FileDialog -> ManagedPtr 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

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe FileDialog -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe 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 GtkFileDialog

-> m (Maybe Text)

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

No description available in the introspection data.

Since: 4.10

getDefaultFilter

fileDialogGetDefaultFilter Source #

Arguments

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

self: a GtkFileDialog

-> m (Maybe FileFilter)

Returns: the current 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 GtkFileDialog

-> m (Maybe ListModel)

Returns: the filters, as a GListModel of GtkFileFilters

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 GtkFileDialog

-> 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 GtkFileDialog

-> 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 GtkFileDialog

-> m (Maybe Text)

Returns: the name

Gets the name for the file that should be initially set.

Since: 4.10

getModal

fileDialogGetModal Source #

Arguments

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

self: a GtkFileDialog

-> 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 GtkFileDialog

-> 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 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 () 

This function initiates a file selection operation by presenting a file chooser dialog to the user.

The callback will be called when the dialog is dismissed. It should call fileDialogOpenFinish to obtain the result.

Since: 4.10

openFinish

fileDialogOpenFinish Source #

Arguments

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

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe File)

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

Finishes the fileDialogOpen call and returns the resulting file.

Since: 4.10

openMultiple

fileDialogOpenMultiple 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 () 

This function initiates a multi-file selection operation by presenting a file chooser dialog to the user.

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

The callback will be called when the dialog is dismissed. It should call fileDialogOpenMultipleFinish to obtain the result.

Since: 4.10

openMultipleFinish

fileDialogOpenMultipleFinish Source #

Arguments

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

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe ListModel)

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

Finishes the fileDialogOpen call and returns the resulting files in a GListModel.

Since: 4.10

save

fileDialogSave 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 () 

This function initiates a file save operation by presenting a file chooser dialog to the user.

The callback will be called when the dialog is dismissed. It should call fileDialogSaveFinish to obtain the result.

Since: 4.10

saveFinish

fileDialogSaveFinish Source #

Arguments

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

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe File)

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

Finishes the fileDialogSave call and returns the resulting file.

Since: 4.10

selectFolder

fileDialogSelectFolder 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 () 

This function initiates a directory selection operation by presenting a file chooser dialog to the user.

If you pass initialFolder, the file chooser 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. It should call fileDialogSelectFolderFinish to obtain the result.

Since: 4.10

selectFolderFinish

fileDialogSelectFolderFinish Source #

Arguments

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

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe File)

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

Finishes the fileDialogSelectFolder call and returns the resulting file.

Since: 4.10

selectMultipleFolders

fileDialogSelectMultipleFolders 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 () 

This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user.

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

The callback will be called when the dialog is dismissed. It should call fileDialogSelectMultipleFoldersFinish to obtain the result.

Since: 4.10

selectMultipleFoldersFinish

fileDialogSelectMultipleFoldersFinish Source #

Arguments

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

self: a GtkFileDialog

-> b

result: a GAsyncResult

-> m (Maybe ListModel)

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

Finishes the fileDialogSelectMultipleFolders call and returns the resulting files in a GListModel.

Since: 4.10

setAcceptLabel

fileDialogSetAcceptLabel Source #

Arguments

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

self: a GtkFileDialog

-> 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 GtkFileDialog

-> Maybe b

filter: a GtkFileFilter

-> m () 

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

If set to Nothing, 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 GtkFileDialog

-> b

filters: a GListModel of GtkFileFilters

-> 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 GtkFileDialog

-> Maybe b

file: a GFile

-> 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 GtkFileDialog

-> Maybe b

folder: a GFile

-> 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 GtkFileDialog

-> Maybe Text

name: a UTF8 string

-> m () 

Sets the name for the file that should be initially set. For saving dialogs, this 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 should preselect it.

Since: 4.10

setModal

fileDialogSetModal Source #

Arguments

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

self: a GtkFileDialog

-> 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 GtkFileDialog

-> 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, that is, the filter that is initially active in the file chooser dialog.

If the default filter is Nothing, 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 Nothing, 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 those two properties interact.

Since: 4.10

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 inital file, that is, the file that 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 inital folder, that 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 inital name, that is, the filename 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 ]