Amtk.ActionInfoStore

g Amtk.ActionInfoStore Amtk.ActionInfoStore GObject.Object GObject.Object GObject.Object->Amtk.ActionInfoStore

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add (info)

add_entries (entries, translation_domain)

check_all_used ()

lookup (action_name)

set_all_accels_to_app (application)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Amtk.ActionInfoStore(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Amtk.ActionInfoStoreClass

classmethod new()
Returns:

a new Amtk.ActionInfoStore.

Return type:

Amtk.ActionInfoStore

New in version 3.0.

add(info)
Parameters:

info (Amtk.ActionInfo) – an Amtk.ActionInfo.

Inserts info into self and into the Amtk.ActionInfoCentralStore. Both the self and central store must not already contain an Amtk.ActionInfo with the same action name. The stores take their own reference on info.

New in version 2.0.

add_entries(entries, translation_domain)
Parameters:

Calls Amtk.ActionInfoStore.add() for each entry.

If translation_domain is not None, GLib.dgettext() is used to translate the label and tooltip of each entry before setting them to the Amtk.ActionInfo.

An API similar to Gio.ActionMap.add_action_entries().

New in version 2.0.

check_all_used()

Checks for each Amtk.ActionInfo of self that it has been used (see Amtk.ActionInfo.has_been_used()). If an Amtk.ActionInfo has not been used, a warning is printed and might indicate dead code.

You probably want to call this function on the application store after creating the menu and toolbar. But it can also be useful for a store provided by a library, to easily see which actions are not used by the application.

New in version 2.0.

lookup(action_name)
Parameters:

action_name (str) – an action name.

Returns:

the found Amtk.ActionInfo, or None.

Return type:

Amtk.ActionInfo

New in version 2.0.

set_all_accels_to_app(application)
Parameters:

application (Gtk.Application) – a Gtk.Application.

Calls Gtk.Application.set_accels_for_action() for all Amtk.ActionInfo's part of self with the accelerators returned by Amtk.ActionInfo.get_accels(). This function does *not* call Amtk.ActionInfo.mark_as_used(), because if it did it would not be possible to detect dead code in self with Amtk.ActionInfoStore.check_all_used().

This function is not recommended if self is provided by a library, because a future version of the library may add accelerators that are not wanted in the application. So for a library store, you should let Amtk.Factory call Gtk.Application.set_accels_for_action().

This function can be convenient for an application store, in combination with Amtk.FactoryFlags.IGNORE_ACCELS_FOR_APP (and/or having a None Gtk.Application in Amtk.Factory). It has the advantage that Gtk.Application.set_accels_for_action() is called only once per action, not each time that a Gtk.ApplicationWindow is created.

This function can also be useful if – for some actions – the objects are not created directly with Amtk.Factory on application startup, but are created later, on demand. For example to create a Gtk.ShortcutsWindow with Amtk.Factory, containing information about actions that are not added to any menu or toolbar.

New in version 5.0.