Portability | portable (depends on GHC) |
---|---|
Stability | alpha |
Maintainer | gtk2hs-devel@lists.sourceforge.net |
Safe Haskell | None |
- data AppInfo
- class GObjectClass o => AppInfoClass o
- data AppLaunchContext
- class FileInfoClass o => AppLaunchContextClass o
- data AppInfoCreateFlags
- 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
class GObjectClass o => AppInfoClass o Source
data AppLaunchContext Source
Enums
data AppInfoCreateFlags Source
Flags used when creating a AppInfo
.
Methods
appInfoCreateFromCommandlineSource
:: String |
|
-> Maybe String |
|
-> [AppInfoCreateFlags] |
|
-> IO AppInfo | returns new |
Creates a new AppInfo
from the given information.
appInfoDup :: AppInfoClass appinfo => appinfo -> IO AppInfoSource
Creates a duplicate of a AppInfo
.
:: (AppInfoClass info1, AppInfoClass info2) | |
=> info1 | |
-> info2 | |
-> Bool | returns |
Checks if two AppInfo
s are equal.
appInfoGetId :: AppInfoClass appinfo => 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.
:: AppInfoClass appinfo | |
=> appinfo | |
-> String | returns the name of the application for appinfo. |
Gets the installed name of the application.
:: 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.
:: AppInfoClass appinfo | |
=> appinfo | |
-> Maybe String | returns a string containing a description of the application appinfo, or |
Gets a human-readable description of an installed application.
:: AppInfoClass appinfo | |
=> appinfo | |
-> String | returns the executable of the application for appinfo. |
Gets the executable's name for the installed application.
:: AppInfoClass appinfo | |
=> appinfo | |
-> Maybe ByteString | returns a string containing the appinfo's commandline, or |
Gets the commandline with which the application will be started.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO (Maybe Icon) |
Gets the icon for the application.
:: AppInfoClass appinfo | |
=> appinfo | |
-> [File] |
|
-> Maybe AppLaunchContext |
|
-> 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.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
Checks if the application accepts files as arguments.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
Checks if the application accepts uris as arguments.
:: AppInfoClass appinfo | |
=> appinfo | |
-> [String] |
|
-> Maybe AppLaunchContext |
|
-> 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.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
Checks if the application info should be shown in menus that list available applications.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
Obtains the information whether the AppInfo
can be deleted. See appInfoDelete
.
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
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
.
appInfoResetTypeAssociationsSource
Removes all changes to the type associations done by appInfoSetAsDefaultForType
,
appInfoSetAsDefaultForExtension
or
appInfoRemoveSupportsType
.
appInfoSetAsDefaultForTypeSource
:: AppInfoClass appinfo | |
=> appinfo | |
-> String |
|
-> IO () |
Sets the application as the default handler for a given type.
Throws a GError
if an error occurs.
appInfoSetAsDefaultForExtensionSource
:: AppInfoClass appinfo | |
=> appinfo | |
-> String |
|
-> IO () |
Sets the application as the default handler for a given extension.
Throws a GError
if an error occurs.
:: AppInfoClass appinfo | |
=> appinfo | |
-> 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.
appInfoCanRemoveSupportsTypeSource
:: AppInfoClass appinfo | |
=> appinfo | |
-> IO Bool | returns |
Checks if a supported content type can be removed from an application.
appInfoRemoveSupportsTypeSource
:: AppInfoClass appinfo | |
=> appinfo | |
-> 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.
:: String |
|
-> IO [AppInfo] | returns list of |
Gets a list of all AppInfo
s for a given content type.
appInfoGetDefaultForTypeSource
:: String |
|
-> Bool |
|
-> IO (Maybe AppInfo) | returns list of |
Gets the AppInfo
that corresponds to a given content type.
appInfoLaunchDefaultForUriSource
:: String |
|
-> 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.
appLaunchContextGetDisplaySource
:: AppInfoClass appinfo | |
=> AppLaunchContext | |
-> appinfo | |
-> [File] |
|
-> 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.
appLaunchContextGetStartupNotifyIdSource
:: AppInfoClass appinfo | |
=> AppLaunchContext | |
-> appinfo | |
-> [File] |
|
-> IO (Maybe String) | returns a startup notification ID for the application, or |
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.
appLaunchContextLaunchFailedSource
:: AppLaunchContext | |
-> String |
|
-> IO () |
Called when an application has failed to launch, so that it can cancel the application startup
notification started in appLaunchContextGetStartupNotifyId
.
appLaunchContextNew :: IO AppLaunchContextSource
Creates a new application launch context. This is not normally used, instead you instantiate a
subclass of this, such as AppLaunchContext
.