summaryrefslogtreecommitdiff
path: root/legacy/efreet
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2008-12-17 15:33:43 +0000
committerCedric BAIL <cedric.bail@free.fr>2008-12-17 15:33:43 +0000
commit35540b3a3b22af94a9277f336c0ac7d4f927931e (patch)
tree1ed94cf3972c63859ee88b3b7c0bb953ed186141 /legacy/efreet
parente33474c92fab31424aa4bfce1017b688e016ea36 (diff)
This commit is huge. I did test it a lot on my computer, and it run fine here.
But is so big i fear i could have broken some piece of code. So report any wrong behaviour to me (cedric on #edevelop). So moving e17 and efreet to eina_hash. With a little efreet API break so they must come together. SVN revision: 38185
Diffstat (limited to 'legacy/efreet')
-rw-r--r--legacy/efreet/src/bin/ef_icon_theme.c57
-rw-r--r--legacy/efreet/src/lib/efreet_desktop.c77
-rw-r--r--legacy/efreet/src/lib/efreet_desktop.h2
-rw-r--r--legacy/efreet/src/lib/efreet_icon.c70
-rw-r--r--legacy/efreet/src/lib/efreet_ini.c97
-rw-r--r--legacy/efreet/src/lib/efreet_ini.h4
-rw-r--r--legacy/efreet/src/lib/efreet_menu.c137
-rw-r--r--legacy/efreet/src/lib/efreet_mime.c32
-rw-r--r--legacy/efreet/src/lib/efreet_private.h2
-rw-r--r--legacy/efreet/src/lib/efreet_utils.c334
10 files changed, 440 insertions, 372 deletions
diff --git a/legacy/efreet/src/bin/ef_icon_theme.c b/legacy/efreet/src/bin/ef_icon_theme.c
index 2ed512dfe6..56dcaf8b2d 100644
--- a/legacy/efreet/src/bin/ef_icon_theme.c
+++ b/legacy/efreet/src/bin/ef_icon_theme.c
@@ -12,11 +12,12 @@
12#define THEME "Tango" 12#define THEME "Tango"
13#define FREE(x) do { free(x); x = NULL; } while (0); 13#define FREE(x) do { free(x); x = NULL; } while (0);
14 14
15static Eina_Bool _hash_keys(Eina_Hash *hash, const char *key, void *list);
15static void ef_icon_theme_themes_find(const char *search_dir, 16static void ef_icon_theme_themes_find(const char *search_dir,
16 Ecore_Hash *themes); 17 Eina_Hash *themes);
17static void ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, 18static void ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes,
18 Ecore_Hash *icons); 19 Eina_Hash *icons);
19static void ef_read_dir(const char *dir, Ecore_Hash *icons); 20static void ef_read_dir(const char *dir, Eina_Hash *icons);
20 21
21int 22int
22ef_cb_efreet_icon_theme(void) 23ef_cb_efreet_icon_theme(void)
@@ -52,19 +53,27 @@ ef_cb_efreet_icon_theme(void)
52 return ret; 53 return ret;
53} 54}
54 55
56static Eina_Bool
57_hash_keys(Eina_Hash *hash, const char *key, void *list)
58{
59 ecore_list_append(list, key);
60 return EINA_TRUE;
61}
62
55int 63int
56ef_cb_efreet_icon_theme_list(void) 64ef_cb_efreet_icon_theme_list(void)
57{ 65{
58 int ret = 1; 66 int ret = 1;
59 Ecore_List *themes; 67 Ecore_List *themes;
60 Ecore_Hash *dirs; 68 Eina_Hash *dirs;
69 Eina_Iterator *it;
61 Efreet_Icon_Theme *theme; 70 Efreet_Icon_Theme *theme;
62 Ecore_List *icon_dirs; 71 Ecore_List *icon_dirs;
63 const char *dir; 72 const char *dir;
64 char buf[PATH_MAX]; 73 char buf[PATH_MAX];
74 void *value;
65 75
66 dirs = ecore_hash_new(ecore_str_hash, ecore_str_compare); 76 dirs = eina_hash_string_superfast_new(free);
67 ecore_hash_free_key_cb_set(dirs, free);
68 77
69 icon_dirs = efreet_data_dirs_get(); 78 icon_dirs = efreet_data_dirs_get();
70 ecore_list_first_goto(icon_dirs); 79 ecore_list_first_goto(icon_dirs);
@@ -81,8 +90,8 @@ ef_cb_efreet_icon_theme_list(void)
81 ecore_list_first_goto(themes); 90 ecore_list_first_goto(themes);
82 while ((theme = ecore_list_next(themes))) 91 while ((theme = ecore_list_next(themes)))
83 { 92 {
84 if (ecore_hash_get(dirs, theme->name.internal)) 93 if ((eina_hash_find(dirs, theme->name.internal)))
85 ecore_hash_remove(dirs, theme->name.internal); 94 eina_hash_del(dirs, theme->name.internal, NULL);
86 else 95 else
87 { 96 {
88 printf("efreet_icon_theme_list_get() returned %s which we didn't " 97 printf("efreet_icon_theme_list_get() returned %s which we didn't "
@@ -92,7 +101,11 @@ ef_cb_efreet_icon_theme_list(void)
92 } 101 }
93 ecore_list_destroy(themes); 102 ecore_list_destroy(themes);
94 103
95 themes = ecore_hash_keys(dirs); 104 themes = ecore_list_new();
105 it = eina_hash_iterator_key_new(dirs);
106 eina_iterator_foreach(it, EINA_EACH(_hash_keys), themes);
107 eina_iterator_free(it);
108
96 if (ecore_list_count(themes) > 0) 109 if (ecore_list_count(themes) > 0)
97 { 110 {
98 char *dir; 111 char *dir;
@@ -106,13 +119,13 @@ ef_cb_efreet_icon_theme_list(void)
106 ret = 0; 119 ret = 0;
107 } 120 }
108 ecore_list_destroy(themes); 121 ecore_list_destroy(themes);
109 ecore_hash_destroy(dirs); 122 eina_hash_free(dirs);
110 123
111 return ret; 124 return ret;
112} 125}
113 126
114static void 127static void
115ef_icon_theme_themes_find(const char *search_dir, Ecore_Hash *themes) 128ef_icon_theme_themes_find(const char *search_dir, Eina_Hash *themes)
116{ 129{
117 Ecore_List *dirs; 130 Ecore_List *dirs;
118 char *dir; 131 char *dir;
@@ -127,7 +140,7 @@ ef_icon_theme_themes_find(const char *search_dir, Ecore_Hash *themes)
127 char p[PATH_MAX]; 140 char p[PATH_MAX];
128 141
129 /* if we've already added the theme we're done */ 142 /* if we've already added the theme we're done */
130 if (ecore_hash_get(themes, dir)) 143 if (eina_hash_find(themes, dir))
131 { 144 {
132 free(dir); 145 free(dir);
133 continue; 146 continue;
@@ -152,7 +165,7 @@ ef_icon_theme_themes_find(const char *search_dir, Ecore_Hash *themes)
152 if (!skip) 165 if (!skip)
153 { 166 {
154 d = strdup(dir); 167 d = strdup(dir);
155 ecore_hash_set(themes, d, d); 168 eina_hash_add(themes, dir, d);
156 } 169 }
157 } 170 }
158 free(dir); 171 free(dir);
@@ -425,7 +438,7 @@ int
425ef_cb_efreet_icon_match(void) 438ef_cb_efreet_icon_match(void)
426{ 439{
427 int i, ret = 1; 440 int i, ret = 1;
428 Ecore_Hash *icon_hash; 441 Eina_Hash *icon_hash;
429 Efreet_Icon_Theme *theme; 442 Efreet_Icon_Theme *theme;
430 Ecore_List *themes; 443 Ecore_List *themes;
431 444
@@ -444,9 +457,7 @@ ef_cb_efreet_icon_match(void)
444 return 1; 457 return 1;
445 } 458 }
446 459
447 icon_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); 460 icon_hash = eina_hash_string_superfast_new(free);
448 ecore_hash_free_key_cb_set(icon_hash, free);
449 ecore_hash_free_value_cb_set(icon_hash, free);
450 461
451 ef_icons_find(theme, themes, icon_hash); 462 ef_icons_find(theme, themes, icon_hash);
452 ecore_list_destroy(themes); 463 ecore_list_destroy(themes);
@@ -461,7 +472,7 @@ ef_cb_efreet_icon_match(void)
461 if (!path) 472 if (!path)
462 { 473 {
463#if 1 474#if 1
464 if (ecore_hash_get(icon_hash, icons[i])) 475 if (eina_hash_find(icon_hash, icons[i]))
465 { 476 {
466 printf("NOT FOUND %s\n", icons[i]); 477 printf("NOT FOUND %s\n", icons[i]);
467 ret = 0; 478 ret = 0;
@@ -469,7 +480,7 @@ ef_cb_efreet_icon_match(void)
469#endif 480#endif
470 continue; 481 continue;
471 } 482 }
472 else if (!ecore_hash_get(icon_hash, icons[i])) 483 else if (!eina_hash_find(icon_hash, icons[i]))
473 { 484 {
474 printf("Found icon not in hash: %s\n", icons[i]); 485 printf("Found icon not in hash: %s\n", icons[i]);
475 } 486 }
@@ -487,7 +498,7 @@ ef_cb_efreet_icon_match(void)
487 free(path); 498 free(path);
488 } 499 }
489 printf("Time: %f\n", (ecore_time_get() - start)); 500 printf("Time: %f\n", (ecore_time_get() - start));
490 ecore_hash_destroy(icon_hash); 501 eina_hash_free(icon_hash);
491 502
492 start = ecore_time_get(); 503 start = ecore_time_get();
493 for (i = 0; icons[i] != NULL; i++) 504 for (i = 0; icons[i] != NULL; i++)
@@ -516,7 +527,7 @@ ef_cb_efreet_icon_match(void)
516} 527}
517 528
518static void 529static void
519ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Ecore_Hash *icons) 530ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Eina_Hash *icons)
520{ 531{
521 char path[PATH_MAX]; 532 char path[PATH_MAX];
522 533
@@ -599,7 +610,7 @@ ef_icons_find(Efreet_Icon_Theme *theme, Ecore_List *themes, Ecore_Hash *icons)
599} 610}
600 611
601static void 612static void
602ef_read_dir(const char *dir, Ecore_Hash *icons) 613ef_read_dir(const char *dir, Eina_Hash *icons)
603{ 614{
604 Ecore_List *files; 615 Ecore_List *files;
605 char *file; 616 char *file;
@@ -624,7 +635,7 @@ ef_read_dir(const char *dir, Ecore_Hash *icons)
624 { 635 {
625 *p = '\0'; 636 *p = '\0';
626 637
627 ecore_hash_set(icons, strdup(file), strdup(file)); 638 eina_hash_add(icons, file, strdup(file));
628 } 639 }
629 640
630 FREE(file); 641 FREE(file);
diff --git a/legacy/efreet/src/lib/efreet_desktop.c b/legacy/efreet/src/lib/efreet_desktop.c
index bdc3a48476..b0f057e207 100644
--- a/legacy/efreet/src/lib/efreet_desktop.c
+++ b/legacy/efreet/src/lib/efreet_desktop.c
@@ -13,7 +13,7 @@ static const char *desktop_environment = NULL;
13 * A cache of all loaded desktops, hashed by file name. 13 * A cache of all loaded desktops, hashed by file name.
14 * Values are Efreet_Desktop structures 14 * Values are Efreet_Desktop structures
15 */ 15 */
16static Ecore_Hash *efreet_desktop_cache = NULL; 16static Eina_Hash *efreet_desktop_cache = NULL;
17 17
18/** 18/**
19 * A list of the desktop types available 19 * A list of the desktop types available
@@ -61,10 +61,14 @@ static int efreet_desktop_generic_fields_parse(Efreet_Desktop *desktop,
61 Efreet_Ini *ini); 61 Efreet_Ini *ini);
62static void efreet_desktop_generic_fields_save(Efreet_Desktop *desktop, 62static void efreet_desktop_generic_fields_save(Efreet_Desktop *desktop,
63 Efreet_Ini *ini); 63 Efreet_Ini *ini);
64static void efreet_desktop_x_fields_parse(Ecore_Hash_Node *node, 64static Eina_Bool efreet_desktop_x_fields_parse(const Eina_Hash *hash,
65 Efreet_Desktop *desktop); 65 const void *key,
66static void efreet_desktop_x_fields_save(Ecore_Hash_Node *node, 66 void *data,
67 Efreet_Ini *ini); 67 void *fdata);
68static Eina_Bool efreet_desktop_x_fields_save(const Eina_Hash *hash,
69 const void *key,
70 void *value,
71 void *fdata);
68static int efreet_desktop_environment_check(Efreet_Ini *ini); 72static int efreet_desktop_environment_check(Efreet_Ini *ini);
69static char *efreet_string_append(char *dest, int *size, 73static char *efreet_string_append(char *dest, int *size,
70 int *len, const char *src); 74 int *len, const char *src);
@@ -116,8 +120,7 @@ efreet_desktop_init(void)
116 if (!eina_stringshare_init()) return --init; 120 if (!eina_stringshare_init()) return --init;
117 if (!ecore_file_init()) return --init; 121 if (!ecore_file_init()) return --init;
118 122
119 efreet_desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); 123 efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
120 ecore_hash_free_key_cb_set(efreet_desktop_cache, ECORE_FREE_CB(free));
121 124
122 efreet_desktop_types = ecore_list_new(); 125 efreet_desktop_types = ecore_list_new();
123 ecore_list_free_cb_set(efreet_desktop_types, 126 ecore_list_free_cb_set(efreet_desktop_types,
@@ -188,7 +191,7 @@ efreet_desktop_get(const char *file)
188 191
189 if (efreet_desktop_cache) 192 if (efreet_desktop_cache)
190 { 193 {
191 desktop = ecore_hash_get(efreet_desktop_cache, file); 194 desktop = eina_hash_find(efreet_desktop_cache, file);
192 if (desktop) 195 if (desktop)
193 { 196 {
194 if (efreet_desktop_cache_check(desktop)) 197 if (efreet_desktop_cache_check(desktop))
@@ -206,14 +209,14 @@ efreet_desktop_get(const char *file)
206 } 209 }
207 210
208 desktop->cached = 0; 211 desktop->cached = 0;
209 ecore_hash_remove(efreet_desktop_cache, file); 212 eina_hash_del(efreet_desktop_cache, file, NULL);
210 } 213 }
211 } 214 }
212 215
213 desktop = efreet_desktop_new(file); 216 desktop = efreet_desktop_new(file);
214 if (!desktop) return NULL; 217 if (!desktop) return NULL;
215 218
216 ecore_hash_set(efreet_desktop_cache, strdup(file), desktop); 219 eina_hash_add(efreet_desktop_cache, file, desktop);
217 desktop->cached = 1; 220 desktop->cached = 1;
218 return desktop; 221 return desktop;
219} 222}
@@ -330,8 +333,7 @@ efreet_desktop_read(Efreet_Desktop *desktop)
330 if (!error && !efreet_desktop_environment_check(ini)) error = 1; 333 if (!error && !efreet_desktop_environment_check(ini)) error = 1;
331 if (!error && !efreet_desktop_generic_fields_parse(desktop, ini)) error = 1; 334 if (!error && !efreet_desktop_generic_fields_parse(desktop, ini)) error = 1;
332 if (!error) 335 if (!error)
333 ecore_hash_for_each_node(ini->section, 336 eina_hash_foreach(ini->section, efreet_desktop_x_fields_parse, desktop);
334 ECORE_FOR_EACH(efreet_desktop_x_fields_parse), desktop);
335 337
336 efreet_ini_free(ini); 338 efreet_ini_free(ini);
337 339
@@ -428,11 +430,12 @@ efreet_desktop_save(Efreet_Desktop *desktop)
428 if (!efreet_ini_save(ini, desktop->orig_path)) ok = 0; 430 if (!efreet_ini_save(ini, desktop->orig_path)) ok = 0;
429 else 431 else
430 { 432 {
431 if (desktop != ecore_hash_get(efreet_desktop_cache, desktop->orig_path)) 433 if (desktop != eina_hash_find(efreet_desktop_cache, desktop->orig_path))
432 { 434 {
433 desktop->cached = 1; 435 desktop->cached = 1;
434 ecore_hash_set(efreet_desktop_cache, 436 eina_hash_del(efreet_desktop_cache, desktop->orig_path, NULL);
435 strdup(desktop->orig_path), desktop); 437 eina_hash_add(efreet_desktop_cache, desktop->orig_path,
438 desktop);
436 } 439 }
437 } 440 }
438 } 441 }
@@ -449,10 +452,10 @@ efreet_desktop_save(Efreet_Desktop *desktop)
449EAPI int 452EAPI int
450efreet_desktop_save_as(Efreet_Desktop *desktop, const char *file) 453efreet_desktop_save_as(Efreet_Desktop *desktop, const char *file)
451{ 454{
452 if (desktop == ecore_hash_get(efreet_desktop_cache, desktop->orig_path)) 455 if (desktop == eina_hash_find(efreet_desktop_cache, desktop->orig_path))
453 { 456 {
454 desktop->cached = 0; 457 desktop->cached = 0;
455 ecore_hash_remove(efreet_desktop_cache, desktop->orig_path); 458 eina_hash_del(efreet_desktop_cache, desktop->orig_path, NULL);
456 } 459 }
457 FREE(desktop->orig_path); 460 FREE(desktop->orig_path);
458 desktop->orig_path = strdup(file); 461 desktop->orig_path = strdup(file);
@@ -474,7 +477,7 @@ efreet_desktop_free(Efreet_Desktop *desktop)
474 if (desktop->ref > 0) return; 477 if (desktop->ref > 0) return;
475 478
476 if (desktop->cached && efreet_desktop_cache) 479 if (desktop->cached && efreet_desktop_cache)
477 ecore_hash_remove(efreet_desktop_cache, desktop->orig_path); 480 eina_hash_del(efreet_desktop_cache, desktop->orig_path, NULL);
478 481
479 IF_FREE(desktop->orig_path); 482 IF_FREE(desktop->orig_path);
480 483
@@ -985,9 +988,8 @@ efreet_desktop_generic_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
985 efreet_ini_boolean_set(ini, "NoDisplay", desktop->no_display); 988 efreet_ini_boolean_set(ini, "NoDisplay", desktop->no_display);
986 efreet_ini_boolean_set(ini, "Hidden", desktop->hidden); 989 efreet_ini_boolean_set(ini, "Hidden", desktop->hidden);
987 990
988 if (desktop->x) ecore_hash_for_each_node(desktop->x, 991 if (desktop->x) eina_hash_foreach(desktop->x, efreet_desktop_x_fields_save,
989 ECORE_FOR_EACH(efreet_desktop_x_fields_save), 992 ini);
990 ini);
991} 993}
992 994
993/** 995/**
@@ -997,21 +999,19 @@ efreet_desktop_generic_fields_save(Efreet_Desktop *desktop, Efreet_Ini *ini)
997 * @return Returns no value 999 * @return Returns no value
998 * @brief Parses out an X- key from @a node and stores in @a desktop 1000 * @brief Parses out an X- key from @a node and stores in @a desktop
999 */ 1001 */
1000static void 1002static Eina_Bool
1001efreet_desktop_x_fields_parse(Ecore_Hash_Node *node, Efreet_Desktop *desktop) 1003efreet_desktop_x_fields_parse(const Eina_Hash *hash, const void *key, void *value, void *fdata)
1002{ 1004{
1003 if (strncmp(node->key, "X-", 2)) return; 1005 Efreet_Desktop * desktop = fdata;
1004 1006
1005 if (!desktop->x) 1007 if (strncmp(key, "X-", 2)) return EINA_TRUE;
1006 { 1008
1007 desktop->x = ecore_hash_new(ecore_str_hash, ecore_str_compare); 1009 if (desktop && !desktop->x)
1008 ecore_hash_free_key_cb_set(desktop->x, 1010 desktop->x = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
1009 ECORE_FREE_CB(eina_stringshare_del)); 1011 eina_hash_del(desktop->x, key, NULL);
1010 ecore_hash_free_value_cb_set(desktop->x, 1012 eina_hash_add(desktop->x, key, (void *)eina_stringshare_add(value));
1011 ECORE_FREE_CB(eina_stringshare_del)); 1013
1012 } 1014 return EINA_TRUE;
1013 ecore_hash_set(desktop->x, (void *)eina_stringshare_add(node->key),
1014 (void *)eina_stringshare_add(node->value));
1015} 1015}
1016 1016
1017/** 1017/**
@@ -1021,10 +1021,13 @@ efreet_desktop_x_fields_parse(Ecore_Hash_Node *node, Efreet_Desktop *desktop)
1021 * @return Returns no value 1021 * @return Returns no value
1022 * @brief Stores an X- key from @a node and stores in @a ini 1022 * @brief Stores an X- key from @a node and stores in @a ini
1023 */ 1023 */
1024static void 1024static Eina_Bool
1025efreet_desktop_x_fields_save(Ecore_Hash_Node *node, Efreet_Ini *ini) 1025efreet_desktop_x_fields_save(const Eina_Hash *hash, const void *key, void *value, void *fdata)
1026{ 1026{
1027 efreet_ini_string_set(ini, node->key, node->value); 1027 Efreet_Ini *ini = fdata;
1028 efreet_ini_string_set(ini, key, value);
1029
1030 return EINA_TRUE;
1028} 1031}
1029 1032
1030 1033
diff --git a/legacy/efreet/src/lib/efreet_desktop.h b/legacy/efreet/src/lib/efreet_desktop.h
index 5244bc2112..efe3f407cb 100644
--- a/legacy/efreet/src/lib/efreet_desktop.h
+++ b/legacy/efreet/src/lib/efreet_desktop.h
@@ -93,7 +93,7 @@ struct Efreet_Desktop
93 unsigned char startup_notify:1; /**< The starup notify settings of the app */ 93 unsigned char startup_notify:1; /**< The starup notify settings of the app */
94 unsigned char cached:1; /**< The desktop file is cached by Efreet */ 94 unsigned char cached:1; /**< The desktop file is cached by Efreet */
95 95
96 Ecore_Hash *x; /**< Keep track of all user extensions, keys that begin with X- */ 96 Eina_Hash *x; /**< Keep track of all user extensions, keys that begin with X- */
97 void *type_data; /**< Type specific data for custom types */ 97 void *type_data; /**< Type specific data for custom types */
98}; 98};
99 99
diff --git a/legacy/efreet/src/lib/efreet_icon.c b/legacy/efreet/src/lib/efreet_icon.c
index 72b03a64e7..59440e1868 100644
--- a/legacy/efreet/src/lib/efreet_icon.c
+++ b/legacy/efreet/src/lib/efreet_icon.c
@@ -6,10 +6,10 @@
6 6
7static char *efreet_icon_deprecated_user_dir = NULL; 7static char *efreet_icon_deprecated_user_dir = NULL;
8static char *efreet_icon_user_dir = NULL; 8static char *efreet_icon_user_dir = NULL;
9static Ecore_Hash *efreet_icon_themes = NULL; 9static Eina_Hash *efreet_icon_themes = NULL;
10static Ecore_List *efreet_icon_extensions = NULL; 10static Ecore_List *efreet_icon_extensions = NULL;
11static Ecore_List *efreet_extra_icon_dirs = NULL; 11static Ecore_List *efreet_extra_icon_dirs = NULL;
12static Ecore_Hash *efreet_icon_cache = NULL; 12static Eina_Hash *efreet_icon_cache = NULL;
13 13
14static int efreet_icon_init_count = 0; 14static int efreet_icon_init_count = 0;
15 15
@@ -110,13 +110,10 @@ efreet_icon_init(void)
110 for (i = 0; default_exts[i] != NULL; i++) 110 for (i = 0; default_exts[i] != NULL; i++)
111 ecore_list_append(efreet_icon_extensions, strdup(default_exts[i])); 111 ecore_list_append(efreet_icon_extensions, strdup(default_exts[i]));
112 112
113 efreet_icon_themes = ecore_hash_new(NULL, NULL); 113 efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_icon_theme_free));
114 ecore_hash_free_value_cb_set(efreet_icon_themes,
115 ECORE_FREE_CB(efreet_icon_theme_free));
116 efreet_extra_icon_dirs = ecore_list_new(); 114 efreet_extra_icon_dirs = ecore_list_new();
117 115
118 efreet_icon_cache = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); 116 efreet_icon_cache = eina_hash_pointer_new(EINA_FREE_CB(ecore_list_destroy));
119 ecore_hash_free_value_cb_set(efreet_icon_cache, ECORE_FREE_CB(ecore_list_destroy));
120 } 117 }
121 118
122 return 1; 119 return 1;
@@ -207,6 +204,12 @@ efreet_icon_extra_list_get(void)
207 return efreet_extra_icon_dirs; 204 return efreet_extra_icon_dirs;
208} 205}
209 206
207static Eina_Bool
208_hash_keys(Eina_Hash *hash, const void *key, void *list)
209{
210 ecore_list_append(list, key);
211 return EINA_TRUE;
212}
210/** 213/**
211 * @return Returns a list of Efreet_Icon structs for all the non-hidden icon 214 * @return Returns a list of Efreet_Icon structs for all the non-hidden icon
212 * themes 215 * themes
@@ -218,6 +221,7 @@ efreet_icon_theme_list_get(void)
218{ 221{
219 Ecore_List *list, *theme_list; 222 Ecore_List *list, *theme_list;
220 char *dir; 223 char *dir;
224 Eina_Iterator *it;
221 225
222 /* update the list to include all icon themes */ 226 /* update the list to include all icon themes */
223 efreet_icon_theme_dir_scan_all(NULL); 227 efreet_icon_theme_dir_scan_all(NULL);
@@ -225,13 +229,16 @@ efreet_icon_theme_list_get(void)
225 229
226 /* create the list for the user */ 230 /* create the list for the user */
227 list = ecore_list_new(); 231 list = ecore_list_new();
228 theme_list = ecore_hash_keys(efreet_icon_themes); 232 theme_list = ecore_list_new();
233 it = eina_hash_iterator_key_new(efreet_icon_themes);
234 eina_iterator_foreach(it, EINA_EACH(_hash_keys), theme_list);
235 eina_iterator_free(it);
229 ecore_list_first_goto(theme_list); 236 ecore_list_first_goto(theme_list);
230 while ((dir = ecore_list_next(theme_list))) 237 while ((dir = ecore_list_next(theme_list)))
231 { 238 {
232 Efreet_Icon_Theme *theme; 239 Efreet_Icon_Theme *theme;
233 240
234 theme = ecore_hash_get(efreet_icon_themes, dir); 241 theme = eina_hash_find(efreet_icon_themes, dir);
235 if (theme->hidden || theme->fake) continue; 242 if (theme->hidden || theme->fake) continue;
236#ifndef STRICT_SPEC 243#ifndef STRICT_SPEC
237 if (!theme->name.name) continue; 244 if (!theme->name.name) continue;
@@ -257,11 +264,11 @@ efreet_icon_theme_find(const char *theme_name)
257 Efreet_Icon_Theme *theme; 264 Efreet_Icon_Theme *theme;
258 265
259 key = eina_stringshare_add(theme_name); 266 key = eina_stringshare_add(theme_name);
260 theme = ecore_hash_get(efreet_icon_themes, key); 267 theme = eina_hash_find(efreet_icon_themes, key);
261 if (!theme) 268 if (!theme)
262 { 269 {
263 efreet_icon_theme_dir_scan_all(theme_name); 270 efreet_icon_theme_dir_scan_all(theme_name);
264 theme = ecore_hash_get(efreet_icon_themes, key); 271 theme = eina_hash_find(efreet_icon_themes, key);
265 } 272 }
266 eina_stringshare_del(key); 273 eina_stringshare_del(key);
267 274
@@ -319,7 +326,8 @@ efreet_icon_find_theme_check(const char *theme_name)
319 theme = efreet_icon_theme_new(); 326 theme = efreet_icon_theme_new();
320 theme->fake = 1; 327 theme->fake = 1;
321 theme->name.internal = eina_stringshare_add(theme_name); 328 theme->name.internal = eina_stringshare_add(theme_name);
322 ecore_hash_set(efreet_icon_themes, (void *)theme->name.internal, theme); 329 eina_hash_del(efreet_icon_themes, (void *)theme->name.internal, NULL);
330 eina_hash_add(efreet_icon_themes, (void *)theme->name.internal, theme);
323 } 331 }
324 332
325 return theme; 333 return theme;
@@ -1217,7 +1225,7 @@ efreet_icon_theme_cache_check_dir(Efreet_Icon_Theme *theme, const char *dir)
1217 /* have we modified this directory since our last cache check? */ 1225 /* have we modified this directory since our last cache check? */
1218 if (stat(dir, &buf) || (buf.st_mtime > theme->last_cache_check)) 1226 if (stat(dir, &buf) || (buf.st_mtime > theme->last_cache_check))
1219 { 1227 {
1220 ecore_hash_remove(efreet_icon_cache, theme); 1228 eina_hash_del(efreet_icon_cache, &theme, NULL);
1221 return 0; 1229 return 0;
1222 } 1230 }
1223 1231
@@ -1289,14 +1297,14 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
1289 continue; 1297 continue;
1290 1298
1291 key = eina_stringshare_add(dir->d_name); 1299 key = eina_stringshare_add(dir->d_name);
1292 theme = ecore_hash_get(efreet_icon_themes, key); 1300 theme = eina_hash_find(efreet_icon_themes, key);
1293 1301
1294 if (!theme) 1302 if (!theme)
1295 { 1303 {
1296 theme = efreet_icon_theme_new(); 1304 theme = efreet_icon_theme_new();
1297 theme->name.internal = key; 1305 theme->name.internal = key;
1298 ecore_hash_set(efreet_icon_themes, 1306 eina_hash_add(efreet_icon_themes,
1299 (void *)theme->name.internal, theme); 1307 (void *)theme->name.internal, theme);
1300 } 1308 }
1301 else 1309 else
1302 { 1310 {
@@ -1323,12 +1331,9 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
1323 { 1331 {
1324 Efreet_Icon_Theme *theme; 1332 Efreet_Icon_Theme *theme;
1325 1333
1326 theme = ecore_hash_get(efreet_icon_themes, theme_name); 1334 theme = eina_hash_find(efreet_icon_themes, theme_name);
1327 if (theme && !theme->valid && !theme->fake) 1335 if (theme && !theme->valid && !theme->fake)
1328 { 1336 eina_hash_del(efreet_icon_themes, theme_name, theme);
1329 ecore_hash_remove(efreet_icon_themes, theme_name);
1330 efreet_icon_theme_free(theme);
1331 }
1332 } 1337 }
1333} 1338}
1334 1339
@@ -1441,19 +1446,20 @@ efreet_icon_theme_dir_validity_check(void)
1441{ 1446{
1442 Ecore_List *keys; 1447 Ecore_List *keys;
1443 const char *name; 1448 const char *name;
1449 Eina_Iterator *it;
1444 1450
1445 keys = ecore_hash_keys(efreet_icon_themes); 1451 keys = ecore_list_new();
1452 it = eina_hash_iterator_key_new(efreet_icon_themes);
1453 eina_iterator_foreach(it, EINA_EACH(_hash_keys), keys);
1454 eina_iterator_free(it);
1446 ecore_list_first_goto(keys); 1455 ecore_list_first_goto(keys);
1447 while ((name = ecore_list_next(keys))) 1456 while ((name = ecore_list_next(keys)))
1448 { 1457 {
1449 Efreet_Icon_Theme *theme; 1458 Efreet_Icon_Theme *theme;
1450 1459
1451 theme = ecore_hash_get(efreet_icon_themes, name); 1460 theme = eina_hash_find(efreet_icon_themes, name);
1452 if (!theme->valid && !theme->fake) 1461 if (theme && !theme->valid && !theme->fake)
1453 { 1462 eina_hash_del(efreet_icon_themes, name, theme);
1454 ecore_hash_remove(efreet_icon_themes, name);
1455 efreet_icon_theme_free(theme);
1456 }
1457 } 1463 }
1458 ecore_list_destroy(keys); 1464 ecore_list_destroy(keys);
1459} 1465}
@@ -1583,12 +1589,12 @@ efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int
1583 char key[4096]; 1589 char key[4096];
1584 struct stat st; 1590 struct stat st;
1585 1591
1586 list = ecore_hash_get(efreet_icon_cache, theme); 1592 list = eina_hash_find(efreet_icon_cache, &theme);
1587 if (!list) 1593 if (!list)
1588 { 1594 {
1589 list = ecore_list_new(); 1595 list = ecore_list_new();
1590 ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free)); 1596 ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free));
1591 ecore_hash_set(efreet_icon_cache, theme, list); 1597 eina_hash_add(efreet_icon_cache, &theme, list);
1592 return NULL; 1598 return NULL;
1593 } 1599 }
1594 1600
@@ -1620,12 +1626,12 @@ efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int s
1620 char key[4096]; 1626 char key[4096];
1621 struct stat st; 1627 struct stat st;
1622 1628
1623 list = ecore_hash_get(efreet_icon_cache, theme); 1629 list = eina_hash_find(efreet_icon_cache, &theme);
1624 if (!list) 1630 if (!list)
1625 { 1631 {
1626 list = ecore_list_new(); 1632 list = ecore_list_new();
1627 ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free)); 1633 ecore_list_free_cb_set(list, ECORE_FREE_CB(efreet_icon_cache_free));
1628 ecore_hash_set(efreet_icon_cache, theme, list); 1634 eina_hash_add(efreet_icon_cache, &theme, list);
1629 } 1635 }
1630 1636
1631 snprintf(key, sizeof(key), "%s %d", icon, size); 1637 snprintf(key, sizeof(key), "%s %d", icon, size);
diff --git a/legacy/efreet/src/lib/efreet_ini.c b/legacy/efreet/src/lib/efreet_ini.c
index 3801b390df..da1cb969eb 100644
--- a/legacy/efreet/src/lib/efreet_ini.c
+++ b/legacy/efreet/src/lib/efreet_ini.c
@@ -2,11 +2,13 @@
2#include "Efreet.h" 2#include "Efreet.h"
3#include "efreet_private.h" 3#include "efreet_private.h"
4 4
5static Ecore_Hash *efreet_ini_parse(const char *file); 5static Eina_Hash *efreet_ini_parse(const char *file);
6static char *efreet_ini_unescape(const char *str); 6static char *efreet_ini_unescape(const char *str);
7 7
8static void efreet_ini_section_save(Ecore_Hash_Node *node, FILE *f); 8static Eina_Bool
9static void efreet_ini_value_save(Ecore_Hash_Node *node, FILE *f); 9efreet_ini_section_save(const Eina_Hash *hash, const void *key, void *data, void *fdata);
10static Eina_Bool
11efreet_ini_value_save(const Eina_Hash *hash, const void *key, void *data, void *fdata);
10 12
11/** 13/**
12 * The number of times the Ini subsytem has been initialized 14 * The number of times the Ini subsytem has been initialized
@@ -65,16 +67,16 @@ efreet_ini_new(const char *file)
65/** 67/**
66 * @internal 68 * @internal
67 * @param file The file to parse 69 * @param file The file to parse
68 * @return Returns an Ecore_Hash with the contents of @a file, or NULL if the 70 * @return Returns an Eina_Hash with the contents of @a file, or NULL if the
69 * file fails to parse or if the file doesn't exist 71 * file fails to parse or if the file doesn't exist
70 * @brief Parses the ini file @a file into an Ecore_Hash 72 * @brief Parses the ini file @a file into an Eina_Hash
71 */ 73 */
72static Ecore_Hash * 74static Eina_Hash *
73efreet_ini_parse(const char *file) 75efreet_ini_parse(const char *file)
74{ 76{
75 const char *buffer, *line_start; 77 const char *buffer, *line_start;
76 FILE *f; 78 FILE *f;
77 Ecore_Hash *data, *section = NULL; 79 Eina_Hash *data, *section = NULL;
78 struct stat file_stat; 80 struct stat file_stat;
79 int line_length, left; 81 int line_length, left;
80 82
@@ -100,9 +102,7 @@ efreet_ini_parse(const char *file)
100 return NULL; 102 return NULL;
101 } 103 }
102 104
103 data = ecore_hash_new(ecore_str_hash, ecore_str_compare); 105 data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free));
104 ecore_hash_free_key_cb_set(data, ECORE_FREE_CB(eina_stringshare_del));
105 ecore_hash_free_value_cb_set(data, ECORE_FREE_CB(ecore_hash_destroy));
106 106
107 line_start = buffer; 107 line_start = buffer;
108 while (left > 0) 108 while (left > 0)
@@ -141,7 +141,7 @@ efreet_ini_parse(const char *file)
141 141
142 if (line_start[header_length] == ']') 142 if (line_start[header_length] == ']')
143 { 143 {
144 Ecore_Hash *old; 144 Eina_Hash *old;
145 const char *header; 145 const char *header;
146 146
147 header = alloca(header_length * sizeof(unsigned char)); 147 header = alloca(header_length * sizeof(unsigned char));
@@ -150,18 +150,13 @@ efreet_ini_parse(const char *file)
150 memcpy((char*)header, line_start + 1, header_length - 1); 150 memcpy((char*)header, line_start + 1, header_length - 1);
151 ((char*)header)[header_length - 1] = '\0'; 151 ((char*)header)[header_length - 1] = '\0';
152 152
153 section = ecore_hash_new(ecore_str_hash, ecore_str_compare); 153 section = eina_hash_string_small_new(free);
154 ecore_hash_free_key_cb_set(section,
155 ECORE_FREE_CB(eina_stringshare_del));
156 ecore_hash_free_value_cb_set(section, ECORE_FREE_CB(free));
157 154
158 old = ecore_hash_remove(data, header); 155 eina_hash_del(data, header, NULL);
159// if (old) printf("[efreet] Warning: duplicate section '%s' " 156// if (old) printf("[efreet] Warning: duplicate section '%s' "
160 // "in file '%s'\n", header, file); 157 // "in file '%s'\n", header, file);
161 158
162 IF_FREE_HASH(old); 159 eina_hash_add(data, header, section);
163 ecore_hash_set(data, (void *)eina_stringshare_add(header),
164 section);
165 } 160 }
166 else 161 else
167 { 162 {
@@ -196,16 +191,16 @@ efreet_ini_parse(const char *file)
196 if (!isspace(line_start[key_end])) key_end++; 191 if (!isspace(line_start[key_end])) key_end++;
197 192
198 /* trim whitespace from start of value */ 193 /* trim whitespace from start of value */
199 for (value_start = sep + 1; 194 for (value_start = sep + 1;
200 (value_start < line_length) && 195 (value_start < line_length) &&
201 isspace(line_start[value_start]); ++value_start) 196 isspace(line_start[value_start]); ++value_start)
202 ; 197 ;
203 198
204 /* trim \n off of end of value */ 199 /* trim \n off of end of value */
205 for (value_end = line_length; 200 for (value_end = line_length;
206 (value_end > value_start) && 201 (value_end > value_start) &&
207 ((line_start[value_end] == '\n') || 202 ((line_start[value_end] == '\n') ||
208 (line_start[value_end] == '\r')); --value_end) 203 (line_start[value_end] == '\r')); --value_end)
209 ; 204 ;
210 205
211 if (line_start[value_end] != '\n' 206 if (line_start[value_end] != '\n'
@@ -233,11 +228,8 @@ efreet_ini_parse(const char *file)
233 value_end - value_start); 228 value_end - value_start);
234 ((char*)value)[value_end - value_start] = '\0'; 229 ((char*)value)[value_end - value_start] = '\0';
235 230
236 old = ecore_hash_remove(section, key); 231 eina_hash_del(section, key, NULL);
237 IF_FREE(old); 232 eina_hash_add(section, key, efreet_ini_unescape(value));
238
239 ecore_hash_set(section, (void *)eina_stringshare_add(key),
240 efreet_ini_unescape(value));
241 } 233 }
242// else 234// else
243// { 235// {
@@ -283,7 +275,7 @@ efreet_ini_save(Efreet_Ini *ini, const char *file)
283 275
284 f = fopen(file, "wb"); 276 f = fopen(file, "wb");
285 if (!f) return 0; 277 if (!f) return 0;
286 ecore_hash_for_each_node(ini->data, ECORE_FOR_EACH(efreet_ini_section_save), f); 278 eina_hash_foreach(ini->data, efreet_ini_section_save, f);
287 fclose(f); 279 fclose(f);
288 280
289 return 1; 281 return 1;
@@ -300,7 +292,7 @@ efreet_ini_section_set(Efreet_Ini *ini, const char *section)
300{ 292{
301 if (!ini || !ini->data || !section) return 0; 293 if (!ini || !ini->data || !section) return 0;
302 294
303 ini->section = ecore_hash_get(ini->data, section); 295 ini->section = eina_hash_find(ini->data, section);
304 return (ini->section ? 1 : 0); 296 return (ini->section ? 1 : 0);
305} 297}
306 298
@@ -313,22 +305,16 @@ efreet_ini_section_set(Efreet_Ini *ini, const char *section)
313EAPI void 305EAPI void
314efreet_ini_section_add(Efreet_Ini *ini, const char *section) 306efreet_ini_section_add(Efreet_Ini *ini, const char *section)
315{ 307{
316 Ecore_Hash *hash; 308 Eina_Hash *hash;
317 309
318 if (!ini || !section) return; 310 if (!ini || !section) return;
319 311
320 if (!ini->data) 312 if (!ini->data)
321 { 313 ini->data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free));
322 ini->data = ecore_hash_new(ecore_str_hash, ecore_str_compare); 314 if (eina_hash_find(ini->data, section)) return;
323 ecore_hash_free_key_cb_set(ini->data, ECORE_FREE_CB(eina_stringshare_del));
324 ecore_hash_free_value_cb_set(ini->data, ECORE_FREE_CB(ecore_hash_destroy));
325 }
326 if (ecore_hash_get(ini->data, section)) return;
327 315
328 hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); 316 hash = eina_hash_string_small_new(free);
329 ecore_hash_free_key_cb_set(hash, ECORE_FREE_CB(eina_stringshare_del)); 317 eina_hash_add(ini->data, section, hash);
330 ecore_hash_free_value_cb_set(hash, ECORE_FREE_CB(free));
331 ecore_hash_set(ini->data, (void *)eina_stringshare_add(section), hash);
332} 318}
333 319
334/** 320/**
@@ -343,7 +329,7 @@ efreet_ini_string_get(Efreet_Ini *ini, const char *key)
343{ 329{
344 if (!ini || !key || !ini->section) return NULL; 330 if (!ini || !key || !ini->section) return NULL;
345 331
346 return ecore_hash_get(ini->section, key); 332 return eina_hash_find(ini->section, key);
347} 333}
348 334
349/** 335/**
@@ -358,7 +344,8 @@ efreet_ini_string_set(Efreet_Ini *ini, const char *key, const char *value)
358{ 344{
359 if (!ini || !key || !ini->section) return; 345 if (!ini || !key || !ini->section) return;
360 346
361 ecore_hash_set(ini->section, (void *)eina_stringshare_add(key), strdup(value)); 347 eina_hash_del(ini->section, key, NULL);
348 eina_hash_add(ini->section, key, strdup(value));
362} 349}
363 350
364/** 351/**
@@ -637,15 +624,21 @@ efreet_ini_unescape(const char *str)
637 return buf; 624 return buf;
638} 625}
639 626
640static void 627static Eina_Bool
641efreet_ini_section_save(Ecore_Hash_Node *node, FILE *f) 628efreet_ini_section_save(const Eina_Hash *hash, const void *key, void *value, void *fdata)
642{ 629{
643 fprintf(f, "[%s]\n", (char *)node->key); 630 FILE *f = fdata;
644 ecore_hash_for_each_node(node->value, ECORE_FOR_EACH(efreet_ini_value_save), f); 631
632 fprintf(f, "[%s]\n", (char *)key);
633 eina_hash_foreach(value, efreet_ini_value_save, f);
634 return EINA_TRUE;
645} 635}
646 636
647static void 637static Eina_Bool
648efreet_ini_value_save(Ecore_Hash_Node *node, FILE *f) 638efreet_ini_value_save(const Eina_Hash *hash, const void *key, void *value, void *fdata)
649{ 639{
650 fprintf(f, "%s=%s\n", (char *)node->key, (char *)node->value); 640 FILE *f = fdata;
641
642 fprintf(f, "%s=%s\n", (char *)key, (char *)value);
643 return EINA_TRUE;
651} 644}
diff --git a/legacy/efreet/src/lib/efreet_ini.h b/legacy/efreet/src/lib/efreet_ini.h
index b6614c135d..3f2e462ab6 100644
--- a/legacy/efreet/src/lib/efreet_ini.h
+++ b/legacy/efreet/src/lib/efreet_ini.h
@@ -22,8 +22,8 @@ typedef struct Efreet_Ini Efreet_Ini;
22 */ 22 */
23struct Efreet_Ini 23struct Efreet_Ini
24{ 24{
25 Ecore_Hash *data; /**< Hash of string => (Hash of string => string) */ 25 Eina_Hash *data; /**< Hash of string => (Hash of string => string) */
26 Ecore_Hash *section; /**< currently selected section */ 26 Eina_Hash *section; /**< currently selected section */
27}; 27};
28 28
29EAPI Efreet_Ini *efreet_ini_new(const char *file); 29EAPI Efreet_Ini *efreet_ini_new(const char *file);
diff --git a/legacy/efreet/src/lib/efreet_menu.c b/legacy/efreet/src/lib/efreet_menu.c
index cf9340464f..69508e25bf 100644
--- a/legacy/efreet/src/lib/efreet_menu.c
+++ b/legacy/efreet/src/lib/efreet_menu.c
@@ -51,7 +51,7 @@ struct Efreet_Menu_Internal
51 Ecore_List *applications; /**< applications in this menu */ 51 Ecore_List *applications; /**< applications in this menu */
52 52
53 Ecore_DList *directory_dirs; /**< .directory file directories */ 53 Ecore_DList *directory_dirs; /**< .directory file directories */
54 Ecore_Hash *directory_cache; /**< .directory dirs */ 54 Eina_Hash *directory_cache; /**< .directory dirs */
55 55
56 Ecore_List *moves; /**< List of moves to be handled by the menu */ 56 Ecore_List *moves; /**< List of moves to be handled by the menu */
57 Ecore_List *filters; /**< Include and Exclude filters */ 57 Ecore_List *filters; /**< Include and Exclude filters */
@@ -212,13 +212,13 @@ Ecore_List *efreet_menu_kde_legacy_dirs = NULL; /**< The directories to use for
212static const char *efreet_tag_menu = NULL; 212static const char *efreet_tag_menu = NULL;
213static char *efreet_menu_file = NULL; /**< A menu file set explicityl as default */ 213static char *efreet_menu_file = NULL; /**< A menu file set explicityl as default */
214 214
215static Ecore_Hash *efreet_merged_menus = NULL; 215static Eina_Hash *efreet_merged_menus = NULL;
216static Ecore_Hash *efreet_merged_dirs = NULL; 216static Eina_Hash *efreet_merged_dirs = NULL;
217 217
218static Ecore_Hash *efreet_menu_handle_cbs = NULL; 218static Eina_Hash *efreet_menu_handle_cbs = NULL;
219static Ecore_Hash *efreet_menu_filter_cbs = NULL; 219static Eina_Hash *efreet_menu_filter_cbs = NULL;
220static Ecore_Hash *efreet_menu_move_cbs = NULL; 220static Eina_Hash *efreet_menu_move_cbs = NULL;
221static Ecore_Hash *efreet_menu_layout_cbs = NULL; 221static Eina_Hash *efreet_menu_layout_cbs = NULL;
222 222
223static const char *efreet_menu_prefix_get(void); 223static const char *efreet_menu_prefix_get(void);
224 224
@@ -242,14 +242,14 @@ static int efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal,
242 int legacy); 242 int legacy);
243static int efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal); 243static int efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal);
244static int efreet_menu_directory_dir_scan(const char *path, 244static int efreet_menu_directory_dir_scan(const char *path,
245 const char *relative_path, 245 const char *relative_path,
246 Ecore_Hash *cache); 246 Eina_Hash *cache);
247static Efreet_Desktop *efreet_menu_directory_get(Efreet_Menu_Internal *internal, 247static Efreet_Desktop *efreet_menu_directory_get(Efreet_Menu_Internal *internal,
248 const char *path); 248 const char *path);
249static void efreet_menu_process_filters(Efreet_Menu_Internal *internal, 249static void efreet_menu_process_filters(Efreet_Menu_Internal *internal,
250 unsigned int only_unallocated); 250 unsigned int only_unallocated);
251static void efreet_menu_process_app_pool(Ecore_List *pool, Ecore_List *applications, 251static void efreet_menu_process_app_pool(Ecore_List *pool, Ecore_List *applications,
252 Ecore_Hash *matches, 252 Eina_Hash *matches,
253 Efreet_Menu_Filter *filter, 253 Efreet_Menu_Filter *filter,
254 unsigned int only_unallocated); 254 unsigned int only_unallocated);
255static int efreet_menu_filter_matches(Efreet_Menu_Filter_Op *op, 255static int efreet_menu_filter_matches(Efreet_Menu_Filter_Op *op,
@@ -439,47 +439,54 @@ efreet_menu_init(void)
439 if (!eina_stringshare_init()) return 0; 439 if (!eina_stringshare_init()) return 0;
440 if (!efreet_xml_init()) return 0; 440 if (!efreet_xml_init()) return 0;
441 441
442 efreet_menu_handle_cbs = ecore_hash_new(NULL, NULL); 442 efreet_menu_handle_cbs = eina_hash_string_superfast_new(NULL);
443 efreet_menu_filter_cbs = ecore_hash_new(NULL, NULL); 443 efreet_menu_filter_cbs = eina_hash_string_superfast_new(NULL);
444 efreet_menu_move_cbs = ecore_hash_new(NULL, NULL); 444 efreet_menu_move_cbs = eina_hash_string_superfast_new(NULL);
445 efreet_menu_layout_cbs = ecore_hash_new(NULL, NULL); 445 efreet_menu_layout_cbs = eina_hash_string_superfast_new(NULL);
446 if (!efreet_menu_handle_cbs || !efreet_menu_filter_cbs 446 if (!efreet_menu_handle_cbs || !efreet_menu_filter_cbs
447 || !efreet_menu_move_cbs || !efreet_menu_layout_cbs) 447 || !efreet_menu_move_cbs || !efreet_menu_layout_cbs)
448 return 0; 448 return 0;
449 449
450 ecore_hash_free_key_cb_set(efreet_menu_handle_cbs,
451 ECORE_FREE_CB(eina_stringshare_del));
452 ecore_hash_free_key_cb_set(efreet_menu_filter_cbs,
453 ECORE_FREE_CB(eina_stringshare_del));
454 ecore_hash_free_key_cb_set(efreet_menu_move_cbs,
455 ECORE_FREE_CB(eina_stringshare_del));
456 ecore_hash_free_key_cb_set(efreet_menu_layout_cbs,
457 ECORE_FREE_CB(eina_stringshare_del));
458
459 /* set Menu into it's own so we can check the XML is valid before trying 450 /* set Menu into it's own so we can check the XML is valid before trying
460 * to handle it */ 451 * to handle it */
461 efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key); 452 efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key);
462 453
463 for (i = 0; menu_cbs[i].key != NULL; i++) 454 for (i = 0; menu_cbs[i].key != NULL; i++)
464 ecore_hash_set(efreet_menu_handle_cbs, 455 {
465 (void *)eina_stringshare_add(menu_cbs[i].key), 456 eina_hash_del(efreet_menu_handle_cbs,
466 menu_cbs[i].cb); 457 menu_cbs[i].key,
467 458 NULL);
459 eina_hash_add(efreet_menu_handle_cbs,
460 menu_cbs[i].key,
461 menu_cbs[i].cb);
462 }
468 for (i = 0; filter_cbs[i].key != NULL; i++) 463 for (i = 0; filter_cbs[i].key != NULL; i++)
469 ecore_hash_set(efreet_menu_filter_cbs, 464 {
470 (void *)eina_stringshare_add(filter_cbs[i].key), 465 eina_hash_del(efreet_menu_filter_cbs,
471 filter_cbs[i].cb); 466 filter_cbs[i].key,
472 467 NULL);
468 eina_hash_add(efreet_menu_filter_cbs,
469 filter_cbs[i].key,
470 filter_cbs[i].cb);
471 }
473 for (i = 0; move_cbs[i].key != NULL; i++) 472 for (i = 0; move_cbs[i].key != NULL; i++)
474 ecore_hash_set(efreet_menu_move_cbs, 473 {
475 (void *)eina_stringshare_add(move_cbs[i].key), 474 eina_hash_del(efreet_menu_move_cbs,
476 move_cbs[i].cb); 475 move_cbs[i].key,
477 476 NULL);
477 eina_hash_add(efreet_menu_move_cbs,
478 move_cbs[i].key,
479 move_cbs[i].cb);
480 }
478 for (i = 0; layout_cbs[i].key != NULL; i++) 481 for (i = 0; layout_cbs[i].key != NULL; i++)
479 ecore_hash_set(efreet_menu_layout_cbs, 482 {
480 (void *)eina_stringshare_add(layout_cbs[i].key), 483 eina_hash_del(efreet_menu_layout_cbs,
481 layout_cbs[i].cb); 484 layout_cbs[i].key,
482 485 NULL);
486 eina_hash_add(efreet_menu_layout_cbs,
487 layout_cbs[i].key,
488 layout_cbs[i].cb);
489 }
483 return 1; 490 return 1;
484} 491}
485 492
@@ -651,12 +658,10 @@ efreet_menu_parse(const char *path)
651 } 658 }
652 659
653 IF_FREE_HASH(efreet_merged_menus); 660 IF_FREE_HASH(efreet_merged_menus);
654 efreet_merged_menus = ecore_hash_new(ecore_str_hash, ecore_str_compare); 661 efreet_merged_menus = eina_hash_string_superfast_new(NULL);
655 ecore_hash_free_key_cb_set(efreet_merged_menus, ECORE_FREE_CB(free));
656 662
657 IF_FREE_HASH(efreet_merged_dirs); 663 IF_FREE_HASH(efreet_merged_dirs);
658 efreet_merged_dirs = ecore_hash_new(ecore_str_hash, ecore_str_compare); 664 efreet_merged_dirs = eina_hash_string_superfast_new(NULL);
659 ecore_hash_free_key_cb_set(efreet_merged_dirs, ECORE_FREE_CB(free));
660 665
661 /* split appart the filename and the path */ 666 /* split appart the filename and the path */
662 internal = efreet_menu_internal_new(); 667 internal = efreet_menu_internal_new();
@@ -1065,7 +1070,7 @@ efreet_menu_handle_menu(Efreet_Menu_Internal *internal, Efreet_Xml *xml)
1065 ecore_list_last_goto(xml->children); 1070 ecore_list_last_goto(xml->children);
1066 while ((child = ecore_dlist_previous(xml->children))) 1071 while ((child = ecore_dlist_previous(xml->children)))
1067 { 1072 {
1068 cb = ecore_hash_get(efreet_menu_handle_cbs, child->tag); 1073 cb = eina_hash_find(efreet_menu_handle_cbs, child->tag);
1069 if (cb) 1074 if (cb)
1070 { 1075 {
1071 if (!cb(internal, child)) 1076 if (!cb(internal, child))
@@ -1649,10 +1654,10 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
1649 } 1654 }
1650 1655
1651 /* don't merge the same path twice */ 1656 /* don't merge the same path twice */
1652 if (ecore_hash_get(efreet_merged_menus, realpath)) 1657 if (eina_hash_find(efreet_merged_menus, realpath))
1653 return 1; 1658 return 1;
1654 1659
1655 ecore_hash_set(efreet_merged_menus, strdup(realpath), (void *)1); 1660 eina_hash_add(efreet_merged_menus, realpath, (void *)1);
1656 1661
1657 merge_xml = efreet_xml_new(realpath); 1662 merge_xml = efreet_xml_new(realpath);
1658 FREE(realpath); 1663 FREE(realpath);
@@ -1723,8 +1728,8 @@ efreet_menu_merge_dir(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char
1723 if (!parent || !xml || !path) return 0; 1728 if (!parent || !xml || !path) return 0;
1724 1729
1725 /* check to see if we've merged this directory already */ 1730 /* check to see if we've merged this directory already */
1726 if (ecore_hash_get(efreet_merged_dirs, path)) return 1; 1731 if (eina_hash_find(efreet_merged_dirs, path)) return 1;
1727 ecore_hash_set(efreet_merged_dirs, strdup(path), (void *)1); 1732 eina_hash_add(efreet_merged_dirs, path, (void *)1);
1728 1733
1729 files = opendir(path); 1734 files = opendir(path);
1730 if (!files) return 1; 1735 if (!files) return 1;
@@ -2025,7 +2030,7 @@ efreet_menu_handle_move(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
2025 { 2030 {
2026 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml); 2031 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml);
2027 2032
2028 cb = ecore_hash_get(efreet_menu_move_cbs, child->tag); 2033 cb = eina_hash_find(efreet_menu_move_cbs, child->tag);
2029 if (cb) 2034 if (cb)
2030 { 2035 {
2031 if (!cb(parent, child)) 2036 if (!cb(parent, child))
@@ -2130,7 +2135,7 @@ efreet_menu_handle_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
2130 { 2135 {
2131 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def); 2136 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
2132 2137
2133 cb = ecore_hash_get(efreet_menu_layout_cbs, child->tag); 2138 cb = eina_hash_find(efreet_menu_layout_cbs, child->tag);
2134 if (cb) 2139 if (cb)
2135 { 2140 {
2136 if (!cb(parent, child, 0)) 2141 if (!cb(parent, child, 0))
@@ -2187,7 +2192,7 @@ efreet_menu_handle_default_layout(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
2187 { 2192 {
2188 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def); 2193 int (*cb)(Efreet_Menu_Internal *parent, Efreet_Xml *xml, int def);
2189 2194
2190 cb = ecore_hash_get(efreet_menu_layout_cbs, child->tag); 2195 cb = eina_hash_find(efreet_menu_layout_cbs, child->tag);
2191 if (cb) 2196 if (cb)
2192 { 2197 {
2193 if (!cb(parent, child, 1)) 2198 if (!cb(parent, child, 1))
@@ -2366,7 +2371,7 @@ efreet_menu_handle_filter_op(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml)
2366 { 2371 {
2367 int (*cb)(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml); 2372 int (*cb)(Efreet_Menu_Filter_Op *op, Efreet_Xml *xml);
2368 2373
2369 cb = ecore_hash_get(efreet_menu_filter_cbs, child->tag); 2374 cb = eina_hash_find(efreet_menu_filter_cbs, child->tag);
2370 if (cb) 2375 if (cb)
2371 { 2376 {
2372 if (!cb(op, child)) 2377 if (!cb(op, child))
@@ -2683,9 +2688,9 @@ efreet_menu_process_filters(Efreet_Menu_Internal *internal, unsigned int only_un
2683 2688
2684 if (filter->type == EFREET_MENU_FILTER_INCLUDE) 2689 if (filter->type == EFREET_MENU_FILTER_INCLUDE)
2685 { 2690 {
2686 Ecore_Hash *matches; 2691 Eina_Hash *matches;
2687 2692
2688 matches = ecore_hash_new(ecore_str_hash, ecore_str_compare); 2693 matches = eina_hash_string_superfast_new(NULL);
2689 efreet_menu_process_app_pool(internal->app_pool, internal->applications, 2694 efreet_menu_process_app_pool(internal->app_pool, internal->applications,
2690 matches, filter, internal->only_unallocated); 2695 matches, filter, internal->only_unallocated);
2691 if (internal->parent) 2696 if (internal->parent)
@@ -2699,7 +2704,7 @@ efreet_menu_process_filters(Efreet_Menu_Internal *internal, unsigned int only_un
2699 internal->only_unallocated); 2704 internal->only_unallocated);
2700 } while ((parent = parent->parent)); 2705 } while ((parent = parent->parent));
2701 } 2706 }
2702 ecore_hash_destroy(matches); 2707 eina_hash_free(matches);
2703 } 2708 }
2704 else 2709 else
2705 { 2710 {
@@ -2762,9 +2767,9 @@ efreet_menu_process_filters(Efreet_Menu_Internal *internal, unsigned int only_un
2762 */ 2767 */
2763static 2768static
2764void efreet_menu_process_app_pool(Ecore_List *pool, Ecore_List *applications, 2769void efreet_menu_process_app_pool(Ecore_List *pool, Ecore_List *applications,
2765 Ecore_Hash *matches, 2770 Eina_Hash *matches,
2766 Efreet_Menu_Filter *filter, 2771 Efreet_Menu_Filter *filter,
2767 unsigned int only_unallocated) 2772 unsigned int only_unallocated)
2768{ 2773{
2769 Efreet_Menu_Desktop *md; 2774 Efreet_Menu_Desktop *md;
2770 2775
@@ -2773,12 +2778,12 @@ void efreet_menu_process_app_pool(Ecore_List *pool, Ecore_List *applications,
2773 ecore_list_first_goto(pool); 2778 ecore_list_first_goto(pool);
2774 while ((md = ecore_list_next(pool))) 2779 while ((md = ecore_list_next(pool)))
2775 { 2780 {
2776 if (ecore_hash_get(matches, md->id)) continue; 2781 if (eina_hash_find(matches, md->id)) continue;
2777 if (only_unallocated && md->allocated) continue; 2782 if (only_unallocated && md->allocated) continue;
2778 if (efreet_menu_filter_matches(filter->op, md)) 2783 if (efreet_menu_filter_matches(filter->op, md))
2779 { 2784 {
2780 ecore_list_append(applications, md); 2785 ecore_list_append(applications, md);
2781 ecore_hash_set(matches, (void *)md->id, md); 2786 eina_hash_add(matches, (void *)md->id, md);
2782 md->allocated = 1; 2787 md->allocated = 1;
2783 } 2788 }
2784 } 2789 }
@@ -3459,9 +3464,8 @@ efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
3459 3464
3460 if (internal->directory_dirs) 3465 if (internal->directory_dirs)
3461 { 3466 {
3462 internal->directory_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); 3467 internal->directory_cache =
3463 ecore_hash_free_key_cb_set(internal->directory_cache, ECORE_FREE_CB(free)); 3468 eina_hash_string_superfast_new(EINA_FREE_CB(efreet_desktop_free));
3464 ecore_hash_free_value_cb_set(internal->directory_cache, ECORE_FREE_CB(efreet_desktop_free));
3465 3469
3466 ecore_dlist_last_goto(internal->directory_dirs); 3470 ecore_dlist_last_goto(internal->directory_dirs);
3467 while ((path = ecore_dlist_previous(internal->directory_dirs))) 3471 while ((path = ecore_dlist_previous(internal->directory_dirs)))
@@ -3496,7 +3500,7 @@ efreet_menu_directory_dirs_process(Efreet_Menu_Internal *internal)
3496 */ 3500 */
3497static int 3501static int
3498efreet_menu_directory_dir_scan(const char *path, const char *relative_path, 3502efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
3499 Ecore_Hash *cache) 3503 Eina_Hash *cache)
3500{ 3504{
3501 Efreet_Desktop *desktop; 3505 Efreet_Desktop *desktop;
3502 DIR *files; 3506 DIR *files;
@@ -3531,7 +3535,8 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
3531 continue; 3535 continue;
3532 } 3536 }
3533 3537
3534 ecore_hash_set(cache, (void *)strdup(buf2), desktop); 3538 eina_hash_del(cache, buf2, NULL);
3539 eina_hash_add(cache, buf2, desktop);
3535 } 3540 }
3536 } 3541 }
3537 closedir(files); 3542 closedir(files);
@@ -3553,7 +3558,7 @@ efreet_menu_directory_get(Efreet_Menu_Internal *internal, const char *path)
3553 3558
3554 if (internal->directory_cache) 3559 if (internal->directory_cache)
3555 { 3560 {
3556 dir = ecore_hash_get(internal->directory_cache, path); 3561 dir = eina_hash_find(internal->directory_cache, path);
3557 if (dir) return dir; 3562 if (dir) return dir;
3558 } 3563 }
3559 3564
diff --git a/legacy/efreet/src/lib/efreet_mime.c b/legacy/efreet/src/lib/efreet_mime.c
index e3b6dee6b3..10291ffbd5 100644
--- a/legacy/efreet/src/lib/efreet_mime.c
+++ b/legacy/efreet/src/lib/efreet_mime.c
@@ -9,8 +9,8 @@
9 9
10static Ecore_List *globs = NULL; /* contains Efreet_Mime_Glob structs */ 10static Ecore_List *globs = NULL; /* contains Efreet_Mime_Glob structs */
11static Ecore_List *magics = NULL; /* contains Efreet_Mime_Magic structs */ 11static Ecore_List *magics = NULL; /* contains Efreet_Mime_Magic structs */
12static Ecore_Hash *wild = NULL; /* contains *.ext and mime.types globs*/ 12static Eina_Hash *wild = NULL; /* contains *.ext and mime.types globs*/
13static Ecore_Hash *monitors = NULL; /* contains file monitors */ 13static Eina_Hash *monitors = NULL; /* contains file monitors */
14 14
15/** 15/**
16 * @internal 16 * @internal
@@ -111,10 +111,7 @@ efreet_mime_init(void)
111 111
112 efreet_mime_endianess = efreet_mime_endian_check(); 112 efreet_mime_endianess = efreet_mime_endian_check();
113 113
114 monitors = ecore_hash_new(ecore_str_hash, ecore_str_compare); 114 monitors = eina_hash_string_superfast_new(EINA_FREE_CB(ecore_file_monitor_del));
115 ecore_hash_free_key_cb_set(monitors, ECORE_FREE_CB(free));
116 ecore_hash_free_value_cb_set(monitors,
117 ECORE_FREE_CB(ecore_file_monitor_del));
118 115
119 if (!efreet_mime_init_files()) 116 if (!efreet_mime_init_files())
120 return 0; 117 return 0;
@@ -269,7 +266,7 @@ efreet_mime_globs_type_get(const char *file)
269 while (p) 266 while (p)
270 { 267 {
271 p++; 268 p++;
272 if (p && (mime = ecore_hash_get(wild, p))) return mime; 269 if (p && (mime = eina_hash_find(wild, p))) return mime;
273 p = strchr(p, '.'); 270 p = strchr(p, '.');
274 } 271 }
275 } 272 }
@@ -342,11 +339,14 @@ efreet_mime_monitor_add(const char *file)
342 339
343 /* if this is already in our hash then we're already monitoring so no 340 /* if this is already in our hash then we're already monitoring so no
344 * reason to re-monitor */ 341 * reason to re-monitor */
345 if (ecore_hash_get(monitors, file)) 342 if (eina_hash_find(monitors, file))
346 return; 343 return;
347 344
348 if ((fm = ecore_file_monitor_add(file, efreet_mime_cb_update_file, NULL))) 345 if ((fm = ecore_file_monitor_add(file, efreet_mime_cb_update_file, NULL)))
349 ecore_hash_set(monitors, strdup(file), fm); 346 {
347 eina_hash_del(monitors, file, NULL);
348 eina_hash_add(monitors, file, fm);
349 }
350} 350}
351 351
352/** 352/**
@@ -364,10 +364,7 @@ efreet_mime_load_globs(Ecore_List *datadirs, const char *datahome)
364 const char *datadir = NULL; 364 const char *datadir = NULL;
365 365
366 IF_FREE_HASH(wild); 366 IF_FREE_HASH(wild);
367 wild = ecore_hash_new(ecore_str_hash, ecore_str_compare); 367 wild = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
368 ecore_hash_free_key_cb_set(wild, ECORE_FREE_CB(eina_stringshare_del));
369 ecore_hash_free_value_cb_set(wild,
370 ECORE_FREE_CB(eina_stringshare_del));
371 IF_FREE_LIST(globs); 368 IF_FREE_LIST(globs);
372 globs = ecore_list_new(); 369 globs = ecore_list_new();
373 ecore_list_free_cb_set(globs, efreet_mime_glob_free); 370 ecore_list_free_cb_set(globs, efreet_mime_glob_free);
@@ -688,8 +685,8 @@ efreet_mime_mime_types_load(const char *file)
688 strncpy(ext, pp, (p - pp)); 685 strncpy(ext, pp, (p - pp));
689 ext[p - pp] = 0; 686 ext[p - pp] = 0;
690 687
691 ecore_hash_set(wild, (void*)eina_stringshare_add(ext), 688 eina_hash_del(wild, ext, NULL);
692 (void*)eina_stringshare_add(mimetype)); 689 eina_hash_add(wild, ext, (void*)eina_stringshare_add(mimetype));
693 } 690 }
694 while ((*p != '\n') && (*p != 0)); 691 while ((*p != '\n') && (*p != 0));
695 } 692 }
@@ -746,8 +743,9 @@ efreet_mime_shared_mimeinfo_globs_load(const char *file)
746 743
747 if (ext[0] == '*' && ext[1] == '.') 744 if (ext[0] == '*' && ext[1] == '.')
748 { 745 {
749 ecore_hash_set(wild, (void*)eina_stringshare_add(&(ext[2])), 746 eina_hash_del(wild, &(ext[2]), NULL);
750 (void*)eina_stringshare_add(mimetype)); 747 eina_hash_add(wild, &(ext[2]),
748 (void*)eina_stringshare_add(mimetype));
751 } 749 }
752 else 750 else
753 { 751 {
diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h
index e80670f48c..b2546b62af 100644
--- a/legacy/efreet/src/lib/efreet_private.h
+++ b/legacy/efreet/src/lib/efreet_private.h
@@ -94,7 +94,7 @@
94 */ 94 */
95#define IF_FREE_HASH(x) do { \ 95#define IF_FREE_HASH(x) do { \
96 if (x) { \ 96 if (x) { \
97 Ecore_Hash *__tmp; __tmp = (x); (x) = NULL; ecore_hash_destroy(__tmp); \ 97 Eina_Hash *__tmp; __tmp = (x); (x) = NULL; eina_hash_free(__tmp); \
98 } \ 98 } \
99 (x) = NULL; \ 99 (x) = NULL; \
100} while (0) 100} while (0)
diff --git a/legacy/efreet/src/lib/efreet_utils.c b/legacy/efreet/src/lib/efreet_utils.c
index dbdd83b209..00357d4c05 100644
--- a/legacy/efreet/src/lib/efreet_utils.c
+++ b/legacy/efreet/src/lib/efreet_utils.c
@@ -25,6 +25,7 @@ struct Efreet_Cache_Fill_Dir
25 25
26struct Efreet_Cache_Search 26struct Efreet_Cache_Search
27{ 27{
28 Efreet_Util_Desktop *result;
28 const char *what1; 29 const char *what1;
29 const char *what2; 30 const char *what2;
30}; 31};
@@ -56,16 +57,16 @@ static void efreet_util_cache_remove(const char *path, const char *file_id, int
56static void efreet_util_cache_reload(const char *path, const char *file_id, int priority); 57static void efreet_util_cache_reload(const char *path, const char *file_id, int priority);
57static void efreet_util_cache_dir_free(void *data); 58static void efreet_util_cache_dir_free(void *data);
58 59
59static void efreet_util_cache_search_mime(void *value, void *data); 60static Eina_Bool efreet_util_cache_search_mime(const Eina_Hash *hash, void *value, void *fdata);
60static int efreet_util_cache_search_wm_class(const void *value, const void *data); 61static Eina_Bool efreet_util_cache_search_wm_class(const Eina_Hash *hash, void *value, void *fdata);
61static int efreet_util_cache_search_exec(const void *value, const void *data); 62static Eina_Bool efreet_util_cache_search_exec(const Eina_Hash *hash, void *value, void *fdata);
62static int efreet_util_cache_search_name(const void *value, const void *data); 63static Eina_Bool efreet_util_cache_search_name(const Eina_Hash *hash, void *value, void *fdata);
63static int efreet_util_cache_search_generic_name(const void *value, const void *data); 64static Eina_Bool efreet_util_cache_search_generic_name(const Eina_Hash *hash, void *value, void *fdata);
64 65
65static void efreet_util_cache_search_name_glob(void *value, void *data); 66static Eina_Bool efreet_util_cache_search_name_glob(const Eina_Hash *hash, void *value, void *fdata);
66static void efreet_util_cache_search_exec_glob(void *value, void *data); 67static Eina_Bool efreet_util_cache_search_exec_glob(const Eina_Hash *hash, void *value, void *fdata);
67static void efreet_util_cache_search_generic_name_glob(void *value, void *data); 68static Eina_Bool efreet_util_cache_search_generic_name_glob(const Eina_Hash *hash, void *value, void *fdata);
68static void efreet_util_cache_search_comment_glob(void *value, void *data); 69static Eina_Bool efreet_util_cache_search_comment_glob(const Eina_Hash *hash, void *value, void *fdata);
69 70
70static int efreet_util_glob_match(const char *str, const char *glob); 71static int efreet_util_glob_match(const char *str, const char *glob);
71 72
@@ -81,9 +82,9 @@ static void efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop);
81static void efreet_util_desktop_free(Efreet_Util_Desktop *ud); 82static void efreet_util_desktop_free(Efreet_Util_Desktop *ud);
82static void efreet_event_desktop_change_free(void *data, void *ev); 83static void efreet_event_desktop_change_free(void *data, void *ev);
83 84
84static Ecore_Hash *desktop_by_file_id = NULL; 85static Eina_Hash *desktop_by_file_id = NULL;
85static Ecore_Hash *file_id_by_desktop_path = NULL; 86static Eina_Hash *file_id_by_desktop_path = NULL;
86static Ecore_Hash *desktops_by_category = NULL; 87static Eina_Hash *desktops_by_category = NULL;
87 88
88static Ecore_Idler *idler = NULL; 89static Ecore_Idler *idler = NULL;
89static Efreet_Cache_Fill *fill = NULL; 90static Efreet_Cache_Fill *fill = NULL;
@@ -106,17 +107,9 @@ efreet_util_init(void)
106 EFREET_EVENT_DESKTOP_LIST_CHANGE = ecore_event_type_new(); 107 EFREET_EVENT_DESKTOP_LIST_CHANGE = ecore_event_type_new();
107 if (!EFREET_EVENT_DESKTOP_CHANGE) 108 if (!EFREET_EVENT_DESKTOP_CHANGE)
108 EFREET_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); 109 EFREET_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
109 desktop_by_file_id = ecore_hash_new(ecore_str_hash, ecore_str_compare); 110 desktop_by_file_id = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_util_desktop_free));
110 ecore_hash_free_key_cb_set(desktop_by_file_id, ECORE_FREE_CB(eina_stringshare_del)); 111 file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
111 ecore_hash_free_value_cb_set(desktop_by_file_id, ECORE_FREE_CB(efreet_util_desktop_free)); 112 desktops_by_category = eina_hash_string_superfast_new(EINA_FREE_CB(ecore_list_destroy));
112
113 file_id_by_desktop_path = ecore_hash_new(ecore_str_hash, ecore_str_compare);
114 ecore_hash_free_key_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(eina_stringshare_del));
115 ecore_hash_free_value_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(eina_stringshare_del));
116
117 desktops_by_category = ecore_hash_new(ecore_str_hash, ecore_str_compare);
118 ecore_hash_free_key_cb_set(desktops_by_category, ECORE_FREE_CB(eina_stringshare_del));
119 ecore_hash_free_value_cb_set(desktops_by_category, ECORE_FREE_CB(ecore_list_destroy));
120 113
121 monitors = ecore_list_new(); 114 monitors = ecore_list_new();
122 ecore_list_free_cb_set(monitors, efreet_util_monitor_free); 115 ecore_list_free_cb_set(monitors, efreet_util_monitor_free);
@@ -206,7 +199,7 @@ efreet_util_path_to_file_id(const char *path)
206 const char *file_id = NULL; 199 const char *file_id = NULL;
207 200
208 if (!path) return NULL; 201 if (!path) return NULL;
209 file_id = ecore_hash_get(file_id_by_desktop_path, path); 202 file_id = eina_hash_find(file_id_by_desktop_path, path);
210 if (file_id) return file_id; 203 if (file_id) return file_id;
211 204
212 base = efreet_util_path_in_default("applications", path); 205 base = efreet_util_path_in_default("applications", path);
@@ -234,8 +227,8 @@ efreet_util_path_to_file_id(const char *path)
234 free(base); 227 free(base);
235 file_id = eina_stringshare_add(tmp); 228 file_id = eina_stringshare_add(tmp);
236 free(tmp); 229 free(tmp);
237 ecore_hash_set(file_id_by_desktop_path, (void *)eina_stringshare_add(path), 230 eina_hash_del(file_id_by_desktop_path, path, NULL);
238 (void *)file_id); 231 eina_hash_add(file_id_by_desktop_path, path, (void *)file_id);
239 return file_id; 232 return file_id;
240} 233}
241 234
@@ -243,11 +236,15 @@ EAPI Ecore_List *
243efreet_util_desktop_mime_list(const char *mime) 236efreet_util_desktop_mime_list(const char *mime)
244{ 237{
245 Efreet_Cache_Search_List search; 238 Efreet_Cache_Search_List search;
239 Eina_Iterator *it;
246 240
247 search.list = ecore_list_new(); 241 search.list = ecore_list_new();
248 search.what = eina_stringshare_add(mime); 242 search.what = eina_stringshare_add(mime);
249 243
250 ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_mime, &search); 244 it = eina_hash_iterator_data_new(desktop_by_file_id);
245 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_mime), &search);
246 eina_iterator_free(it);
247
251 eina_stringshare_del(search.what); 248 eina_stringshare_del(search.what);
252 249
253 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list); 250 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
@@ -259,11 +256,18 @@ efreet_util_desktop_wm_class_find(const char *wmname, const char *wmclass)
259{ 256{
260 Efreet_Cache_Search search; 257 Efreet_Cache_Search search;
261 Efreet_Util_Desktop *ud; 258 Efreet_Util_Desktop *ud;
259 Eina_Iterator *it;
262 260
263 if ((!wmname) && (!wmclass)) return NULL; 261 if ((!wmname) && (!wmclass)) return NULL;
264 search.what1 = wmname; 262 search.what1 = wmname;
265 search.what2 = wmclass; 263 search.what2 = wmclass;
266 ud = ecore_hash_find(desktop_by_file_id, efreet_util_cache_search_wm_class, &search); 264 search.result = NULL;
265
266 it = eina_hash_iterator_data_new(desktop_by_file_id);
267 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_wm_class), &search);
268 eina_iterator_free(it);
269 ud = search.result;
270
267 if (ud) return ud->desktop; 271 if (ud) return ud->desktop;
268 return NULL; 272 return NULL;
269} 273}
@@ -278,7 +282,7 @@ efreet_util_desktop_file_id_find(const char *file_id)
278 int priority = 0; 282 int priority = 0;
279 283
280 if (!file_id) return NULL; 284 if (!file_id) return NULL;
281 ud = ecore_hash_get(desktop_by_file_id, file_id); 285 ud = eina_hash_find(desktop_by_file_id, file_id);
282 if (ud) return ud->desktop; 286 if (ud) return ud->desktop;
283 287
284 dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(), 288 dirs = efreet_default_dirs_get(efreet_data_home_get(), efreet_data_dirs_get(),
@@ -315,7 +319,8 @@ efreet_util_desktop_file_id_find(const char *file_id)
315 ud->priority = priority; 319 ud->priority = priority;
316 ud->desktop = desktop; 320 ud->desktop = desktop;
317 321
318 ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud); 322 eina_hash_del(desktop_by_file_id, file_id, NULL);
323 eina_hash_add(desktop_by_file_id, file_id, ud);
319 efreet_util_desktops_by_category_add(desktop); 324 efreet_util_desktops_by_category_add(desktop);
320 325
321 ev = NEW(Efreet_Event_Desktop_Change, 1); 326 ev = NEW(Efreet_Event_Desktop_Change, 1);
@@ -331,13 +336,18 @@ EAPI Efreet_Desktop *
331efreet_util_desktop_exec_find(const char *exec) 336efreet_util_desktop_exec_find(const char *exec)
332{ 337{
333 Efreet_Cache_Search search; 338 Efreet_Cache_Search search;
334 Efreet_Util_Desktop *ud; 339 Eina_Iterator *it;
335 340
336 if (!exec) return NULL; 341 if (!exec) return NULL;
337 search.what1 = exec; 342 search.what1 = exec;
338 search.what2 = NULL; 343 search.what2 = NULL;
339 ud = ecore_hash_find(desktop_by_file_id, efreet_util_cache_search_exec, &search); 344 search.result = NULL;
340 if (ud) return ud->desktop; 345
346 it = eina_hash_iterator_data_new(desktop_by_file_id);
347 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec), &search);
348 eina_iterator_free(it);
349
350 if (search.result) return search.result->desktop;
341 return NULL; 351 return NULL;
342} 352}
343 353
@@ -345,13 +355,18 @@ EAPI Efreet_Desktop *
345efreet_util_desktop_name_find(const char *name) 355efreet_util_desktop_name_find(const char *name)
346{ 356{
347 Efreet_Cache_Search search; 357 Efreet_Cache_Search search;
348 Efreet_Util_Desktop *ud; 358 Eina_Iterator *it;
349 359
350 if (!name) return NULL; 360 if (!name) return NULL;
351 search.what1 = name; 361 search.what1 = name;
352 search.what2 = NULL; 362 search.what2 = NULL;
353 ud = ecore_hash_find(desktop_by_file_id, efreet_util_cache_search_name, &search); 363 search.result = NULL;
354 if (ud) return ud->desktop; 364
365 it = eina_hash_iterator_data_new(desktop_by_file_id);
366 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name), &search);
367 eina_iterator_free(it);
368
369 if (search.result) return search.result->desktop;
355 return NULL; 370 return NULL;
356} 371}
357 372
@@ -359,13 +374,18 @@ EAPI Efreet_Desktop *
359efreet_util_desktop_generic_name_find(const char *generic_name) 374efreet_util_desktop_generic_name_find(const char *generic_name)
360{ 375{
361 Efreet_Cache_Search search; 376 Efreet_Cache_Search search;
362 Efreet_Util_Desktop *ud; 377 Eina_Iterator *it;
363 378
364 if (!generic_name) return NULL; 379 if (!generic_name) return NULL;
365 search.what1 = generic_name; 380 search.what1 = generic_name;
366 search.what2 = NULL; 381 search.what2 = NULL;
367 ud = ecore_hash_find(desktop_by_file_id, efreet_util_cache_search_generic_name, &search); 382 search.result = NULL;
368 if (ud) return ud->desktop; 383
384 it = eina_hash_iterator_data_new(desktop_by_file_id);
385 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name), &search);
386 eina_iterator_free(it);
387
388 if (search.result) return search.result->desktop;
369 return NULL; 389 return NULL;
370} 390}
371 391
@@ -373,11 +393,14 @@ EAPI Ecore_List *
373efreet_util_desktop_name_glob_list(const char *glob) 393efreet_util_desktop_name_glob_list(const char *glob)
374{ 394{
375 Efreet_Cache_Search_List search; 395 Efreet_Cache_Search_List search;
396 Eina_Iterator *it;
376 397
377 search.list = ecore_list_new(); 398 search.list = ecore_list_new();
378 search.what = glob; 399 search.what = glob;
379 400
380 ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_name_glob, &search); 401 it = eina_hash_iterator_data_new(desktop_by_file_id);
402 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_name_glob), &search);
403 eina_iterator_free(it);
381 404
382 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list); 405 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
383 return search.list; 406 return search.list;
@@ -387,11 +410,14 @@ EAPI Ecore_List *
387efreet_util_desktop_exec_glob_list(const char *glob) 410efreet_util_desktop_exec_glob_list(const char *glob)
388{ 411{
389 Efreet_Cache_Search_List search; 412 Efreet_Cache_Search_List search;
413 Eina_Iterator *it;
390 414
391 search.list = ecore_list_new(); 415 search.list = ecore_list_new();
392 search.what = glob; 416 search.what = glob;
393 417
394 ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_exec_glob, &search); 418 it = eina_hash_iterator_data_new(desktop_by_file_id);
419 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_exec_glob), &search);
420 eina_iterator_free(it);
395 421
396 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list); 422 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
397 return search.list; 423 return search.list;
@@ -401,11 +427,14 @@ EAPI Ecore_List *
401efreet_util_desktop_generic_name_glob_list(const char *glob) 427efreet_util_desktop_generic_name_glob_list(const char *glob)
402{ 428{
403 Efreet_Cache_Search_List search; 429 Efreet_Cache_Search_List search;
430 Eina_Iterator *it;
404 431
405 search.list = ecore_list_new(); 432 search.list = ecore_list_new();
406 search.what = glob; 433 search.what = glob;
407 434
408 ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_generic_name_glob, &search); 435 it = eina_hash_iterator_data_new(desktop_by_file_id);
436 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_generic_name_glob), &search);
437 eina_iterator_free(it);
409 438
410 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list); 439 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
411 return search.list; 440 return search.list;
@@ -415,11 +444,14 @@ EAPI Ecore_List *
415efreet_util_desktop_comment_glob_list(const char *glob) 444efreet_util_desktop_comment_glob_list(const char *glob)
416{ 445{
417 Efreet_Cache_Search_List search; 446 Efreet_Cache_Search_List search;
447 Eina_Iterator *it;
418 448
419 search.list = ecore_list_new(); 449 search.list = ecore_list_new();
420 search.what = glob; 450 search.what = glob;
421 451
422 ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_comment_glob, &search); 452 it = eina_hash_iterator_data_new(desktop_by_file_id);
453 eina_iterator_foreach(it, EINA_EACH(efreet_util_cache_search_comment_glob), &search);
454 eina_iterator_free(it);
423 455
424 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list); 456 if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
425 return search.list; 457 return search.list;
@@ -434,7 +466,18 @@ efreet_util_desktop_comment_glob_list(const char *glob)
434EAPI Ecore_List * 466EAPI Ecore_List *
435efreet_util_desktop_categories_list(void) 467efreet_util_desktop_categories_list(void)
436{ 468{
437 return ecore_hash_keys(desktops_by_category); 469 Eina_Iterator *it;
470 Ecore_List *list;
471
472 list = ecore_list_new();
473 if (list)
474 {
475 it = eina_hash_iterator_key_new(desktops_by_category);
476 eina_iterator_foreach(it, EINA_EACH(desktops_by_category), list);
477 eina_iterator_free(it);
478 }
479
480 return list;
438} 481}
439 482
440/** 483/**
@@ -448,21 +491,19 @@ efreet_util_desktop_categories_list(void)
448EAPI Ecore_List * 491EAPI Ecore_List *
449efreet_util_desktop_category_list(const char *category) 492efreet_util_desktop_category_list(const char *category)
450{ 493{
451 return ecore_hash_get(desktops_by_category, category); 494 return eina_hash_find(desktops_by_category, category);
452} 495}
453 496
454#if 0 497#if 0
455static void 498static Eina_Bool
456dump(void *value, void *data __UNUSED__) 499dump(Eina_Hash *hash, const char *key, void *value, __UNUSED__ void *data)
457{ 500{
458 Ecore_Hash_Node *node; 501 printf("%s -> %p\n", (char *)key, value);
459 node = value;
460 printf("%s -> %p\n", (char *)node->key, node->value);
461} 502}
462#endif 503#endif
463 504
464static int 505static int
465efreet_util_cache_fill(void *data __UNUSED__) 506efreet_util_cache_fill(__UNUSED__ void *data)
466{ 507{
467 struct dirent *file = NULL; 508 struct dirent *file = NULL;
468 double start; 509 double start;
@@ -487,9 +528,9 @@ efreet_util_cache_fill(void *data __UNUSED__)
487 idler = NULL; 528 idler = NULL;
488 fill = NULL; 529 fill = NULL;
489#if 0 530#if 0
490 ecore_hash_for_each_node(desktop_by_file_id, dump, NULL); 531 eina_hash_foreach(desktop_by_file_id, dump, NULL);
491 ecore_hash_for_each_node(file_id_by_desktop_path, dump, NULL); 532 eina_hash_foreach(file_id_by_desktop_path, dump, NULL);
492 printf("%d\n", ecore_hash_count(desktop_by_file_id)); 533 printf("%d\n", eina_hash_population(desktop_by_file_id));
493#endif 534#endif
494 ecore_event_add(EFREET_EVENT_DESKTOP_LIST_CHANGE, NULL, NULL, NULL); 535 ecore_event_add(EFREET_EVENT_DESKTOP_LIST_CHANGE, NULL, NULL, NULL);
495 536
@@ -567,19 +608,22 @@ efreet_util_cache_add(const char *path, const char *file_id, int priority, int e
567 return; 608 return;
568 } 609 }
569 610
570 if (!ecore_hash_get(file_id_by_desktop_path, desktop->orig_path)) 611 if (!eina_hash_find(file_id_by_desktop_path, desktop->orig_path))
571 ecore_hash_set(file_id_by_desktop_path, 612 {
572 (void *)eina_stringshare_add(desktop->orig_path), 613 eina_hash_add(file_id_by_desktop_path,
573 (void *)eina_stringshare_add(file_id)); 614 desktop->orig_path,
615 (void *)eina_stringshare_add(file_id));
574 616
575 ud = ecore_hash_get(desktop_by_file_id, file_id); 617 }
618
619 ud = eina_hash_find(desktop_by_file_id, file_id);
576 if (!ud) 620 if (!ud)
577 { 621 {
578 ud = NEW(Efreet_Util_Desktop, 1); 622 ud = NEW(Efreet_Util_Desktop, 1);
579 ud->priority = priority; 623 ud->priority = priority;
580 ud->desktop = desktop; 624 ud->desktop = desktop;
581 625
582 ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud); 626 eina_hash_add(desktop_by_file_id, file_id, ud);
583 efreet_util_desktops_by_category_add(desktop); 627 efreet_util_desktops_by_category_add(desktop);
584 628
585 if (event) 629 if (event)
@@ -630,12 +674,11 @@ efreet_util_cache_remove(const char *path, const char *file_id, int priority)
630 674
631 ext = strrchr(path, '.'); 675 ext = strrchr(path, '.');
632 if (!ext || strcmp(ext, ".desktop")) return; 676 if (!ext || strcmp(ext, ".desktop")) return;
633 ud = ecore_hash_get(desktop_by_file_id, file_id); 677 ud = eina_hash_find(desktop_by_file_id, file_id);
634 if (ud && (ud->priority >= priority)) 678 if (ud && (ud->priority >= priority))
635 { 679 {
636 Efreet_Event_Desktop_Change *ev; 680 Efreet_Event_Desktop_Change *ev;
637 681
638 ecore_hash_remove(desktop_by_file_id, file_id);
639 efreet_util_desktops_by_category_remove(ud->desktop); 682 efreet_util_desktops_by_category_remove(ud->desktop);
640 683
641 ev = NEW(Efreet_Event_Desktop_Change, 1); 684 ev = NEW(Efreet_Event_Desktop_Change, 1);
@@ -644,13 +687,13 @@ efreet_util_cache_remove(const char *path, const char *file_id, int priority)
644 ev->change = EFREET_DESKTOP_CHANGE_REMOVE; 687 ev->change = EFREET_DESKTOP_CHANGE_REMOVE;
645 ecore_event_add(EFREET_EVENT_DESKTOP_CHANGE, ev, efreet_event_desktop_change_free, NULL); 688 ecore_event_add(EFREET_EVENT_DESKTOP_CHANGE, ev, efreet_event_desktop_change_free, NULL);
646 689
647 efreet_util_desktop_free(ud); 690 eina_hash_del(desktop_by_file_id, file_id, ud);
648 691
649 /* This call will search application dirs and add the file to cache if it 692 /* This call will search application dirs and add the file to cache if it
650 * exists. */ 693 * exists. */
651 efreet_util_desktop_file_id_find(file_id); 694 efreet_util_desktop_file_id_find(file_id);
652 } 695 }
653 ecore_hash_remove(file_id_by_desktop_path, path); 696 eina_hash_del(file_id_by_desktop_path, path, eina_hash_find(file_id_by_desktop_path, path));
654} 697}
655 698
656static void 699static void
@@ -670,7 +713,7 @@ efreet_util_cache_reload(const char *path, const char *file_id, int priority)
670 return; 713 return;
671 } 714 }
672 715
673 ud = ecore_hash_get(desktop_by_file_id, file_id); 716 ud = eina_hash_find(desktop_by_file_id, file_id);
674 if (ud) 717 if (ud)
675 { 718 {
676 Efreet_Event_Desktop_Change *ev; 719 Efreet_Event_Desktop_Change *ev;
@@ -703,7 +746,7 @@ efreet_util_cache_reload(const char *path, const char *file_id, int priority)
703 ud->priority = priority; 746 ud->priority = priority;
704 ud->desktop = desktop; 747 ud->desktop = desktop;
705 748
706 ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud); 749 eina_hash_add(desktop_by_file_id, file_id, ud);
707 efreet_util_desktops_by_category_remove(ud->desktop); 750 efreet_util_desktops_by_category_remove(ud->desktop);
708 efreet_util_desktops_by_category_add(desktop); 751 efreet_util_desktops_by_category_add(desktop);
709 752
@@ -726,19 +769,17 @@ efreet_util_cache_dir_free(void *data)
726 free(dir); 769 free(dir);
727} 770}
728 771
729static void 772static Eina_Bool
730efreet_util_cache_search_mime(void *value, void *data) 773efreet_util_cache_search_mime(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
731{ 774{
732 Ecore_Hash_Node *node;
733 Efreet_Cache_Search_List *search; 775 Efreet_Cache_Search_List *search;
734 Efreet_Util_Desktop *ud; 776 Efreet_Util_Desktop *ud;
735 const char *mime; 777 const char *mime;
736 778
737 node = value; 779 search = fdata;
738 search = data; 780 ud = value;
739 ud = node->value;
740 781
741 if (!ud->desktop->mime_types) return; 782 if (!ud->desktop->mime_types) return EINA_FALSE;
742 ecore_list_first_goto(ud->desktop->mime_types); 783 ecore_list_first_goto(ud->desktop->mime_types);
743 while ((mime = ecore_list_next(ud->desktop->mime_types))) 784 while ((mime = ecore_list_next(ud->desktop->mime_types)))
744 { 785 {
@@ -748,109 +789,125 @@ efreet_util_cache_search_mime(void *value, void *data)
748 break; 789 break;
749 } 790 }
750 } 791 }
792 return EINA_TRUE;
751} 793}
752 794
753static int 795static Eina_Bool
754efreet_util_cache_search_wm_class(const void *value, const void *data) 796efreet_util_cache_search_wm_class(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
755{ 797{
756 const Efreet_Cache_Search *search; 798 Efreet_Cache_Search *search;
757 const Efreet_Util_Desktop *ud; 799 Efreet_Util_Desktop *ud;
758 800
759 ud = value; 801 ud = value;
760 search = data; 802 search = fdata;
761 803
762 if (!ud->desktop->startup_wm_class) return 1; 804 if (!ud->desktop->startup_wm_class) return EINA_TRUE;
763 if ((search->what2) && (!strcmp(ud->desktop->startup_wm_class, search->what2))) 805 if ((search->what2) && (!strcmp(ud->desktop->startup_wm_class, search->what2)))
764 return 0; 806 {
807 search->result = ud;
808 return EINA_FALSE;
809 }
765 else if ((search->what1) && (!strcmp(ud->desktop->startup_wm_class, search->what1))) 810 else if ((search->what1) && (!strcmp(ud->desktop->startup_wm_class, search->what1)))
766 return 0; 811 {
767 return 1; 812 search->result = ud;
813 return EINA_FALSE;
814 }
815 return EINA_TRUE;
768} 816}
769 817
770static int 818static Eina_Bool
771efreet_util_cache_search_exec(const void *value, const void *data) 819efreet_util_cache_search_exec(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
772{ 820{
773 const Efreet_Cache_Search *search; 821 Efreet_Cache_Search *search;
774 const Efreet_Util_Desktop *ud; 822 Efreet_Util_Desktop *ud;
775 char *exec; 823 char *exec;
776 const char *file; 824 const char *file;
777 825
778 ud = value; 826 ud = value;
779 search = data; 827 search = fdata;
780 828
781 if (!ud->desktop->exec) return 1; 829 if (!ud->desktop->exec) return EINA_TRUE;
782 exec = ecore_file_app_exe_get(ud->desktop->exec); 830 exec = ecore_file_app_exe_get(ud->desktop->exec);
783 if (!exec) return 1; 831 if (!exec) return EINA_TRUE;
784 if (!strcmp(exec, search->what1)) 832 if (!strcmp(exec, search->what1))
785 { 833 {
786 free(exec); 834 free(exec);
787 return 0; 835 search->result = ud;
836 return EINA_FALSE;
788 } 837 }
789 838
790 file = ecore_file_file_get(exec); 839 file = ecore_file_file_get(exec);
791 if (file && !strcmp(file, search->what1)) 840 if (file && !strcmp(file, search->what1))
792 { 841 {
793 free(exec); 842 free(exec);
794 return 0; 843 search->result = ud;
844 return EINA_FALSE;
795 } 845 }
796 free(exec); 846 free(exec);
797 return 1; 847 return EINA_TRUE;
798} 848}
799 849
800static int 850static Eina_Bool
801efreet_util_cache_search_name(const void *value, const void *data) 851efreet_util_cache_search_name(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
802{ 852{
803 const Efreet_Cache_Search *search; 853 Efreet_Cache_Search *search;
804 const Efreet_Util_Desktop *ud; 854 Efreet_Util_Desktop *ud;
805 855
806 ud = value; 856 ud = value;
807 search = data; 857 search = fdata;
808 858
809 if (!ud->desktop->name) return 1; 859 if (!ud->desktop->name) return EINA_TRUE;
810 return strcmp(ud->desktop->name, search->what1); 860 if (!strcmp(ud->desktop->name, search->what1))
861 {
862 search->result = ud;
863 return EINA_FALSE;
864 }
865 return EINA_TRUE;
811} 866}
812 867
813static int 868static Eina_Bool
814efreet_util_cache_search_generic_name(const void *value, const void *data) 869efreet_util_cache_search_generic_name(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
815{ 870{
816 const Efreet_Cache_Search *search; 871 Efreet_Cache_Search *search;
817 const Efreet_Util_Desktop *ud; 872 Efreet_Util_Desktop *ud;
818 873
819 ud = value; 874 ud = value;
820 search = data; 875 search = fdata;
821 876
822 if (!ud->desktop->generic_name) return 1; 877 if (!ud->desktop->generic_name) return EINA_TRUE;
823 return strcmp(ud->desktop->generic_name, search->what1); 878 if (!strcmp(ud->desktop->generic_name, search->what1))
879 {
880 search->result = ud;
881 return EINA_FALSE;
882 }
883 return EINA_TRUE;
824} 884}
825 885
826static void 886static Eina_Bool
827efreet_util_cache_search_name_glob(void *value, void *data) 887efreet_util_cache_search_name_glob(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
828{ 888{
829 Ecore_Hash_Node *node;
830 Efreet_Cache_Search_List *search; 889 Efreet_Cache_Search_List *search;
831 Efreet_Util_Desktop *ud; 890 Efreet_Util_Desktop *ud;
832 891
833 node = value; 892 search = fdata;
834 search = data; 893 ud = value;
835 ud = node->value;
836 894
837 if (efreet_util_glob_match(ud->desktop->name, search->what)) 895 if (efreet_util_glob_match(ud->desktop->name, search->what))
838 ecore_list_append(search->list, ud->desktop); 896 ecore_list_append(search->list, ud->desktop);
897 return EINA_TRUE;
839} 898}
840 899
841static void 900static Eina_Bool
842efreet_util_cache_search_exec_glob(void *value, void *data) 901efreet_util_cache_search_exec_glob(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
843{ 902{
844 Ecore_Hash_Node *node;
845 Efreet_Cache_Search_List *search; 903 Efreet_Cache_Search_List *search;
846 Efreet_Util_Desktop *ud; 904 Efreet_Util_Desktop *ud;
847 char *exec; 905 char *exec;
848 906
849 node = value; 907 search = fdata;
850 search = data; 908 ud = value;
851 ud = node->value;
852 909
853 if (!ud->desktop->exec) return; 910 if (!ud->desktop->exec) return EINA_FALSE;
854 exec = ecore_file_app_exe_get(ud->desktop->exec); 911 exec = ecore_file_app_exe_get(ud->desktop->exec);
855 if (exec) 912 if (exec)
856 { 913 {
@@ -858,36 +915,35 @@ efreet_util_cache_search_exec_glob(void *value, void *data)
858 ecore_list_append(search->list, ud->desktop); 915 ecore_list_append(search->list, ud->desktop);
859 free(exec); 916 free(exec);
860 } 917 }
918 return EINA_TRUE;
861} 919}
862 920
863static void 921static Eina_Bool
864efreet_util_cache_search_generic_name_glob(void *value, void *data) 922efreet_util_cache_search_generic_name_glob(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
865{ 923{
866 Ecore_Hash_Node *node;
867 Efreet_Cache_Search_List *search; 924 Efreet_Cache_Search_List *search;
868 Efreet_Util_Desktop *ud; 925 Efreet_Util_Desktop *ud;
869 926
870 node = value; 927 search = fdata;
871 search = data; 928 ud = value;
872 ud = node->value;
873 929
874 if (efreet_util_glob_match(ud->desktop->generic_name, search->what)) 930 if (efreet_util_glob_match(ud->desktop->generic_name, search->what))
875 ecore_list_append(search->list, ud->desktop); 931 ecore_list_append(search->list, ud->desktop);
932 return EINA_TRUE;
876} 933}
877 934
878static void 935static Eina_Bool
879efreet_util_cache_search_comment_glob(void *value, void *data) 936efreet_util_cache_search_comment_glob(__UNUSED__ const Eina_Hash *hash, void *value, void *fdata)
880{ 937{
881 Ecore_Hash_Node *node;
882 Efreet_Cache_Search_List *search; 938 Efreet_Cache_Search_List *search;
883 Efreet_Util_Desktop *ud; 939 Efreet_Util_Desktop *ud;
884 940
885 node = value; 941 search = fdata;
886 search = data; 942 ud = value;
887 ud = node->value;
888 943
889 if (efreet_util_glob_match(ud->desktop->comment, search->what)) 944 if (efreet_util_glob_match(ud->desktop->comment, search->what))
890 ecore_list_append(search->list, ud->desktop); 945 ecore_list_append(search->list, ud->desktop);
946 return EINA_TRUE;
891} 947}
892 948
893static int 949static int
@@ -1044,12 +1100,11 @@ efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
1044 while ((category = ecore_list_next(desktop->categories))) 1100 while ((category = ecore_list_next(desktop->categories)))
1045 { 1101 {
1046 Ecore_List *list; 1102 Ecore_List *list;
1047 list = ecore_hash_get(desktops_by_category, category); 1103 list = eina_hash_find(desktops_by_category, category);
1048 if (!list) 1104 if (!list)
1049 { 1105 {
1050 list = ecore_list_new(); 1106 list = ecore_list_new();
1051 ecore_hash_set(desktops_by_category, 1107 eina_hash_add(desktops_by_category, category, list);
1052 (void *)eina_stringshare_add(category), list);
1053 } 1108 }
1054 if (!ecore_list_goto(list, desktop)) 1109 if (!ecore_list_goto(list, desktop))
1055 ecore_list_append(list, desktop); 1110 ecore_list_append(list, desktop);
@@ -1067,15 +1122,12 @@ efreet_util_desktops_by_category_remove(Efreet_Desktop *desktop)
1067 while ((category = ecore_list_next(desktop->categories))) 1122 while ((category = ecore_list_next(desktop->categories)))
1068 { 1123 {
1069 Ecore_List *list; 1124 Ecore_List *list;
1070 list = ecore_hash_get(desktops_by_category, category); 1125 list = eina_hash_find(desktops_by_category, category);
1071 if (!list) continue; 1126 if (!list) continue;
1072 if (ecore_list_goto(list, desktop)) 1127 if (ecore_list_goto(list, desktop))
1073 ecore_list_remove(list); 1128 ecore_list_remove(list);
1074 if (ecore_list_empty_is(list)) 1129 if (ecore_list_empty_is(list))
1075 { 1130 eina_hash_del(desktops_by_category, category, list);
1076 ecore_hash_remove(desktops_by_category, category);
1077 ecore_list_destroy(list);
1078 }
1079 } 1131 }
1080} 1132}
1081 1133