gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.FileLauncher

Contents

- Exported types
- Methods
  - getAlwaysAsk
  - getFile
  - getWritable
  - launch
  - launchFinish
  - new
  - openContainingFolder
  - openContainingFolderFinish
  - setAlwaysAsk
  - setFile
  - setWritable
- Properties
  - alwaysAsk
  - file
  - writable

Description

Asynchronous API to open a file with an application.

`GtkFileLauncher` collects the arguments that are needed to open the file.

Depending on system configuration, user preferences and available APIs, this may or may not show an app chooser dialog or launch the default application right away.

The operation is started with the `fileLauncherLaunch` function.

To launch uris that don't represent files, use `UriLauncher`.

Since: 4.10

Synopsis

- newtype FileLauncher = FileLauncher (ManagedPtr FileLauncher)
- class (GObject o, IsDescendantOf FileLauncher o) => IsFileLauncher o
- toFileLauncher :: (MonadIO m, IsFileLauncher o) => o -> m FileLauncher
- fileLauncherGetAlwaysAsk :: (HasCallStack, MonadIO m, IsFileLauncher a) => a -> m Bool
- fileLauncherGetFile :: (HasCallStack, MonadIO m, IsFileLauncher a) => a -> m (Maybe File)
- fileLauncherGetWritable :: (HasCallStack, MonadIO m, IsFileLauncher a) => a -> m Bool
- fileLauncherLaunch :: (HasCallStack, MonadIO m, IsFileLauncher a, IsWindow b, IsCancellable c) => a -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- fileLauncherLaunchFinish :: (HasCallStack, MonadIO m, IsFileLauncher a, IsAsyncResult b) => a -> b -> m ()
- fileLauncherNew :: (HasCallStack, MonadIO m, IsFile a) => Maybe a -> m FileLauncher
- fileLauncherOpenContainingFolder :: (HasCallStack, MonadIO m, IsFileLauncher a, IsWindow b, IsCancellable c) => a -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- fileLauncherOpenContainingFolderFinish :: (HasCallStack, MonadIO m, IsFileLauncher a, IsAsyncResult b) => a -> b -> m ()
- fileLauncherSetAlwaysAsk :: (HasCallStack, MonadIO m, IsFileLauncher a) => a -> Bool -> m ()
- fileLauncherSetFile :: (HasCallStack, MonadIO m, IsFileLauncher a, IsFile b) => a -> Maybe b -> m ()
- fileLauncherSetWritable :: (HasCallStack, MonadIO m, IsFileLauncher a) => a -> Bool -> m ()
- constructFileLauncherAlwaysAsk :: (IsFileLauncher o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFileLauncherAlwaysAsk :: (MonadIO m, IsFileLauncher o) => o -> m Bool
- setFileLauncherAlwaysAsk :: (MonadIO m, IsFileLauncher o) => o -> Bool -> m ()
- clearFileLauncherFile :: (MonadIO m, IsFileLauncher o) => o -> m ()
- constructFileLauncherFile :: (IsFileLauncher o, MonadIO m, IsFile a) => a -> m (GValueConstruct o)
- getFileLauncherFile :: (MonadIO m, IsFileLauncher o) => o -> m (Maybe File)
- setFileLauncherFile :: (MonadIO m, IsFileLauncher o, IsFile a) => o -> a -> m ()
- constructFileLauncherWritable :: (IsFileLauncher o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFileLauncherWritable :: (MonadIO m, IsFileLauncher o) => o -> m Bool
- setFileLauncherWritable :: (MonadIO m, IsFileLauncher o) => o -> Bool -> m ()

# Exported types

newtype FileLauncher Source #

Memory-managed wrapper type.

Constructors

FileLauncher (ManagedPtr FileLauncher) |

#### Instances

Instances details

Eq FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher Methods (==) :: FileLauncher -> FileLauncher -> Bool Source # (/=) :: FileLauncher -> FileLauncher -> Bool Source #
GObject FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher
ManagedPtrNewtype FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher Methods toManagedPtr :: FileLauncher -> ManagedPtr FileLauncher Source #
TypedObject FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher Methods glibType :: IO GType Source #
HasParentTypes FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher
IsGValue (Maybe FileLauncher) Source # | Convert `FileLauncher` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.FileLauncher Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe FileLauncher -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe FileLauncher) Source #
type ParentTypes FileLauncher Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher type ParentTypes FileLauncher = '[Object]

class (GObject o, IsDescendantOf FileLauncher o) => IsFileLauncher o Source #

Type class for types which can be safely cast to `FileLauncher`, for instance with `toFileLauncher`.

#### Instances

Instances details

(GObject o, IsDescendantOf FileLauncher o) => IsFileLauncher o Source # |
Instance details Defined in GI.Gtk.Objects.FileLauncher

toFileLauncher :: (MonadIO m, IsFileLauncher o) => o -> m FileLauncher Source #

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

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, launch, launchFinish, notify, notifyByPspec, openContainingFolder, openContainingFolderFinish, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getAlwaysAsk, getData, getFile, getProperty, getQdata, getWritable.

#### Setters

setAlwaysAsk, setData, setDataFull, setFile, setProperty, setWritable.

## getAlwaysAsk

fileLauncherGetAlwaysAsk Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a) |
=> a | `self`: a file launcher
-> m Bool | Returns: true if always asking the user

Returns whether to ask the user which app to use.

Since: 4.12

## getFile

fileLauncherGetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a) |
=> a | `self`: a file launcher
-> m (Maybe File) | Returns: the file

Gets the file that will be opened.

Since: 4.10

## getWritable

fileLauncherGetWritable Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a) |
=> a | `self`: a file launcher
-> m Bool | Returns: true if the file will be made writable

Returns whether to make the file writable for the handler.

Since: 4.14

## launch

fileLauncherLaunch Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a, IsWindow b, IsCancellable c) |
=> a | `self`: a file launcher
-> 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 () |

Launches an application to open the file.

This may present an app chooser dialog to the user.

Since: 4.10

## launchFinish

fileLauncherLaunchFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a, IsAsyncResult b) |
=> a | `self`: a file launcher
-> b | `result`: the result
-> m () | (Can throw `GError`)

Finishes the `fileLauncherLaunch` call and returns the result.

Since: 4.10

## new

fileLauncherNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) |
=> Maybe a | `file`: the file to open
-> m FileLauncher | Returns: the new `GtkFileLauncher`

Creates a new `GtkFileLauncher` object.

Since: 4.10

## openContainingFolder

fileLauncherOpenContainingFolder Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a, IsWindow b, IsCancellable c) |
=> a | `self`: a file launcher
-> 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 () |

Launches a file manager to show the file in its parent directory.

This is only supported for native files. It will fail if `file` is e.g. a http:// uri.

Since: 4.10

## openContainingFolderFinish

fileLauncherOpenContainingFolderFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a, IsAsyncResult b) |
=> a | `self`: a file launcher
-> b | `result`: the result
-> m () | (Can throw `GError`)

Finishes the `fileLauncherOpenContainingFolder` call and returns the result.

Since: 4.10

## setAlwaysAsk

fileLauncherSetAlwaysAsk Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a) |
=> a | `self`: a file launcher
-> Bool | `alwaysAsk`: whether to always ask
-> m () |

Sets whether to always ask the user which app to use.

If false, the file might be opened with a default app or the previous choice.

Since: 4.12

## setFile

fileLauncherSetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a, IsFile b) |
=> a | `self`: a file launcher
-> Maybe b | `file`: the file
-> m () |

Sets the file that will be opened.

Since: 4.10

## setWritable

fileLauncherSetWritable Source #

Arguments

:: (HasCallStack, MonadIO m, IsFileLauncher a) |
=> a | `self`: a file launcher
-> Bool | `writable`: whether to make the file writable
-> m () |

Sets whether to make the file writable for the handler.

Since: 4.14

# Properties

## alwaysAsk

Whether to ask the user to choose an app for opening the file. If `FALSE`, the file might be opened with a default app or the previous choice.

Since: 4.12

constructFileLauncherAlwaysAsk :: (IsFileLauncher o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getFileLauncherAlwaysAsk :: (MonadIO m, IsFileLauncher o) => o -> m Bool Source #

Get the value of the “`always-ask`” property. When overloading is enabled, this is equivalent to

    get fileLauncher #alwaysAsk

setFileLauncherAlwaysAsk :: (MonadIO m, IsFileLauncher o) => o -> Bool -> m () Source #

Set the value of the “`always-ask`” property. When overloading is enabled, this is equivalent to

    set fileLauncher [ #alwaysAsk := value ]

## file

The file to launch.

Since: 4.10

clearFileLauncherFile :: (MonadIO m, IsFileLauncher o) => o -> m () Source #

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

    clear #file

constructFileLauncherFile :: (IsFileLauncher o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

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

getFileLauncherFile :: (MonadIO m, IsFileLauncher o) => o -> m (Maybe File) Source #

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

    get fileLauncher #file

setFileLauncherFile :: (MonadIO m, IsFileLauncher o, IsFile a) => o -> a -> m () Source #

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

    set fileLauncher [ #file := value ]

## writable

Whether to make the file writable for the handler.

Since: 4.14

constructFileLauncherWritable :: (IsFileLauncher o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getFileLauncherWritable :: (MonadIO m, IsFileLauncher o) => o -> m Bool Source #

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

    get fileLauncher #writable

setFileLauncherWritable :: (MonadIO m, IsFileLauncher o) => o -> Bool -> m () Source #

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

    set fileLauncher [ #writable := value ]