From 19e3d5ee331f0350d2d82c2337526eb8d53f2fae Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Thu, 25 Nov 2010 09:04:19 +0000 Subject: [PATCH] Make icon test work without theme installed SVN revision: 54973 --- legacy/efreet/src/tests/ef_icon_theme.c | 45 ++++++------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/legacy/efreet/src/tests/ef_icon_theme.c b/legacy/efreet/src/tests/ef_icon_theme.c index 8eae21d475..6cad371193 100644 --- a/legacy/efreet/src/tests/ef_icon_theme.c +++ b/legacy/efreet/src/tests/ef_icon_theme.c @@ -17,8 +17,7 @@ static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list); static void ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes); -static void ef_icons_find(Efreet_Icon_Theme *theme, Eina_List *themes, - Eina_Hash *icons); +static void ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons); static void ef_read_dir(const char *dir, Eina_Hash *icons); int @@ -453,29 +452,11 @@ ef_cb_efreet_icon_match(void) int i, ret = 1; Eina_Hash *icon_hash; Efreet_Icon_Theme *theme; - Eina_List *themes; - Eina_List *l; - - themes = efreet_icon_theme_list_get(); - EINA_LIST_FOREACH(themes, l, theme) - { - if (!strcmp(theme->name.internal, THEME)) - break; - } - - if (!theme) - { - printf("Theme not installed, SKIPPED.\n"); - while (themes) - themes = eina_list_remove_list(themes, themes); - return 1; - } + theme = efreet_icon_theme_find(THEME); icon_hash = eina_hash_string_superfast_new(free); - ef_icons_find(theme, themes, icon_hash); - while (themes) - themes = eina_list_remove_list(themes, themes); + ef_icons_find(theme, icon_hash); double start = ecore_time_get(); for (i = 0; system_icons[i]; i++) @@ -546,7 +527,7 @@ ef_cb_efreet_icon_match(void) } static void -ef_icons_find(Efreet_Icon_Theme *theme, Eina_List *themes, Eina_Hash *icons) +ef_icons_find(Efreet_Icon_Theme *theme, Eina_Hash *icons) { Eina_List *l, *ll; char path[PATH_MAX]; @@ -572,22 +553,18 @@ ef_icons_find(Efreet_Icon_Theme *theme, Eina_List *themes, Eina_Hash *icons) EINA_LIST_FOREACH(theme->inherits, l, parent) { - EINA_LIST_FOREACH(themes, ll, parent_theme) - { - if (!strcmp(parent_theme->name.internal, parent)) - ef_icons_find(parent_theme, themes, icons); - } + parent_theme = efreet_icon_theme_find(parent); + if (parent_theme) + ef_icons_find(parent_theme, icons); } } - else + else if (strcmp(theme->name.internal, "hicolor")) { Efreet_Icon_Theme *parent_theme; - EINA_LIST_FOREACH(themes, l, parent_theme) - { - if (!strcmp(parent_theme->name.internal, "hicolor")) - ef_icons_find(parent_theme, themes, icons); - } + parent_theme = efreet_icon_theme_find("hicolor"); + if (parent_theme) + ef_icons_find(parent_theme, icons); } ef_read_dir("/usr/share/pixmaps", icons);