Interface

Gio-2.0GioActionNamespace

interface ActionNamespace {
    $gtype: GType<Gio.Action>;
    prototype: Gio.Action;
    name_is_valid(action_name: string): boolean;
    parse_detailed_name(
        detailed_name: string,
    ): [boolean, string, GLib.Variant<any>];
    print_detailed_name(
        action_name: string,
        target_value?: GLib.Variant<any>,
    ): string;
}
Index

Properties

$gtype: GType<Gio.Action>
prototype: Gio.Action

Methods

  • 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-UTF-8 action_name. action_name must not be NULL.

    Parameters

    • action_name: string

      a potential action name

    Returns boolean

  • 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 GLib.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 GLib.Variant in target_value is guaranteed to not be floating.

    Parameters

    • detailed_name: string

      a detailed action name

    Returns [boolean, string, GLib.Variant<any>]

  • 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 Gio.Action.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.

    Parameters

    • action_name: string

      a valid action name

    • Optionaltarget_value: GLib.Variant<any>

      a GLib.Variant target value, or NULL

    Returns string