gio-0.13.11.0: Binding to GIO

Maintainer | gtk2hs-devel@lists.sourceforge.net
Stability | alpha
Portability | portable (depends on GHC)
Safe Haskell | Safe-Inferred
Language | Haskell98

System.GIO.File.AppInfo

Contents

- Details
- Types
- Enums
- Methods

Description

Synopsis

- data AppInfo
- class GObjectClass o => AppInfoClass o
- data AppLaunchContext
- class FileInfoClass o => AppLaunchContextClass o
- data AppInfoCreateFlags
  - = AppInfoCreateNone
  - | AppInfoCreateNeedsTerminal
  - | AppInfoCreateSupportsUris
  - | AppInfoCreateSupportsStartupNotification
- appInfoCreateFromCommandline :: GlibString string => string -> Maybe string -> [AppInfoCreateFlags] -> IO AppInfo
- appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo
- appInfoEqual :: (AppInfoClass info1, AppInfoClass info2) => info1 -> info2 -> Bool
- appInfoGetId :: (AppInfoClass appinfo, GlibString string) => appinfo -> IO (Maybe string)
- appInfoGetName :: AppInfoClass appinfo => appinfo -> String
- appInfoGetDisplayName :: (AppInfoClass appinfo, GlibString string) => appinfo -> string
- appInfoGetDescription :: (AppInfoClass appinfo, GlibString string) => appinfo -> Maybe string
- appInfoGetExecutable :: (AppInfoClass appinfo, GlibString string) => appinfo -> string
- appInfoGetCommandline :: AppInfoClass appinfo => appinfo -> Maybe ByteString
- appInfoGetIcon :: AppInfoClass appinfo => appinfo -> IO (Maybe Icon)
- appInfoLaunch :: AppInfoClass appinfo => appinfo -> [File] -> Maybe AppLaunchContext -> IO ()
- appInfoSupportsFiles :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoSupportsUris :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoLaunchUris :: (AppInfoClass appinfo, GlibString string) => appinfo -> [string] -> Maybe AppLaunchContext -> IO ()
- appInfoShouldShow :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoCanDelete :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoDelete :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoResetTypeAssociations :: GlibString string => string -> IO ()
- appInfoSetAsDefaultForType :: (AppInfoClass appinfo, GlibString string) => appinfo -> string -> IO ()
- appInfoSetAsDefaultForExtension :: (AppInfoClass appinfo, GlibString string) => appinfo -> string -> IO ()
- appInfoAddSupportsType :: (AppInfoClass appinfo, GlibString string) => appinfo -> string -> IO ()
- appInfoCanRemoveSupportsType :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoRemoveSupportsType :: (AppInfoClass appinfo, GlibString string) => appinfo -> string -> IO ()
- appInfoGetAll :: IO [AppInfo]
- appInfoGetAllForType :: GlibString string => string -> IO [AppInfo]
- appInfoGetDefaultForType :: GlibString string => string -> Bool -> IO (Maybe AppInfo)
- appInfoGetDefaultForUriScheme :: GlibString string => string -> IO (Maybe AppInfo)
- appInfoLaunchDefaultForUri :: GlibString string => string -> AppLaunchContext -> IO ()
- appLaunchContextGetDisplay :: (AppInfoClass appinfo, GlibString string) => AppLaunchContext -> appinfo -> [File] -> IO string
- appLaunchContextGetStartupNotifyId :: (AppInfoClass appinfo, GlibString string) => AppLaunchContext -> appinfo -> [File] -> IO (Maybe string)
- appLaunchContextLaunchFailed :: GlibString string => AppLaunchContext -> string -> IO ()
- appLaunchContextNew :: IO AppLaunchContext

# Details

`AppInfo` and `AppLaunchContext` are used for describing and launching applications installed on the system.

As of GLib 2.20, URIs will always be converted to POSIX paths (using `fileGetPath` when using `appInfoLaunch` even if the application requested an URI and not a POSIX path. For example for an desktop-file based application with Exec key totem %U and a single URI, sftp: homeuser.gvfssftp on foo/file.avi will be passed. This will only work if a set of suitable GIO extensions (such as gvfs 2.26 compiled with FUSE support), is available and operational; if this is not the case, the URI will be passed unmodified to the application. Some URIs, such as mailto:, of course cannot be mapped to a POSIX path (in gvfs there's no FUSE mount for it); such URIs will be passed unmodified to the application.

Specifically for gvfs 2.26 and later, the POSIX URI will be mapped back to the GIO URI in the `File` constructors (since gvfs implements the GVfs extension point). As such, if the application needs to examine the URI, it needs to use `fileGetUri` or similar on `File`. In other words, an application cannot assume that the URI passed to e.g. 'fileNewForCommandlineArg ' is equal to the result of `fileGetUri`.

# Types

data AppInfo Source #

#### Instances

Instances details

Eq AppInfo Source # |
Instance details Defined in System.GIO.Types Methods (==) :: AppInfo -> AppInfo -> Bool Source # (/=) :: AppInfo -> AppInfo -> Bool Source #
Ord AppInfo Source # |
Instance details Defined in System.GIO.Types Methods compare :: AppInfo -> AppInfo -> Ordering Source # (<) :: AppInfo -> AppInfo -> Bool Source # (<=) :: AppInfo -> AppInfo -> Bool Source # (>) :: AppInfo -> AppInfo -> Bool Source # (>=) :: AppInfo -> AppInfo -> Bool Source # max :: AppInfo -> AppInfo -> AppInfo Source # min :: AppInfo -> AppInfo -> AppInfo Source #
AppInfoClass AppInfo Source # |
Instance details Defined in System.GIO.Types
GObjectClass AppInfo Source # |
Instance details Defined in System.GIO.Types Methods toGObject :: AppInfo -> GObject Source # unsafeCastGObject :: GObject -> AppInfo Source #

class GObjectClass o => AppInfoClass o Source #

#### Instances

Instances details

AppInfoClass AppInfo Source # |
Instance details Defined in System.GIO.Types

data AppLaunchContext Source #

#### Instances

Instances details

Eq AppLaunchContext Source # |
Instance details Defined in System.GIO.Types Methods (==) :: AppLaunchContext -> AppLaunchContext -> Bool Source # (/=) :: AppLaunchContext -> AppLaunchContext -> Bool Source #
Ord AppLaunchContext Source # |

Instance details

Defined in System.GIO.Types

Methods

compare :: AppLaunchContext -> AppLaunchContext -> Ordering Source #

(<) :: AppLaunchContext -> AppLaunchContext -> Bool Source #

(<=) :: AppLaunchContext -> AppLaunchContext -> Bool Source #

(>) :: AppLaunchContext -> AppLaunchContext -> Bool Source #

(>=) :: AppLaunchContext -> AppLaunchContext -> Bool Source #

max :: AppLaunchContext -> AppLaunchContext -> AppLaunchContext Source #

min :: AppLaunchContext -> AppLaunchContext -> AppLaunchContext Source #

AppLaunchContextClass AppLaunchContext Source # |
Instance details Defined in System.GIO.Types
FileInfoClass AppLaunchContext Source # |
Instance details Defined in System.GIO.Types
GObjectClass AppLaunchContext Source # |
Instance details Defined in System.GIO.Types Methods toGObject :: AppLaunchContext -> GObject Source # unsafeCastGObject :: GObject -> AppLaunchContext Source #

class FileInfoClass o => AppLaunchContextClass o Source #

#### Instances

Instances details

AppLaunchContextClass AppLaunchContext Source # |
Instance details Defined in System.GIO.Types

# Enums

data AppInfoCreateFlags Source #

Flags used when creating a `AppInfo`.

Constructors

AppInfoCreateNone |
AppInfoCreateNeedsTerminal |
AppInfoCreateSupportsUris |
AppInfoCreateSupportsStartupNotification |

#### Instances

Instances details

Bounded AppInfoCreateFlags Source # |
Instance details Defined in System.GIO.Enums Methods minBound :: AppInfoCreateFlags Source # maxBound :: AppInfoCreateFlags Source #
Enum AppInfoCreateFlags Source # |

Instance details

Defined in System.GIO.Enums

Methods

succ :: AppInfoCreateFlags -> AppInfoCreateFlags Source #

pred :: AppInfoCreateFlags -> AppInfoCreateFlags Source #

toEnum :: Int -> AppInfoCreateFlags Source #

fromEnum :: AppInfoCreateFlags -> Int Source #

enumFrom :: AppInfoCreateFlags -> [AppInfoCreateFlags] Source #

enumFromThen :: AppInfoCreateFlags -> AppInfoCreateFlags -> [AppInfoCreateFlags] Source #

enumFromTo :: AppInfoCreateFlags -> AppInfoCreateFlags -> [AppInfoCreateFlags] Source #

enumFromThenTo :: AppInfoCreateFlags -> AppInfoCreateFlags -> AppInfoCreateFlags -> [AppInfoCreateFlags] Source #

Show AppInfoCreateFlags Source # |
Instance details Defined in System.GIO.Enums Methods showsPrec :: Int -> AppInfoCreateFlags -> ShowS Source # show :: AppInfoCreateFlags -> String Source # showList :: [AppInfoCreateFlags] -> ShowS Source #
Eq AppInfoCreateFlags Source # |
Instance details Defined in System.GIO.Enums Methods (==) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source # (/=) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source #
Ord AppInfoCreateFlags Source # |

Instance details

Defined in System.GIO.Enums

Methods

compare :: AppInfoCreateFlags -> AppInfoCreateFlags -> Ordering Source #

(<) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source #

(<=) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source #

(>) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source #

(>=) :: AppInfoCreateFlags -> AppInfoCreateFlags -> Bool Source #

max :: AppInfoCreateFlags -> AppInfoCreateFlags -> AppInfoCreateFlags Source #

min :: AppInfoCreateFlags -> AppInfoCreateFlags -> AppInfoCreateFlags Source #

Flags AppInfoCreateFlags Source # |
Instance details Defined in System.GIO.Enums

# Methods

appInfoCreateFromCommandline Source #

Arguments

:: GlibString string |
=> string | `commandline` the commandline to use
-> Maybe string | `applicationName` the application name, or `Nothing` to use commandline
-> [AppInfoCreateFlags] | `flags` flags that can specify details of the created `AppInfo`
-> IO AppInfo | returns new `AppInfo` for given command.

Creates a new `AppInfo` from the given information.

appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo Source #

Creates a duplicate of a `AppInfo`.

appInfoEqual Source #

Arguments

:: (AppInfoClass info1, AppInfoClass info2) |
=> info1 |
-> info2 |
-> Bool | returns `True` if appinfo1 is equal to appinfo2. `False` otherwise.

Checks if two `AppInfo`s are equal.

appInfoGetId :: (AppInfoClass appinfo, GlibString string) => appinfo -> IO (Maybe string) Source #

Gets the ID of an application. An id is a string that identifies the application. The exact format of the id is platform dependent. For instance, on Unix this is the desktop file id from the xdg menu specification.

Note that the returned ID may be `Nothing`, depending on how the appinfo has been constructed.

appInfoGetName Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> String | returns the name of the application for appinfo.

Gets the installed name of the application.

appInfoGetDisplayName Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | returns the display name of the application for appinfo, or the name if no display name is available.

Gets the installed name of the application.

appInfoGetDescription Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> Maybe string | returns a string containing a description of the application appinfo, or `Nothing` if none.

Gets a human-readable description of an installed application.

appInfoGetExecutable Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | returns the executable of the application for appinfo.

Gets the executable's name for the installed application.

appInfoGetCommandline Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> Maybe ByteString | returns a string containing the appinfo's commandline, or `Nothing` if this information is not available

Gets the commandline with which the application will be started.

appInfoGetIcon Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO (Maybe Icon) | returns the default `Icon` for appinfo or `Nothing`

Gets the icon for the application.

appInfoLaunch Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> [File] | `files` a list of `File` objects
-> Maybe AppLaunchContext | `launchContext` a `AppLaunchContext` or `Nothing`
-> IO () |

Launches the application. Passes files to the launched application as arguments, using the optional `launchContext` to get information about the details of the launcher (like what screen it is on). Throws a `GError` if an error occurs

To launch the application without arguments pass a empty files list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

Some URIs can be changed when passed through a `File` (for instance unsupported uris with strange formats like mailto:), so if you have a textual uri you want to pass in as argument, consider using `appInfoLaunchUris` instead.

appInfoSupportsFiles Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if the appinfo supports files.

Checks if the application accepts files as arguments.

appInfoSupportsUris Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if the appinfo supports uris.

Checks if the application accepts uris as arguments.

appInfoLaunchUris Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> [string] | `uris` a list containing URIs to launch.
-> Maybe AppLaunchContext | `launchContext` a `AppLaunchContext` or `Nothing`
-> IO () |

Launches the application. Passes uris to the launched application as arguments, using the optional `launchContext` to get information about the details of the launcher (like what screen it is on). Throws a `GError` if an error occurs.

To launch the application without arguments pass a empty uris list.

Note that even if the launch is successful the application launched can fail to start if it runs into problems during startup. There is no way to detect this.

appInfoShouldShow Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if the appinfo should be shown, `False` otherwise.

Checks if the application info should be shown in menus that list available applications.

appInfoCanDelete Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if appinfo can be deleted

Obtains the information whether the `AppInfo` can be deleted. See `appInfoDelete`.

appInfoDelete Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if appinfo has been deleted

Tries to delete a `AppInfo`.

On some platforms, there may be a difference between user-defined `AppInfo`s which can be deleted, and system-wide ones which cannot. See `appInfoCanDelete`.

appInfoResetTypeAssociations Source #

Arguments

:: GlibString string |
=> string | `contentType` a content type
-> IO () |

Removes all changes to the type associations done by `appInfoSetAsDefaultForType`, `appInfoSetAsDefaultForExtension` or `appInfoRemoveSupportsType`.

appInfoSetAsDefaultForType Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | `contentType` the content type.
-> IO () |

Sets the application as the default handler for a given type. Throws a `GError` if an error occurs.

appInfoSetAsDefaultForExtension Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | `extension` a string containing the file extension (without the dot).
-> IO () |

Sets the application as the default handler for a given extension. Throws a `GError` if an error occurs.

appInfoAddSupportsType Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | `contentType` a string.
-> IO () |

Adds a content type to the application information to indicate the application is capable of opening files with the given content type. Throws a `GError` if an error occurs.

appInfoCanRemoveSupportsType Source #

Arguments

:: AppInfoClass appinfo |
=> appinfo |
-> IO Bool | returns `True` if it is possible to remove supported content types from a given appinfo, `False` if not.

Checks if a supported content type can be removed from an application.

appInfoRemoveSupportsType Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> appinfo |
-> string | `contentType` a string.
-> IO () |

Removes a supported type from an application, if possible. Throws a `GError` if an error occurs.

appInfoGetAll :: IO [AppInfo] Source #

Gets a list of all of the applications currently registered on this system.

For desktop files, this includes applications that have NoDisplay=true set or are excluded from display by means of OnlyShowIn or NotShowIn. See `appInfoShouldShow`. The returned list does not include applications which have the Hidden key set.

appInfoGetAllForType Source #

Arguments

:: GlibString string |
=> string | `contentType` the content type to find a `AppInfo` for
-> IO [AppInfo] | returns list of `AppInfo`s for given `contentType` or `empty` on error.

Gets a list of all `AppInfo`s for a given content type.

appInfoGetDefaultForType Source #

Arguments

:: GlibString string |
=> string | `contentType` the content type to find a `AppInfo` for
-> Bool | `mustSupportUris` if `True`, the `AppInfo` is expected to support URIs
-> IO (Maybe AppInfo) | returns list of `AppInfo`s for given `contentType` or `Nothing` on error.

Gets the `AppInfo` that corresponds to a given content type.

appInfoGetDefaultForUriScheme Source #

Arguments

:: GlibString string |
=> string | `uriScheme` a string containing a URI scheme.
-> IO (Maybe AppInfo) | returns list of `AppInfo`s for given `contentType` or `Nothing` on error.

Gets the default application for launching applications using this URI scheme. A URI scheme is the initial part of the URI, up to but not including the `:`, e.g. "http", "ftp" or "sip".

appInfoLaunchDefaultForUri Source #

Arguments

:: GlibString string |
=> string | `uri` the uri to show
-> AppLaunchContext | `launchContext` an optional `AppLaunchContext`.
-> IO () |

Utility function that launches the default application registered to handle the specified uri. Synchronous I/O is done on the uri to detect the type of the file if required. Throws a `GError` if an error occurs.

appLaunchContextGetDisplay Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> AppLaunchContext |
-> appinfo |
-> [File] | `files` a list of `File` objects
-> IO string | returns a display string for the display.

Gets the display string for the display. This is used to ensure new applications are started on the same display as the launching application.

appLaunchContextGetStartupNotifyId Source #

Arguments

:: (AppInfoClass appinfo, GlibString string) |
=> AppLaunchContext |
-> appinfo |
-> [File] | `files` a list of `File` objects
-> IO (Maybe string) | returns a startup notification ID for the application, or `Nothing` if not supported.

Initiates startup notification for the application and returns the DesktopStartupId for the launched operation, if supported.

Startup notification IDs are defined in the FreeDesktop.Org Startup Notifications standard.

appLaunchContextLaunchFailed Source #

Arguments

:: GlibString string |
=> AppLaunchContext |
-> string | `startupNotifyId` the startup notification id that was returned by `appLaunchContextGetStartupNotifyId`.
-> IO () |

Called when an application has failed to launch, so that it can cancel the application startup notification started in `appLaunchContextGetStartupNotifyId`.

appLaunchContextNew :: IO AppLaunchContext Source #

Creates a new application launch context. This is not normally used, instead you instantiate a subclass of this, such as `AppLaunchContext`.