Virtual Method

GioAppInfolaunch

Declaration [src]

gboolean
launch (
  GAppInfo* appinfo,
  GList* files,
  GAppLaunchContext* context,
  GError** error
)

Description [src]

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.

To launch the application without arguments pass a NULL 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 GFile (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 g_app_info_launch_uris() instead.

The launched application inherits the environment of the launching process, but it can be modified with g_app_launch_context_setenv() and g_app_launch_context_unsetenv().

On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE environment variable with the path of the launched desktop file and GIO_LAUNCHED_DESKTOP_FILE_PID to the process id of the launched process. This can be used to ignore GIO_LAUNCHED_DESKTOP_FILE, should it be inherited by further processes. The DISPLAY, XDG_ACTIVATION_TOKEN and DESKTOP_STARTUP_ID environment variables are also set, based on information provided in context.

Parameters

files

Type: A list of None

A list of GFile objects.

The argument can be NULL.
The data is owned by the caller of the method.
context

Type: GAppLaunchContext

The launch context.

The argument can be NULL.
The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the virtual function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on successful launch, FALSE otherwise.