CMenu.Tree

g CMenu.Tree CMenu.Tree GObject.Object GObject.Object GObject.Object->CMenu.Tree

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

item_ref (item)

class

item_unref (item)

class

new (menu_basename, flags)

class

new_for_path (menu_path, flags)

get_canonical_menu_path ()

get_directory_from_path (path)

get_entry_by_id (id)

get_root_directory ()

load_sync ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

flags

CMenu.TreeFlags

r/w/co

menu-basename

str

r/w/co

menu-path

str

r/w/co

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

Fields

Inherited:

GObject.Object (1)

Class Details

class CMenu.Tree(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

CMenu.TreeClass

classmethod item_ref(item)
Parameters:

item (object or None) – a #GMenuTreeItem

Returns:

The same item, or None if item is not a valid #GMenuTreeItem

Return type:

object or None

classmethod item_unref(item)
Parameters:

item (object or None) –

classmethod new(menu_basename, flags)
Parameters:
  • menu_basename (str) – Basename of menu file

  • flags (CMenu.TreeFlags) – Flags controlling menu content

Returns:

A new CMenu.Tree instance

Return type:

CMenu.Tree

classmethod new_for_path(menu_path, flags)
Parameters:
Return type:

CMenu.Tree

get_canonical_menu_path()
Returns:

The absolute and canonicalized path to the loaded menu file

Return type:

str

This function is only available if the tree has been loaded via CMenu.Tree.load_sync() or a variant thereof.

get_directory_from_path(path)
Parameters:

path (str) –

Return type:

CMenu.TreeDirectory

get_entry_by_id(id)
Parameters:

id (str) – a desktop file ID

Returns:

A newly referenced CMenu.TreeEntry, or None if none

Return type:

CMenu.TreeEntry

Look up the entry corresponding to the given “desktop file id”.

get_root_directory()
Returns:

Root of the tree

Return type:

CMenu.TreeDirectory

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

load_sync()
Raises:

GLib.Error

Returns:

True on success, False on error

Return type:

bool

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

Signal Details

CMenu.Tree.signals.changed(tree)
Signal Name:

changed

Flags:

RUN_LAST

Parameters:

tree (CMenu.Tree) – The object which received the signal

Property Details

CMenu.Tree.props.flags
Name:

flags

Type:

CMenu.TreeFlags

Default Value:

CMenu.TreeFlags.NONE

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Flags controlling the content of the menu.

CMenu.Tree.props.menu_basename
Name:

menu-basename

Type:

str

Default Value:

'applications.menu'

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

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.

CMenu.Tree.props.menu_path
Name:

menu-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

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