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)
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)
146 s = efreet_language_get(); 146 s = efreet_language_get();
147 if (s) len = strlen(s); 147 if (s) len = strlen(s);
148 ecore_ipc_server_send(ipc, 1, 0, 0, 0, 0, s, len); 148 ecore_ipc_server_send(ipc, 1, 0, 0, 0, 0, s, len);
149 efreet_icon_extensions_refresh();
149 } 150 }
150 return ECORE_CALLBACK_DONE; 151 return ECORE_CALLBACK_DONE;
151} 152}
152 153
154static void
155_icon_desktop_cache_update_event_add(int event_type)
156{
157 Efreet_Event_Cache_Update *ev;
158 Efreet_Old_Cache *d = NULL;
159 Eina_List *l = NULL;
160
161 efreet_cache_desktop_close();
162
163 ev = NEW(Efreet_Event_Cache_Update, 1);
164 if (!ev) return;
165
166 IF_RELEASE(theme_name);
167
168 // Save all old caches
169 d = NEW(Efreet_Old_Cache, 1);
170 if (d)
171 {
172 d->hash = themes;
173 d->ef = icon_theme_cache;
174 l = eina_list_append(l, d);
175 }
176
177 d = NEW(Efreet_Old_Cache, 1);
178 if (d)
179 {
180 d->hash = icons;
181 d->ef = icon_cache;
182 l = eina_list_append(l, d);
183 }
184
185 d = NEW(Efreet_Old_Cache, 1);
186 if (d)
187 {
188 d->hash = fallbacks;
189 d->ef = fallback_cache;
190 l = eina_list_append(l, d);
191 }
192
193 // Create new empty caches
194 themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
195 icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free));
196 fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free));
197
198 icon_theme_cache = NULL;
199 icon_cache = NULL;
200 fallback_cache = NULL;
201
202 // Send event
203 ecore_event_add(event_type, ev, icon_cache_update_free, l);
204}
205
153static Eina_Bool 206static Eina_Bool
154_cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 207_cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
155{ 208{
@@ -162,69 +215,14 @@ _cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
162 else if (e->major == 2) // icon cache update 215 else if (e->major == 2) // icon cache update
163 { 216 {
164 if (e->minor == 1) 217 if (e->minor == 1)
165 { 218 _icon_desktop_cache_update_event_add(EFREET_EVENT_ICON_CACHE_UPDATE);
166 Efreet_Event_Cache_Update *ev;
167
168 efreet_cache_desktop_close();
169
170 ev = NEW(Efreet_Event_Cache_Update, 1);
171 if (ev)
172 ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, NULL, NULL);
173 }
174 else 219 else
175 ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, NULL, NULL, NULL); 220 ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, NULL, NULL, NULL);
176 } 221 }
177 else if (e->major == 3) // desktop cache update 222 else if (e->major == 3) // desktop cache update
178 { 223 {
179 Efreet_Event_Cache_Update *ev = NULL; 224 _icon_desktop_cache_update_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE);
180 Efreet_Old_Cache *d = NULL;
181 Eina_List *l = NULL;
182
183 if (e->minor == 1)
184 {
185 ev = NEW(Efreet_Event_Cache_Update, 1);
186 if (!ev) goto error;
187
188 IF_RELEASE(theme_name);
189
190 // Save all old caches
191 d = NEW(Efreet_Old_Cache, 1);
192 if (!d) goto error;
193 d->hash = themes;
194 d->ef = icon_theme_cache;
195 l = eina_list_append(l, d);
196
197 d = NEW(Efreet_Old_Cache, 1);
198 if (!d) goto error;
199 d->hash = icons;
200 d->ef = icon_cache;
201 l = eina_list_append(l, d);
202
203 d = NEW(Efreet_Old_Cache, 1);
204 if (!d) goto error;
205 d->hash = fallbacks;
206 d->ef = fallback_cache;
207 l = eina_list_append(l, d);
208
209 // Create new empty caches
210 themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free));
211 icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free));
212 fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free));
213
214 icon_theme_cache = NULL;
215 icon_cache = NULL;
216 fallback_cache = NULL;
217
218 // Send event
219 ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, icon_cache_update_free, l);
220 goto done;
221 }
222error:
223 IF_FREE(ev);
224 EINA_LIST_FREE(l, d)
225 free(d);
226 } 225 }
227done:
228 return ECORE_CALLBACK_DONE; 226 return ECORE_CALLBACK_DONE;
229} 227}
230 228
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)
62 efreet_icon_extensions = eina_list_append(efreet_icon_extensions, eina_stringshare_add(default_exts[i])); 62 efreet_icon_extensions = eina_list_append(efreet_icon_extensions, eina_stringshare_add(default_exts[i]));
63 63
64 efreet_extra_icon_dirs = NULL; 64 efreet_extra_icon_dirs = NULL;
65 efreet_cache_icon_exts_add(efreet_icon_extensions); 65 efreet_icon_extensions_refresh();
66 66
67 return 1; 67 return 1;
68} 68}
@@ -85,6 +85,12 @@ efreet_icon_shutdown(void)
85 _efreet_icon_log_dom = -1; 85 _efreet_icon_log_dom = -1;
86} 86}
87 87
88void
89efreet_icon_extensions_refresh(void)
90{
91 efreet_cache_icon_exts_add(efreet_icon_extensions);
92}
93
88EAPI const char * 94EAPI const char *
89efreet_icon_deprecated_user_dir_get(void) 95efreet_icon_deprecated_user_dir_get(void)
90{ 96{
@@ -143,7 +149,7 @@ efreet_icon_extension_add(const char *ext)
143 } 149 }
144 else 150 else
145 efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, ext); 151 efreet_icon_extensions = eina_list_prepend(efreet_icon_extensions, ext);
146 efreet_cache_icon_exts_add(efreet_icon_extensions); 152 efreet_icon_extensions_refresh();
147} 153}
148 154
149EAPI Eina_List ** 155EAPI 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);
197 197
198int efreet_icon_init(void); 198int efreet_icon_init(void);
199void efreet_icon_shutdown(void); 199void efreet_icon_shutdown(void);
200void efreet_icon_extensions_refresh(void);
200 201
201int efreet_menu_init(void); 202int efreet_menu_init(void);
202void efreet_menu_shutdown(void); 203void efreet_menu_shutdown(void);