gio.app_info
Module for [AppInfo] interface
Types 2
Information about an installed application and methods to launch it (with file arguments).
[gio.app_info.AppInfo] and [gio.app_launch_context.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 [gio.file.File.getPath]) when using [gio.app_info.AppInfo.launch] even if the application requested an URI and not a POSIX path. For example for a desktop-file based application with Exec key totem
U` and a single URI, sftp://foo/file.avi, then
/home/user/.gvfs/sftp 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 [gio.file.File] constructors (since GVfs
implements the GVfs extension point). As such, if the application
needs to examine the URI, it needs to use [gio.file.File.getUri]
or similar on [gio.file.File]. In other words, an application cannot
assume that the URI passed to e.g. [gio.file.File.newForCommandlineArg]
is equal to the result of [gio.file.File.getUri]. The following snippet
illustrates this:
CODEBLOCK0
This code will work when both cdda://sr0/Track 1.wav and
/home/user/.gvfs/cdda on sr0/Track 1.wav` is passed to the application. It should be noted that it's generally not safe for applications to rely on the format of a particular URIs. Different launcher applications (e.g. file managers) may have different ideas of what a given URI means.
gio.app_info.AppInfo createFromCommandline(string commandline, string applicationName, gio.types.AppInfoCreateFlags flags)Creates a new #GAppInfo from the given information.gio.app_info.AppInfo[] getAll()Gets a list of all of the applications currently registered on this system.gio.app_info.AppInfo[] getAllForType(string contentType)Gets a list of all #GAppInfos for a given content type, including the recommended and fallback #GAppInfos. See [gio.appinfo.AppInfo.getRecommendedForType] and [gio.appinfo.AppInfo.getFallbackForType].gio.app_info.AppInfo getDefaultForType(string contentType, bool mustSupportUris)Gets the default #GAppInfo for a given content type.void getDefaultForTypeAsync(string contentType, bool mustSupportUris, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Asynchronously gets the default #GAppInfo for a given content type.gio.app_info.AppInfo getDefaultForTypeFinish(gio.async_result.AsyncResult result)Finishes a default #GAppInfo lookup started by [gio.app_info.AppInfo.getDefaultForTypeAsync].gio.app_info.AppInfo getDefaultForUriScheme(string uriScheme)Gets the default application for handling URIs with the given URI scheme. A URI scheme is the initial part of the URI, up to but not including the ':', e.g. "http", "ftp" or "sip".void getDefaultForUriSchemeAsync(string uriScheme, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Asynchronously gets the default application for handling URIs with the given URI scheme. A URI scheme is the initial part of the URI, up to but not including the ':', e.g. "http", "ftp" or "sip".gio.app_info.AppInfo getDefaultForUriSchemeFinish(gio.async_result.AsyncResult result)Finishes a default #GAppInfo lookup started by [gio.app_info.AppInfo.getDefaultForUriSchemeAsync].gio.app_info.AppInfo[] getFallbackForType(string contentType)Gets a list of fallback #GAppInfos for a given content type, i.e. those applications which claim to support the given content type by MIME type subclassing and not directly.gio.app_info.AppInfo[] getRecommendedForType(string contentType)Gets a list of recommended #GAppInfos for a given content type, i.e. those applications which claim to support the given content type exactly, and not by MIME type subclassing. Note that the first ...bool launchDefaultForUri(string uri, gio.app_launch_context.AppLaunchContext context = null)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.void launchDefaultForUriAsync(string uri, gio.app_launch_context.AppLaunchContext context = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Async version of [gio.app_info.AppInfo.launchDefaultForUri].bool launchDefaultForUriFinish(gio.async_result.AsyncResult result)Finishes an asynchronous launch-default-for-uri operation.void resetTypeAssociations(string contentType)Removes all changes to the type associations done by [gio.appinfo.AppInfo.setAsDefaultForType], [gio.appinfo.AppInfo.setAsDefaultForExtension], [gio.appinfo.AppInfo.addSupportsType] or [gio.appinfo...bool addSupportsType(string contentType)Adds a content type to the application information to indicate the application is capable of opening files with the given content type.bool canDelete()Obtains the information whether the #GAppInfo can be deleted. See [gio.appinfo.AppInfo.delete]. Returns: true if appinfo can be deletedbool canRemoveSupportsType()Checks if a supported content type can be removed from an application. Returns: true if it is possible to remove supported content types from a given appinfo, false if not.bool delete_()Tries to delete a #GAppInfo.gio.app_info.AppInfo dup()Creates a duplicate of a #GAppInfo. Returns: a duplicate of appinfo.bool equal(gio.app_info.AppInfo appinfo2)Checks if two #GAppInfos are equal.string getCommandline()Gets the commandline with which the application will be started. Returns: a string containing the appinfo's commandline, or null if this information is not availablestring getDescription()Gets a human-readable description of an installed application. Returns: a string containing a description of the application appinfo, or null if none.string getDisplayName()Gets the display name of the application. The display name is often more descriptive to the user than the name itself. Returns: the display name of the application for appinfo, or the name if no di...string getExecutable()Gets the executable's name for the installed application.gio.icon.Icon getIcon()Gets the icon for the application. Returns: the default #GIcon for appinfo or null if there is no default icon.string getId()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 me...string getName()Gets the installed name of the application. Returns: the name of the application for appinfo.string[] getSupportedTypes()Retrieves the list of content types that appinfo claims to support. If this information is not provided by the environment, this function will return null. This function does not take in considerat...bool launch(gio.file.File[] files = null, gio.app_launch_context.AppLaunchContext context = null)Launches the application. Passes files to the launched application as arguments, using the optional context to get information about the details of the launcher (like what screen it is on). On erro...bool launchUris(string[] uris = null, gio.app_launch_context.AppLaunchContext context = null)Launches the application. This passes the uris to the launched application as arguments, using the optional context to get information about the details of the launcher (like what screen it is on)....void launchUrisAsync(string[] uris = null, gio.app_launch_context.AppLaunchContext context = null, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Async version of [gio.app_info.AppInfo.launchUris].bool launchUrisFinish(gio.async_result.AsyncResult result)Finishes a [gio.app_info.AppInfo.launchUrisAsync] operation.bool removeSupportsType(string contentType)Removes a supported type from an application, if possible.bool setAsDefaultForExtension(string extension)Sets the application as the default handler for the given file extension.bool setAsDefaultForType(string contentType)Sets the application as the default handler for a given type.bool setAsLastUsedForType(string contentType)Sets the application as the last used application for a given type. This will make the application appear as first in the list returned by [gio.app_info.AppInfo.getRecommendedForType], regardless o...bool shouldShow()Checks if the application info should be shown in menus that list available applications. Returns: true if the appinfo should be shown, false otherwise.bool supportsFiles()Checks if the application accepts files as arguments. Returns: true if the appinfo supports files.bool supportsUris()Checks if the application supports reading files and directories from URIs. Returns: true if the appinfo supports URIs.