Function

GioActionparse_detailed_name

since: 2.38

Declaration

gboolean
g_action_parse_detailed_name (
  const gchar* detailed_name,
  gchar** action_name,
  GVariant** target_value,
  GError** error
)

Description

Parses a detailed action name into its separate name and target components.

Detailed action names can have three formats.

The first format is used to represent an action name with no target value and consists of just an action name containing no whitespace nor the characters :, ( or ). For example: app.action.

The second format is used to represent an action with a target value that is a non-empty string consisting only of alphanumerics, plus - and .. In that case, the action name and target value are separated by a double colon (::). For example: app.action::target.

The third format is used to represent an action with any type of target value, including strings. The target value follows the action name, surrounded in parens. For example: app.action(42). The target value is parsed using g_variant_parse(). If a tuple-typed value is desired, it must be specified in the same way, resulting in two sets of parens, for example: app.action((1,2,3)). A string target can be specified this way as well: app.action('target'). For strings, this third format must be used if target value is empty or contains characters other than alphanumerics, - and ..

If this function returns TRUE, a non-NULL value is guaranteed to be returned in action_name (if a pointer is passed in). A NULL value may still be returned in target_value, as the detailed_name may not contain a target.

If returned, the GVariant in target_value is guaranteed to not be floating.

Available since: 2.38

Parameters

detailed_name

Type: const gchar*

A detailed action name.

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

Type: gchar**

The action name.

The argument will be set by the function.
The argument can be NULL.
The called function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.
target_value

Type: GVariant

The target value, or NULL for no target.

The argument will be set by the function.
The argument can be set to NULL by the function.
The argument can be NULL.
The called function takes ownership of the data, and is responsible for freeing it.
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 if successful, else FALSE with error set.