From 246150b72cf2f13202a7531bc6630326994db43a Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Wed, 10 Oct 2012 20:56:29 +0000 Subject: [PATCH] efreet: get all files with new extension Previous code would only allow one file with new extension from inherited theme. Now we accept for all already known icon types. SVN revision: 77810 --- .../efreet/src/bin/efreet_icon_cache_create.c | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/legacy/efreet/src/bin/efreet_icon_cache_create.c b/legacy/efreet/src/bin/efreet_icon_cache_create.c index b77a8ce70b..0994955beb 100644 --- a/legacy/efreet/src/bin/efreet_icon_cache_create.c +++ b/legacy/efreet/src/bin/efreet_icon_cache_create.c @@ -18,10 +18,6 @@ static int _efreet_icon_cache_log_dom = -1; #include "efreet_private.h" #include "efreet_cache_private.h" -/* TODO: - * - Need to handle programs using different exts - */ - static Eina_Array *exts = NULL; static Eina_Array *extra_dirs = NULL; static Eina_Array *strs = NULL; @@ -245,30 +241,6 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, eina_array_push(strs, icon->theme); eina_hash_add(icons, name, icon); } - else if (icon->theme && strcmp(icon->theme, theme->name.internal)) - { - const char *ext2; - int has_ext = 0; - unsigned int j; - /* Check if we already has this extension */ - for (i = 0; i < icon->icons_count; ++i) - { - for (j = 0; j < icon->icons[i]->paths_count; ++j) - { - ext2 = strrchr(icon->icons[i]->paths[j], '.'); - if (ext2) - { - ext2++; - has_ext = !strcmp((ext + 1), ext2); - if (has_ext) break; - } - } - if (has_ext) break; - } - /* We got this icon from a parent theme */ - if (has_ext) - continue; - } /* find if we have the same icon in another type */ for (i = 0; i < icon->icons_count; ++i) @@ -293,9 +265,32 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, if (j != icon->icons[i]->paths_count) continue; + + /* If we are inherited, check if we already have extension */ + if (strcmp(icon->theme, theme->name.internal)) + { + const char *ext2; + int has_ext = 0; + for (j = 0; j < icon->icons[i]->paths_count; ++j) + { + ext2 = strrchr(icon->icons[i]->paths[j], '.'); + if (ext2) + { + ext2++; + has_ext = !strcmp((ext + 1), ext2); + if (has_ext) break; + } + } + if (has_ext) + continue; + } } /* no icon match so add a new one */ - else + /* only allow to add new icon for main theme + * if we allow inherited theme to add new icons, + * we will get weird effects when icon scales + */ + else if (!strcmp(icon->theme, theme->name.internal)) { icon->icons = realloc(icon->icons, sizeof (Efreet_Cache_Icon_Element*) * (++icon->icons_count)); @@ -307,6 +302,10 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme, icon->icons[i]->paths = NULL; icon->icons[i]->paths_count = 0; } + else + { + continue; + } /* and finally store the path */ icon->icons[i]->paths = realloc(icon->icons[i]->paths,