Top | ![]() |
![]() |
![]() |
![]() |
EUIParser parses UI definitions for menus, headerbar and toolbar from an XML data. It's associated with an EUIManager.
The object is not thread-safe, it's meant to be used only from the main/GUI thread.
EUIElement *
e_ui_element_copy (const EUIElement *src
);
Creates a copy of the src
. Free the returned pointer
with e_ui_element_free()
, when no longer needed.
The function does nothing when the src
is NULL.
This does not copy the src
children, it only copies the src
itself.
Since: 3.56
void
e_ui_element_free (EUIElement *self
);
Frees the self
. The function does nothing when the self
is NULL
.
Since: 3.56
EUIElement *
e_ui_element_new_separator (void
);
Creates a new EUIElement of kind E_UI_ELEMENT_KIND_SEPARATOR
.
Free it with e_ui_element_free()
, when no longer needed.
Since: 3.56
void e_ui_element_add_child (EUIElement *self
,EUIElement *child
);
Adds a new child
into the self
. The function assumes
ownership of the child
.
Since: 3.56
gboolean e_ui_element_remove_child (EUIElement *self
,EUIElement *child
);
Removes a direct child
from the children of the self
.
See e_ui_element_remove_child_by_id()
.
Since: 3.56
gboolean e_ui_element_remove_child_by_id (EUIElement *self
,const gchar *id
);
Removes a direct child of the self
with ID id
.
Since: 3.56
EUIElementKind
e_ui_element_get_kind (const EUIElement *self
);
Gets the kind of the self
.
Since: 3.56
const gchar *
e_ui_element_get_id (const EUIElement *self
);
Gets the identifier of the self
.
Since: 3.56
guint
e_ui_element_get_n_children (const EUIElement *self
);
Gets how many children the element has.
Since: 3.56
EUIElement * e_ui_element_get_child (EUIElement *self
,guint index
);
Gets a child at index
, which should be less
than e_ui_element_get_n_children()
.
a child element at index index
,
or NULL
, when index
is out of bounds.
[transfer none][nullable]
Since: 3.56
EUIElement * e_ui_element_get_child_by_id (EUIElement *self
,const gchar *id
);
Gets a child by its identifier. It searches the direct
children of the self
only.
Since: 3.56
gboolean
e_ui_element_menu_get_is_popup (const EUIElement *self
);
Gets a whether a menu is a popup (context) menu. Such menu hides actions
when they are insensitive. The default value is FALSE
.
This can be called only on elements of kind E_UI_ELEMENT_KIND_MENU
.
Since: 3.56
const gchar *
e_ui_element_submenu_get_action (const EUIElement *self
);
Gets a submenu action name.
This can be called only on elements of kind E_UI_ELEMENT_KIND_SUBMENU
.
Since: 3.56
gboolean
e_ui_element_headerbar_get_use_gtk_type
(const EUIElement *self
);
Gets whether a GtkHeaderBar should be created, instead of an EHeaderBar.
This can be called only on elements of kind E_UI_ELEMENT_KIND_HEADERBAR
.
Since: 3.56
gboolean
e_ui_element_toolbar_get_primary (const EUIElement *self
);
Gets whether the toolbar is a primary toolbar.
This can be called only on elements of kind E_UI_ELEMENT_KIND_TOOLBAR
.
Since: 3.56
guint
e_ui_element_item_get_label_priority (const EUIElement *self
);
Gets a label priority value for an item element. It is set only for headerbar items.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gint
e_ui_element_item_get_order (const EUIElement *self
);
Gets order of the button in the header bar. Items with lower number are added before items with higher number. The default value is zero, meaning use the order as added through the .eui file.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
void e_ui_element_item_set_order (EUIElement *self
,gint order
);
Sets an order of the button in the header bar. See e_ui_element_item_get_order()
for more information.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gboolean
e_ui_element_item_get_icon_only_is_set
(const EUIElement *self
);
Gets whether an item has set icon-only property. The default value is FALSE
.
It is set only for headerbar items. Use e_ui_element_item_get_icon_only()
to get the actual value.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gboolean
e_ui_element_item_get_icon_only (const EUIElement *self
);
Gets whether an item may show only icon. The default value is FALSE
.
It is set only for headerbar items. Use e_ui_element_item_get_icon_only_is_set()
to check whether the value had been set.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gboolean
e_ui_element_item_get_text_only_is_set
(const EUIElement *self
);
Gets whether an item has set text-only property. The default value is FALSE
.
Use e_ui_element_item_get_text_only()
to get the actual value.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gboolean
e_ui_element_item_get_text_only (const EUIElement *self
);
Gets whether an item may show only text. The default value is FALSE
.
Use e_ui_element_item_get_text_only_is_set()
to check whether the value had been set.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
gboolean
e_ui_element_item_get_important (const EUIElement *self
);
Gets whether an item is important. The default value is FALSE
.
It's used for items inside toolbars.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
const gchar *
e_ui_element_item_get_css_classes (const EUIElement *self
);
Gets a space-separated list of CSS classes to add on the item.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
a space-separated list of CSS classes to add on a GtkWidget,
or NULL
, when not set.
[nullable]
Since: 3.56
const gchar *
e_ui_element_item_get_action (const EUIElement *self
);
Gets a item action name.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
Since: 3.56
const gchar *
e_ui_element_item_get_group (const EUIElement *self
);
Gets a radio group name.
This can be called only on elements of kind E_UI_ELEMENT_KIND_ITEM
.
a radio group name of an item, or NULL
,
when the item is not part of any radio group.
[nullable]
Since: 3.56
EUIParser *
e_ui_parser_new (void
);
Creates a new EUIParser. Use g_object_unref()
to free it, when no longer needed.
Since: 3.56
gboolean e_ui_parser_merge_file (EUIParser *self
,const gchar *filename
,GError **error
);
Adds content of the filename
into the UI definition. Items with
the same identifier are reused, allowing to add new items into
existing hierarchy.
self |
an EUIParser |
|
filename |
a filename to merge |
|
error |
an output location to store a GError at, or |
Since: 3.56
gboolean e_ui_parser_merge_data (EUIParser *self
,const gchar *data
,gssize data_len
,GError **error
);
Adds content of the data
into the UI definition. Items with
the same identifier are reused, allowing to add new items into
existing hierarchy.
self |
an EUIParser |
|
data |
a data to merge |
|
data_len |
length of the |
|
error |
an output location to store a GError at, or |
Since: 3.56
void
e_ui_parser_clear (EUIParser *self
);
Removes all content of the self
.
Since: 3.56
EUIElement *
e_ui_parser_get_root (EUIParser *self
);
Gets the root element of the self
.
Since: 3.56
EUIElement *
e_ui_parser_create_root (EUIParser *self
);
Clears any current content of the self
and create a new root element,
which will be used by the self
.
Since: 3.56
GPtrArray * e_ui_parser_get_accels (EUIParser *self
,const gchar *action_name
);
Returns an array of the defined accelerators for the action_name
, to be used
instead of those defined in the code. An empty array means no accels to be used,
while a NULL
means no accels had been set for the action_name
.
The first item of the returned array is meant as the main accelerator, while the following are secondary accelerators.
a GPtrArray with
the accelerators for the action_name
, or NULL
.
[nullable][transfer none][element-type utf8]
Since: 3.56
void e_ui_parser_take_accels (EUIParser *self
,const gchar *action_name
,GPtrArray *accels
);
Sets the accels
as the accelerators for the action action_name
.
Use NULL
to unset any previous values.
The function assumes ownership of the accels
.
self |
an EUIParser |
|
action_name |
an action name |
|
accels |
accelerators to use, or |
[nullable][transfer full][element-type utf8] |
Since: 3.56
gchar * e_ui_parser_export (EUIParser *self
,EUIParserExportFlags flags
);
Exports the content of the self
in a format suitable for e_ui_parser_merge_file()
and e_ui_parser_merge_data()
.
Free the returned string with g_free()
, when no longer needed.
a string representation of the self
content,
or NULL
, when the self
is empty.
[transfer full][nullable]
Since: 3.56
“accels-changed”
signalvoid user_function (EUIParser *parser, char *action_name, GPtrArray *old_accels, GPtrArray *new_accels, gpointer user_data)
Emitted when the settings for the accels change. When the old_accels
is NULL
, the there had not been set any accels for the action_name
yet. When the new_accels
is NULL
, the accels for the action_name
had
been removed. For the NULL
the accels defined on the EUIAction should
be used.
parser |
an EUIParser |
|
action_name |
an action name |
|
old_accels |
accels used before the change, or |
[element-type utf8][nullable] |
new_accels |
accels used after the change, or |
[element-type utf8][nullable] |
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.56