2010-11-15 13:07:22 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2010-11-22 06:16:09 -08:00
|
|
|
#include <unistd.h>
|
2010-11-23 12:14:13 -08:00
|
|
|
#include <fcntl.h>
|
2010-11-23 18:40:54 -08:00
|
|
|
#include <sys/stat.h>
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
#include "Efreet.h"
|
|
|
|
#include "efreet_private.h"
|
|
|
|
|
2010-11-22 06:16:29 -08:00
|
|
|
/* TODO: Listen for changes for icon dirs */
|
2010-11-23 12:14:13 -08:00
|
|
|
|
|
|
|
typedef struct _Efreet_Old_Cache Efreet_Old_Cache;
|
|
|
|
|
|
|
|
struct _Efreet_Old_Cache
|
|
|
|
{
|
|
|
|
Eina_Hash *hash;
|
|
|
|
Eet_File *ef;
|
|
|
|
};
|
|
|
|
|
2010-11-22 06:16:29 -08:00
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
/**
|
|
|
|
* Data for cache files
|
|
|
|
*/
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
static Eet_Data_Descriptor *cache_icon_edd = NULL;
|
|
|
|
static Eet_Data_Descriptor *cache_icon_element_edd = NULL;
|
2010-11-16 02:32:21 -08:00
|
|
|
static Eet_Data_Descriptor *cache_icon_fallback_edd = NULL;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2010-11-22 06:16:09 -08:00
|
|
|
static Eet_File *icon_cache = NULL;
|
|
|
|
static const char *icon_cache_name = NULL;
|
2010-11-22 12:50:46 -08:00
|
|
|
static Eet_File *icon_fallback_cache = NULL;
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
static Eet_Data_Descriptor *desktop_edd = NULL;
|
|
|
|
|
|
|
|
static Eet_File *desktop_cache = NULL;
|
|
|
|
static const char *desktop_cache_dirs = NULL;
|
|
|
|
static const char *desktop_cache_file = NULL;
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
static Ecore_File_Monitor *cache_monitor = NULL;
|
|
|
|
|
2010-11-23 13:35:32 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
static Ecore_Timer *cache_timer = NULL;
|
2010-11-23 13:35:32 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
|
|
|
|
static Ecore_Event_Handler *cache_exe_handler = NULL;
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
static Ecore_Job *icon_cache_job = NULL;
|
2010-11-22 06:16:09 -08:00
|
|
|
static Ecore_Exe *icon_cache_exe = NULL;
|
|
|
|
static int icon_cache_exe_lock = -1;
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
static Ecore_Job *desktop_cache_job = NULL;
|
|
|
|
static Ecore_Exe *desktop_cache_exe = NULL;
|
|
|
|
static int desktop_cache_exe_lock = -1;
|
|
|
|
|
|
|
|
static Eina_List *old_desktop_caches = NULL;
|
2010-11-16 13:50:53 -08:00
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
static void efreet_icon_edd_shutdown(void);
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
static void efreet_desktop_edd_shutdown(void);
|
2010-11-22 06:16:48 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
static Eina_Bool cache_exe_cb(void *data, int type, void *event);
|
|
|
|
static void cache_update_cb(void *data, Ecore_File_Monitor *em,
|
2010-11-22 06:16:09 -08:00
|
|
|
Ecore_File_Event event, const char *path);
|
|
|
|
|
2010-11-23 13:35:32 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
static void cache_timer_update(void);
|
|
|
|
static Eina_Bool cache_timer_cb(void *data);
|
2010-11-23 13:35:32 -08:00
|
|
|
#endif
|
2010-11-22 12:51:05 -08:00
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-22 12:51:05 -08:00
|
|
|
static void icon_cache_close(void);
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-22 12:51:05 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
static void desktop_cache_update_cache_job(void *data);
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
static void icon_cache_update_cache_job(void *data);
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
static void desktop_cache_update_free(void *data, void *ev);
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-22 06:16:09 -08:00
|
|
|
EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0;
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
|
|
|
int
|
|
|
|
efreet_cache_init(void)
|
|
|
|
{
|
2010-11-22 06:16:09 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-16 02:32:21 -08:00
|
|
|
if (!efreet_icon_edd_init())
|
2010-11-23 12:14:13 -08:00
|
|
|
goto error;
|
2010-11-16 02:32:21 -08:00
|
|
|
if (!efreet_icon_fallback_edd_init())
|
2010-11-23 12:14:13 -08:00
|
|
|
goto error;
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
if (!efreet_desktop_edd_init())
|
|
|
|
goto error;
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-22 06:16:09 -08:00
|
|
|
EFREET_EVENT_ICON_CACHE_UPDATE = ecore_event_type_new();
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new();
|
2010-11-22 06:16:09 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/.efreet", efreet_home_dir_get());
|
2010-11-23 12:14:13 -08:00
|
|
|
if (!ecore_file_mkpath(buf)) goto error;
|
2010-11-22 06:16:09 -08:00
|
|
|
|
|
|
|
if (efreet_cache_update)
|
|
|
|
{
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
|
|
|
cache_exe_cb, NULL);
|
|
|
|
if (!cache_exe_handler) goto error;
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_monitor = ecore_file_monitor_add(buf,
|
|
|
|
cache_update_cb,
|
2010-11-22 06:16:09 -08:00
|
|
|
NULL);
|
2010-11-23 12:14:13 -08:00
|
|
|
if (!cache_monitor) goto error;
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
#if 0
|
|
|
|
efreet_icon_changes_listen();
|
2010-11-22 06:16:09 -08:00
|
|
|
#endif
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
efreet_cache_icon_update();
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
efreet_cache_desktop_update();
|
2010-11-22 06:16:09 -08:00
|
|
|
}
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
return 1;
|
2010-11-23 12:14:13 -08:00
|
|
|
error:
|
|
|
|
if (cache_exe_handler) ecore_event_handler_del(cache_exe_handler);
|
2010-11-23 13:15:55 -08:00
|
|
|
cache_exe_handler = NULL;
|
2010-11-23 12:14:13 -08:00
|
|
|
if (cache_monitor) ecore_file_monitor_del(cache_monitor);
|
2010-11-23 13:15:55 -08:00
|
|
|
cache_monitor = NULL;
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
efreet_icon_edd_shutdown();
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
efreet_desktop_edd_shutdown();
|
2010-11-22 06:16:09 -08:00
|
|
|
return 0;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
efreet_cache_shutdown(void)
|
|
|
|
{
|
2010-11-23 12:14:13 -08:00
|
|
|
Efreet_Old_Cache *d;
|
|
|
|
|
2010-11-23 13:35:32 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
if (cache_timer) ecore_timer_del(cache_timer);
|
2010-11-23 13:15:55 -08:00
|
|
|
cache_timer = NULL;
|
2010-11-22 12:51:05 -08:00
|
|
|
icon_cache_close();
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
if (desktop_cache) eet_close(desktop_cache);
|
2010-11-23 13:15:55 -08:00
|
|
|
desktop_cache = NULL;
|
2010-11-23 12:14:13 -08:00
|
|
|
IF_RELEASE(desktop_cache_file);
|
|
|
|
IF_RELEASE(desktop_cache_dirs);
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
if (cache_exe_handler) ecore_event_handler_del(cache_exe_handler);
|
2010-11-23 13:15:55 -08:00
|
|
|
cache_exe_handler = NULL;
|
2010-11-23 12:14:13 -08:00
|
|
|
if (cache_monitor) ecore_file_monitor_del(cache_monitor);
|
2010-11-23 13:15:55 -08:00
|
|
|
cache_monitor = NULL;
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
efreet_icon_edd_shutdown();
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
efreet_desktop_edd_shutdown();
|
|
|
|
if (desktop_cache_job)
|
|
|
|
{
|
|
|
|
ecore_job_del(desktop_cache_job);
|
|
|
|
desktop_cache_job = NULL;
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
if (icon_cache_exe) ecore_exe_terminate(icon_cache_exe);
|
|
|
|
if (icon_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(icon_cache_exe_lock);
|
|
|
|
icon_cache_exe_lock = -1;
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
|
|
|
if (desktop_cache_exe) ecore_exe_terminate(desktop_cache_exe);
|
2010-11-23 12:14:13 -08:00
|
|
|
if (desktop_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(desktop_cache_exe_lock);
|
|
|
|
desktop_cache_exe_lock = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE(old_desktop_caches, d)
|
|
|
|
{
|
|
|
|
eina_hash_free(d->hash);
|
|
|
|
free(d);
|
|
|
|
}
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
efreet_icon_cache_file(const char *theme)
|
|
|
|
{
|
|
|
|
static char cache_file[PATH_MAX] = { '\0' };
|
|
|
|
const char *home;
|
|
|
|
|
|
|
|
home = efreet_home_dir_get();
|
|
|
|
|
|
|
|
snprintf(cache_file, sizeof(cache_file), "%s/.efreet/icon_%s.cache", home, theme);
|
|
|
|
|
|
|
|
return cache_file;
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
efreet_desktop_cache_file(void)
|
|
|
|
{
|
|
|
|
char tmp[PATH_MAX] = { '\0' };
|
|
|
|
const char *home, *lang, *country, *modifier;
|
|
|
|
|
|
|
|
if (desktop_cache_file) return desktop_cache_file;
|
|
|
|
|
|
|
|
home = efreet_home_dir_get();
|
|
|
|
lang = efreet_lang_get();
|
|
|
|
country = efreet_lang_country_get();
|
|
|
|
modifier = efreet_lang_modifier_get();
|
|
|
|
|
|
|
|
if (lang && country && modifier)
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_%s_%s@%s.cache", home, lang, country, modifier);
|
|
|
|
else if (lang && country)
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_%s_%s.cache", home, lang, country);
|
|
|
|
else if (lang)
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_%s.cache", home, lang);
|
|
|
|
else
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop.cache", home);
|
|
|
|
|
|
|
|
desktop_cache_file = eina_stringshare_add(tmp);
|
|
|
|
return desktop_cache_file;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
efreet_desktop_cache_dirs(void)
|
|
|
|
{
|
|
|
|
char tmp[PATH_MAX] = { '\0' };
|
|
|
|
|
|
|
|
if (desktop_cache_dirs) return desktop_cache_dirs;
|
|
|
|
|
|
|
|
snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_dirs.cache", efreet_home_dir_get());
|
|
|
|
|
|
|
|
desktop_cache_dirs = eina_stringshare_add(tmp);
|
|
|
|
return desktop_cache_dirs;
|
|
|
|
}
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI Eet_Data_Descriptor *
|
|
|
|
efreet_icon_edd_init(void)
|
|
|
|
{
|
|
|
|
Eet_Data_Descriptor_Class iconeddc;
|
|
|
|
Eet_Data_Descriptor_Class elemeddc;
|
|
|
|
|
|
|
|
if (!cache_icon_edd)
|
|
|
|
{
|
|
|
|
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&iconeddc, Efreet_Cache_Icon);
|
|
|
|
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&elemeddc, Efreet_Cache_Icon_Element);
|
|
|
|
cache_icon_edd = eet_data_descriptor_file_new(&iconeddc);
|
|
|
|
if (!cache_icon_edd)
|
|
|
|
goto error;
|
|
|
|
cache_icon_element_edd = eet_data_descriptor_file_new(&elemeddc);
|
|
|
|
if (!cache_icon_element_edd)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_edd, Efreet_Cache_Icon, "name", name, EET_T_STRING);
|
|
|
|
#endif
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_edd, Efreet_Cache_Icon, "theme", theme, EET_T_STRING);
|
|
|
|
#if 0
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_edd, Efreet_Cache_Icon, "context", context, EET_T_INT);
|
|
|
|
#endif
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_LIST(cache_icon_edd, Efreet_Cache_Icon, "icons", icons, cache_icon_element_edd);
|
|
|
|
#if 0
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_element_edd, Efreet_Cache_Icon_Element, "type", type, EET_T_INT);
|
|
|
|
#endif
|
|
|
|
eet_data_descriptor_element_add(cache_icon_element_edd, "paths", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Cache_Icon_Element, paths), 0, NULL, NULL);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_element_edd, Efreet_Cache_Icon_Element, "size.normal", size.normal, EET_T_USHORT);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_element_edd, Efreet_Cache_Icon_Element, "size.min", size.min, EET_T_USHORT);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_element_edd, Efreet_Cache_Icon_Element, "size.max", size.max, EET_T_USHORT);
|
|
|
|
}
|
|
|
|
return cache_icon_edd;
|
|
|
|
error:
|
|
|
|
efreet_icon_edd_shutdown();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-16 02:32:21 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI Eet_Data_Descriptor *
|
|
|
|
efreet_icon_fallback_edd_init(void)
|
|
|
|
{
|
|
|
|
Eet_Data_Descriptor_Class eddc;
|
|
|
|
|
|
|
|
if (!cache_icon_fallback_edd)
|
|
|
|
{
|
|
|
|
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Efreet_Cache_Icon);
|
|
|
|
cache_icon_fallback_edd = eet_data_descriptor_file_new(&eddc);
|
|
|
|
if (!cache_icon_fallback_edd)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_fallback_edd, Efreet_Cache_Icon, "name", name, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_fallback_edd, Efreet_Cache_Icon, "theme", theme, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_fallback_edd, Efreet_Cache_Icon, "context", context, EET_T_INT);
|
|
|
|
#endif
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(cache_icon_fallback_edd, Efreet_Cache_Icon, "fallback", fallback, EET_T_UCHAR);
|
|
|
|
eet_data_descriptor_element_add(cache_icon_fallback_edd, "icons", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Cache_Icon, icons), 0, NULL, NULL);
|
|
|
|
}
|
|
|
|
return cache_icon_fallback_edd;
|
|
|
|
error:
|
|
|
|
efreet_icon_edd_shutdown();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
static void
|
|
|
|
efreet_icon_edd_shutdown(void)
|
|
|
|
{
|
|
|
|
if (cache_icon_edd) eet_data_descriptor_free(cache_icon_edd);
|
|
|
|
cache_icon_edd = NULL;
|
|
|
|
if (cache_icon_element_edd) eet_data_descriptor_free(cache_icon_element_edd);
|
|
|
|
cache_icon_element_edd = NULL;
|
2010-11-16 02:32:21 -08:00
|
|
|
if (cache_icon_fallback_edd) eet_data_descriptor_free(cache_icon_fallback_edd);
|
|
|
|
cache_icon_fallback_edd = NULL;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI Eet_Data_Descriptor *
|
|
|
|
efreet_desktop_edd_init(void)
|
|
|
|
{
|
|
|
|
if (!desktop_edd)
|
|
|
|
{
|
|
|
|
Eet_Data_Descriptor_Class eddc;
|
|
|
|
|
|
|
|
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Efreet_Desktop);
|
|
|
|
desktop_edd = eet_data_descriptor_file_new(&eddc);
|
|
|
|
if (!desktop_edd) return NULL;
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "type", type, EET_T_INT);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "version", version, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "orig_path", orig_path, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "load_time", load_time, EET_T_LONG_LONG);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "name", name, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "generic_name", generic_name, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "comment", comment, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "icon", icon, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "try_exec", try_exec, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "exec", exec, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "path", path, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "startup_wm_class", startup_wm_class, EET_T_STRING);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "url", url, EET_T_STRING);
|
|
|
|
eet_data_descriptor_element_add(desktop_edd, "only_show_in", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Desktop, only_show_in), 0, NULL, NULL);
|
|
|
|
eet_data_descriptor_element_add(desktop_edd, "not_show_in", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Desktop, not_show_in), 0, NULL, NULL);
|
|
|
|
eet_data_descriptor_element_add(desktop_edd, "categories", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Desktop, categories), 0, NULL, NULL);
|
|
|
|
eet_data_descriptor_element_add(desktop_edd, "mime_types", EET_T_STRING, EET_G_LIST, offsetof(Efreet_Desktop, mime_types), 0, NULL, NULL);
|
|
|
|
eet_data_descriptor_element_add(desktop_edd, "x", EET_T_STRING, EET_G_HASH, offsetof(Efreet_Desktop, x), 0, NULL, NULL);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "no_display", no_display, EET_T_UCHAR);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "hidden", hidden, EET_T_UCHAR);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "terminal", terminal, EET_T_UCHAR);
|
|
|
|
EET_DATA_DESCRIPTOR_ADD_BASIC(desktop_edd, Efreet_Desktop, "startup_notify", startup_notify, EET_T_UCHAR);
|
|
|
|
}
|
|
|
|
return desktop_edd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
efreet_desktop_edd_shutdown(void)
|
|
|
|
{
|
|
|
|
if (desktop_edd) eet_data_descriptor_free(desktop_edd);
|
|
|
|
desktop_edd = NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-15 13:07:22 -08:00
|
|
|
/*
|
|
|
|
* Needs EAPI because of helper binaries
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
efreet_cache_icon_free(Efreet_Cache_Icon *icon)
|
|
|
|
{
|
2010-11-16 02:32:21 -08:00
|
|
|
void *data;
|
|
|
|
|
2010-11-16 13:50:53 -08:00
|
|
|
if (!icon) return;
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
if (icon->free)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
eina_stringshare_del(icon->name);
|
|
|
|
#endif
|
|
|
|
eina_stringshare_del(icon->theme);
|
|
|
|
}
|
|
|
|
|
2010-11-16 02:32:21 -08:00
|
|
|
EINA_LIST_FREE(icon->icons, data)
|
2010-11-15 13:07:22 -08:00
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
|
2010-11-16 02:32:21 -08:00
|
|
|
if (icon->fallback)
|
|
|
|
{
|
|
|
|
if (icon->free)
|
|
|
|
eina_stringshare_del(data);
|
|
|
|
}
|
2010-11-15 13:07:22 -08:00
|
|
|
else
|
2010-11-16 02:32:21 -08:00
|
|
|
{
|
|
|
|
Efreet_Cache_Icon_Element *elem;
|
|
|
|
|
|
|
|
elem = data;
|
|
|
|
if (icon->free)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(elem->paths, path)
|
|
|
|
eina_stringshare_del(path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
eina_list_free(elem->paths);
|
|
|
|
free(elem);
|
|
|
|
}
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
free(icon);
|
|
|
|
}
|
2010-11-16 13:50:53 -08:00
|
|
|
|
|
|
|
Efreet_Cache_Icon *
|
|
|
|
efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon)
|
|
|
|
{
|
2010-11-22 06:16:09 -08:00
|
|
|
if (icon_cache)
|
2010-11-16 13:50:53 -08:00
|
|
|
{
|
2010-11-22 06:16:09 -08:00
|
|
|
if (!strcmp(icon_cache_name, theme->name.internal))
|
2010-11-16 13:50:53 -08:00
|
|
|
{
|
2010-11-22 06:16:09 -08:00
|
|
|
eet_close(icon_cache);
|
|
|
|
eina_stringshare_del(icon_cache_name);
|
|
|
|
icon_cache = NULL;
|
|
|
|
icon_cache_name = NULL;
|
2010-11-16 13:50:53 -08:00
|
|
|
}
|
|
|
|
}
|
2010-11-22 06:16:09 -08:00
|
|
|
if (!icon_cache)
|
2010-11-16 13:50:53 -08:00
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
|
|
|
|
path = efreet_icon_cache_file(theme->name.internal);
|
2010-11-22 06:16:09 -08:00
|
|
|
icon_cache = eet_open(path, EET_FILE_MODE_READ);
|
|
|
|
if (icon_cache)
|
|
|
|
{
|
|
|
|
icon_cache_name = eina_stringshare_add(theme->name.internal);
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer_update();
|
2010-11-22 06:16:09 -08:00
|
|
|
}
|
2010-11-16 13:50:53 -08:00
|
|
|
}
|
2010-11-22 06:16:09 -08:00
|
|
|
if (icon_cache)
|
|
|
|
return eet_data_read(icon_cache, cache_icon_edd, icon);
|
2010-11-16 13:50:53 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
2010-11-22 06:16:09 -08:00
|
|
|
|
2010-11-22 12:51:34 -08:00
|
|
|
Efreet_Cache_Icon *
|
2010-11-22 12:50:46 -08:00
|
|
|
efreet_cache_icon_fallback_find(const char *icon)
|
|
|
|
{
|
|
|
|
if (!icon_fallback_cache)
|
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
|
|
|
|
path = efreet_icon_cache_file("_fallback");
|
|
|
|
icon_fallback_cache = eet_open(path, EET_FILE_MODE_READ);
|
2010-11-22 12:51:05 -08:00
|
|
|
if (icon_fallback_cache)
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer_update();
|
2010-11-22 12:50:46 -08:00
|
|
|
}
|
|
|
|
if (icon_fallback_cache)
|
|
|
|
return eet_data_read(icon_fallback_cache, cache_icon_fallback_edd, icon);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-22 12:50:46 -08:00
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
Efreet_Desktop *
|
|
|
|
efreet_cache_desktop_find(const char *file)
|
|
|
|
{
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
char rp[PATH_MAX];
|
|
|
|
|
|
|
|
if (!realpath(file, rp)) return NULL;
|
|
|
|
|
|
|
|
if (!desktop_cache)
|
|
|
|
desktop_cache = eet_open(efreet_desktop_cache_file(), EET_FILE_MODE_READ);
|
|
|
|
if (!desktop_cache)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
desktop = eet_data_read(desktop_cache, desktop_edd, rp);
|
|
|
|
if (!desktop) return NULL;
|
|
|
|
desktop->ref = 1;
|
|
|
|
desktop->eet = 1;
|
|
|
|
return desktop;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
efreet_cache_desktop_update(void)
|
|
|
|
{
|
|
|
|
if (!efreet_cache_update) return;
|
|
|
|
|
|
|
|
/* TODO: Make sure we don't create a lot of execs, maybe use a timer? */
|
|
|
|
if (desktop_cache_job) ecore_job_del(desktop_cache_job);
|
|
|
|
desktop_cache_job = ecore_job_add(desktop_cache_update_cache_job, NULL);
|
|
|
|
}
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
void
|
|
|
|
efreet_cache_icon_update(void)
|
|
|
|
{
|
|
|
|
if (!efreet_cache_update) return;
|
|
|
|
|
|
|
|
/* TODO: Make sure we don't create a lot of execs, maybe use a timer? */
|
|
|
|
if (icon_cache_job) ecore_job_del(icon_cache_job);
|
|
|
|
icon_cache_job = ecore_job_add(icon_cache_update_cache_job, NULL);
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
efreet_cache_desktop_free(Efreet_Desktop *desktop)
|
|
|
|
{
|
|
|
|
Efreet_Old_Cache *d;
|
|
|
|
Efreet_Desktop *curr;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
if (!old_desktop_caches) return;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(old_desktop_caches, l, d)
|
|
|
|
{
|
|
|
|
curr = eina_hash_find(d->hash, desktop->orig_path);
|
|
|
|
if (curr && curr == desktop)
|
|
|
|
{
|
|
|
|
eina_hash_del_by_key(d->hash, desktop->orig_path);
|
|
|
|
if (eina_hash_population(d->hash) == 0)
|
|
|
|
{
|
|
|
|
eina_hash_free(d->hash);
|
|
|
|
d->hash = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-22 06:16:09 -08:00
|
|
|
static Eina_Bool
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_exe_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2010-11-22 06:16:09 -08:00
|
|
|
{
|
|
|
|
Ecore_Exe_Event_Del *ev;
|
|
|
|
|
|
|
|
ev = event;
|
2010-11-23 12:26:50 -08:00
|
|
|
if (ev->exe == desktop_cache_exe)
|
2010-11-23 12:14:13 -08:00
|
|
|
{
|
|
|
|
if (desktop_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(desktop_cache_exe_lock);
|
|
|
|
desktop_cache_exe_lock = -1;
|
|
|
|
}
|
|
|
|
desktop_cache_exe = NULL;
|
2010-11-22 06:16:09 -08:00
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
|
|
|
else if (ev->exe == icon_cache_exe)
|
|
|
|
{
|
|
|
|
if (icon_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(icon_cache_exe_lock);
|
|
|
|
icon_cache_exe_lock = -1;
|
|
|
|
}
|
|
|
|
icon_cache_exe = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2010-11-22 06:16:09 -08:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
|
2010-11-22 06:16:09 -08:00
|
|
|
Ecore_File_Event event, const char *path)
|
|
|
|
{
|
2010-11-23 12:14:13 -08:00
|
|
|
const char *file;
|
2010-11-22 06:16:09 -08:00
|
|
|
Efreet_Event_Cache_Update *ev = NULL;
|
2010-11-23 12:14:13 -08:00
|
|
|
Eet_File *tmp = NULL;
|
|
|
|
Efreet_Old_Cache *d = NULL;
|
|
|
|
|
2010-11-22 06:16:09 -08:00
|
|
|
if (event != ECORE_FILE_EVENT_CREATED_FILE &&
|
|
|
|
event != ECORE_FILE_EVENT_MODIFIED) return;
|
|
|
|
|
2010-11-23 12:14:13 -08:00
|
|
|
file = ecore_file_file_get(path);
|
|
|
|
if (!file) return;
|
2010-11-23 12:26:50 -08:00
|
|
|
if (!strcmp(file, "desktop_data.update"))
|
2010-11-23 12:14:13 -08:00
|
|
|
{
|
|
|
|
tmp = eet_open(efreet_desktop_cache_file(), EET_FILE_MODE_READ);
|
|
|
|
if (!tmp) return;
|
|
|
|
ev = NEW(Efreet_Event_Cache_Update, 1);
|
|
|
|
if (!ev) goto error;
|
|
|
|
d = NEW(Efreet_Old_Cache, 1);
|
|
|
|
if (!d) goto error;
|
|
|
|
|
|
|
|
d->hash = efreet_desktop_cache;
|
|
|
|
d->ef = desktop_cache;
|
|
|
|
old_desktop_caches = eina_list_append(old_desktop_caches, d);
|
|
|
|
|
|
|
|
efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
|
|
|
|
desktop_cache = tmp;
|
|
|
|
|
|
|
|
efreet_util_desktop_cache_reload();
|
|
|
|
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, desktop_cache_update_free, d);
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
|
|
|
else if (!strcmp(file, "icon_data.update"))
|
|
|
|
{
|
|
|
|
icon_cache_close();
|
|
|
|
|
|
|
|
ev = NEW(Efreet_Event_Cache_Update, 1);
|
|
|
|
if (!ev) return;
|
|
|
|
ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, NULL, NULL);
|
|
|
|
}
|
2010-11-24 02:33:40 -08:00
|
|
|
return;
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
error:
|
|
|
|
IF_FREE(ev);
|
|
|
|
IF_FREE(d);
|
2010-11-24 02:33:49 -08:00
|
|
|
if (tmp) eet_close(tmp);
|
2010-11-22 06:16:09 -08:00
|
|
|
}
|
|
|
|
|
2010-11-23 13:35:32 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-22 12:51:05 -08:00
|
|
|
static void
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer_update(void)
|
2010-11-22 12:51:05 -08:00
|
|
|
{
|
2010-11-23 12:14:13 -08:00
|
|
|
if (cache_timer)
|
|
|
|
ecore_timer_interval_set(cache_timer, 60.0);
|
2010-11-22 12:51:05 -08:00
|
|
|
else
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer = ecore_timer_add(60.0, cache_timer_cb, NULL);
|
2010-11-22 12:51:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer_cb(void *data __UNUSED__)
|
2010-11-22 12:51:05 -08:00
|
|
|
{
|
2010-11-23 12:14:13 -08:00
|
|
|
cache_timer = NULL;
|
2010-11-22 12:51:05 -08:00
|
|
|
|
|
|
|
icon_cache_close();
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
icon_cache_close(void)
|
|
|
|
{
|
|
|
|
if (icon_cache) eet_close(icon_cache);
|
|
|
|
icon_cache = NULL;
|
|
|
|
if (icon_fallback_cache) eet_close(icon_fallback_cache);
|
|
|
|
icon_fallback_cache = NULL;
|
|
|
|
IF_RELEASE(icon_cache_name);
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
desktop_cache_update_cache_job(void *data __UNUSED__)
|
|
|
|
{
|
|
|
|
char file[PATH_MAX];
|
|
|
|
struct flock fl;
|
|
|
|
|
|
|
|
desktop_cache_job = NULL;
|
|
|
|
|
|
|
|
/* TODO: Retry update cache later */
|
|
|
|
if (desktop_cache_exe_lock > 0) return;
|
|
|
|
|
|
|
|
if (!efreet_desktop_write_cache_dirs_file()) return;
|
|
|
|
|
|
|
|
snprintf(file, sizeof(file), "%s/.efreet/desktop_exec.lock", efreet_home_dir_get());
|
|
|
|
|
|
|
|
desktop_cache_exe_lock = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
|
|
|
if (desktop_cache_exe_lock < 0) return;
|
|
|
|
memset(&fl, 0, sizeof(struct flock));
|
|
|
|
fl.l_type = F_WRLCK;
|
|
|
|
fl.l_whence = SEEK_SET;
|
|
|
|
if (fcntl(desktop_cache_exe_lock, F_SETLK, &fl) < 0) goto error;
|
|
|
|
desktop_cache_exe = ecore_exe_run(PACKAGE_LIB_DIR "/efreet/efreet_desktop_cache_create", NULL);
|
|
|
|
if (!desktop_cache_exe) goto error;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (desktop_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(desktop_cache_exe_lock);
|
|
|
|
desktop_cache_exe_lock = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-23 12:26:50 -08:00
|
|
|
#ifdef ICON_CACHE
|
2010-11-23 12:14:13 -08:00
|
|
|
static void
|
|
|
|
icon_cache_update_cache_job(void *data __UNUSED__)
|
|
|
|
{
|
|
|
|
char file[PATH_MAX];
|
|
|
|
struct flock fl;
|
|
|
|
|
|
|
|
icon_cache_job = NULL;
|
|
|
|
|
|
|
|
/* TODO: Retry update cache later */
|
|
|
|
if (icon_cache_exe_lock > 0) return;
|
|
|
|
|
|
|
|
snprintf(file, sizeof(file), "%s/.efreet/icon_exec.lock", efreet_home_dir_get());
|
|
|
|
|
|
|
|
icon_cache_exe_lock = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
|
|
|
if (icon_cache_exe_lock < 0) return;
|
|
|
|
memset(&fl, 0, sizeof(struct flock));
|
|
|
|
fl.l_type = F_WRLCK;
|
|
|
|
fl.l_whence = SEEK_SET;
|
|
|
|
if (fcntl(icon_cache_exe_lock, F_SETLK, &fl) < 0) goto error;
|
|
|
|
icon_cache_exe = ecore_exe_run(PACKAGE_LIB_DIR "/efreet/efreet_icon_cache_create", NULL);
|
|
|
|
if (!icon_cache_exe) goto error;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (icon_cache_exe_lock > 0)
|
|
|
|
{
|
|
|
|
close(icon_cache_exe_lock);
|
|
|
|
icon_cache_exe_lock = -1;
|
|
|
|
}
|
|
|
|
}
|
2010-11-23 12:26:50 -08:00
|
|
|
#endif
|
2010-11-23 12:14:13 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
desktop_cache_update_free(void *data, void *ev)
|
|
|
|
{
|
|
|
|
Efreet_Old_Cache *d;
|
|
|
|
int dangling = 0;
|
|
|
|
|
|
|
|
d = data;
|
|
|
|
/*
|
|
|
|
* All users should now had the chance to update their pointers, so we can now
|
|
|
|
* free the old cache
|
|
|
|
*/
|
|
|
|
if (d->hash)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_tuple_new(d->hash);
|
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
|
|
|
{
|
|
|
|
printf("Efreet: %d:%s still in cache on cache close!\n",
|
|
|
|
((Efreet_Desktop *)tuple->data)->ref, (char *)tuple->key);
|
|
|
|
dangling++;
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
eina_hash_free(d->hash);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If there are dangling references the eet file won't be closed - to
|
|
|
|
* avoid crashes, but this will leak instead.
|
|
|
|
*/
|
|
|
|
if (dangling == 0)
|
|
|
|
{
|
|
|
|
if (d->ef) eet_close(d->ef);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("Efreet: ERROR. There are still %i desktop files with old\n"
|
|
|
|
"dangling references to desktop files. This application\n"
|
|
|
|
"has not handled the EFREET_EVENT_DESKTOP_CACHE_UPDATE\n"
|
|
|
|
"fully and released its references. Please fix the application\n"
|
|
|
|
"so it does this.\n",
|
|
|
|
dangling);
|
|
|
|
}
|
|
|
|
old_desktop_caches = eina_list_remove(old_desktop_caches, d);
|
|
|
|
free(d);
|
|
|
|
free(ev);
|
|
|
|
}
|
|
|
|
|