Top | ![]() |
![]() |
![]() |
![]() |
void | changed | Action |
gboolean | create-gicon | Action |
gboolean | create-item | Action |
void | freeze | Action |
gboolean | ignore-accel | Action |
void | thaw | Action |
The EUIManager is a central point of managing headerbars, toolbars, menubars
and context menus in the application.
The EUIParser is used to read the .eui definition from an XML file or data.
Each item in the definition corresponds to an EUIAction, which should be added
with the e_ui_manager_add_actions()
or e_ui_manager_add_actions_enum()
before
the corresponding items are created with the e_ui_manager_create_item()
.
The e_ui_manager_set_action_groups_widget()
is used to assign a widget to
which the action groups should be inserted (for example a GtkWindow, but
can be other as well).
The GtkAccelGroup returned from the e_ui_manager_get_accel_group()
needs
to be added to the GtkWindow with gtk_window_add_accel_group()
.
The object is not thread-safe, it's meant to be used only from the main/GUI thread.
EUIManager *
e_ui_manager_new (gchar *customizer_filename
);
Creates a new EUIManager. Use g_object_unref()
to free it, when no longer needed.
The customizer_filename
, if not NULL
, is a full path to a file where
UI customization are stored. If not set, the UI manager will not allow
the customizations. The function assumes ownership of the string.
customizer_filename |
an optional EUICustomizer filename, or |
[nullable][transfer full] |
Since: 3.56
EUIParser *
e_ui_manager_get_parser (EUIManager *self
);
Gets an EUIParser associated with the self
. Any UI definitions
are loaded into it and the layouts are read from it.
Since: 3.56
EUICustomizer *
e_ui_manager_get_customizer (EUIManager *self
);
Gets an EUICustomizer for the self
.
Since: 3.56
GtkAccelGroup *
e_ui_manager_get_accel_group (EUIManager *self
);
Gets a GtkAccelGroup associated with the self
. Actions
with configured accelerators register themselves to this accel
group.
It should be added to a GtkWindow with gtk_window_add_accel_group()
.
Since: 3.56
void
e_ui_manager_freeze (EUIManager *self
);
Freezes change notifications on the self
. The function
can be called multiple times, only each call should be
followed by a corresponding e_ui_manager_thaw()
.
Since: 3.56
void
e_ui_manager_thaw (EUIManager *self
);
Reverts effect of one e_ui_manager_freeze()
call.
It's a programming error to call this function when
the self
is not frozen.
Since: 3.56
gboolean
e_ui_manager_is_frozen (EUIManager *self
);
Check whether the change notifications are frozen
with e_ui_manager_freeze()
call.
Since: 3.56
void
e_ui_manager_changed (EUIManager *self
);
Let the self
know that something changed, indicating
the UI parts should be regenerated. In case the self
is frozen, the regeneration is done once it's unfrozen.
Since: 3.56
void e_ui_manager_add_actions (EUIManager *self
,const gchar *group_name
,const gchar *translation_domain
,const EUIActionEntry *entries
,gint n_entries
,gpointer user_data
);
Just like g_action_map_add_action_entries()
, only uses EUIAction instead
of GSimpleAction actions and adds the actions into a named action group.
When there is no action group of the group_name
, a new is added.
The translation_domain
can be NULL, in which case the Evolution's translation
domain is used. It's used also when the translation_domain
is an empty string.
self |
an EUIManager |
|
group_name |
a name of an action group to add the actions to. |
[not nullable] |
translation_domain |
translation domain for the |
[nullable] |
entries |
action entries to be added, as EUIActionEntry array |
|
n_entries |
how many items |
|
user_data |
user data to pass to action callbacks |
Since: 3.56
void e_ui_manager_add_actions_enum (EUIManager *self
,const gchar *group_name
,const gchar *translation_domain
,const EUIActionEnumEntry *entries
,gint n_entries
,gpointer user_data
);
The same as e_ui_manager_add_actions()
, only creates radio actions, whose
states correspond to certain enum value. If bindings between the action's
state and a corresponding enum GObject property is needed, a utility function
e_ui_action_util_gvalue_to_enum_state()
and e_ui_action_util_enum_state_to_gvalue()
can be used to transform the value from the GObject to an action state or vice versa.
The translation_domain
can be NULL
, in which case the Evolution's translation
domain is used. It's used also when the translation_domain
is an empty string.
self |
an EUIManager |
|
group_name |
a name of an action group to add the actions to. |
[not nullable] |
translation_domain |
translation domain for the |
[nullable] |
entries |
action entries to be added, as EUIActionEnumEntry array |
|
n_entries |
how many items |
|
user_data |
user data to pass to action callbacks |
Since: 3.56
void e_ui_manager_add_action (EUIManager *self
,const gchar *group_name
,EUIAction *action
,EUIActionFunc activate
,EUIActionFunc change_state
,gpointer user_data
);
Adds a single action
to the group_name
. The actions group cannot contain
an action of the same name.
self |
an EUIManager |
|
group_name |
a name of an action group to add the action to. |
[not nullable] |
action |
the action to add. |
[transfer none] |
activate |
an optional callback to call on "activate" signal, or |
[nullable] |
change_state |
an optional callback to call on "change-state" signal, or |
[nullable] |
user_data |
user data to pass to action callbacks |
Since: 3.56
void e_ui_manager_add_actions_with_eui_data (EUIManager *self
,const gchar *group_name
,const gchar *translation_domain
,const EUIActionEntry *entries
,gint n_entries
,gpointer user_data
,const gchar *eui
);
Combines e_ui_manager_add_actions()
with e_ui_parser_merge_data()
, in this order,
printing any errors in the eui
into the terminal. This can be used to add built-in
UI definition with the related actions in a single call.
self |
an EUIManager |
|
group_name |
a name of an action group to add the actions to. |
[not nullable] |
translation_domain |
translation domain for the |
[nullable] |
entries |
action entries to be added, as EUIActionEntry array |
|
n_entries |
how many items |
|
user_data |
user data to pass to action callbacks |
|
eui |
Evolution UI definition |
Since: 3.56
void e_ui_manager_add_action_groups_to_widget (EUIManager *self
,GtkWidget *widget
);
Adds all currently known action groups into the widget
with
gtk_widget_insert_action_group()
. In contrast to e_ui_manager_set_action_groups_widget()
,
this does not add any later added action groups into the widget
.
In other words, this is a one-time operation only.
Since: 3.56
void e_ui_manager_set_action_groups_widget (EUIManager *self
,GtkWidget *widget
);
Sets the widget
to be the one where all action groups will
be inserted. When the self
creates a new action group, it
is automatically added into the widget
.
When the widget
is NULL
, any previous widget is unset.
Overwriting any existing widget
will remove the groups
from the previous widget first.
Since: 3.56
GtkWidget *
e_ui_manager_ref_action_groups_widget (EUIManager *self
);
References a GtkWidget, which is used to add action groups to.
The returned widget, if not NULL
, should be dereferenced
with g_object_unref()
, when no longer needed.
a referenced GtkWidget used
to add action groups to, or NULL
, when none is set.
[transfer full][nullable]
Since: 3.56
gboolean e_ui_manager_has_action_group (EUIManager *self
,const gchar *name
);
Check whether an action group named name
already exists in self
.
Since: 3.56
EUIActionGroup * e_ui_manager_get_action_group (EUIManager *self
,const gchar *name
);
Gets an EUIActionGroup named name
. If no such exists, a new is created.
Use e_ui_manager_has_action_group()
to check whether an action group exists.
Since: 3.56
void e_ui_manager_add_action_group (EUIManager *self
,EUIActionGroup *action_group
);
Adds an existing action group to the self
, being able to
call actions from it. The function does nothing when the action_group
is already part of the self
, nonetheless it's considered a programming
error to try to add a different group of the same name into the self
.
Since: 3.56
GPtrArray *
e_ui_manager_list_action_groups (EUIManager *self
);
Lists all action groups added into the self
.
Since: 3.56
EUIAction * e_ui_manager_get_action (EUIManager *self
,const gchar *name
);
Looks up an EUIAction by its name
among all known action maps and returns it.
Since: 3.56
GIcon * e_ui_manager_get_gicon (EUIManager *self
,const gchar *name
);
Retrieves a named GIcon. These are cached. The signal "create-gicon"
is used to create icons prefixed with "gicon::" in the .eui definitions,
as they are custom icons. The name
is without this prefix.
While returning NULL
is possible, it's considered an error and
a runtime warning is printed on the terminal, thus there should
always be a "create-gicon" signal handler providing the GIcon.
Since: 3.56
GObject * e_ui_manager_create_item (EUIManager *self
,const gchar *id
);
Creates a new item corresponding to the identifier id
. This
is supposed to be part of the self
's EUIParser on the toplevel,
thus either a menu, a headerbar or a toolbar. It's an error to ask
for an item which does not exist.
The returned GObject is an EUIMenu (a GMenuModel descendant) for the menu, an EHeaderBar for the headerbar and a GtkToolbar for the toolbar.
Since: 3.56
void e_ui_manager_fill_menu (EUIManager *self
,const gchar *id
,struct _EUIMenu *ui_menu
);
Fills the ui_menu
with the menu definition with ID id
.
This is meant to be used by EUIMenu itself during its rebuild.
Since: 3.56
void e_ui_manager_update_item_from_action (EUIManager *self
,gpointer item
,EUIAction *action
);
Updates properties of the item
with the values from the action
.
The function can handle only GMenuItem, GtkToolButton,
GtkButton and EHeaderBarButton descendants.
Passing other than supported types into the function is considered a programming error.
self |
an EUIManager |
|
item |
an item object, its type varies based on the place of use |
|
action |
an EUIAction to update the |
Since: 3.56
GObject * e_ui_manager_create_item_from_menu_model (EUIManager *self
,EUIElement *elem
,EUIAction *action
,EUIElementKind for_kind
,GMenuModel *menu_model
);
Creates a new UI item suitable for the for_kind
, containing the menu_model
.
For E_UI_ELEMENT_KIND_MENU
returns a submenu GMenuItem;
for E_UI_ELEMENT_KIND_TOOLBAR
returns a GtkMenuToolButton and
for E_UI_ELEMENT_KIND_HEADERBAR
returns an EHeaderBarButton.
This might be usually called from EUIManager 's "create-item" callback.
self |
an EUIManager |
|
elem |
corresponding EUIElement, or |
[nullable] |
action |
an EUIAction |
|
for_kind |
for which part of the UI the item should be created; it influences the type of the returned item |
|
menu_model |
a GMenuModel to use for the created item. |
[transfer none] |
Since: 3.56
void e_ui_manager_set_actions_usable_for_kinds (EUIManager *self
,guint32 kinds
,const gchar *first_action_name
,...
);
Sets "usable-for-kinds" kinds
to one or more actions identified by their name.
The kinds
can contain only E_UI_ELEMENT_KIND_HEADERBAR
,
E_UI_ELEMENT_KIND_TOOLBAR
and E_UI_ELEMENT_KIND_MENU
.
See e_ui_manager_set_entries_usable_for_kinds()
,
e_ui_manager_set_enum_entries_usable_for_kinds()
self |
an EUIManager |
|
kinds |
a bit-or of EUIElementKind to set |
|
first_action_name |
name of the first action |
|
... |
NULL-terminated list of additional action names. |
[null-terminated] |
Since: 3.56
void e_ui_manager_set_entries_usable_for_kinds (EUIManager *self
,guint32 kinds
,const EUIActionEntry *entries
,gint n_entries
);
Sets "usable-for-kinds" kinds
to all of the actions in the entries
.
The kinds
can contain only E_UI_ELEMENT_KIND_HEADERBAR
,
E_UI_ELEMENT_KIND_TOOLBAR
and E_UI_ELEMENT_KIND_MENU
.
See e_ui_manager_set_enum_entries_usable_for_kinds()
,
e_ui_manager_set_actions_usable_for_kinds()
self |
an EUIManager |
|
kinds |
a bit-or of EUIElementKind to set |
|
entries |
action entries to be added, as EUIActionEntry array |
|
n_entries |
how many items |
Since: 3.56
void e_ui_manager_set_enum_entries_usable_for_kinds (EUIManager *self
,guint32 kinds
,const EUIActionEnumEntry *entries
,gint n_entries
);
Sets "usable-for-kinds" kinds
to all of the actions in the entries
.
The kinds
can contain only E_UI_ELEMENT_KIND_HEADERBAR
,
E_UI_ELEMENT_KIND_TOOLBAR
and E_UI_ELEMENT_KIND_MENU
.
See e_ui_manager_set_entries_usable_for_kinds()
,
e_ui_manager_set_actions_usable_for_kinds()
self |
an EUIManager |
|
kinds |
a bit-or of EUIElementKind to set |
|
entries |
action entries to be added, as EUIActionEnumEntry array |
|
n_entries |
how many items |
Since: 3.56
guint
e_ui_manager_shortcut_def_hash (gconstpointer ptr
);
Returns a hash value of the EUIManagerShortcutDef.
Since: 3.56
gboolean e_ui_manager_shortcut_def_equal (gconstpointer ptr1
,gconstpointer ptr2
);
Returns whether the two EUIManagerShortcutDef equal.
Since: 3.56
“customizer-filename”
property “customizer-filename” char *
A file name, into which the customizations are saved and loaded from.
It can be NULL
, when the customizations are disabled.
Owner: EUIManager
Flags: Read / Write / Construct Only
Default value: NULL
Since: 3.56
“changed”
signalvoid user_function (EUIManager *manager, gpointer user_data)
A signal called when the manager
content changed. It's a signal to
regenerate the UI elements.
Flags: Action
Since: 3.56
“create-gicon”
signalgboolean user_function (EUIManager *manager, char *name, gpointer out_gicon, gpointer user_data)
The actions can have defined custom icons as "gicon::name", aka with a "gicon::" prefix, which are looked for by the name (without the special prefix) using this callback.
It's expected only one handler can create the GIcon, thus the first
which returns TRUE
will stop further signal emission.
manager |
an EUIManager |
|
name |
a custom icon name |
|
out_gicon |
an output location to store a created GIcon to. |
[out][transfer full] |
user_data |
user data set when the signal handler was connected. |
TRUE
when the item was created and set into the out_gicon
,
FALSE
when cannot create the item
Flags: Action
Since: 3.56
“create-item”
signalgboolean user_function (EUIManager *manager, gpointer elem, EUIAction *action, EUIElementKind for_kind, gpointer out_item, gpointer user_data)
Return TRUE
, when could create the item described by elem
with associated action
and
sets it into the out_item
. The for_kind
can only be E_UI_ELEMENT_KIND_HEADERBAR
,
E_UI_ELEMENT_KIND_TOOLBAR
or E_UI_ELEMENT_KIND_MENU
.
For the E_UI_ELEMENT_KIND_HEADERBAR
any widget can be returned, though the mostly
used might be an EHeaderBarButton.
For the E_UI_ELEMENT_KIND_TOOLBAR
only a GtkToolItem descendant is expected.
For the E_UI_ELEMENT_KIND_MENU
only a GMenuItem descendant is expected.
It's expected only one handler can create the item, thus the first
which returns TRUE
will stop further signal emission.
[skip]
manager |
an EUIManager |
|
elem |
an EUIElement to create the item for |
|
action |
an associated |
|
for_kind |
for which part of the UI the item should be created; it influences the type of the returned item |
|
out_item |
a location to set the created item to. |
[out][transfer full] |
user_data |
user data set when the signal handler was connected. |
TRUE
when the item was created and set into the out_item
,
FALSE
when cannot create the item
Flags: Action
Since: 3.56
“freeze”
signalvoid user_function (EUIManager *manager, gpointer user_data)
A signal called when the manager
has called e_ui_manager_freeze()
.
Flags: Action
Since: 3.56
“ignore-accel”
signalgboolean user_function (EUIManager *manager, EUIAction *action, gpointer user_data)
The signal allows to ignore accelerators to be activated.
Multiple signal handlers can be connected, the first which
returns TRUE
will stop the signal emission and the accelerator
will be ignored. When all handlers return FALSE
, the accelerator
will be used and the action
will be activated.
manager |
an EUIManager |
|
action |
an EUIAction whose accelerator is about to be activated |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.56
“thaw”
signalvoid user_function (EUIManager *manager, gboolean changed_while_frozen, gpointer user_data)
A signal called when the manager
has called e_ui_manager_thaw()
.
When the changed_while_frozen
is set to TRUE
, there will also
be called the “changed” signal once the manager
is completely unfrozen.
manager |
an EUIManager |
|
changed_while_frozen |
whether changed while had been frozen |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.56