Garcon.Menu¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
Directory entry associated with this menu |
||
r/w/co |
file |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Fields¶
- Inherited:
Class Details¶
- class Garcon.Menu(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(file)¶
- Parameters:
file (
Gio.File) –Gio.Filefor the .menu file you want to load.- Returns:
a new
Garcon.Menu.- Return type:
Creates a new
Garcon.Menufor the .menu file referred to by file. This operation only fails if file is invalid. To load the menu tree from the file, you need to callGarcon.Menu.load() with the returnedGarcon.Menu.<informalexample><programlisting>
Garcon.Menu*menu =Garcon.Menu.new(filename);if (
Garcon.Menu.load(menu, &error)) … else …GObject.Object.unref(menu); </programlisting></informalexample>The caller is responsible to destroy the returned
Garcon.MenuusingGObject.Object.unref().For more information about the usage see
Garcon.Menu.new().
- classmethod new_applications()¶
- Returns:
a new
Garcon.Menufor applications.menu.- Return type:
Creates a new
Garcon.Menufor the applications.menu file which is being used to display installed applications.For more information about the usage see
Garcon.Menu.new().
- classmethod new_for_path(filename)¶
- Parameters:
filename (
str) – Path/URI of the .menu file you want to load.- Returns:
a new
Garcon.Menufor filename.- Return type:
Creates a new
Garcon.Menufor the .menu file referred to by filename. This operation only fails if the filename isNone. To load the menu tree from the file, you need to callGarcon.Menu.load() with the returnedGarcon.Menu.The caller is responsible to destroy the returned
Garcon.MenuusingGObject.Object.unref().
- add_menu(submenu)¶
- Parameters:
submenu (
Garcon.Menu) – aGarcon.Menu
Adds submenu as a sub menu to self.
- get_directory()¶
- Returns:
- Return type:
Returns the
Garcon.MenuDirectoryof self orNoneif self has no valid directory element.The menu directory may contain a lot of useful information about the menu like the display and icon name, desktop environments it should show up in etc.
- get_elements()¶
- Return type:
[
Garcon.MenuItem] orNone
Get all the menu element in self. This contains sub menus, menu items and separators.
Returns a list of
Garcon.MenuItemorNone. Free the list with g_list_free().
- get_file()¶
-
Get the file for self. It refers to the .menu file from which self was or will be loaded.
The returned object should be unreffed with
GObject.Object.unref() when no longer needed.
- get_item_pool()¶
- Returns:
- Return type:
Get the item pool of the menu. This pool contains all items in this menu (for that of its submenus).
- get_items()¶
- Returns:
list of
Garcon.MenuItemincluded in self.- Return type:
Returns all
Garcon.MenuItemincluded in self. The items are sorted by their display names in ascending order.The caller is responsible to free the returned list using g_list_free() when no longer needed.
- get_menu_with_name(name)¶
- Parameters:
name (
str) – a sub menu name- Returns:
a
Garcon.MenuorNone.- Return type:
Garcon.MenuorNone
Looks in self for a submenu with name as name.
- get_menus()¶
- Returns:
a sorted list of
Garcon.Menu.- Return type:
Returns a sorted list of
Garcon.Menusubmenus of self. The list should be freed with g_list_free().
- get_parent()¶
- Returns:
a
Garcon.MenuorNoneif self is the root menu.- Return type:
Garcon.MenuorNone
Returns the parent
Garcon.Menuor self.
- load(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable- Raises:
- Returns:
Trueif the menu was loaded successfully orFalseif there was an error or the process was cancelled.- Return type:
This function loads the entire menu tree from the file referred to by self. It resolves merges, moves and everything else defined in the menu specification. The resulting tree information is stored within self and can be accessed using the public
Garcon.MenuAPI afterwards.cancellable can be used to handle blocking I/O when reading data from files during the loading process.
error should either be
Noneor point to aGLib.Errorreturn location where errors should be stored in.
Signal Details¶
- Garcon.Menu.signals.directory_changed(menu, object, p0)¶
- Signal Name:
directory-changed- Flags:
- Parameters:
menu (
Garcon.Menu) – The object which received the signalobject (
Garcon.MenuDirectory) –p0 (
Garcon.MenuDirectory) –
- Garcon.Menu.signals.reload_required(menu)¶
- Signal Name:
reload-required- Flags:
- Parameters:
menu (
Garcon.Menu) – The object which received the signal
Property Details¶
- Garcon.Menu.props.directory¶
- Name:
directory- Type:
- Default Value:
- Flags:
The directory entry associated with this menu.
- Garcon.Menu.props.file¶
- Name:
file- Type:
- Default Value:
- Flags:
The
Gio.Filefrom which theGarcon.Menuwas loaded.