summaryrefslogtreecommitdiff
path: root/legacy/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2012-10-10 20:56:29 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2012-10-10 20:56:29 +0000
commit246150b72cf2f13202a7531bc6630326994db43a (patch)
tree093323a8904740c9141ebb238d819f1500d2143d /legacy/efreet
parent1e1ce2fdabb832d6a2af7b2e3885f75794b7ce04 (diff)
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
Diffstat (limited to 'legacy/efreet')
-rw-r--r--legacy/efreet/src/bin/efreet_icon_cache_create.c57
1 files 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;
18#include "efreet_private.h" 18#include "efreet_private.h"
19#include "efreet_cache_private.h" 19#include "efreet_cache_private.h"
20 20
21/* TODO:
22 * - Need to handle programs using different exts
23 */
24
25static Eina_Array *exts = NULL; 21static Eina_Array *exts = NULL;
26static Eina_Array *extra_dirs = NULL; 22static Eina_Array *extra_dirs = NULL;
27static Eina_Array *strs = NULL; 23static Eina_Array *strs = NULL;
@@ -245,30 +241,6 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme,
245 eina_array_push(strs, icon->theme); 241 eina_array_push(strs, icon->theme);
246 eina_hash_add(icons, name, icon); 242 eina_hash_add(icons, name, icon);
247 } 243 }
248 else if (icon->theme && strcmp(icon->theme, theme->name.internal))
249 {
250 const char *ext2;
251 int has_ext = 0;
252 unsigned int j;
253 /* Check if we already has this extension */
254 for (i = 0; i < icon->icons_count; ++i)
255 {
256 for (j = 0; j < icon->icons[i]->paths_count; ++j)
257 {
258 ext2 = strrchr(icon->icons[i]->paths[j], '.');
259 if (ext2)
260 {
261 ext2++;
262 has_ext = !strcmp((ext + 1), ext2);
263 if (has_ext) break;
264 }
265 }
266 if (has_ext) break;
267 }
268 /* We got this icon from a parent theme */
269 if (has_ext)
270 continue;
271 }
272 244
273 /* find if we have the same icon in another type */ 245 /* find if we have the same icon in another type */
274 for (i = 0; i < icon->icons_count; ++i) 246 for (i = 0; i < icon->icons_count; ++i)
@@ -293,9 +265,32 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme,
293 265
294 if (j != icon->icons[i]->paths_count) 266 if (j != icon->icons[i]->paths_count)
295 continue; 267 continue;
268
269 /* If we are inherited, check if we already have extension */
270 if (strcmp(icon->theme, theme->name.internal))
271 {
272 const char *ext2;
273 int has_ext = 0;
274 for (j = 0; j < icon->icons[i]->paths_count; ++j)
275 {
276 ext2 = strrchr(icon->icons[i]->paths[j], '.');
277 if (ext2)
278 {
279 ext2++;
280 has_ext = !strcmp((ext + 1), ext2);
281 if (has_ext) break;
282 }
283 }
284 if (has_ext)
285 continue;
286 }
296 } 287 }
297 /* no icon match so add a new one */ 288 /* no icon match so add a new one */
298 else 289 /* only allow to add new icon for main theme
290 * if we allow inherited theme to add new icons,
291 * we will get weird effects when icon scales
292 */
293 else if (!strcmp(icon->theme, theme->name.internal))
299 { 294 {
300 icon->icons = realloc(icon->icons, 295 icon->icons = realloc(icon->icons,
301 sizeof (Efreet_Cache_Icon_Element*) * (++icon->icons_count)); 296 sizeof (Efreet_Cache_Icon_Element*) * (++icon->icons_count));
@@ -307,6 +302,10 @@ cache_scan_path_dir(Efreet_Icon_Theme *theme,
307 icon->icons[i]->paths = NULL; 302 icon->icons[i]->paths = NULL;
308 icon->icons[i]->paths_count = 0; 303 icon->icons[i]->paths_count = 0;
309 } 304 }
305 else
306 {
307 continue;
308 }
310 309
311 /* and finally store the path */ 310 /* and finally store the path */
312 icon->icons[i]->paths = realloc(icon->icons[i]->paths, 311 icon->icons[i]->paths = realloc(icon->icons[i]->paths,