* efreet: Remove ecore_dlist from Efreet.

SVN revision: 39730
This commit is contained in:
Cedric BAIL 2009-03-26 17:54:50 +00:00
parent 3eb42f9fc2
commit 7e6af0a5c1
6 changed files with 44 additions and 58 deletions

View File

@ -1089,7 +1089,7 @@ efreet_desktop_environment_check(Efreet_Ini *ini)
/**
* @param desktop: the desktop entry
* @param files: an ecore list of file names to execute, as either absolute paths,
* @param files: an eina list of file names to execute, as either absolute paths,
* relative paths, or uris
* @param func: a callback to call for each prepared command line
* @param data: user data passed to the callback
@ -1105,8 +1105,8 @@ efreet_desktop_command_get(Efreet_Desktop *desktop, Eina_List *files,
/**
* @param desktop: the desktop entry
* @param files an ecore list of local files, as absolute paths, local paths, or file:// uris (or NULL to get exec string with no files appended)
* @return Returns an ecore list of exec strings
* @param files an eina list of local files, as absolute paths, local paths, or file:// uris (or NULL to get exec string with no files appended)
* @return Returns an eina list of exec strings
* @brief Get the command to use to execute a desktop entry
*
* The returned list and each of its elements must be freed.
@ -1153,7 +1153,7 @@ efreet_desktop_command_local_get(Efreet_Desktop *desktop, Eina_List *files)
/**
* @param desktop: the desktop entry
* @param files: an ecore list of file names to execute, as either absolute paths,
* @param files: an eina list of file names to execute, as either absolute paths,
* relative paths, or uris
* @param cb_command: a callback to call for each prepared command line
* @param cb_progress: a callback to get progress for the downloads

View File

@ -41,7 +41,7 @@ struct Efreet_Menu_Internal
} name; /**< The names for this menu */
Efreet_Desktop *directory; /**< The directory */
Ecore_DList *directories; /**< All the directories set in the menu file */
Eina_List *directories; /**< All the directories set in the menu file */
Efreet_Menu_Move *current_move; /**< The current move */
@ -50,7 +50,7 @@ struct Efreet_Menu_Internal
Eina_List *app_pool; /**< application pool */
Eina_List *applications; /**< applications in this menu */
Ecore_DList *directory_dirs; /**< .directory file directories */
Eina_List *directory_dirs; /**< .directory file directories */
Eina_Hash *directory_cache; /**< .directory dirs */
Eina_List *moves; /**< List of moves to be handled by the menu */
@ -1001,10 +1001,10 @@ efreet_menu_internal_free(Efreet_Menu_Internal *internal)
internal->applications = eina_list_free(internal->applications);
IF_FREE_DLIST(internal->directories);
IF_FREE_LIST(internal->directories, free);
IF_FREE_LIST(internal->app_dirs, efreet_menu_app_dir_free);
IF_FREE_LIST(internal->app_pool, efreet_menu_desktop_free);
IF_FREE_DLIST(internal->directory_dirs);
IF_FREE_LIST(internal->directory_dirs, free);
IF_FREE_HASH(internal->directory_cache);
IF_FREE_LIST(internal->moves, efreet_menu_move_free);
@ -1053,10 +1053,10 @@ static int
efreet_menu_handle_menu(Efreet_Menu_Internal *internal, Efreet_Xml *xml)
{
Efreet_Xml *child;
Eina_List *l;
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
ecore_list_last_goto(xml->children);
while ((child = ecore_dlist_previous(xml->children)))
EINA_LIST_REVERSE_FOREACH(xml->children, l, child)
{
cb = eina_hash_find(efreet_menu_handle_cbs, child->tag);
if (cb)
@ -1206,13 +1206,13 @@ efreet_menu_handle_directory_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
if (!path) return 0;
/* we've already got this guy in our list we can skip it */
if (ecore_list_find(parent->directory_dirs, ECORE_COMPARE_CB(strcmp), path))
if (eina_list_search_unsorted(parent->directory_dirs, EINA_COMPARE_CB(strcmp), path))
{
FREE(path);
return 1;
}
ecore_dlist_prepend(parent->directory_dirs, path);
parent->directory_dirs = eina_list_prepend(parent->directory_dirs, path);
return 1;
}
@ -1237,10 +1237,10 @@ efreet_menu_handle_default_directory_dirs(Efreet_Menu_Internal *parent, Efreet_X
"desktop-directories");
EINA_LIST_FOREACH(dirs, l, dir)
{
if (ecore_list_find(parent->directory_dirs, ECORE_COMPARE_CB(strcmp), dir))
if (eina_list_search_unsorted(parent->directory_dirs, EINA_COMPARE_CB(strcmp), dir))
continue;
ecore_dlist_prepend(parent->directory_dirs, strdup(dir));
parent->directory_dirs = eina_list_prepend(parent->directory_dirs, strdup(dir));
}
while (dirs)
@ -1293,7 +1293,7 @@ efreet_menu_handle_directory(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
if (!parent || !xml) return 0;
efreet_menu_create_directories_list(parent);
ecore_dlist_prepend(parent->directories, strdup(xml->text));
parent->directories = eina_list_prepend(parent->directories, strdup(xml->text));
return 1;
}
@ -1867,7 +1867,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
/* add the legacy dir as a directory dir */
efreet_menu_create_directory_dirs_list(legacy_internal);
ecore_dlist_append(legacy_internal->directory_dirs, strdup(path));
legacy_internal->directory_dirs = eina_list_append(legacy_internal->directory_dirs, strdup(path));
/* setup a filter for all the conforming .desktop files in the legacy
* dir */
@ -2003,13 +2003,13 @@ static int
efreet_menu_handle_move(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
{
Efreet_Xml *child;
Eina_List *l;
if (!parent || !xml) return 0;
efreet_menu_create_move_list(parent);
ecore_list_first_goto(xml->children);
while ((child = ecore_list_next(xml->children)))
EINA_LIST_FOREACH(xml->children, l, child)
{
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
@ -2110,6 +2110,7 @@ static int
efreet_menu_handle_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
{
Efreet_Xml *child;
Eina_List *l;
if (!parent || !xml) return 0;
@ -2118,8 +2119,7 @@ efreet_menu_handle_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
efreet_menu_create_layout_list(parent);
ecore_list_first_goto(xml->children);
while ((child = ecore_list_next(xml->children)))
EINA_LIST_FOREACH(xml->children, l, child)
{
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
@ -2152,6 +2152,7 @@ efreet_menu_handle_default_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
{
const char *val;
Efreet_Xml *child;
Eina_List *l;
if (!parent || !xml) return 0;
@ -2175,8 +2176,7 @@ efreet_menu_handle_default_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
efreet_menu_create_default_layout_list(parent);
ecore_list_first_goto(xml->children);
while ((child = ecore_list_next(xml->children)))
EINA_LIST_FOREACH(xml->children, l, child)
{
int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
@ -2353,9 +2353,9 @@ static int
efreet_menu_handle_filter_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
{
Efreet_Xml *child;
Eina_List *l;
ecore_list_first_goto(xml->children);
while ((child = ecore_list_next(xml->children)))
EINA_LIST_FOREACH(xml->children, l, child)
{
int (*cb)(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
@ -2971,34 +2971,36 @@ efreet_menu_concatenate(Efreet_Menu_Internal *dest, Efreet_Menu_Internal *src)
if (src->directories)
{
efreet_menu_create_directories_list(dest);
ecore_dlist_prepend_list(dest->directories, src->directories);
dest->directories = eina_list_merge(src->directories, dest->directories);
src->directories = NULL;
}
if (src->app_dirs)
{
efreet_menu_create_app_dirs_list(dest);
dest->app_dirs = eina_list_merge(src->app_dirs, dest->app_dirs);
src->app_dirs = NULL;
src->app_dirs = NULL;
}
if (src->directory_dirs)
{
efreet_menu_create_directory_dirs_list(dest);
ecore_dlist_prepend_list(dest->directory_dirs, src->directory_dirs);
dest->directory_dirs = eina_list_merge(src->directory_dirs, dest->directory_dirs);
src->directory_dirs = NULL;
}
if (src->moves)
{
efreet_menu_create_move_list(dest);
dest->moves = eina_list_merge(src->moves, dest->moves);
src->moves = NULL;
src->moves = NULL;
}
if (src->filters)
{
efreet_menu_create_filter_list(dest);
dest->filters = eina_list_merge(src->filters, dest->filters);
src->filters = NULL;
src->filters = NULL;
}
if (src->sub_menus)
@ -3270,8 +3272,7 @@ efreet_menu_create_directory_dirs_list(Efreet_Menu_Internal *internal)
{
if (!internal || internal->directory_dirs) return;
internal->directory_dirs = ecore_dlist_new();
ecore_dlist_free_cb_set(internal->directory_dirs, free);
internal->directory_dirs = NULL;
}
static void
@ -3311,8 +3312,7 @@ efreet_menu_create_directories_list(Efreet_Menu_Internal *internal)
{
if (!internal || internal->directories) return;
internal->directories = ecore_dlist_new();
ecore_dlist_free_cb_set(internal->directories, free);
internal->directories = NULL;
}
static char *
@ -3429,21 +3429,20 @@ static int
efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
{
const char *path;
Eina_List *l;
if (internal->directory_dirs)
{
internal->directory_cache =
eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free));
ecore_dlist_last_goto(internal->directory_dirs);
while ((path = ecore_dlist_previous(internal->directory_dirs)))
EINA_LIST_REVERSE_FOREACH(internal->directory_dirs, l, path)
efreet_menu_directory_dir_scan(path, NULL, internal->directory_cache);
}
if (internal->directories)
{
ecore_dlist_last_goto(internal->directories);
while ((path = ecore_dlist_previous(internal->directories)))
EINA_LIST_REVERSE_FOREACH(internal->directories, l, path)
{
internal->directory = efreet_menu_directory_get(internal, path);
if (internal->directory) break;

View File

@ -78,17 +78,6 @@
} \
} while (0)
/**
* @def IF_FREE_DLIST(x)
* If x is a valid pointer destroy x and set to NULL
*/
#define IF_FREE_DLIST(x) do { \
if (x) { \
Ecore_DList *__tmp; __tmp = (x); (x) = NULL; ecore_dlist_destroy(__tmp); \
} \
(x) = NULL; \
} while (0)
/**
* @def IF_FREE_HASH(x)
* If x is a valid pointer destroy x and set to NULL

View File

@ -490,7 +490,7 @@ _hash_keys(Eina_Hash *hash __UNUSED__, const void *key, void *fdata)
/**
* Find all desktop categories
* This list must be freed using ecore_list_destroy()
* This list must be freed using EINA_LIST_FREE
*
* @return an Eina_List of category names (const char *)
*/
@ -1102,7 +1102,7 @@ efreet_util_monitor_free(void *data)
/**
* Returns a list of .menu files found in the various config dirs.
* @return An ecore list of menu file paths (const char *). This must be freed with ecore_list_destroy().
* @return An eina list of menu file paths (const char *). This must be freed with EINA_LIST_FREE.
*/
EAPI Eina_List *
efreet_util_menus_find(void)

View File

@ -97,8 +97,7 @@ ERROR:
void
efreet_xml_del(Efreet_Xml *xml)
{
if (xml->children) ecore_dlist_destroy(xml->children);
xml->children = NULL;
IF_FREE_LIST(xml->children, efreet_xml_cb_attribute_free);
if (xml->tag) eina_stringshare_del(xml->tag);
if (xml->attributes)
@ -166,11 +165,11 @@ efreet_xml_dump(Efreet_Xml *xml, int level)
if (xml->children)
{
Efreet_Xml *child;
Eina_List *l;
printf(">\n");
ecore_dlist_first_goto(xml->children);
while ((child = ecore_dlist_next(xml->children)))
EINA_LIST_FOREACH(xml->children, l, child)
efreet_xml_dump(child, level + 1);
for (i = 0; i < level; i++)
@ -200,8 +199,7 @@ efreet_xml_parse(char **data, int *size)
return NULL;
}
xml->children = ecore_dlist_new();
ecore_dlist_free_cb_set(xml->children, efreet_xml_cb_attribute_free);
xml->children = NULL;
xml->tag = tag;
efreet_xml_attributes_parse(data, size, &(xml->attributes));
@ -214,7 +212,7 @@ efreet_xml_parse(char **data, int *size)
if (efreet_xml_tag_close(data, size, xml->tag)) return xml;
while ((sub_xml = efreet_xml_parse(data, size)))
ecore_dlist_append(xml->children, sub_xml);
xml->children = eina_list_append(xml->children, sub_xml);
efreet_xml_tag_close(data, size, xml->tag);

View File

@ -42,7 +42,7 @@ struct Efreet_Xml
Efreet_Xml_Attribute **attributes; /**< The attributes for this node */
Ecore_DList *children; /**< Child nodes */
Eina_List *children; /**< Child nodes */
};
int efreet_xml_init(void);