summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2010-12-11 20:37:17 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2010-12-11 20:37:17 +0000
commit8babc062be951b774110468e272fdb688541965f (patch)
tree0cfc57b48d2cbf828bb44240448ce49713d15e00 /legacy
parentd8765063db07cf941f3361a64958af5d70e54968 (diff)
delay closing of icon theme cache
SVN revision: 55502
Diffstat (limited to 'legacy')
-rw-r--r--legacy/efreet/src/lib/efreet_cache.c36
-rw-r--r--legacy/efreet/src/lib/efreet_icon.c16
-rw-r--r--legacy/efreet/src/lib/efreet_private.h5
3 files changed, 34 insertions, 23 deletions
diff --git a/legacy/efreet/src/lib/efreet_cache.c b/legacy/efreet/src/lib/efreet_cache.c
index 0cdd014142..28f84f9ff1 100644
--- a/legacy/efreet/src/lib/efreet_cache.c
+++ b/legacy/efreet/src/lib/efreet_cache.c
@@ -90,6 +90,9 @@ static void desktop_cache_update_cache_job(void *data);
90static void icon_cache_update_cache_job(void *data); 90static void icon_cache_update_cache_job(void *data);
91#endif 91#endif
92static void desktop_cache_update_free(void *data, void *ev); 92static void desktop_cache_update_free(void *data, void *ev);
93#ifdef ICON_CACHE
94static void icon_cache_update_free(void *data, void *ev);
95#endif
93 96
94EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0; 97EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0;
95EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0; 98EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0;
@@ -151,7 +154,6 @@ efreet_cache_shutdown(void)
151 theme_name = NULL; 154 theme_name = NULL;
152 155
153 icon_cache = efreet_cache_close(icon_cache); 156 icon_cache = efreet_cache_close(icon_cache);
154 efreet_icon_themes_flush();
155 icon_theme_cache = efreet_cache_close(icon_theme_cache); 157 icon_theme_cache = efreet_cache_close(icon_theme_cache);
156#endif 158#endif
157 159
@@ -836,6 +838,11 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
836#ifdef ICON_CACHE 838#ifdef ICON_CACHE
837 else if (!strcmp(file, "icon_data.update")) 839 else if (!strcmp(file, "icon_data.update"))
838 { 840 {
841 ev = NEW(Efreet_Event_Cache_Update, 1);
842 if (!ev) goto error;
843 d = NEW(Efreet_Old_Cache, 1);
844 if (!d) goto error;
845
839 if (theme_cache) 846 if (theme_cache)
840 { 847 {
841 INFO("Destorying theme cache due to cache change."); 848 INFO("Destorying theme cache due to cache change.");
@@ -852,13 +859,14 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
852 } 859 }
853 860
854 icon_cache = efreet_cache_close(icon_cache); 861 icon_cache = efreet_cache_close(icon_cache);
855 efreet_icon_themes_flush();
856 /* TODO: We must delay closing this file until event is done, so users can free/refetch */
857 icon_theme_cache = efreet_cache_close(icon_theme_cache);
858 862
859 ev = NEW(Efreet_Event_Cache_Update, 1); 863 d->hash = efreet_icon_themes;
860 if (!ev) return; 864 d->ef = icon_theme_cache;
861 ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, NULL, NULL); 865
866 efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
867 icon_theme_cache = NULL;
868
869 ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, icon_cache_update_free, d);
862 } 870 }
863#endif 871#endif
864 return; 872 return;
@@ -992,3 +1000,17 @@ desktop_cache_update_free(void *data, void *ev)
992 free(ev); 1000 free(ev);
993} 1001}
994 1002
1003#ifdef ICON_CACHE
1004static void
1005icon_cache_update_free(void *data, void *ev)
1006{
1007 Efreet_Old_Cache *d;
1008
1009 d = data;
1010 if (d->hash)
1011 eina_hash_free(d->hash);
1012 efreet_cache_close(d->ef);
1013 free(d);
1014 free(ev);
1015}
1016#endif
diff --git a/legacy/efreet/src/lib/efreet_icon.c b/legacy/efreet/src/lib/efreet_icon.c
index 709ab3f2cd..9b4efa4c37 100644
--- a/legacy/efreet/src/lib/efreet_icon.c
+++ b/legacy/efreet/src/lib/efreet_icon.c
@@ -44,9 +44,10 @@ static int _efreet_icon_log_dom = -1;
44 44
45/* TODO: Scan efreet_extra_icon_dirs for themes */ 45/* TODO: Scan efreet_extra_icon_dirs for themes */
46 46
47Eina_Hash *efreet_icon_themes = NULL;
48
47static const char *efreet_icon_deprecated_user_dir = NULL; 49static const char *efreet_icon_deprecated_user_dir = NULL;
48static const char *efreet_icon_user_dir = NULL; 50static const char *efreet_icon_user_dir = NULL;
49static Eina_Hash *efreet_icon_themes = NULL;
50static Eina_List *efreet_icon_extensions = NULL; 51static Eina_List *efreet_icon_extensions = NULL;
51static Eina_List *efreet_extra_icon_dirs = NULL; 52static Eina_List *efreet_extra_icon_dirs = NULL;
52#ifndef ICON_CACHE 53#ifndef ICON_CACHE
@@ -352,19 +353,6 @@ efreet_icon_theme_find(const char *theme_name)
352 return theme; 353 return theme;
353} 354}
354 355
355#ifdef ICON_CACHE
356/**
357 * @internal
358 * @brief Clears icon theme cache
359 */
360void
361efreet_icon_themes_flush(void)
362{
363 IF_FREE_HASH(efreet_icon_themes);
364 efreet_icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
365}
366#endif
367
368/** 356/**
369 * @internal 357 * @internal
370 * @param icon: The icon name to strip extension 358 * @param icon: The icon name to strip extension
diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h
index 243080ee2e..74327617f4 100644
--- a/legacy/efreet/src/lib/efreet_private.h
+++ b/legacy/efreet/src/lib/efreet_private.h
@@ -114,6 +114,9 @@ extern int _efreet_log_dom_global;
114#define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__) 114#define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
115 115
116extern Eina_Hash *efreet_desktop_cache; 116extern Eina_Hash *efreet_desktop_cache;
117#ifdef ICON_CACHE
118extern Eina_Hash *efreet_icon_themes;
119#endif
117 120
118#define EFREET_DESKTOP_CACHE_MAJOR 0 121#define EFREET_DESKTOP_CACHE_MAJOR 0
119#define EFREET_DESKTOP_CACHE_MINOR 1 122#define EFREET_DESKTOP_CACHE_MINOR 1
@@ -241,8 +244,6 @@ Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon);
241Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme); 244Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme);
242void efreet_cache_icon_theme_free(Efreet_Icon_Theme *theme); 245void efreet_cache_icon_theme_free(Efreet_Icon_Theme *theme);
243char **efreet_cache_icon_theme_name_list(int *num); 246char **efreet_cache_icon_theme_name_list(int *num);
244
245void efreet_icon_themes_flush(void);
246#endif 247#endif
247 248
248EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb); 249EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb);