Link Here
|
1 |
--- menu-cache-daemon/menu-cached.c.o 2011-03-17 10:58:03.876822788 -0400 |
|
|
2 |
+++ menu-cache-daemon/menu-cached.c 2011-03-17 10:58:49.355824755 -0400 |
3 |
@@ -341,6 +341,29 @@ |
4 |
GFileMonitorEvent evt, Cache* cache ) |
5 |
{ |
6 |
/* DEBUG("file %s is changed (%d).", g_file_get_path(gf), evt); */ |
7 |
+ |
8 |
+ if ( evt == G_FILE_MONITOR_EVENT_DELETED ) |
9 |
+ { |
10 |
+ int idx; |
11 |
+ /* dirty hack: get index of the monitor in array */ |
12 |
+ for(idx = 0; idx < cache->n_files; ++idx) |
13 |
+ { |
14 |
+ if(mon == cache->mons[idx]) |
15 |
+ break; |
16 |
+ } |
17 |
+ |
18 |
+ /* Check if this file or directory was already removed from the cache */ |
19 |
+ char* changed_file = g_file_get_path(gf); |
20 |
+ char* dir_path = cache->files[idx]+1; |
21 |
+ int len = strlen(dir_path); |
22 |
+ char* base_name = changed_file + len + 1; |
23 |
+ gboolean in_cache = is_desktop_file_in_cache(cache, idx, g_file_get_path(gf)); |
24 |
+ if( ! in_cache ) { /* Means this file was already deleted, no need to refresh cache */ |
25 |
+ DEBUG("files are changed, but no re-generation is needed."); |
26 |
+ return; |
27 |
+ } |
28 |
+ } |
29 |
+ |
30 |
/* if( mon != cache->cache_mon ) */ |
31 |
{ |
32 |
/* Optimization: Some files in the dir are changed, but it |