
Gnome::Gio::T-action
Class initialization
new
Initialization of a type class is simple and only needed when the standalone functions are used.
method new ( )
Standalone Functions
action-name-is-valid
Checks if $action-name
is valid. $action-name
is valid if it consists only of alphanumeric characters, plus '-' and '.'. The empty string is not a valid action name.
It is an error to call this function with a non-utf8 $action-name
. $action-name
must not be undefined.
method action-name-is-valid ( Str $action-name --> Bool )
$action-name; a potential action name.
Return value; True
if $action-name
is valid.
action-parse-detailed-name
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-undefined value is guaranteed to be returned in $action-name
(if a pointer is passed in). A undefined value may still be returned in $target-value
, as the $detailed-name
may not contain a target.
If returned, the Gnome::Glib::N-Variant in $target-value
is guaranteed to not be floating.
method action-parse-detailed-name ( Str $detailed-name, Array[Str] $action-name, N-Object $target-value, CArray[N-Error] $err --> Bool )
$detailed-name; a detailed action name.
$action-name; (transfer ownership: full) the action name.
$target-value; (transfer ownership: full) the target value, or undefined for no target
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if successful, else False
with $error
set.
action-print-detailed-name
Formats a detailed action name from $action-name
and $target-value
.
It is an error to call this function with an invalid action name.
This function is the opposite of .parse-detailed-name()
. It will produce a string that can be parsed back to the $action-name
and $target-value
by that function.
See that function for the types of strings that will be printed by this function.
method action-print-detailed-name ( Str $action-name, N-Object $target-value --> Str )
$action-name; a valid action name.
$target-value; a Gnome::Glib::N-Variant target value, or undefined
Return value; a detailed format string.