Efreet_Menu: The FDO Desktop Menu Specification

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Enumerations | Functions
Efreet_Menu: The FDO Desktop Menu Specification
Efreet

functions and structures More...

## Data Structures
struct | Efreet_Menu
| Efreet_Menu Stores information on a entry in the menu. More...

## Typedefs
typedef enum Efreet_Menu_Entry_Type | Efreet_Menu_Entry_Type
| The type of entry.
typedef struct Efreet_Menu | Efreet_Menu
| Efreet_Menu.
typedef void(* | Efreet_Menu_Cb) (void *data, Efreet_Menu *menu)
| A callback used with efreet_menu_async_get() and efreet_menu_async_parse() More...

## Enumerations
enum | Efreet_Menu_Entry_Type { EFREET_MENU_ENTRY_MENU, EFREET_MENU_ENTRY_DESKTOP, EFREET_MENU_ENTRY_SEPARATOR, EFREET_MENU_ENTRY_HEADER }
| The type of entry.

## Functions
int | efreet_menu_kde_legacy_init (void)
| Initialize legacy kde support. This function blocks while the kde-config script is run. More...
Efreet_Menu * | efreet_menu_new (const char *name)
| Creates a new menu. More...
void | efreet_menu_file_set (const char *file)
| Override which file is used for menu creation. More...
void | efreet_menu_async_get (Efreet_Menu_Cb func, const void *data)
| Creates the Efreet_Menu representation of the default menu or NULL if none found and returns it in the callback. More...
Efreet_Menu * | efreet_menu_get (void)
| Creates the default menu representation. More...
void | efreet_menu_async_parse (const char *path, Efreet_Menu_Cb func, const void *data)
| Parses the given .menu file and creates the menu representation, and returns it in the callback. More...
Efreet_Menu * | efreet_menu_parse (const char *path)
| Parses the given .menu file and creates the menu representation. More...
int | efreet_menu_save (Efreet_Menu *menu, const char *path)
| Saves the menu to file. More...
void | efreet_menu_free (Efreet_Menu *menu)
| Frees the given structure (if refcount at 1 at the time of this call) More...
void | efreet_menu_ref (Efreet_Menu *menu)
| Incriments refcount for the menu. More...
void | efreet_menu_unref (Efreet_Menu *menu)
| Decrements refcount for the menu, and on 0 frees. More...
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. More...
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. More...
void | efreet_menu_dump (Efreet_Menu *menu, const char *indent)
| Dumps the contents of the menu to the command line. More...

## Detailed Description

functions and structures

## Typedef Documentation

typedef void(* Efreet_Menu_Cb) (void *data, Efreet_Menu *menu)

A callback used with efreet_menu_async_get() and efreet_menu_async_parse()

Since
  1.8

## Function Documentation

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 eina_list_append(), eina_log_domain_unregister(), eina_stringshare_add(), eina_stringshare_del(), and ERR.

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 eina_stringshare_add(), and name.

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

void efreet_menu_async_get | ( | Efreet_Menu_Cb | func,
|  | const void * | data
| ) |  |

Creates the Efreet_Menu representation of the default menu or NULL if none found and returns it in the callback.

Parameters

  func | function to call when menu is created
  data | user data to return in callback

Since
  1.8

References ecore_file_exists(), efreet_config_dirs_get(), efreet_config_home_get(), efreet_menu_async_parse(), and EINA_LIST_FOREACH.

Efreet_Menu* efreet_menu_get | ( | void |  | ) |

Creates the default menu representation.

Returns
  Returns the Efreet_Menu representation of the default menu or NULL if none found

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

void efreet_menu_async_parse | ( | const char * | path,
|  | Efreet_Menu_Cb | func,
|  | const void * | data
| ) |  |

Parses the given .menu file and creates the menu representation, and returns it in the callback.

Parameters

  path | The path of the menu to load
  func | function to call when menu is created
  data | user data to return in callback

Since
  1.8

References ecore_thread_run(), and eina_stringshare_add().

Referenced by efreet_menu_async_get().

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 representation on success or NULL on failure

References eina_hash_string_superfast_new(), Efreet_Xml::tag, and WRN.

Referenced by efreet_menu_get(), and efreet_menu_unref().

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

void efreet_menu_free | ( | Efreet_Menu * | menu | ) |

Frees the given structure (if refcount at 1 at the time of this call)

Parameters

  menu | The Efreet_Menu to free

Returns
  Returns no value

References desktop, efreet_desktop_free(), efreet_menu_free(), EINA_LIST_FREE, entries, icon, id, name, and references.

Referenced by efreet_menu_desktop_remove(), efreet_menu_free(), and efreet_menu_unref().

void efreet_menu_ref | ( | Efreet_Menu * | menu | ) |

Incriments refcount for the menu.

Parameters

  menu | The Efreet_Menu to reference

Returns
  Returns no value

Since
  1.11

References efreet_menu_ref(), EINA_LIST_FOREACH, entries, and references.

Referenced by efreet_menu_ref().

void efreet_menu_unref | ( | Efreet_Menu * | menu | ) |

Decrements refcount for the menu, and on 0 frees.

Parameters

  menu | The Efreet_Menu to unreference

Returns
  Returns no value

Since
  1.11

References alloca(), desktop, ecore_file_file_get(), efreet_desktop_free(), efreet_desktop_get(), efreet_desktop_ref(), efreet_menu_free(), efreet_menu_parse(), EINA_COMPARE_CB, EINA_FILE_DIR, eina_file_stat_ls(), EINA_FREE_CB, eina_hash_add(), eina_hash_del(), eina_hash_direct_add(), eina_hash_find(), eina_hash_free(), eina_hash_string_superfast_new(), EINA_ITERATOR_FOREACH, eina_iterator_free(), eina_list_append(), eina_list_count(), eina_list_data_get(), EINA_LIST_FOREACH, EINA_LIST_FOREACH_SAFE, eina_list_free(), EINA_LIST_FREE, eina_list_last(), eina_list_merge(), eina_list_next(), eina_list_prepend(), eina_list_remove(), eina_list_remove_list(), EINA_LIST_REVERSE_FOREACH, eina_list_search_unsorted(), eina_list_sort(), eina_stringshare_add(), eina_stringshare_del(), entries, icon, id, INF, name, _Efreet_Desktop::name, _Eina_File_Direct_Info::name_start, _Efreet_Desktop::orig_path, efl::eo::parent, _Eina_File_Direct_Info::path, _Efreet_Desktop::type, and _Eina_File_Direct_Info::type.

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_util_path_to_file_id(), eina_list_append(), eina_list_append_relative(), eina_list_count(), eina_list_nth(), eina_stringshare_add(), entries, icon, _Efreet_Desktop::icon, id, name, _Efreet_Desktop::name, and _Efreet_Desktop::orig_path.

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(), EINA_COMPARE_CB, eina_list_remove(), eina_list_search_unsorted(), and entries.

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_Xml::children, ecore_file_exists(), ecore_file_file_get(), efreet_config_dirs_get(), efreet_config_home_get(), efreet_data_dirs_get(), efreet_data_home_get(), efreet_desktop_category_add(), efreet_desktop_category_count_get(), efreet_desktop_free(), efreet_desktop_get(), efreet_menu_dump(), EINA_COMPARE_CB, EINA_FILE_DIR, eina_file_direct_ls(), eina_file_stat_ls(), eina_hash_add(), eina_hash_find(), EINA_ITERATOR_FOREACH, eina_iterator_free(), eina_list_append(), EINA_LIST_FOREACH, eina_list_free(), EINA_LIST_FREE, eina_list_merge(), eina_list_prepend(), eina_list_remove(), EINA_LIST_REVERSE_FOREACH, eina_list_search_unsorted(), eina_stringshare_add(), eina_stringshare_del(), eina_stringshare_ref(), eina_stringshare_strlen(), EINA_UNUSED, entries, icon, INF, name, _Eina_File_Direct_Info::name_start, efl::eo::parent, _Eina_File_Direct_Info::path, references, Efreet_Xml::tag, Efreet_Xml::text, _Eina_File_Direct_Info::type, and WRN.

Referenced by efreet_menu_dump().