Efreet_Menu: The FDO Desktop Menu Specification

Data Structures

struct  Efreet_Menu

Typedefs

typedef struct Efreet_Menu Efreet_Menu
typedef enum Efreet_Menu_Entry_Type Efreet_Menu_Entry_Type

Enumerations

enum  Efreet_Menu_Entry_Type { EFREET_MENU_ENTRY_MENU, EFREET_MENU_ENTRY_DESKTOP, EFREET_MENU_ENTRY_SEPARATOR, EFREET_MENU_ENTRY_HEADER }

Functions

EAPI int efreet_menu_desktop_insert (Efreet_Menu *menu, Efreet_Desktop *desktop, int pos)
 Insert a desktop element in a menu structure. Only accepts desktop files in default directories.
EAPI int efreet_menu_desktop_remove (Efreet_Menu *menu, Efreet_Desktop *desktop)
 Remove a desktop element in a menu structure. Only accepts desktop files in default directories.
EAPI void efreet_menu_dump (Efreet_Menu *menu, const char *indent)
 Dumps the contents of the menu to the command line.
EAPI void efreet_menu_file_set (const char *file)
 Override which file is used for menu creation.
EAPI void efreet_menu_free (Efreet_Menu *menu)
 Frees the given structure.
EAPI Efreet_Menuefreet_menu_get (void)
 Creates the default menu representation.
EAPI int efreet_menu_kde_legacy_init (void)
 Initialize legacy kde support. This function blocks while the kde-config script is run.
EAPI Efreet_Menuefreet_menu_new (const char *name)
 Creates a new menu.
EAPI Efreet_Menuefreet_menu_parse (const char *path)
 Parses the given .menu file and creates the menu representation.
EAPI int efreet_menu_save (Efreet_Menu *menu, const char *path)
 Saves the menu to file.

Detailed Description

functions and structures


Typedef Documentation

The type of entry


Enumeration Type Documentation

The type of entry

Enumerator:
EFREET_MENU_ENTRY_MENU 
EFREET_MENU_ENTRY_DESKTOP 
EFREET_MENU_ENTRY_SEPARATOR 
EFREET_MENU_ENTRY_HEADER 

Function Documentation

EAPI int efreet_menu_desktop_insert ( Efreet_Menu menu,
Efreet_Desktop desktop,
int  pos 
)

Insert a desktop element in a menu structure. Only accepts desktop files in default directories.

Parameters:
menu The menu to work with
desktop The desktop to insert
pos The position to place the new desktop
Returns:
Returns 1 on success, 0 on failure

References desktop, efreet_desktop_ref(), EFREET_MENU_ENTRY_DESKTOP, efreet_util_path_to_file_id(), entries, icon, _Efreet_Desktop::icon, id, _Efreet_Desktop::name, name, _Efreet_Desktop::orig_path, and type.

EAPI int efreet_menu_desktop_remove ( Efreet_Menu menu,
Efreet_Desktop desktop 
)

Remove a desktop element in a menu structure. Only accepts desktop files in default directories.

Parameters:
menu The menu to work with
desktop The desktop to remove
Returns:
Returns 1 on success, 0 on failure

References efreet_menu_free(), and entries.

EAPI void efreet_menu_dump ( Efreet_Menu menu,
const char *  indent 
)

Dumps the contents of the menu to the command line.

Parameters:
menu The menu to work with
menu The menu to work with
indent The indent level to print the menu at
Returns:
Returns no value

References alloca(), efreet_menu_dump(), EFREET_MENU_ENTRY_DESKTOP, EFREET_MENU_ENTRY_HEADER, EFREET_MENU_ENTRY_MENU, EFREET_MENU_ENTRY_SEPARATOR, entries, icon, INF, name, and type.

Referenced by efreet_menu_dump().

EAPI void efreet_menu_file_set ( const char *  file  ) 

Override which file is used for menu creation.

Parameters:
file The file to use for menu creation

This file is only used if it exists, else the standard files will be used for the menu.

References IF_RELEASE.

EAPI void efreet_menu_free ( Efreet_Menu entry  ) 

Frees the given structure.

Parameters:
entry The Efreet_Menu to free
Returns:
Returns no value

References desktop, efreet_desktop_free(), efreet_menu_free(), entries, FREE, icon, id, IF_RELEASE, and name.

Referenced by efreet_menu_desktop_remove(), and efreet_menu_free().

EAPI Efreet_Menu* efreet_menu_get ( void   ) 

Creates the default menu representation.

Returns:
Returns the Efreet_Menu_Internal representation of the default menu or NULL if none found

References efreet_config_dirs_get(), efreet_config_home_get(), and efreet_menu_parse().

EAPI int efreet_menu_kde_legacy_init ( void   ) 

Initialize legacy kde support. This function blocks while the kde-config script is run.

Returns:
Returns no value

References efreet_menu_kde_legacy_dirs, ERR, and IF_FREE_LIST.

EAPI Efreet_Menu* efreet_menu_new ( const char *  name  ) 

Creates a new menu.

Parameters:
name The internal name of the menu
Returns:
Returns the Efreet_Menu on success or NULL on failure

References EFREET_MENU_ENTRY_MENU, ERR, name, and type.

EAPI Efreet_Menu* efreet_menu_parse ( const char *  path  ) 

Parses the given .menu file and creates the menu representation.

Parameters:
path The path of the menu to load
Returns:
Returns the Efreet_Menu_Internal representation on success or NULL on failure

References efreet_xml_del(), efreet_xml_new(), IF_FREE_HASH, Efreet_Xml::tag, and WRN.

Referenced by efreet_menu_get().

EAPI int efreet_menu_save ( Efreet_Menu menu,
const char *  path 
)

Saves the menu to file.

Parameters:
menu The menu to work with
path The path where the menu should be saved
Returns:
Returns 1 on success, 0 on failure