GarconMenu

GarconMenu

Synopsis

                    GarconMenuPrivate;
GarconMenu *        garcon_menu_new                     (GFile *file);
GarconMenu *        garcon_menu_new_for_path            (const gchar *filename);
GarconMenu *        garcon_menu_new_applications        (void);
gboolean            garcon_menu_load                    (GarconMenu *menu,
                                                         GCancellable *cancellable,
                                                         GError **error);
GFile *             garcon_menu_get_file                (GarconMenu *menu);
GarconMenuDirectory * garcon_menu_get_directory         (GarconMenu *menu);
GList *             garcon_menu_get_menus               (GarconMenu *menu);
void                garcon_menu_add_menu                (GarconMenu *menu,
                                                         GarconMenu *submenu);
GarconMenu *        garcon_menu_get_menu_with_name      (GarconMenu *menu,
                                                         const gchar *name);
GarconMenu *        garcon_menu_get_parent              (GarconMenu *menu);
GarconMenuItemPool * garcon_menu_get_item_pool          (GarconMenu *menu);
GList *             garcon_menu_get_items               (GarconMenu *menu);
GList *             garcon_menu_get_elements            (GarconMenu *menu);
                    GarconMenu;

Object Hierarchy

  GObject
   +----GarconMenu

Implemented Interfaces

GarconMenu implements GarconMenuElement.

Properties

  "directory"                GarconMenuDirectory*  : Read / Write
  "file"                     GFile*                : Read / Write / Construct Only

Description

Details

GarconMenuPrivate

typedef struct _GarconMenuPrivate GarconMenuPrivate;


garcon_menu_new ()

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().

file :

GFile for the .menu file you want to load.

Returns :

a new GarconMenu for file.

garcon_menu_new_for_path ()

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.

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().

filename :

Path/URI of the .menu file you want to load.

Returns :

a new GarconMenu for filename.

garcon_menu_new_applications ()

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().

Returns :

a new GarconMenu for applications.menu.

garcon_menu_load ()

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.

menu :

a GarconMenu

cancellable :

a GCancellable

error :

GError return location

Returns :

TRUE if the menu was loaded successfully or FALSE if there was an error or the process was cancelled.

garcon_menu_get_file ()

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.

menu :

a GarconMenu.

Returns :

a GFile. The returned object should be unreffed with g_object_unref() when no longer needed.

garcon_menu_get_directory ()

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.

menu :

a GarconMenu.

Returns :

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.

garcon_menu_get_menus ()

GList *             garcon_menu_get_menus               (GarconMenu *menu);

menu :

Returns :


garcon_menu_add_menu ()

void                garcon_menu_add_menu                (GarconMenu *menu,
                                                         GarconMenu *submenu);

menu :

submenu :


garcon_menu_get_menu_with_name ()

GarconMenu *        garcon_menu_get_menu_with_name      (GarconMenu *menu,
                                                         const gchar *name);

menu :

name :

Returns :


garcon_menu_get_parent ()

GarconMenu *        garcon_menu_get_parent              (GarconMenu *menu);

menu :

Returns :


garcon_menu_get_item_pool ()

GarconMenuItemPool * garcon_menu_get_item_pool          (GarconMenu *menu);

menu :

Returns :


garcon_menu_get_items ()

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

g_list_free (list);

when no longer needed.

menu :

a GarconMenu.

Returns :

list of GarconMenuItems included in menu.

garcon_menu_get_elements ()

GList *             garcon_menu_get_elements            (GarconMenu *menu);

menu :

Returns :


GarconMenu

typedef struct _GarconMenu GarconMenu;

Property Details

The "directory" property

  "directory"                GarconMenuDirectory*  : Read / Write

The directory entry associated with this menu.


The "file" property

  "file"                     GFile*                : Read / Write / Construct Only

The GFile from which the GarconMenuItem was loaded.