Function

GioAppInfolaunch_default_for_uri

Declaration

gboolean
g_app_info_launch_default_for_uri (
  const char* uri,
  GAppLaunchContext* context,
  GError** error
)

Description

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.

The D-Bus–activated applications don’t have to be started if your application terminates too soon after this function. To prevent this, use g_app_info_launch_default_for_uri_async() instead.

Parameters

uri

Type: const char*

The uri to show.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
context

Type: GAppLaunchContext

An optional GAppLaunchContext.

The argument can be NULL.
The data is owned by the caller of the function.
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 left initialized to NULL by the 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 success, FALSE on error.