2005-10-18 16:03:36 -07:00
|
|
|
/*
|
2006-07-08 02:18:04 -07:00
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2005-10-18 16:03:36 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
typedef struct _E_Thumb E_Thumb;
|
2005-10-18 16:03:36 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
struct _E_Thumb
|
2005-11-22 01:27:25 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
int objid;
|
|
|
|
int w, h;
|
2006-07-28 04:27:59 -07:00
|
|
|
const char *file;
|
|
|
|
const char *key;
|
2006-07-08 02:18:04 -07:00
|
|
|
unsigned char queued : 1;
|
|
|
|
unsigned char busy : 1;
|
2006-07-23 14:19:04 -07:00
|
|
|
unsigned char done : 1;
|
2005-11-22 01:27:25 -08:00
|
|
|
};
|
2005-10-18 16:03:36 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
/* local subsystem functions */
|
2006-07-28 04:27:59 -07:00
|
|
|
static void _e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h);
|
2006-07-08 02:18:04 -07:00
|
|
|
static void _e_thumb_gen_end(int objid);
|
|
|
|
static void _e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _e_thumb_hash_add(int objid, Evas_Object *obj);
|
|
|
|
static void _e_thumb_hash_del(int objid);
|
|
|
|
static Evas_Object *_e_thumb_hash_find(int objid);
|
|
|
|
static void _e_thumb_thumbnailers_kill(void);
|
2006-07-08 06:53:55 -07:00
|
|
|
static void _e_thumb_thumbnailers_kill_cancel(void);
|
|
|
|
static int _e_thumb_cb_kill(void *data);
|
2006-07-08 02:18:04 -07:00
|
|
|
static int _e_thumb_cb_exe_event_del(void *data, int type, void *event);
|
|
|
|
|
|
|
|
/* local subsystem globals */
|
2008-10-22 04:49:33 -07:00
|
|
|
static Eina_List *_thumbnailers = NULL;
|
|
|
|
static Eina_List *_thumbnailers_exe = NULL;
|
|
|
|
static Eina_List *_thumb_queue = NULL;
|
2006-07-08 02:18:04 -07:00
|
|
|
static int _objid = 0;
|
2008-12-17 07:33:43 -08:00
|
|
|
static Eina_Hash *_thumbs = NULL;
|
2006-07-08 02:18:04 -07:00
|
|
|
static int _pending = 0;
|
2007-03-02 09:00:20 -08:00
|
|
|
static int _num_thumbnailers = 1;
|
2006-07-08 02:18:04 -07:00
|
|
|
static Ecore_Event_Handler *_exe_del_handler = NULL;
|
2006-07-08 06:53:55 -07:00
|
|
|
static Ecore_Timer *_kill_timer = NULL;
|
2006-07-08 02:18:04 -07:00
|
|
|
|
|
|
|
/* externally accessible functions */
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-10-18 16:03:36 -07:00
|
|
|
e_thumb_init(void)
|
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
_exe_del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
|
|
|
_e_thumb_cb_exe_event_del,
|
|
|
|
NULL);
|
2008-12-17 07:33:43 -08:00
|
|
|
_thumbs = eina_hash_string_superfast_new(NULL);
|
2005-10-18 16:03:36 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI int
|
2005-10-18 16:03:36 -07:00
|
|
|
e_thumb_shutdown(void)
|
|
|
|
{
|
2006-07-08 06:53:55 -07:00
|
|
|
_e_thumb_thumbnailers_kill_cancel();
|
|
|
|
_e_thumb_cb_kill(NULL);
|
2006-07-08 02:18:04 -07:00
|
|
|
ecore_event_handler_del(_exe_del_handler);
|
|
|
|
_exe_del_handler = NULL;
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumbnailers = eina_list_free(_thumbnailers);
|
2006-07-08 06:53:55 -07:00
|
|
|
while (_thumbnailers_exe)
|
|
|
|
{
|
|
|
|
ecore_exe_free(_thumbnailers_exe->data);
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumbnailers_exe = eina_list_remove_list(_thumbnailers_exe, _thumbnailers_exe);
|
2006-07-08 06:53:55 -07:00
|
|
|
}
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_free(_thumb_queue);
|
2006-07-08 06:53:55 -07:00
|
|
|
_objid = 0;
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_free(_thumbs);
|
2006-07-08 06:53:55 -07:00
|
|
|
_thumbs = NULL;
|
|
|
|
_pending = 0;
|
2005-10-18 16:03:36 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-04-04 20:49:16 -07:00
|
|
|
static void
|
|
|
|
_thumb_preloaded(void *data, Evas_Object *obj, void *event)
|
|
|
|
{
|
|
|
|
evas_object_smart_callback_call(data, "e_thumb_gen", NULL);
|
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI Evas_Object *
|
2006-07-08 02:18:04 -07:00
|
|
|
e_thumb_icon_add(Evas *evas)
|
2005-11-22 01:27:25 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
E_Thumb *eth;
|
2006-07-17 12:02:42 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
obj = e_icon_add(evas);
|
2009-04-04 20:49:16 -07:00
|
|
|
evas_object_smart_callback_add(obj, "preloaded", _thumb_preloaded, obj);
|
2006-07-08 02:18:04 -07:00
|
|
|
_objid++;
|
|
|
|
eth = E_NEW(E_Thumb, 1);
|
|
|
|
eth->objid = _objid;
|
|
|
|
eth->w = 64;
|
|
|
|
eth->h = 64;
|
|
|
|
evas_object_data_set(obj, "e_thumbdata", eth);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
|
|
|
|
_e_thumb_del_hook, NULL);
|
|
|
|
_e_thumb_hash_add(eth->objid, obj);
|
|
|
|
return obj;
|
2005-11-22 01:27:25 -08:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2006-07-28 04:27:59 -07:00
|
|
|
e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key)
|
2005-11-22 01:27:25 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
E_Thumb *eth;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (eth->file) eina_stringshare_del(eth->file);
|
2006-07-28 04:27:59 -07:00
|
|
|
eth->file = NULL;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (eth->key) eina_stringshare_del(eth->key);
|
2006-07-28 04:27:59 -07:00
|
|
|
eth->key = NULL;
|
2008-10-15 08:12:56 -07:00
|
|
|
if (file) eth->file = eina_stringshare_add(file);
|
|
|
|
if (key) eth->key = eina_stringshare_add(key);
|
2005-11-22 01:27:25 -08:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
EAPI void
|
|
|
|
e_thumb_icon_size_set(Evas_Object *obj, int w, int h)
|
2005-10-18 16:03:36 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
E_Thumb *eth;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
|
|
|
if ((w < 1) || (h <1)) return;
|
|
|
|
eth->w = w;
|
|
|
|
eth->h = h;
|
2005-10-18 16:03:36 -07:00
|
|
|
}
|
|
|
|
|
2006-01-07 02:39:46 -08:00
|
|
|
EAPI void
|
2006-07-08 02:18:04 -07:00
|
|
|
e_thumb_icon_begin(Evas_Object *obj)
|
2005-12-07 23:55:10 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
E_Thumb *eth, *eth2;
|
|
|
|
char buf[4096];
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
2006-07-23 07:05:39 -07:00
|
|
|
if (eth->queued) return;
|
2006-07-22 14:48:24 -07:00
|
|
|
if (eth->busy) return;
|
2006-07-23 14:19:04 -07:00
|
|
|
if (eth->done) return;
|
2006-07-08 02:18:04 -07:00
|
|
|
if (!eth->file) return;
|
|
|
|
if (!_thumbnailers)
|
2005-12-07 23:55:10 -08:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
while (eina_list_count(_thumbnailers_exe) < _num_thumbnailers)
|
2005-12-07 23:55:10 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
Ecore_Exe *exe;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2009-01-01 17:08:14 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s/enlightenment/utils/enlightenment_thumb --nice=%d", e_prefix_lib_get(),
|
2007-04-05 10:20:09 -07:00
|
|
|
e_config->thumb_nice);
|
2006-07-08 02:18:04 -07:00
|
|
|
exe = ecore_exe_run(buf, NULL);
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumbnailers_exe = eina_list_append(_thumbnailers_exe, exe);
|
2005-12-07 23:55:10 -08:00
|
|
|
}
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_append(_thumb_queue, eth);
|
2006-07-08 02:18:04 -07:00
|
|
|
eth->queued = 1;
|
|
|
|
return;
|
2005-12-07 23:55:10 -08:00
|
|
|
}
|
2006-07-08 02:18:04 -07:00
|
|
|
while (_thumb_queue)
|
2005-12-07 23:55:10 -08:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
eth2 = _thumb_queue->data;
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_remove_list(_thumb_queue, _thumb_queue);
|
2006-07-08 02:18:04 -07:00
|
|
|
eth2->queued = 0;
|
|
|
|
eth2->busy = 1;
|
|
|
|
_pending++;
|
2006-07-08 06:53:55 -07:00
|
|
|
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_gen_begin(eth2->objid, eth2->file, eth2->key, eth2->w, eth2->h);
|
2005-12-07 23:55:10 -08:00
|
|
|
}
|
2006-07-08 02:18:04 -07:00
|
|
|
eth->busy = 1;
|
|
|
|
_pending++;
|
2006-07-08 06:53:55 -07:00
|
|
|
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h);
|
2005-12-07 23:55:10 -08:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
EAPI void
|
|
|
|
e_thumb_icon_end(Evas_Object *obj)
|
2005-10-18 16:03:36 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
E_Thumb *eth;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
2006-07-23 07:05:39 -07:00
|
|
|
if (eth->queued)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_remove(_thumb_queue, eth);
|
2006-07-23 07:05:39 -07:00
|
|
|
eth->queued = 0;
|
|
|
|
}
|
|
|
|
if (eth->busy)
|
|
|
|
{
|
|
|
|
_e_thumb_gen_end(eth->objid);
|
|
|
|
eth->busy = 0;
|
|
|
|
_pending--;
|
|
|
|
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
|
|
|
}
|
2005-10-18 16:03:36 -07:00
|
|
|
}
|
|
|
|
|
2006-10-17 20:31:45 -07:00
|
|
|
EAPI void
|
|
|
|
e_thumb_icon_rethumb(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
E_Thumb *eth;
|
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
|
|
|
|
|
|
|
if (eth->done) eth->done = 0;
|
|
|
|
else e_thumb_icon_end(obj);
|
|
|
|
|
|
|
|
e_thumb_icon_begin(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
EAPI void
|
|
|
|
e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
|
2005-10-22 10:02:37 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
int objid;
|
|
|
|
char *icon;
|
|
|
|
E_Thumb *eth;
|
|
|
|
Evas_Object *obj;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2008-10-22 04:49:33 -07:00
|
|
|
if (!eina_list_data_find(_thumbnailers, e->client))
|
|
|
|
_thumbnailers = eina_list_prepend(_thumbnailers, e->client);
|
2006-07-08 02:18:04 -07:00
|
|
|
if (e->minor == 2)
|
2005-10-23 08:18:47 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
objid = e->ref;
|
|
|
|
icon = e->data;
|
|
|
|
if ((icon) && (e->size > 1) && (icon[e->size - 1] == 0))
|
2005-10-23 08:18:47 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
obj = _e_thumb_hash_find(objid);
|
|
|
|
if (obj)
|
|
|
|
{
|
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (eth)
|
|
|
|
{
|
|
|
|
eth->busy = 0;
|
|
|
|
_pending--;
|
2006-07-23 14:19:04 -07:00
|
|
|
eth->done = 1;
|
2006-07-08 02:18:04 -07:00
|
|
|
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
2009-04-04 20:49:16 -07:00
|
|
|
e_icon_preload_set(obj, 1);
|
2006-07-08 02:18:04 -07:00
|
|
|
e_icon_file_key_set(obj, icon, "/thumbnail/data");
|
2009-04-04 20:49:16 -07:00
|
|
|
//x// evas_object_smart_callback_call(obj, "e_thumb_gen", NULL);
|
2006-07-08 02:18:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e->minor == 1)
|
|
|
|
{
|
|
|
|
/* hello message */
|
|
|
|
while (_thumb_queue)
|
|
|
|
{
|
|
|
|
eth = _thumb_queue->data;
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_remove_list(_thumb_queue, _thumb_queue);
|
2006-07-08 02:18:04 -07:00
|
|
|
eth->queued = 0;
|
|
|
|
eth->busy = 1;
|
|
|
|
_pending++;
|
2006-07-08 06:53:55 -07:00
|
|
|
if (_pending == 1) _e_thumb_thumbnailers_kill_cancel();
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h);
|
2005-10-23 08:18:47 -07:00
|
|
|
}
|
|
|
|
}
|
2005-10-22 10:02:37 -07:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
EAPI void
|
|
|
|
e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e)
|
2005-10-22 10:02:37 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
if (!eina_list_data_find(_thumbnailers, e->client)) return;
|
|
|
|
_thumbnailers = eina_list_remove(_thumbnailers, e->client);
|
2006-07-22 14:48:24 -07:00
|
|
|
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
|
2006-07-08 02:18:04 -07:00
|
|
|
}
|
2005-10-22 10:02:37 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
/* local subsystem functions */
|
|
|
|
static void
|
2006-07-28 04:27:59 -07:00
|
|
|
_e_thumb_gen_begin(int objid, const char *file, const char *key, int w, int h)
|
2006-07-08 02:18:04 -07:00
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
int l1, l2;
|
|
|
|
Ecore_Ipc_Client *cli;
|
|
|
|
|
|
|
|
/* send thumb req */
|
|
|
|
l1 = strlen(file);
|
|
|
|
l2 = 0;
|
|
|
|
if (key) l2 = strlen(key);
|
|
|
|
buf = alloca(l1 + 1 + l2 + 1);
|
|
|
|
strcpy(buf, file);
|
|
|
|
if (key) strcpy(buf + l1 + 1, key);
|
|
|
|
else buf[l1 + 1] = 0;
|
|
|
|
cli = _thumbnailers->data;
|
|
|
|
if (!cli) return;
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumbnailers = eina_list_remove_list(_thumbnailers, _thumbnailers);
|
|
|
|
_thumbnailers = eina_list_append(_thumbnailers, cli);
|
2006-07-08 02:18:04 -07:00
|
|
|
ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 1, objid, w, h, buf, l1 + 1 + l2 + 1);
|
2005-10-22 10:02:37 -07:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
static void
|
|
|
|
_e_thumb_gen_end(int objid)
|
2005-10-22 10:02:37 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-07-08 02:18:04 -07:00
|
|
|
Ecore_Ipc_Client *cli;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
/* send thumb cancel */
|
|
|
|
for (l = _thumbnailers; l; l = l->next)
|
2006-06-05 04:48:26 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
cli = l->data;
|
|
|
|
ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 2, objid, 0, 0, NULL, 0);
|
2006-06-05 04:48:26 -07:00
|
|
|
}
|
2005-10-22 10:02:37 -07:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
static void
|
|
|
|
_e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
2005-10-18 16:03:36 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
E_Thumb *eth;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
eth = evas_object_data_get(obj, "e_thumbdata");
|
|
|
|
if (!eth) return;
|
|
|
|
evas_object_data_del(obj, "e_thumbdata");
|
|
|
|
_e_thumb_hash_del(eth->objid);
|
|
|
|
if (eth->busy)
|
2005-10-20 08:07:45 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_gen_end(eth->objid);
|
2006-07-23 07:05:39 -07:00
|
|
|
eth->busy = 0;
|
2006-07-08 02:18:04 -07:00
|
|
|
_pending--;
|
|
|
|
if (_pending == 0) _e_thumb_thumbnailers_kill();
|
2005-10-20 08:07:45 -07:00
|
|
|
}
|
2006-07-08 02:18:04 -07:00
|
|
|
if (eth->queued)
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumb_queue = eina_list_remove(_thumb_queue, eth);
|
2008-10-15 08:12:56 -07:00
|
|
|
if (eth->file) eina_stringshare_del(eth->file);
|
|
|
|
if (eth->key) eina_stringshare_del(eth->key);
|
2006-07-08 02:18:04 -07:00
|
|
|
free(eth);
|
2005-10-18 16:03:36 -07:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
static void
|
|
|
|
_e_thumb_hash_add(int objid, Evas_Object *obj)
|
2005-10-18 16:03:36 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
char buf[32];
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%i", objid);
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_add(_thumbs, buf, obj);
|
2006-07-08 02:18:04 -07:00
|
|
|
}
|
2005-10-21 02:52:46 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
static void
|
|
|
|
_e_thumb_hash_del(int objid)
|
|
|
|
{
|
|
|
|
char buf[32];
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%i", objid);
|
2008-12-17 07:33:43 -08:00
|
|
|
eina_hash_del(_thumbs, buf, NULL);
|
2006-07-22 14:48:24 -07:00
|
|
|
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
|
2005-10-18 16:03:36 -07:00
|
|
|
}
|
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_e_thumb_hash_find(int objid)
|
2005-10-18 16:03:36 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
char buf[32];
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%i", objid);
|
2008-12-17 07:33:43 -08:00
|
|
|
return eina_hash_find(_thumbs, buf);
|
2005-10-18 16:03:36 -07:00
|
|
|
}
|
2005-11-22 01:27:25 -08:00
|
|
|
|
|
|
|
static void
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_thumbnailers_kill(void)
|
2006-07-08 06:53:55 -07:00
|
|
|
{
|
|
|
|
if (_kill_timer) ecore_timer_del(_kill_timer);
|
|
|
|
_kill_timer = ecore_timer_add(1.0, _e_thumb_cb_kill, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_thumb_thumbnailers_kill_cancel(void)
|
|
|
|
{
|
|
|
|
if (_kill_timer) ecore_timer_del(_kill_timer);
|
|
|
|
_kill_timer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_thumb_cb_kill(void *data)
|
2005-11-22 01:27:25 -08:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2006-07-08 02:18:04 -07:00
|
|
|
for (l = _thumbnailers_exe; l; l = l->next)
|
|
|
|
ecore_exe_terminate(l->data);
|
2006-07-08 06:53:55 -07:00
|
|
|
_kill_timer = NULL;
|
|
|
|
return 0;
|
2005-11-22 01:27:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-07-08 02:18:04 -07:00
|
|
|
_e_thumb_cb_exe_event_del(void *data, int type, void *event)
|
2005-11-22 01:27:25 -08:00
|
|
|
{
|
2006-01-15 03:27:19 -08:00
|
|
|
Ecore_Exe_Event_Del *ev;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2007-03-24 05:55:30 -07:00
|
|
|
|
2005-11-22 01:27:25 -08:00
|
|
|
ev = event;
|
2006-07-08 02:18:04 -07:00
|
|
|
for (l = _thumbnailers_exe; l; l = l->next)
|
2006-07-05 23:16:21 -07:00
|
|
|
{
|
2006-07-08 02:18:04 -07:00
|
|
|
if (l->data == ev->exe)
|
2005-12-19 06:42:43 -08:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
_thumbnailers_exe = eina_list_remove_list(_thumbnailers_exe, l);
|
2006-07-08 02:18:04 -07:00
|
|
|
break;
|
2005-12-19 06:42:43 -08:00
|
|
|
}
|
2005-11-22 01:27:25 -08:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|