Make icon test work without theme installed
authorSebastian Dransfeld <sd@tango.flipp.net>
Thu, 25 Nov 2010 09:04:19 +0000 (09:04 +0000)
committerSebastian Dransfeld <sd@tango.flipp.net>
Thu, 25 Nov 2010 09:04:19 +0000 (09:04 +0000)
SVN revision: 54973

legacy/efreet/src/tests/ef_icon_theme.c

index 8eae21d475dd98126bf89a06b46a0274504a2d49..6cad37119310a174afb17d5835d18b1591cdd5cd 100644 (file)
@@ -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);