## e-ui-menu

e-ui-menu — a UI menu

## Functions

EUIMenu * | e_ui_menu_new ()
EUIManager * | e_ui_menu_get_manager ()
const gchar * | e_ui_menu_get_id ()
void | e_ui_menu_append_item ()
void | e_ui_menu_append_section ()
void | e_ui_menu_track_action ()
void | e_ui_menu_freeze ()
void | e_ui_menu_thaw ()
gboolean | e_ui_menu_is_frozen ()
void | e_ui_menu_rebuild ()
void | e_ui_menu_remove_all ()

## Properties

char * | id | Read / Write / Construct Only
EUIManager * | manager | Read / Write / Construct Only

## Types and Values

#define | E_TYPE_UI_MENU
| EUIMenu

## Object Hierarchy

        GObject
        ╰── GMenuModel
            ╰── EUIMenu

## Includes

    #include <e-util/e-util.h>

## Description

EUIMenu is a GMenuModel descendant, which takes care of an EUIAction visibility and regenerates its content when any of the actions hides/shows itself or when the associated EUIManager changes.

The object is not thread-safe, it's meant to be used only from the main/GUI thread.

## Functions

### e_ui_menu_new ()

    EUIMenu *
    e_ui_menu_new (EUIManager *manager,
                   const gchar *id);

Creates a new EUIMenu, which will use the `manager` to get its content from under identifier `id` .

#### Parameters

manager | an *EUIManager |
id | a menu identifier to use the created EUIMenu with |

#### Returns

a new EUIMenu.

[transfer full]

Since: 3.56

### e_ui_menu_get_manager ()

    EUIManager *
    e_ui_menu_get_manager (EUIMenu *self);

Gets an associated EUIManager.

#### Parameters

self | an EUIMenu |

#### Returns

an associated EUIManager.

[transfer none]

Since: 3.56

### e_ui_menu_get_id ()

    const gchar *
    e_ui_menu_get_id (EUIMenu *self);

Gets an identifier of the menu to populate the `self` with.

#### Parameters

self | an EUIMenu |

#### Returns

a menu identifier

Since: 3.56

### e_ui_menu_append_item ()

    void
    e_ui_menu_append_item (EUIMenu *self,
                           EUIAction *action,
                           GMenuItem *item);

Appends a GMenuItem descendant `item` into the menu, which can be related to the `action` . When the `action` is not `NULL`, its state is tracked and the menu is regenerated whenever the state changed (and when needed).

#### Parameters

self | an EUIMenu |
action | an EUIAction, or `NULL`. | [nullable]
item | a GMenuItem to append |

Since: 3.56

### e_ui_menu_append_section ()

    void
    e_ui_menu_append_section (EUIMenu *self,
                              GMenuModel *section);

Appends a GMenuModel as a new section in the `self` .

#### Parameters

self | an EUIMenu |
section | a GMenuModel |

Since: 3.56

### e_ui_menu_track_action ()

    void
    e_ui_menu_track_action (EUIMenu *self,
                            EUIAction *action);

Tracks a state change of the `action` and regenerates the menu content when needed.

#### Parameters

self | an EUIMenu |
action | an EUIAction. | [not nullable]

Since: 3.56

### e_ui_menu_freeze ()

    void
    e_ui_menu_freeze (EUIMenu *self);

Freezes rebuild of the menu content. Useful when filling the content. The function can be called multiple times, only each call needs a pair call of the `e_ui_menu_thaw()` to revert the effect of this function.

#### Parameters

self | an EUIMenu |

Since: 3.56

### e_ui_menu_thaw ()

    void
    e_ui_menu_thaw (EUIMenu *self);

Pair function for the `e_ui_menu_freeze()`. It's a programming error to thaw a menu, which is not frozen.

#### Parameters

self | an EUIMenu |

Since: 3.56

### e_ui_menu_is_frozen ()

    gboolean
    e_ui_menu_is_frozen (EUIMenu *self);

Gets whether the `self` is frozen for rebuild. It can be frozen with the `e_ui_menu_freeze()` and unfrozen with the `e_ui_menu_thaw()`.

#### Parameters

self | an EUIMenu |

#### Returns

whether rebuild of the `self` is frozen

Since: 3.56

### e_ui_menu_rebuild ()

    void
    e_ui_menu_rebuild (EUIMenu *self);

Rebuilds the `self` content. If the rebuild is frozen (see `e_ui_menu_freeze()`), the rebuild is postponed until the rebuild is allowed again.

#### Parameters

self | an EUIMenu |

Since: 3.56

### e_ui_menu_remove_all ()

    void
    e_ui_menu_remove_all (EUIMenu *self);

Cleans up content of the `self` , including tracked actions and all the menu items.

#### Parameters

self | an EUIMenu |

Since: 3.56

## Types and Values

### E_TYPE_UI_MENU

    #define E_TYPE_UI_MENU e_ui_menu_get_type ()

### EUIMenu

    typedef struct _EUIMenu EUIMenu;

## Property Details

### The `“id”` property

      “id”                       char *

Identifier of the menu to be read from the EUIManager.

Owner: EUIMenu

Flags: Read / Write / Construct Only

Default value: NULL

Since: 3.56

### The `“manager”` property

      “manager”                  EUIManager *

An EUIManager associated with the menu.

Owner: EUIMenu

Flags: Read / Write / Construct Only

Since: 3.56