gio-0.12.4: Binding to the GIO.

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

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 :: String -> Maybe String -> [AppInfoCreateFlags] -> IO AppInfo
- appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfo
- appInfoEqual :: (AppInfoClass info1, AppInfoClass info2) => info1 -> info2 -> Bool
- appInfoGetId :: AppInfoClass appinfo => appinfo -> IO (Maybe String)
- appInfoGetName :: AppInfoClass appinfo => appinfo -> String
- appInfoGetDisplayName :: AppInfoClass appinfo => appinfo -> String
- appInfoGetDescription :: AppInfoClass appinfo => appinfo -> Maybe String
- appInfoGetExecutable :: AppInfoClass appinfo => 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 => appinfo -> [String] -> Maybe AppLaunchContext -> IO ()
- appInfoShouldShow :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoCanDelete :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoDelete :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoResetTypeAssociations :: String -> IO ()
- appInfoSetAsDefaultForType :: AppInfoClass appinfo => appinfo -> String -> IO ()
- appInfoSetAsDefaultForExtension :: AppInfoClass appinfo => appinfo -> String -> IO ()
- appInfoAddSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO ()
- appInfoCanRemoveSupportsType :: AppInfoClass appinfo => appinfo -> IO Bool
- appInfoRemoveSupportsType :: AppInfoClass appinfo => appinfo -> String -> IO ()
- appInfoGetAll :: IO [AppInfo]
- appInfoGetAllForType :: String -> IO [AppInfo]
- appInfoGetDefaultForType :: String -> Bool -> IO (Maybe AppInfo)
- appInfoGetDefaultForUriScheme :: String -> IO (Maybe AppInfo)
- appInfoLaunchDefaultForUri :: String -> AppLaunchContext -> IO ()
- appLaunchContextGetDisplay :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO String
- appLaunchContextGetStartupNotifyId :: AppInfoClass appinfo => AppLaunchContext -> appinfo -> [File] -> IO (Maybe String)
- appLaunchContextLaunchFailed :: 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

Instances

Eq AppInfo |
Ord AppInfo |
GObjectClass AppInfo |
AppInfoClass AppInfo |

class GObjectClass o => AppInfoClass o

Instances

AppInfoClass AppInfo |

data AppLaunchContext

Instances

Eq AppLaunchContext |
Ord AppLaunchContext |
GObjectClass AppLaunchContext |
AppLaunchContextClass AppLaunchContext |
FileInfoClass AppLaunchContext |

class FileInfoClass o => AppLaunchContextClass o

Instances

AppLaunchContextClass AppLaunchContext |

# Enums

data AppInfoCreateFlags

Flags used when creating a `AppInfo`.

Constructors

AppInfoCreateNone |
AppInfoCreateNeedsTerminal |
AppInfoCreateSupportsUris |
AppInfoCreateSupportsStartupNotification |

Instances

Bounded AppInfoCreateFlags |
Enum AppInfoCreateFlags |
Eq AppInfoCreateFlags |
Ord AppInfoCreateFlags |
Show AppInfoCreateFlags |
Typeable AppInfoCreateFlags |
Flags AppInfoCreateFlags |

# Methods

appInfoCreateFromCommandline

Arguments

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

Creates a duplicate of a `AppInfo`.

appInfoEqual

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 => appinfo -> IO (Maybe String)

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

Arguments

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

Gets the installed name of the application.

appInfoGetDisplayName

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

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

Gets the executable's name for the installed application.

appInfoGetCommandline

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

Arguments

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

Gets the icon for the application.

appInfoLaunch

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 lauch the application without arguments pass a emtpy 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

Arguments

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

Checks if the application accepts files as arguments.

appInfoSupportsUris

Arguments

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

Checks if the application accepts uris as arguments.

appInfoLaunchUris

Arguments

:: AppInfoClass appinfo |
=> 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 lauch 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

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

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

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

Arguments

:: String | `contentType` a content type
-> IO () |

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

appInfoSetAsDefaultForType

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

:: AppInfoClass appinfo |
=> 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

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

Arguments

:: AppInfoClass appinfo |
=> 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]

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

Arguments

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

Arguments

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

Arguments

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

Arguments

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

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

:: AppInfoClass appinfo |
=> 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

Arguments

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

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