## GMenuTree

GMenuTree

## Functions

GMenuTree * | gmenu_tree_new ()
GMenuTree * | gmenu_tree_new_for_path ()
gboolean | gmenu_tree_load_sync ()
const char * | gmenu_tree_get_canonical_menu_path ()
GMenuTreeDirectory * | gmenu_tree_get_root_directory ()
GMenuTreeDirectory * | gmenu_tree_get_directory_from_path ()
GMenuTreeEntry * | gmenu_tree_get_entry_by_id ()
gpointer | gmenu_tree_item_ref ()
void | gmenu_tree_item_unref ()
GMenuTreeDirectory * | gmenu_tree_directory_get_parent ()
const char * | gmenu_tree_directory_get_name ()
const char * | gmenu_tree_directory_get_generic_name ()
const char * | gmenu_tree_directory_get_comment ()
GIcon * | gmenu_tree_directory_get_icon ()
const char * | gmenu_tree_directory_get_desktop_file_path ()
const char * | gmenu_tree_directory_get_menu_id ()
GMenuTree * | gmenu_tree_directory_get_tree ()
gboolean | gmenu_tree_directory_get_is_nodisplay ()
GMenuTreeIter * | gmenu_tree_directory_iter ()
GMenuTreeIter * | gmenu_tree_iter_ref ()
void | gmenu_tree_iter_unref ()
GMenuTreeItemType | gmenu_tree_iter_next ()
GMenuTreeDirectory * | gmenu_tree_iter_get_directory ()
GMenuTreeEntry * | gmenu_tree_iter_get_entry ()
GMenuTreeHeader * | gmenu_tree_iter_get_header ()
GMenuTreeAlias * | gmenu_tree_iter_get_alias ()
GMenuTreeSeparator * | gmenu_tree_iter_get_separator ()
char * | gmenu_tree_directory_make_path ()
GMenuDesktopAppInfo * | gmenu_tree_entry_get_app_info ()
GMenuTreeDirectory * | gmenu_tree_entry_get_parent ()
GMenuTree * | gmenu_tree_entry_get_tree ()
const char * | gmenu_tree_entry_get_desktop_file_path ()
const char * | gmenu_tree_entry_get_desktop_file_id ()
gboolean | gmenu_tree_entry_get_is_nodisplay_recurse ()
gboolean | gmenu_tree_entry_get_is_excluded ()
gboolean | gmenu_tree_entry_get_is_unallocated ()
gboolean | gmenu_tree_entry_get_is_flatpak ()
GMenuTreeDirectory * | gmenu_tree_header_get_directory ()
GMenuTree * | gmenu_tree_header_get_tree ()
GMenuTreeDirectory * | gmenu_tree_header_get_parent ()
GMenuTreeDirectory * | gmenu_tree_alias_get_directory ()
GMenuTreeItemType | gmenu_tree_alias_get_aliased_item_type ()
GMenuTreeDirectory * | gmenu_tree_alias_get_aliased_directory ()
GMenuTreeEntry * | gmenu_tree_alias_get_aliased_entry ()
GMenuTree * | gmenu_tree_alias_get_tree ()
GMenuTreeDirectory * | gmenu_tree_alias_get_parent ()
GMenuTree * | gmenu_tree_separator_get_tree ()
GMenuTreeDirectory * | gmenu_tree_separator_get_parent ()

## Properties

GMenuTreeFlags | flags | Read / Write / Construct Only
char * | menu-basename | Read / Write / Construct Only
char * | menu-path | Read / Write / Construct Only

## Signals

void | changed | Run Last

## Types and Values

enum | GMenuTreeItemType

## Object Hierarchy

        GBoxed
        ├── GMenuTreeAlias
        ├── GMenuTreeDirectory
        ├── GMenuTreeEntry
        ├── GMenuTreeHeader
        ├── GMenuTreeIter
        ╰── GMenuTreeSeparator
        GFlags
        ╰── GMenuTreeFlags
        GObject
        ╰── GMenuTree

## Description

## Functions

### gmenu_tree_new ()

    GMenuTree *
    gmenu_tree_new (const char *menu_basename,
                    GMenuTreeFlags flags);

#### Parameters

menu_basename | Basename of menu file |
flags | Flags controlling menu content |

#### Returns

A new GMenuTree instance.

[transfer full]

### gmenu_tree_new_for_path ()

    GMenuTree *
    gmenu_tree_new_for_path (const char *menu_path,
                             GMenuTreeFlags flags);

### gmenu_tree_load_sync ()

    gboolean
    gmenu_tree_load_sync (GMenuTree *tree,
                          GError **error);

Synchronously load the menu contents. This function performs a significant amount of blocking I/O if the tree has not been loaded yet.

#### Parameters

tree | a GMenuTree |
error | a GError |

#### Returns

`TRUE` on success, `FALSE` on error

### gmenu_tree_get_canonical_menu_path ()

    const char *
    gmenu_tree_get_canonical_menu_path (GMenuTree *tree);

This function is only available if the tree has been loaded via `gmenu_tree_load_sync()` or a variant thereof.

#### Parameters

tree | a GMenuTree |

#### Returns

The absolute and canonicalized path to the loaded menu file

### gmenu_tree_get_root_directory ()

    GMenuTreeDirectory *
    gmenu_tree_get_root_directory (GMenuTree *tree);

Get the root directory; you must have loaded the tree first (at least once) via `gmenu_tree_load_sync()` or a variant thereof.

#### Parameters

tree | a GMenuTree |

#### Returns

Root of the tree.

[transfer full]

### gmenu_tree_get_directory_from_path ()

    GMenuTreeDirectory *
    gmenu_tree_get_directory_from_path (GMenuTree *tree,
                                        const char *path);

### gmenu_tree_get_entry_by_id ()

    GMenuTreeEntry *
    gmenu_tree_get_entry_by_id (GMenuTree *tree,
                                const char *id);

Look up the entry corresponding to the given "desktop file id".

#### Parameters

tree | a GMenuTree |
id | a desktop file ID |

#### Returns

A newly referenced GMenuTreeEntry, or `NULL` if none.

[transfer full]

### gmenu_tree_item_ref ()

    gpointer
    gmenu_tree_item_ref (gpointer item);

#### Parameters

item | a GMenuTreeItem |

#### Returns

The same `item` , or `NULL` if `item` is not a valid GMenuTreeItem.

[transfer full]

### gmenu_tree_item_unref ()

    void
    gmenu_tree_item_unref (gpointer item);

### gmenu_tree_directory_get_parent ()

    GMenuTreeDirectory *
    gmenu_tree_directory_get_parent (GMenuTreeDirectory *directory);

#### Parameters

directory | a GMenuTreeDirectory |

#### Returns

The parent directory, or `NULL` if none.

[transfer full]

### gmenu_tree_directory_get_name ()

    const char *
    gmenu_tree_directory_get_name (GMenuTreeDirectory *directory);

### gmenu_tree_directory_get_generic_name ()

    const char *
    gmenu_tree_directory_get_generic_name (GMenuTreeDirectory *directory);

### gmenu_tree_directory_get_comment ()

    const char *
    gmenu_tree_directory_get_comment (GMenuTreeDirectory *directory);

### gmenu_tree_directory_get_icon ()

    GIcon *
    gmenu_tree_directory_get_icon (GMenuTreeDirectory *directory);

Gets the icon for the directory.

#### Parameters

directory | a GMenuTreeDirectory |

#### Returns

The GIcon for this directory.

[transfer none]

### gmenu_tree_directory_get_desktop_file_path ()

    const char *
    gmenu_tree_directory_get_desktop_file_path
                                   (GMenuTreeDirectory *directory);

### gmenu_tree_directory_get_menu_id ()

    const char *
    gmenu_tree_directory_get_menu_id (GMenuTreeDirectory *directory);

### gmenu_tree_directory_get_tree ()

    GMenuTree *
    gmenu_tree_directory_get_tree (GMenuTreeDirectory *directory);

Grab the tree associated with a GMenuTreeItem.

#### Parameters

directory | A GMenuTreeDirectory |

#### Returns

The GMenuTree.

[transfer full]

### gmenu_tree_directory_get_is_nodisplay ()

    gboolean
    gmenu_tree_directory_get_is_nodisplay (GMenuTreeDirectory *directory);

### gmenu_tree_directory_iter ()

    GMenuTreeIter *
    gmenu_tree_directory_iter (GMenuTreeDirectory *directory);

#### Parameters

directory | directory |

#### Returns

A new iterator over the directory contents.

[transfer full]

### gmenu_tree_iter_ref ()

    GMenuTreeIter *
    gmenu_tree_iter_ref (GMenuTreeIter *iter);

Increment the reference count of `iter`

[skip]

#### Parameters

iter | iter |

### gmenu_tree_iter_unref ()

    void
    gmenu_tree_iter_unref (GMenuTreeIter *iter);

Decrement the reference count of `iter`

[skip]

#### Parameters

iter | iter |

### gmenu_tree_iter_next ()

    GMenuTreeItemType
    gmenu_tree_iter_next (GMenuTreeIter *iter);

Change the iterator to the next item, and return its type. If there are no more items, `GMENU_TREE_ITEM_INVALID` is returned.

#### Parameters

iter | iter |

#### Returns

The type of the next item that can be retrived from the iterator

### gmenu_tree_iter_get_directory ()

    GMenuTreeDirectory *
    gmenu_tree_iter_get_directory (GMenuTreeIter *iter);

This method may only be called if `gmenu_tree_iter_next()` returned GMENU_TREE_ITEM_DIRECTORY.

#### Parameters

iter | iter |

#### Returns

A directory.

[transfer full]

### gmenu_tree_iter_get_entry ()

    GMenuTreeEntry *
    gmenu_tree_iter_get_entry (GMenuTreeIter *iter);

This method may only be called if `gmenu_tree_iter_next()` returned GMENU_TREE_ITEM_ENTRY.

#### Parameters

iter | iter |

#### Returns

An entry.

[transfer full]

### gmenu_tree_iter_get_header ()

    GMenuTreeHeader *
    gmenu_tree_iter_get_header (GMenuTreeIter *iter);

This method may only be called if `gmenu_tree_iter_next()` returned GMENU_TREE_ITEM_HEADER.

#### Parameters

iter | iter |

#### Returns

A header.

[transfer full]

### gmenu_tree_iter_get_alias ()

    GMenuTreeAlias *
    gmenu_tree_iter_get_alias (GMenuTreeIter *iter);

This method may only be called if `gmenu_tree_iter_next()` returned GMENU_TREE_ITEM_ALIAS.

#### Parameters

iter | iter |

#### Returns

An alias.

[transfer full]

### gmenu_tree_iter_get_separator ()

    GMenuTreeSeparator *
    gmenu_tree_iter_get_separator (GMenuTreeIter *iter);

This method may only be called if `gmenu_tree_iter_next()` returned GMENU_TREE_ITEM_SEPARATOR.

#### Parameters

iter | iter |

#### Returns

A separator.

[transfer full]

### gmenu_tree_directory_make_path ()

    char *
    gmenu_tree_directory_make_path (GMenuTreeDirectory *directory,
                                    GMenuTreeEntry *entry);

### gmenu_tree_entry_get_app_info ()

    GMenuDesktopAppInfo *
    gmenu_tree_entry_get_app_info (GMenuTreeEntry *entry);

#### Parameters

entry | a GMenuTreeEntry |

#### Returns

The GMenuDesktopAppInfo for this entry.

[transfer none]

### gmenu_tree_entry_get_parent ()

    GMenuTreeDirectory *
    gmenu_tree_entry_get_parent (GMenuTreeEntry *entry);

#### Parameters

entry | a GMenuTreeEntry |

#### Returns

The parent directory, or `NULL` if none.

[transfer full]

### gmenu_tree_entry_get_tree ()

    GMenuTree *
    gmenu_tree_entry_get_tree (GMenuTreeEntry *entry);

Grab the tree associated with a GMenuTreeEntry.

#### Parameters

entry | A GMenuTreeEntry |

#### Returns

The GMenuTree.

[transfer full]

### gmenu_tree_entry_get_desktop_file_path ()

    const char *
    gmenu_tree_entry_get_desktop_file_path
                                   (GMenuTreeEntry *entry);

### gmenu_tree_entry_get_desktop_file_id ()

    const char *
    gmenu_tree_entry_get_desktop_file_id (GMenuTreeEntry *entry);

### gmenu_tree_entry_get_is_nodisplay_recurse ()

    gboolean
    gmenu_tree_entry_get_is_nodisplay_recurse
                                   (GMenuTreeEntry *entry);

### gmenu_tree_entry_get_is_excluded ()

    gboolean
    gmenu_tree_entry_get_is_excluded (GMenuTreeEntry *entry);

### gmenu_tree_entry_get_is_unallocated ()

    gboolean
    gmenu_tree_entry_get_is_unallocated (GMenuTreeEntry *entry);

### gmenu_tree_entry_get_is_flatpak ()

    gboolean
    gmenu_tree_entry_get_is_flatpak (GMenuTreeEntry *entry);

### gmenu_tree_header_get_directory ()

    GMenuTreeDirectory *
    gmenu_tree_header_get_directory (GMenuTreeHeader *header);

### gmenu_tree_header_get_tree ()

    GMenuTree *
    gmenu_tree_header_get_tree (GMenuTreeHeader *header);

Grab the tree associated with a GMenuTreeHeader.

#### Parameters

header | A GMenuTreeHeader |

#### Returns

The GMenuTree.

[transfer full]

### gmenu_tree_header_get_parent ()

    GMenuTreeDirectory *
    gmenu_tree_header_get_parent (GMenuTreeHeader *header);

#### Parameters

header | a GMenuTreeHeader |

#### Returns

The parent directory, or `NULL` if none.

[transfer full]

### gmenu_tree_alias_get_directory ()

    GMenuTreeDirectory *
    gmenu_tree_alias_get_directory (GMenuTreeAlias *alias);

### gmenu_tree_alias_get_aliased_item_type ()

    GMenuTreeItemType
    gmenu_tree_alias_get_aliased_item_type
                                   (GMenuTreeAlias *alias);

### gmenu_tree_alias_get_aliased_directory ()

    GMenuTreeDirectory *
    gmenu_tree_alias_get_aliased_directory
                                   (GMenuTreeAlias *alias);

#### Parameters

alias | alias |

#### Returns

The aliased directory entry.

[transfer full]

### gmenu_tree_alias_get_aliased_entry ()

    GMenuTreeEntry *
    gmenu_tree_alias_get_aliased_entry (GMenuTreeAlias *alias);

#### Parameters

alias | alias |

#### Returns

The aliased entry.

[transfer full]

### gmenu_tree_alias_get_tree ()

    GMenuTree *
    gmenu_tree_alias_get_tree (GMenuTreeAlias *alias);

Grab the tree associated with a GMenuTreeAlias.

#### Parameters

alias | A GMenuTreeAlias |

#### Returns

The GMenuTree.

[transfer full]

### gmenu_tree_alias_get_parent ()

    GMenuTreeDirectory *
    gmenu_tree_alias_get_parent (GMenuTreeAlias *alias);

#### Parameters

alias | a GMenuTreeAlias |

#### Returns

The parent directory, or `NULL` if none.

[transfer full]

### gmenu_tree_separator_get_tree ()

    GMenuTree *
    gmenu_tree_separator_get_tree (GMenuTreeSeparator *separator);

Grab the tree associated with a GMenuTreeSeparator.

#### Parameters

separator | A GMenuTreeSeparator |

#### Returns

The GMenuTree.

[transfer full]

### gmenu_tree_separator_get_parent ()

    GMenuTreeDirectory *
    gmenu_tree_separator_get_parent (GMenuTreeSeparator *separator);

#### Parameters

separator | a GMenuTreeSeparator |

#### Returns

The parent directory, or `NULL` if none.

[transfer full]

## Types and Values

### enum GMenuTreeItemType

#### Members

GMENU_TREE_ITEM_INVALID |  |
GMENU_TREE_ITEM_DIRECTORY |  |
GMENU_TREE_ITEM_ENTRY |  |
GMENU_TREE_ITEM_SEPARATOR |  |
GMENU_TREE_ITEM_HEADER |  |
GMENU_TREE_ITEM_ALIAS |  |

## Property Details

### The `“flags”` property

      “flags”                    GMenuTreeFlags

Flags controlling the content of the menu.

Owner: GMenuTree

Flags: Read / Write / Construct Only

### The `“menu-basename”` property

      “menu-basename”            char *

The name of the menu file; must be a basename or a relative path. The file will be looked up in $XDG_CONFIG_DIRS/menus/. See the Desktop Menu specification.

Owner: GMenuTree

Flags: Read / Write / Construct Only

Default value: "applications.menu"

### The `“menu-path”` property

      “menu-path”                char *

The full path of the menu file. If set, GMenuTree:menu-basename will get ignored.

Owner: GMenuTree

Flags: Read / Write / Construct Only

Default value: NULL

## Signal Details

### The `“changed”` signal

    void
    user_function (GMenuTree *gmenutree,
                   gpointer   user_data)

Flags: Run Last