AppInfo

interface AppInfo

Information about an installed application and methods to launch it (with file arguments).

GAppInfo and GAppLaunchContext 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 method@Gio.File.get_path) when using method@Gio.AppInfo.launch even if the application requested an URI and not a POSIX path. For example for a desktop-file based application with the following Exec key:

Exec=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 iface@Gio.File constructors (since GVfs implements the GVfs extension point). As such, if the application needs to examine the URI, it needs to use method@Gio.File.get_uri or similar on iface@Gio.File. In other words, an application cannot assume that the URI passed to e.g. func@Gio.File.new_for_commandline_arg is equal to the result of method@Gio.File.get_uri. The following snippet illustrates this:

GFile *f;
char *uri;

file = g_file_new_for_commandline_arg (uri_from_commandline);

uri = g_file_get_uri (file);
strcmp (uri, uri_from_commandline) == 0;
g_free (uri);

if (g_file_has_uri_scheme (file, "cdda"))
{
// do something special with uri
}
g_object_unref (file);

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.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val gioAppInfoPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun addSupportsType(contentType: String): <Error class: unknown class><Boolean>

Adds a content type to the application information to indicate the application is capable of opening files with the given content type.

Link copied to clipboard
open fun canDelete(): Boolean

Obtains the information whether the iface@Gio.AppInfo can be deleted. See method@Gio.AppInfo.delete.

Link copied to clipboard

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

Link copied to clipboard
open fun delete(): Boolean

Tries to delete a iface@Gio.AppInfo.

Link copied to clipboard
open fun dup(): AppInfo

Creates a duplicate of a iface@Gio.AppInfo.

Link copied to clipboard
open fun equal(appinfo2: AppInfo): Boolean

Checks if two iface@Gio.AppInfos are equal.

Link copied to clipboard
open fun getCommandline(): String?

Gets the commandline with which the application will be started.

Link copied to clipboard
open fun getDescription(): String?

Gets a human-readable description of an installed application.

Link copied to clipboard

Gets the display name of the application. The display name is often more descriptive to the user than the name itself.

Link copied to clipboard
open fun getExecutable(): String

Gets the executable’s name for the installed application.

Link copied to clipboard
open fun getIcon(): Icon?

Gets the icon for the application.

Link copied to clipboard
open fun getId(): 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.

Link copied to clipboard
open fun getName(): String

Gets the installed name of the application.

Link copied to clipboard

Retrieves the list of content types that @app_info claims to support. If this information is not provided by the environment, this function will return NULL.

Link copied to clipboard
open fun launch(files: <Error class: unknown class>? = null, context: AppLaunchContext? = null): <Error class: unknown class><Boolean>

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 error, @error will be set accordingly.

Link copied to clipboard
open fun launchUris(uris: <Error class: unknown class>? = null, context: AppLaunchContext? = null): <Error class: unknown class><Boolean>

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). On error, @error will be set accordingly. If the application only supports one URI per invocation as part of their command-line, multiple instances of the application will be spawned.

Link copied to clipboard
open fun launchUrisAsync(uris: <Error class: unknown class>? = null, context: AppLaunchContext? = null, cancellable: Cancellable? = null, callback: AsyncReadyCallback)

Async version of method@Gio.AppInfo.launch_uris.

Link copied to clipboard
open fun launchUrisFinish(result: AsyncResult): <Error class: unknown class><Boolean>

Finishes a method@Gio.AppInfo.launch_uris_async operation.

Link copied to clipboard
open fun removeSupportsType(contentType: String): <Error class: unknown class><Boolean>

Removes a supported type from an application, if possible.

Link copied to clipboard
open fun setAsDefaultForExtension(extension: String): <Error class: unknown class><Boolean>

Sets the application as the default handler for the given file extension.

Link copied to clipboard
open fun setAsDefaultForType(contentType: String): <Error class: unknown class><Boolean>

Sets the application as the default handler for a given type.

Link copied to clipboard
open fun setAsLastUsedForType(contentType: String): <Error class: unknown class><Boolean>

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 func@Gio.AppInfo.get_recommended_for_type, regardless of the default application for that content type.

Link copied to clipboard
open fun shouldShow(): Boolean

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

Link copied to clipboard

Checks if the application accepts files as arguments.

Link copied to clipboard
open fun supportsUris(): Boolean

Checks if the application supports reading files and directories from URIs.