Top | ![]() |
![]() |
![]() |
![]() |
GarconMenu *
garcon_menu_new (GFile *file
);
Creates a new GarconMenu for the .menu file referred to by file
.
This operation only fails file
is invalid. To load the menu
tree from the file, you need to call garcon_menu_load()
with the
returned GarconMenu.
The caller is responsible to destroy the returned GarconMenu
using g_object_unref()
.
For more information about the usage see
garcon_menu_new()
.
GarconMenu *
garcon_menu_new_for_path (const gchar *filename
);
Creates a new GarconMenu for the .menu file referred to by filename
.
This operation only fails if the filename is NULL. To load the menu
tree from the file, you need to call garcon_menu_load()
with the
returned GarconMenu.
1 2 3 4 5 6 7 8 |
GarconMenu *menu = garcon_menu_new (filename); if (garcon_menu_load (menu, &error)) ... else ... g_object_unref (menu); |
The caller is responsible to destroy the returned GarconMenu
using g_object_unref()
.
GarconMenu *
garcon_menu_new_applications (void
);
Creates a new GarconMenu for the applications.menu file which is being used to display installed applications.
For more information about the usage see
garcon_menu_new()
.
gboolean garcon_menu_load (GarconMenu *menu
,GCancellable *cancellable
,GError **error
);
This function loads the entire menu tree from the file referred to
by menu
. It resolves merges, moves and everything else defined
in the menu specification. The resulting tree information is
stored within menu
and can be accessed using the public GarconMenu
API afterwards.
cancellable
can be used to handle blocking I/O when reading data
from files during the loading process.
error
should either be NULL or point to a GError return location
where errors should be stored in.
GFile *
garcon_menu_get_file (GarconMenu *menu
);
Get the file for menu
. It refers to the .menu file from which
menu
was or will be loaded.
a GFile. The returned object
should be unreffed with g_object_unref()
when no longer needed.
GarconMenuDirectory *
garcon_menu_get_directory (GarconMenu *menu
);
Returns the GarconMenuDirectory of menu
or NULL
if the <Menu>
element that corresponds to menu
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.
GarconMenuDirectory of menu
or NULL
if
menu
has no valid directory element. The returned object
should be unreffed with g_object_unref()
when no longer needed.
GList *
garcon_menu_get_menus (GarconMenu *menu
);
Returns a sorted list of GarconMenu submenus of menu
.
void garcon_menu_add_menu (GarconMenu *menu
,GarconMenu *submenu
);
Adds submenu
as a sub menu to menu
.
GarconMenu * garcon_menu_get_menu_with_name (GarconMenu *menu
,const gchar *name
);
Looks in menu
for a submenu with name
as name.
GarconMenu *
garcon_menu_get_parent (GarconMenu *menu
);
Returns the parent GarconMenu or menu
.
GarconMenuItemPool *
garcon_menu_get_item_pool (GarconMenu *menu
);
Get the item pool of the menu. This pool contains all items in this menu (for that of its submenus).
GList *
garcon_menu_get_items (GarconMenu *menu
);
Returns all GarconMenuItems included in menu
. The items are
sorted by their display names in ascending order.
The caller is responsible to free the returned list using
1 |
g_list_free (list); |
when no longer needed.
GList *
garcon_menu_get_elements (GarconMenu *menu
);
Get all the menu element in menu
. This contains sub menus, menu items
and separators.
“directory”
property“directory” GarconMenuDirectory *
The directory entry associated with this menu.
Flags: Read / Write
“file”
property“file” GFile *
The GFile from which the GarconMenu
was loaded.
Flags: Read / Write / Construct Only
“directory-changed”
signalvoid user_function (GarconMenu *garconmenu, GarconMenuDirectory *arg1, GarconMenuDirectory *arg2, gpointer user_data)
Flags: No Hooks
“reload-required”
signalvoid user_function (GarconMenu *garconmenu, gpointer user_data)
Flags: No Hooks