raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e89253e59702442ee41c55975323e57a37fd353c

commit e89253e59702442ee41c55975323e57a37fd353c
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Aug 11 12:56:02 2015 +0900

    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
---
 src/lib/efreet/efreet_cache.c   | 114 ++++++++++++++++++++--------------------
 src/lib/efreet/efreet_icon.c    |  10 +++-
 src/lib/efreet/efreet_private.h |   1 +
 3 files changed, 65 insertions(+), 60 deletions(-)

diff --git a/src/lib/efreet/efreet_cache.c b/src/lib/efreet/efreet_cache.c
index bba77d4..88fda2e 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 3cb7f5c..8980520 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 9455485..139754d 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);

-- 


Reply via email to