summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-11 12:56:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-12 20:08:14 +0900
commite89253e59702442ee41c55975323e57a37fd353c (patch)
treeed314191e37ddda457fb69bfd7cc6654fd1ffedb /src/lib/efreet
parent761d6fa192b3912ef2ae787d955f605e4e657536 (diff)
downloadefl-e89253e59702442ee41c55975323e57a37fd353c.tar.gz
efreet - fix efreetd kill and start with clean cache case blank icons
if you kill efreetd ANd delete all the caches, the restart of efreetd will lose all icons until an app re-registeres icon extensions and it can scan all icons .. and then app has to actually get the right upodate events and do the update properly when this happens. this fixes that scenario @fix
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/efreet_cache.c114
-rw-r--r--src/lib/efreet/efreet_icon.c10
-rw-r--r--src/lib/efreet/efreet_private.h1
3 files changed, 65 insertions, 60 deletions
diff --git a/src/lib/efreet/efreet_cache.c b/src/lib/efreet/efreet_cache.c
index bba77d44a3..88fda2e6a3 100644
--- a/src/lib/efreet/efreet_cache.c
+++ b/src/lib/efreet/efreet_cache.c
@@ -146,10 +146,63 @@ _cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
s = efreet_language_get();
if (s) len = strlen(s);
ecore_ipc_server_send(ipc, 1, 0, 0, 0, 0, s, len);
+ efreet_icon_extensions_refresh();
}
return ECORE_CALLBACK_DONE;
}
+static void
+_icon_desktop_cache_update_event_add(int event_type)
+{
+ Efreet_Event_Cache_Update *ev;
+ Efreet_Old_Cache *d = NULL;
+ Eina_List *l = NULL;
+
+ efreet_cache_desktop_close();
+
+ ev = NEW(Efreet_Event_Cache_Update, 1);
+ if (!ev) return;
+
+ IF_RELEASE(theme_name);
+
+ // Save all old caches
+ d = NEW(Efreet_Old_Cache, 1);
+ if (d)
+ {
+ d->hash = themes;
+ d->ef = icon_theme_cache;
+ l = eina_list_append(l, d);
+ }
+
+ d = NEW(Efreet_Old_Cache, 1);
+ if (d)
+ {
+ d->hash = icons;
+ d->ef = icon_cache;
+ l = eina_list_append(l, d);
+ }
+
+ d = NEW(Efreet_Old_Cache, 1);
+ if (d)
+ {
+ d->hash = fallbacks;
+ d->ef = fallback_cache;
+ l = eina_list_append(l, d);
+ }
+
+ // Create new empty caches
+ themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
+ icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free));
+ fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free));
+
+ icon_theme_cache = NULL;
+ icon_cache = NULL;
+ fallback_cache = NULL;
+
+ // Send event
+ ecore_event_add(event_type, ev, icon_cache_update_free, l);
+}
+
static Eina_Bool
_cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
@@ -162,69 +215,14 @@ _cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
else if (e->major == 2) // icon cache update
{
if (e->minor == 1)
- {
- Efreet_Event_Cache_Update *ev;
-
- efreet_cache_desktop_close();
-
- ev = NEW(Efreet_Event_Cache_Update, 1);
- if (ev)
- ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, NULL, NULL);
- }
+ _icon_desktop_cache_update_event_add(EFREET_EVENT_ICON_CACHE_UPDATE);
else
- ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, NULL, NULL, NULL);
+ ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, NULL, NULL, NULL);
}
else if (e->major == 3) // desktop cache update
{
- Efreet_Event_Cache_Update *ev = NULL;
- Efreet_Old_Cache *d = NULL;
- Eina_List *l = NULL;
-
- if (e->minor == 1)
- {
- ev = NEW(Efreet_Event_Cache_Update, 1);
- if (!ev) goto error;
-
- IF_RELEASE(theme_name);
-
- // Save all old caches
- d = NEW(Efreet_Old_Cache, 1);
- if (!d) goto error;
- d->hash = themes;
- d->ef = icon_theme_cache;
- l = eina_list_append(l, d);
-
- d = NEW(Efreet_Old_Cache, 1);
- if (!d) goto error;
- d->hash = icons;
- d->ef = icon_cache;
- l = eina_list_append(l, d);
-
- d = NEW(Efreet_Old_Cache, 1);
- if (!d) goto error;
- d->hash = fallbacks;
- d->ef = fallback_cache;
- l = eina_list_append(l, d);
-
- // Create new empty caches
- themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
- icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free));
- fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free));
-
- icon_theme_cache = NULL;
- icon_cache = NULL;
- fallback_cache = NULL;
-
- // Send event
- ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, icon_cache_update_free, l);
- goto done;
- }
-error:
- IF_FREE(ev);
- EINA_LIST_FREE(l, d)
- free(d);
+ _icon_desktop_cache_update_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE);
}
-done:
return ECORE_CALLBACK_DONE;
}
diff --git a/src/lib/efreet/efreet_icon.c b/src/lib/efreet/efreet_icon.c
index 3cb7f5c8f5..89805201a4 100644
--- a/src/lib/efreet/efreet_icon.c
+++ b/src/lib/efreet/efreet_icon.c
@@ -62,7 +62,7 @@ efreet_icon_init(void)
efreet_icon_extensions = eina_list_append(efreet_icon_extensions, eina_stringshare_add(default_exts[i]));
efreet_extra_icon_dirs = NULL;
- efreet_cache_icon_exts_add(efreet_icon_extensions);
+ efreet_icon_extensions_refresh();
return 1;
}
@@ -85,6 +85,12 @@ efreet_icon_shutdown(void)
_efreet_icon_log_dom = -1;
}
+void
+efreet_icon_extensions_refresh(void)
+{
+ efreet_cache_icon_exts_add(efreet_icon_extensions);
+}
+
EAPI const char *
efreet_icon_deprecated_user_dir_get(void)
{
@@ -143,7 +149,7 @@ efreet_icon_extension_add(const char *ext)
}
else
efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, ext);
- efreet_cache_icon_exts_add(efreet_icon_extensions);
+ efreet_icon_extensions_refresh();
}
EAPI Eina_List **
diff --git a/src/lib/efreet/efreet_private.h b/src/lib/efreet/efreet_private.h
index 9455485f2f..139754d81a 100644
--- a/src/lib/efreet/efreet_private.h
+++ b/src/lib/efreet/efreet_private.h
@@ -197,6 +197,7 @@ void efreet_cache_shutdown(void);
int efreet_icon_init(void);
void efreet_icon_shutdown(void);
+void efreet_icon_extensions_refresh(void);
int efreet_menu_init(void);
void efreet_menu_shutdown(void);