Amtk.ActionInfoStore¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Amtk.ActionInfoStore(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
a new
Amtk.ActionInfoStore
.- Return type:
New in version 3.0.
- add(info)¶
- Parameters:
info (
Amtk.ActionInfo
) – anAmtk.ActionInfo
.
Inserts info into self and into the
Amtk.ActionInfoCentralStore
. Both the self and central store must not already contain anAmtk.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:
entries ([
Amtk.ActionInfoEntry
]) – a pointer to the first item in an array ofAmtk.ActionInfoEntry
structs.translation_domain (
str
orNone
) – a gettext domain, orNone
.
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 theAmtk.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 (seeAmtk.ActionInfo.has_been_used
()). If anAmtk.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
, orNone
.- Return type:
New in version 2.0.
- set_all_accels_to_app(application)¶
- Parameters:
application (
Gtk.Application
) – aGtk.Application
.
Calls
Gtk.Application.set_accels_for_action
() for allAmtk.ActionInfo
's part of self with the accelerators returned byAmtk.ActionInfo.get_accels
(). This function does *not* callAmtk.ActionInfo.mark_as_used
(), because if it did it would not be possible to detect dead code in self withAmtk.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
callGtk.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 aNone
Gtk.Application
inAmtk.Factory
). It has the advantage thatGtk.Application.set_accels_for_action
() is called only once per action, not each time that aGtk.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 aGtk.ShortcutsWindow
withAmtk.Factory
, containing information about actions that are not added to any menu or toolbar.New in version 5.0.