gio-0.13.1.1: Binding to GIO

Maintainergtk2hs-devel@lists.sourceforge.net
Stabilityalpha
Portabilityportable (depends on GHC)
Safe HaskellNone
LanguageHaskell98

System.GIO.File.AppInfo

Contents

Description

 

Synopsis

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

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 AppInfos 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 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 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 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 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 AppInfos 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 AppInfos for given contentType or empty on error.

Gets a list of all AppInfos 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 AppInfos 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 AppInfos 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.