gio/actionmap: Port docs to gi-docgen

This commit is contained in:
Georges Basile Stavracas Neto 2024-05-30 16:11:37 +02:00 committed by Philip Withnall
parent 3bd477b454
commit 110e76a140

View File

@ -37,7 +37,7 @@
* One useful application of this interface is to map the * One useful application of this interface is to map the
* names of actions from various action groups to unique, * names of actions from various action groups to unique,
* prefixed names (e.g. by prepending "app." or "win."). * prefixed names (e.g. by prepending "app." or "win.").
* This is the motivation for the 'Map' part of the interface * This is the motivation for the Map part of the interface
* name. * name.
* *
* Since: 2.32 * Since: 2.32
@ -45,11 +45,14 @@
/** /**
* GActionMapInterface: * GActionMapInterface:
* @lookup_action: the virtual function pointer for g_action_map_lookup_action() * @lookup_action: the virtual function pointer for
* @add_action: the virtual function pointer for g_action_map_add_action() * [method@Gio.ActionMap.lookup_action]
* @remove_action: the virtual function pointer for g_action_map_remove_action() * @add_action: the virtual function pointer for
* [method@Gio.ActionMap.add_action]
* @remove_action: the virtual function pointer for
* [method@Gio.ActionMap.remove_action]
* *
* The virtual function table for #GActionMap. * The virtual function table for [iface@Gio.ActionMap].
* *
* Since: 2.32 * Since: 2.32
**/ **/
@ -63,14 +66,14 @@ g_action_map_default_init (GActionMapInterface *iface)
/** /**
* g_action_map_lookup_action: * g_action_map_lookup_action:
* @action_map: a #GActionMap * @action_map: an action map
* @action_name: the name of an action * @action_name: the name of an action
* *
* Looks up the action with the name @action_name in @action_map. * Looks up the action with the name @action_name in @action_map.
* *
* If no such action exists, returns %NULL. * If no such action exists, returns `NULL`.
* *
* Returns: (nullable) (transfer none): a #GAction, or %NULL * Returns: (nullable) (transfer none): a [iface@Gio.Action]
* *
* Since: 2.32 * Since: 2.32
*/ */
@ -84,8 +87,8 @@ g_action_map_lookup_action (GActionMap *action_map,
/** /**
* g_action_map_add_action: * g_action_map_add_action:
* @action_map: a #GActionMap * @action_map: an action map
* @action: a #GAction * @action: a [iface@Gio.Action]
* *
* Adds an action to the @action_map. * Adds an action to the @action_map.
* *
@ -105,7 +108,7 @@ g_action_map_add_action (GActionMap *action_map,
/** /**
* g_action_map_remove_action: * g_action_map_remove_action:
* @action_map: a #GActionMap * @action_map: an action map
* @action_name: the name of the action * @action_name: the name of the action
* *
* Removes the named action from the action map. * Removes the named action from the action map.
@ -124,51 +127,49 @@ g_action_map_remove_action (GActionMap *action_map,
/** /**
* GActionEntry: * GActionEntry:
* @name: the name of the action * @name: the name of the action
* @activate: the callback to connect to the "activate" signal of the * @activate: the callback to connect to the "activate" signal of the action.
* action. Since GLib 2.40, this can be %NULL for stateful * Since GLib 2.40, this can be `NULL` for stateful actions, in which case
* actions, in which case the default handler is used. For * the default handler is used. For boolean-stated actions with no
* boolean-stated actions with no parameter, this is a * parameter, this is a toggle. For other state types (and parameter type
* toggle. For other state types (and parameter type equal * equal to the state type) this will be a function that just calls
* to the state type) this will be a function that * @change_state (which you should provide).
* just calls @change_state (which you should provide).
* @parameter_type: the type of the parameter that must be passed to the * @parameter_type: the type of the parameter that must be passed to the
* activate function for this action, given as a single * activate function for this action, given as a single GVariant type string
* GVariant type string (or %NULL for no parameter) * (or `NULL` for no parameter)
* @state: the initial state for this action, given in * @state: the initial state for this action, given in
* [GVariant text format](gvariant-text-format.html). The state is parsed * [GVariant text format](gvariant-text-format.html). The state is parsed
* with no extra type information, so type tags must be added to * with no extra type information, so type tags must be added to the string
* the string if they are necessary. Stateless actions should * if they are necessary. Stateless actions should give `NULL` here.
* give %NULL here. * @change_state: the callback to connect to the "change-state" signal of the
* @change_state: the callback to connect to the "change-state" signal * action. All stateful actions should provide a handler here; stateless
* of the action. All stateful actions should provide a * actions should not.
* handler here; stateless actions should not.
* *
* This struct defines a single action. It is for use with * This struct defines a single action. It is for use with
* g_action_map_add_action_entries(). * [method@Gio.ActionMap.add_action_entries].
* *
* The order of the items in the structure are intended to reflect * The order of the items in the structure are intended to reflect
* frequency of use. It is permissible to use an incomplete initialiser * frequency of use. It is permissible to use an incomplete initialiser
* in order to leave some of the later values as %NULL. All values * in order to leave some of the later values as `NULL`. All values
* after @name are optional. Additional optional fields may be added in * after @name are optional. Additional optional fields may be added in
* the future. * the future.
* *
* See g_action_map_add_action_entries() for an example. * See [method@Gio.ActionMap.add_action_entries] for an example.
**/ **/
/** /**
* g_action_map_add_action_entries: * g_action_map_add_action_entries:
* @action_map: a #GActionMap * @action_map: an action map
* @entries: (array length=n_entries) (element-type GActionEntry): a pointer to * @entries: (array length=n_entries) (element-type GActionEntry): a pointer to
* the first item in an array of #GActionEntry structs * the first item in an array of [struct@Gio.ActionEntry] structs
* @n_entries: the length of @entries, or -1 if @entries is %NULL-terminated * @n_entries: the length of @entries, or -1 if @entries is `NULL`-terminated
* @user_data: the user data for signal connections * @user_data: the user data for signal connections
* *
* A convenience function for creating multiple #GSimpleAction instances * A convenience function for creating multiple [class@Gio.SimpleAction]
* and adding them to a #GActionMap. * instances and adding them to a [iface@Gio.ActionMap].
* *
* Each action is constructed as per one #GActionEntry. * Each action is constructed as per one [struct@Gio.ActionEntry].
* *
* |[<!-- language="C" --> * ```c
* static void * static void
* activate_quit (GSimpleAction *simple, * activate_quit (GSimpleAction *simple,
* GVariant *parameter, * GVariant *parameter,
@ -199,7 +200,7 @@ g_action_map_remove_action (GActionMap *action_map,
* *
* return G_ACTION_GROUP (group); * return G_ACTION_GROUP (group);
* } * }
* ]| * ```
* *
* Since: 2.32 * Since: 2.32
*/ */
@ -278,16 +279,16 @@ g_action_map_add_action_entries (GActionMap *action_map,
/** /**
* g_action_map_remove_action_entries: * g_action_map_remove_action_entries:
* @action_map: The #GActionMap * @action_map: The [iface@Gio.ActionMap]
* @entries: (array length=n_entries) (element-type GActionEntry): a pointer to * @entries: (array length=n_entries) (element-type GActionEntry): a pointer to
* the first item in an array of #GActionEntry structs * the first item in an array of [struct@Gio.ActionEntry] structs
* @n_entries: the length of @entries, or -1 if @entries is %NULL-terminated * @n_entries: the length of @entries, or -1 if @entries is `NULL`-terminated
* *
* Remove actions from a #GActionMap. This is meant as the reverse of * Remove actions from a [iface@Gio.ActionMap]. This is meant as the reverse of
* g_action_map_add_action_entries(). * [method@Gio.ActionMap.add_action_entries].
* *
* *
* |[<!-- language="C" --> * ```c
* static const GActionEntry entries[] = { * static const GActionEntry entries[] = {
* { "quit", activate_quit }, * { "quit", activate_quit },
* { "print-string", activate_print_string, "s" } * { "print-string", activate_print_string, "s" }
@ -304,7 +305,7 @@ g_action_map_add_action_entries (GActionMap *action_map,
* { * {
* g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries)); * g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
* } * }
* ]| * ```
* *
* Since: 2.78 * Since: 2.78
*/ */