Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
Makefile.am e_fileman_icon.c e_fileman_mime.c
e_fileman_smart.c e_icon.h e_int_config_background.c
e_int_config_background_import.c e_int_config_desklock.c
e_int_config_startup.c e_int_config_theme.c e_ipc.c e_ipc.h
e_menu.c e_thumb.c e_thumb.h
Added Files:
e_thumb_main.c
Log Message:
new thumbnailer system. works a bit more like epsilon - launches a
special-purpose executable and hands off workd to do via ipc (well the exe
connects back to e's ipc port actually but either way - same thing). it can
actually launch any numebr of thumbnailers - the default is 2, but this means
it can make full use of smp systems. i need to make this # of thumbnailers
configurable and add a config dialog for it. this does mean thew bg/theme
etc. dialogs pop up much faster as they dont load all the thumbs to start -
its farmed off and ipc tells us when they are ready (and if already generated
- thats pretty damn fast). :) anyway - now thumbnailing works reliably
(thoguh i think the queue handling isnt quite that good - well when it comes
to interacting with efm... but i'll check into that later. dont worry though
- it does actually generate all the thumbs - it just may be busy generating
ones you don't see while it catches up).
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/Makefile.am,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -3 -r1.124 -r1.125
--- Makefile.am 2 Jun 2006 19:07:50 -0000 1.124
+++ Makefile.am 8 Jul 2006 09:18:03 -0000 1.125
@@ -14,7 +14,8 @@
enlightenment_eapp \
enlightenment_eapp_cache_gen \
enlightenment_imc \
-enlightenment_start
+enlightenment_start \
+enlightenment_thumb
ENLIGHTENMENTHEADERS = \
e.h \
@@ -334,6 +335,11 @@
e_start_main.c
enlightenment_start_LDFLAGS =
+
+enlightenment_thumb_SOURCES = \
+e_thumb_main.c
+
+enlightenment_thumb_LDFLAGS = @e_libs@ @dlopen_libs@
installed_headersdir = $(prefix)/include/enlightenment
installed_headers_DATA = $(ENLIGHTENMENTHEADERS)
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fileman_icon.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- e_fileman_icon.c 17 Feb 2006 13:36:31 -0000 1.31
+++ e_fileman_icon.c 8 Jul 2006 09:18:03 -0000 1.32
@@ -12,7 +12,6 @@
Evas *evas;
Evas_Object *obj;
- char *thumb_path;
char *saved_title;
Evas_Object *event_object;
@@ -137,50 +136,32 @@
sd = evas_object_smart_data_get(obj);
if (!sd) return;
- if(!sd->file)
- e_object_ref(E_OBJECT(file));
+ if (!sd->file) e_object_ref(E_OBJECT(file));
sd->file = file;
file->icon_object = obj;
- /* FIXME fix this */
if (sd->file->mime->thumbnail)
{
- sd->thumb_path = e_thumb_file_get(sd->file->path);
- if (e_thumb_exists(sd->file->path))
- {
- sd->thumb_object = e_thumb_evas_object_get(sd->file->path,
- sd->evas,
- sd->iw,
- sd->ih,
- 1);
- // evas_object_geometry_get(sd->thumb_object, NULL, NULL,
&icon_w, &icon_h);
- // sd->iw = icon_w;
- // sd->ih = icon_h;
- sd->image_object = edje_object_add(sd->evas);
- e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
- "fileman/icon_thumb");
- edje_extern_object_min_size_set(sd->thumb_object, sd->iw, sd->ih);
- edje_extern_object_max_size_set(sd->thumb_object, sd->iw, sd->ih);
- edje_object_part_swallow(sd->image_object, "icon_swallow",
- sd->thumb_object);
- edje_object_size_min_calc(sd->image_object, &icon_w, &icon_h);
- sd->iw = icon_w;
- sd->ih = icon_h;
- edje_extern_object_min_size_set(sd->image_object, icon_w, icon_h);
- edje_extern_object_max_size_set(sd->image_object, icon_w, icon_h);
- edje_object_part_swallow(sd->icon_object, "icon_swallow",
- sd->image_object);
- }
- else
- {
- sd->thumb_object = sd->file->mime->thumbnail(sd->file->path,
sd->iw,
- sd->ih, sd->evas,
- &sd->thumb_object,
-
_e_fm_icon_thumb_generate_cb,
- sd);
-
- _e_fm_icon_icon_mime_get(sd);
- }
+ /* FIXME: should use smart callback to change icon when thumb done */
+ sd->thumb_object = e_thumb_icon_add(sd->evas);
+ e_thumb_icon_file_set(sd->thumb_object, sd->file->path, NULL);
+ e_thumb_icon_size_set(sd->thumb_object, 64, 64);
+ e_thumb_icon_begin(sd->thumb_object);
+ evas_object_show(sd->thumb_object);
+ sd->image_object = edje_object_add(sd->evas);
+ e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
+ "fileman/icon_thumb");
+ edje_extern_object_min_size_set(sd->thumb_object, sd->iw, sd->ih);
+ edje_extern_object_max_size_set(sd->thumb_object, sd->iw, sd->ih);
+ edje_object_part_swallow(sd->image_object, "icon_swallow",
+ sd->thumb_object);
+ edje_object_size_min_calc(sd->image_object, &icon_w, &icon_h);
+ sd->iw = icon_w;
+ sd->ih = icon_h;
+ edje_extern_object_min_size_set(sd->image_object, icon_w, icon_h);
+ edje_extern_object_max_size_set(sd->image_object, icon_w, icon_h);
+ edje_object_part_swallow(sd->icon_object, "icon_swallow",
+ sd->image_object);
}
else
{
@@ -511,49 +492,6 @@
edje_extern_object_max_size_set(sd->image_object, sd->iw, sd->ih);
edje_object_part_swallow(sd->icon_object, "icon_swallow",
sd->image_object);
-}
-
-
-
-void
-_e_fm_icon_thumb_generate_cb(Evas_Object *obj, void *data)
-{
- E_Smart_Data *sd;
-
- sd = data;
-
- /* FIXME fix this */
-#if 0
- if (e_fm_file_has_mime(sd->file,".eap") ||
(ecore_file_exists(sd->thumb_path)))
- {
- Evas_Coord icon_w, icon_h;
-
- if (sd->image_object) evas_object_del(sd->image_object);
-
- sd->thumb_object = e_thumb_evas_object_get(sd->file->path,
- sd->evas,
- sd->iw,
- sd->ih,
- 1);
-
- sd->image_object = edje_object_add(sd->evas);
- e_theme_edje_object_set(sd->image_object, "base/theme/fileman",
- "fileman/icon_thumb");
- evas_object_show(sd->image_object);
- evas_object_show(sd->thumb_object);
- edje_extern_object_min_size_set(sd->thumb_object, sd->iw, sd->ih);
- edje_extern_object_max_size_set(sd->thumb_object, sd->iw, sd->ih);
- edje_object_part_swallow(sd->image_object, "icon_swallow",
- sd->thumb_object);
- edje_object_size_min_calc(sd->image_object, &icon_w, &icon_h);
- sd->iw = icon_w;
- sd->ih = icon_h;
- edje_extern_object_min_size_set(sd->image_object, icon_w, icon_h);
- edje_extern_object_max_size_set(sd->image_object, icon_w, icon_h);
- edje_object_part_swallow(sd->icon_object, "icon_swallow",
- sd->image_object);
- }
-#endif
}
static void
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fileman_mime.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_fileman_mime.c 2 Mar 2006 12:03:48 -0000 1.9
+++ e_fileman_mime.c 8 Jul 2006 09:18:03 -0000 1.10
@@ -610,8 +610,7 @@
E_Fm_File *file;
file = sd->operation.files->data;
- e_fm_dir_set(sd->object, file->path);
-
+ if (file) e_fm_dir_set(sd->object, file->path);
}
static void
@@ -621,8 +620,11 @@
E_Fm_File *file;
file = sd->operation.files->data;
- fileman =
e_fileman_new_to_dir(e_container_current_get(e_manager_current_get()),
file->path);
- e_fileman_show(fileman);
+ if (file)
+ {
+ fileman =
e_fileman_new_to_dir(e_container_current_get(e_manager_current_get()),
file->path);
+ e_fileman_show(fileman);
+ }
}
static void
_e_fm_mime_action_internal_copy_to(E_Fm_Smart_Data *sd)
@@ -637,14 +639,15 @@
/* thumbnail functions */
/***********************/
-Evas_Object * _e_fm_mime_thumbnail_evas(char *path, Evas_Coord w, Evas_Coord
h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data),
void *data)
+Evas_Object *
+_e_fm_mime_thumbnail_evas(char *path, Evas_Coord w, Evas_Coord h, Evas *evas,
Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data)
{
Evas_Object *r;
- r = e_thumb_generate_begin(path, w,
- h, evas, tmp, cb,
- data);
-
+ r = e_thumb_icon_add(evas);
+ e_thumb_icon_file_set(r, path, NULL);
+ e_thumb_icon_size_set(r, w, h);
+ e_thumb_icon_begin(r);
return r;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fileman_smart.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -3 -r1.137 -r1.138
--- e_fileman_smart.c 23 Feb 2006 16:42:38 -0000 1.137
+++ e_fileman_smart.c 8 Jul 2006 09:18:03 -0000 1.138
@@ -501,7 +501,6 @@
E_Fm_Icon *icon;
icon = data;
- e_thumb_generate_end(icon->file->path);
evas_object_del(icon->icon_obj);
icon->state.visible = 0;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_icon.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_icon.h 22 Nov 2005 09:27:25 -0000 1.9
+++ e_icon.h 8 Jul 2006 09:18:03 -0000 1.10
@@ -10,7 +10,7 @@
EAPI void e_icon_file_set (Evas_Object *obj, const char *file);
EAPI void e_icon_file_key_set (Evas_Object *obj, const char *file,
const char *key);
EAPI void e_icon_file_edje_set (Evas_Object *obj, const char *file,
const char *part);
-EAPI void e_icon_object_set(Evas_Object *obj, Evas_Object *o);
+EAPI void e_icon_object_set (Evas_Object *obj, Evas_Object *o);
EAPI const char *e_icon_file_get (Evas_Object *obj);
EAPI void e_icon_smooth_scale_set (Evas_Object *obj, int smooth);
EAPI int e_icon_smooth_scale_get (Evas_Object *obj);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_background.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- e_int_config_background.c 2 Jul 2006 16:19:51 -0000 1.55
+++ e_int_config_background.c 8 Jul 2006 09:18:03 -0000 1.56
@@ -304,11 +304,12 @@
{
Evas_Object *ic = NULL;
- if (!e_thumb_exists(c))
- ic = e_thumb_generate_begin(c, 48, 48, cfd->dia->win->evas, &ic,
NULL, NULL);
- else
- ic = e_thumb_evas_object_get(c, cfd->dia->win->evas, 48, 48, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, f, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+ e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(il, ic, _("Theme Wallpaper"),
_ilist_cb_bg_selected, cfd, "");
if (!e_config->desktop_default_background) selnum = i;
i++;
@@ -370,11 +371,12 @@
if (ecore_file_is_dir(full_path)) continue;
if (!e_util_edje_collection_exists(full_path,
"desktop/background")) continue;
- if (!e_thumb_exists(full_path))
- ic = e_thumb_generate_begin(full_path, 48, 48, evas, &ic, NULL,
NULL);
- else
- ic = e_thumb_evas_object_get(full_path, evas, 48, 48, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, full_path, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+
e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(il, ic, ecore_file_strip_ext(bg_file),
_ilist_cb_bg_selected, cfd, full_path);
if ((e_config->desktop_default_background) &&
(!strcmp(e_config->desktop_default_background, full_path)))
@@ -486,10 +488,12 @@
{
if (e_util_edje_collection_exists((char *)path, "desktop/background"))
{
- if (!e_thumb_exists((char *)path))
- ic = e_thumb_generate_begin((char *)path, 48, 48, evas, &ic,
NULL, NULL);
- else
- ic = e_thumb_evas_object_get((char *)path, evas, 48, 48, 1);
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, path, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+
e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(il, ic, noext, _ilist_cb_bg_selected, cfd,
(char *)path);
}
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_background_import.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_int_config_background_import.c 3 Jul 2006 19:04:00 -0000 1.9
+++ e_int_config_background_import.c 8 Jul 2006 09:18:03 -0000 1.10
@@ -255,16 +255,18 @@
int w, h;
const char *file;
char buff[4096], cmd[4096];
- char ipart[512];
+ char ipart[4096];
char *imgdir = NULL;
- static char tmpn[1024];
+ static char tmpn[4096];
FILE *out = NULL;
Ecore_Exe *x;
if (!filename) return;
file = ecore_file_get_file(filename);
- snprintf(buff, sizeof(buff), "%s/.e/e/backgrounds/%s.edj",
e_user_homedir_get(), ecore_file_strip_ext(file));
+ snprintf(buff, sizeof(buff), "%s/.e/e/backgrounds/%s.edj",
+ e_user_homedir_get(),
+ ecore_file_strip_ext(file));
strcpy(tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX");
fd = mkstemp(tmpn);
if (fd < 0)
@@ -309,7 +311,10 @@
fclose(out);
- snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s", ipart, tmpn, buff);
+ snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s",
+ ipart,
+ tmpn,
+ e_util_filename_escape(buff));
_edj_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_edj_exe_exit_cb, NULL);
x = ecore_exe_run(cmd, tmpn);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_desklock.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- e_int_config_desklock.c 2 Jul 2006 16:19:51 -0000 1.23
+++ e_int_config_desklock.c 8 Jul 2006 09:18:03 -0000 1.24
@@ -532,13 +532,12 @@
e_widget_ilist_header_append(cfdata->gui.bg_list, NULL, _("Theme
Backgrounds"));
if (edje_object_file_set(o, f1, "desklock/background"))
{
- if (!e_thumb_exists(c))
- ic = e_thumb_generate_begin(c, BG_LIST_ICON_SIZE_W,
BG_LIST_ICON_SIZE_H,
- cfdata->evas, &ic, NULL, NULL);
- else
- ic = e_thumb_evas_object_get(c, cfdata->evas, BG_LIST_ICON_SIZE_W,
- BG_LIST_ICON_SIZE_H, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, (char *)f1, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+ e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(cfdata->gui.bg_list, ic, _("Theme Desklock
Background"),
_ibg_list_cb_bg_selected, cfdata,
DEF_DESKLOCK_BACKGROUND);
}
@@ -565,13 +564,12 @@
ic = NULL;
if (edje_object_file_set(o, f, "desktop/background"))
{
- if (!e_thumb_exists(c))
- ic = e_thumb_generate_begin(c, BG_LIST_ICON_SIZE_W,
BG_LIST_ICON_SIZE_H,
- cfdata->evas, &ic, NULL, NULL);
- else
- ic = e_thumb_evas_object_get(c, cfdata->evas, BG_LIST_ICON_SIZE_W,
- BG_LIST_ICON_SIZE_H, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, (char *)f, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+ e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(cfdata->gui.bg_list, ic, _("Theme Background"),
_ibg_list_cb_bg_selected, cfdata,
DEF_THEME_BACKGROUND);
}
@@ -612,13 +610,12 @@
if (ecore_file_is_dir(full_path)) continue;
if (!e_util_edje_collection_exists(full_path,
"desktop/background")) continue;
- if (!e_thumb_exists(full_path))
- ic = e_thumb_generate_begin(full_path, BG_LIST_ICON_SIZE_W,
BG_LIST_ICON_SIZE_H,
- cfdata->evas, &ic, NULL, NULL);
- else
- ic = e_thumb_evas_object_get(full_path, cfdata->evas,
BG_LIST_ICON_SIZE_W,
- BG_LIST_ICON_SIZE_H, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, full_path, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+
e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(cfdata->gui.bg_list, ic,
ecore_file_strip_ext(bg_file),
_ibg_list_cb_bg_selected, cfdata,
full_path);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_startup.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- e_int_config_startup.c 2 Jul 2006 16:19:51 -0000 1.9
+++ e_int_config_startup.c 8 Jul 2006 09:18:03 -0000 1.10
@@ -195,11 +195,12 @@
if (ecore_file_is_dir(full_path)) continue;
if (!e_util_edje_collection_exists(full_path, "init/splash"))
continue;
- if (!e_thumb_exists(full_path))
- ic = e_thumb_generate_begin(full_path, 48, 48,
cfd->dia->win->evas, &ic, NULL, NULL);
- else
- ic = e_thumb_evas_object_get(full_path, cfd->dia->win->evas, 48,
48, 1);
-
+ ic = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(ic, full_path, "desktop/background");
+ e_thumb_icon_size_set(ic, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+
e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(ic);
e_widget_ilist_append(il, ic, ecore_file_strip_ext(init_file),
_ilist_cb_init_selected, cfd, full_path);
if ((e_config->init_default_theme) &&
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_theme.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- e_int_config_theme.c 2 Jul 2006 16:19:51 -0000 1.27
+++ e_int_config_theme.c 8 Jul 2006 09:18:03 -0000 1.28
@@ -104,7 +104,6 @@
d = data;
e_widget_preview_edje_set(d->cfd->data, d->file, "desktop/background");
-// e_widget_image_object_set(d->cfd->data, e_thumb_evas_object_get(d->file,
d->cfd->dia->win->evas, 160, 120, 1));
cfdata = d->cfd->cfdata;
if (cfdata->current_theme)
@@ -199,10 +198,12 @@
char *noext;
E_Cfg_Theme_Data *cb_data;
- if (!e_thumb_exists(fulltheme))
- o3 = e_thumb_generate_begin(fulltheme, 48, 48,
cfd->dia->win->evas, &o3, NULL, NULL);
- else
- o3 = e_thumb_evas_object_get(fulltheme,
cfd->dia->win->evas, 48, 48, 1);
+ o3 = e_thumb_icon_add(cfd->dia->win->evas);
+ e_thumb_icon_file_set(o3, fulltheme, "desktop/background");
+ e_thumb_icon_size_set(o3, 64,
+ (64 *
e_zone_current_get(cfd->dia->win->container)->h) /
+
e_zone_current_get(cfd->dia->win->container)->w);
+ e_thumb_icon_begin(o3);
noext = ecore_file_strip_ext(themefile);
@@ -221,8 +222,6 @@
(320 *
e_zone_current_get(cfd->dia->win->container)->h) /
e_zone_current_get(cfd->dia->win->container)->w);
e_widget_preview_edje_set(im, fulltheme,
"desktop/background");
- // im = e_widget_image_add_from_object(evas, theme, 320,
240);
- // e_widget_image_object_set(im,
e_thumb_evas_object_get(fulltheme, evas, 320, 240, 1));
}
free(noext);
i++;
@@ -245,9 +244,6 @@
(320 *
e_zone_current_get(cfd->dia->win->container)->h) /
e_zone_current_get(cfd->dia->win->container)->w);
e_widget_preview_edje_set(im, fulltheme, "desktop/background");
-// theme = e_thumb_generate_begin(fulltheme, 320, 240, evas, &theme, NULL,
NULL);
-// im = e_widget_image_add_from_object(evas, theme, 320, 240);
-// e_widget_image_object_set(im, e_thumb_evas_object_get(fulltheme, evas,
320, 240, 1));
}
cfd->data = im;
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_ipc.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- e_ipc.c 4 Jul 2006 18:36:29 -0000 1.54
+++ e_ipc.c 8 Jul 2006 09:18:03 -0000 1.55
@@ -116,6 +116,7 @@
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1;
/* delete client sruct */
+ e_thumb_client_del(e);
ecore_ipc_client_del(e->client);
return 1;
}
@@ -127,11 +128,24 @@
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1;
- switch (e->minor)
+ switch (e->major)
{
+ case E_IPC_DOMAIN_SETUP:
+ case E_IPC_DOMAIN_REQUEST:
+ case E_IPC_DOMAIN_REPLY:
+ case E_IPC_DOMAIN_EVENT:
+ switch (e->minor)
+ {
#define TYPE E_WM_IN
-#include "e_ipc_handlers.h"
+#include "e_ipc_handlers.h"
#undef TYPE
+ default:
+ break;
+ }
+ break;
+ case E_IPC_DOMAIN_THUMB:
+ e_thumb_client_data(e);
+ break;
default:
break;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_ipc.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- e_ipc.h 10 Mar 2006 05:48:46 -0000 1.20
+++ e_ipc.h 8 Jul 2006 09:18:03 -0000 1.21
@@ -13,6 +13,7 @@
E_IPC_DOMAIN_REQUEST,
E_IPC_DOMAIN_REPLY,
E_IPC_DOMAIN_EVENT,
+ E_IPC_DOMAIN_THUMB,
E_IPC_DOMAIN_LAST
} E_Ipc_Domain;
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- e_menu.c 20 Jun 2006 13:10:08 -0000 1.52
+++ e_menu.c 8 Jul 2006 09:18:03 -0000 1.53
@@ -1788,7 +1788,7 @@
static void
_e_menu_submenu_deactivate(E_Menu_Item *mi)
{
- if (mi->menu->active) return;
+ if (!mi->menu->active) return;
if (mi->submenu_post_cb.func)
mi->submenu_post_cb.func(mi->submenu_post_cb.data, mi->menu, mi);
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_thumb.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- e_thumb.c 6 Jul 2006 06:16:21 -0000 1.28
+++ e_thumb.c 8 Jul 2006 09:18:04 -0000 1.29
@@ -1,631 +1,317 @@
/*
-* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
-*/
-
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
#include "e.h"
-#ifdef EFM_DEBUG
-# define D(x) do {printf(__FILE__ ":%d: ", __LINE__); printf x;
fflush(stdout);} while (0)
-#else
-# define D(x) ((void) 0)
-#endif
-
-typedef struct _E_Thumb_Item E_Thumb_Item;
-
-static char *_e_thumb_file_id(char *file);
-static void _e_thumb_generate(void);
-static int _e_thumb_cb_exe_exit(void *data, int type, void *event);
-
-static char *thumb_path = NULL;
-static Evas_List *thumb_files = NULL;
-static Evas_List *event_handlers = NULL;
-static pid_t pid = -1;
-
-struct _E_Thumb_Item
-{
- char path[PATH_MAX];
- Evas_Object *obj;
- Evas *evas;
- Evas_Coord w, h;
- void (*cb)(Evas_Object *obj, void *data);
- void *data;
+typedef struct _E_Thumb E_Thumb;
+
+struct _E_Thumb
+{
+ int objid;
+ int w, h;
+ char *file;
+ char *key;
+ unsigned char queued : 1;
+ unsigned char busy : 1;
};
+/* local subsystem functions */
+static void _e_thumb_gen_begin(int objid, char *file, char *key, int w, int h);
+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);
+static int _e_thumb_cb_exe_event_del(void *data, int type, void *event);
+
+/* local subsystem globals */
+static Evas_List *_thumbnailers = NULL;
+static Evas_List *_thumbnailers_exe = NULL;
+static Evas_List *_thumb_queue = NULL;
+static int _objid = 0;
+static Evas_Hash *_thumbs = NULL;
+static int _pending = 0;
+static int _num_thumbnailers = 2;
+static Ecore_Event_Handler *_exe_del_handler = NULL;
+
+/* externally accessible functions */
EAPI int
e_thumb_init(void)
{
- char *homedir;
- char path[PATH_MAX];
-
- homedir = e_user_homedir_get();
- if (homedir)
- {
- snprintf(path, sizeof(path), "%s/.e/e/fileman/thumbnails", homedir);
- if (!ecore_file_exists(path))
- ecore_file_mkpath(path);
- thumb_path = strdup(path);
- free(homedir);
- }
- else return 0;
-
- event_handlers =
- evas_list_append(event_handlers,
- ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
- _e_thumb_cb_exe_exit,
- NULL));
+ _exe_del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
+ _e_thumb_cb_exe_event_del,
+ NULL);
return 1;
}
EAPI int
e_thumb_shutdown(void)
{
- E_FREE(thumb_path);
- while (event_handlers)
- {
- ecore_event_handler_del(event_handlers->data);
- event_handlers = evas_list_remove_list(event_handlers, event_handlers);
- }
- evas_list_free(thumb_files);
-
- if (pid != -1)
- kill(pid, SIGTERM);
-
+ ecore_event_handler_del(_exe_del_handler);
+ _exe_del_handler = NULL;
return 1;
}
-/* return dir where thumbs are saved */
-EAPI const char *
-e_thumb_dir_get(void)
+EAPI Evas_Object *
+e_thumb_icon_add(Evas *evas)
{
- return thumb_path;
+ Evas_Object *obj;
+ E_Thumb *eth;
+ char buf[32];
+
+ obj = e_icon_add(evas);
+ _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;
}
-/* queue an image for thumbnailing or return the thumb if it exists */
-EAPI Evas_Object *
-e_thumb_generate_begin(char *path, Evas_Coord w, Evas_Coord h, Evas *evas,
Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data)
+EAPI void
+e_thumb_icon_file_set(Evas_Object *obj, char *file, char *key)
{
- E_Thumb_Item *t;
+ E_Thumb *eth;
- if(!ecore_file_exists(path)) return *tmp;
- if (e_thumb_exists(path))
- {
- evas_object_del(*tmp);
- *tmp = e_thumb_evas_object_get(path, evas, w, h, 1);
- return *tmp;
- }
-
- t = E_NEW(E_Thumb_Item, 1);
- t->w = w;
- t->h = h;
- t->evas = evas;
- t->cb = cb;
- t->data = data;
- *tmp = e_icon_add(evas);
- t->obj = *tmp;
- snprintf(t->path, sizeof(t->path), "%s", path);
- thumb_files = evas_list_append(thumb_files, t);
- if (pid == -1) _e_thumb_generate();
+ eth = evas_object_data_get(obj, "e_thumbdata");
+ if (!eth) return;
+ E_FREE(eth->file);
+ E_FREE(eth->key);
+ if (file) eth->file = strdup(file);
+ if (key) eth->key = strdup(key);
+}
+
+EAPI void
+e_thumb_icon_size_set(Evas_Object *obj, int w, int h)
+{
+ E_Thumb *eth;
- return *tmp;
+ eth = evas_object_data_get(obj, "e_thumbdata");
+ if (!eth) return;
+ if ((w < 1) || (h <1)) return;
+ eth->w = w;
+ eth->h = h;
}
-/* delete an image from the thumb queue */
EAPI void
-e_thumb_generate_end(char *path)
+e_thumb_icon_begin(Evas_Object *obj)
{
- Evas_List *l;
- E_Thumb_Item *t;
+ E_Thumb *eth, *eth2;
+ char buf[4096];
- for(l = thumb_files; l; l = l->next)
- {
- t = l->data;
- if(!strcmp(path, t->path))
- {
- thumb_files = evas_list_remove_list(thumb_files, l);
- break;
- }
+ eth = evas_object_data_get(obj, "e_thumbdata");
+ if (!eth) return;
+ if (!eth->file) return;
+ if (!_thumbnailers)
+ {
+ while (evas_list_count(_thumbnailers_exe) < _num_thumbnailers)
+ {
+ Ecore_Exe *exe;
+
+ snprintf(buf, sizeof(buf), "%s/enlightenment_thumb",
e_prefix_bin_get());
+ exe = ecore_exe_run(buf, NULL);
+ _thumbnailers_exe = evas_list_append(_thumbnailers_exe, exe);
+ }
+ _thumb_queue = evas_list_append(_thumb_queue, eth);
+ eth->queued = 1;
+ return;
}
+ while (_thumb_queue)
+ {
+ eth2 = _thumb_queue->data;
+ _thumb_queue = evas_list_remove_list(_thumb_queue, _thumb_queue);
+ eth2->queued = 0;
+ eth2->busy = 1;
+ _pending++;
+ _e_thumb_gen_begin(eth2->objid, eth2->file, eth2->key, eth2->w,
eth2->h);
+ }
+ eth->busy = 1;
+ _pending++;
+ _e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w, eth->h);
}
-/* return hashed path of thumb */
-EAPI char *
-e_thumb_file_get(char *file)
-{
- char *id;
- char thumb[PATH_MAX];
-
- id = _e_thumb_file_id(file);
- if (!id) return NULL;
- snprintf(thumb, sizeof(thumb), "%s/%s", thumb_path, id);
- free(id);
- return strdup(thumb);
+EAPI void
+e_thumb_icon_end(Evas_Object *obj)
+{
+ E_Thumb *eth;
+
+ eth = evas_object_data_get(obj, "e_thumbdata");
+ if (!eth) return;
+ if (eth->queued) _thumb_queue = evas_list_remove(_thumb_queue, eth);
+ eth->queued = 0;
+ if (eth->busy) _e_thumb_gen_end(eth->objid);
+ eth->busy = 0;
+ _pending--;
+ if (_pending == 0) _e_thumb_thumbnailers_kill();
}
-/* return the width and height of a thumb, if from_eet is set, then we
- * assume that the file being passed is the thumb's eet
- */
EAPI void
-e_thumb_geometry_get(char *file, int *w, int *h, int from_eet)
+e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
{
- Eet_File *ef;
-
- if(!from_eet)
- {
- char *eet_file;
-
- eet_file = _e_thumb_file_id(file);
- if(!eet_file)
- {
- if(w) *w = -1;
- if(h) *h = -1;
- return;
- }
- ef = eet_open(eet_file, EET_FILE_MODE_READ);
- if (!ef)
+ int objid;
+ char *icon;
+ E_Thumb *eth;
+ Evas_Object *obj;
+
+ if (!evas_list_find(_thumbnailers, e->client))
+ _thumbnailers = evas_list_prepend(_thumbnailers, e->client);
+ if (e->minor == 2)
+ {
+ objid = e->ref;
+ icon = e->data;
+ if ((icon) && (e->size > 1) && (icon[e->size - 1] == 0))
{
- eet_close(ef);
- if(w) *w = -1;
- if(h) *h = -1;
- return;
+ obj = _e_thumb_hash_find(objid);
+ if (obj)
+ {
+ eth = evas_object_data_get(obj, "e_thumbdata");
+ if (eth)
+ {
+ eth->busy = 0;
+ _pending--;
+ if (_pending == 0) _e_thumb_thumbnailers_kill();
+ e_icon_file_key_set(obj, icon, "/thumbnail/data");
+ evas_object_smart_callback_call(obj, "e_thumb_gen",
NULL);
+ }
+ }
}
}
- else
+ if (e->minor == 1)
{
- ef = eet_open(file, EET_FILE_MODE_READ);
- if (!ef)
+ /* hello message */
+ while (_thumb_queue)
{
- eet_close(ef);
- if(w) *w = -1;
- if(h) *h = -1;
- return;
+ eth = _thumb_queue->data;
+ _thumb_queue = evas_list_remove_list(_thumb_queue, _thumb_queue);
+ eth->queued = 0;
+ eth->busy = 1;
+ _pending++;
+ _e_thumb_gen_begin(eth->objid, eth->file, eth->key, eth->w,
eth->h);
}
}
- if(!eet_data_image_header_read(ef, "/thumbnail/data", w, h, NULL, NULL,
- NULL, NULL))
- {
- eet_close(ef);
- if(w) *w = -1;
- if(h) *h = -1;
- return;
- }
- eet_close(ef);
}
-/* return true if the saved thumb exists OR if its an eap */
-EAPI int
-e_thumb_exists(char *file)
+EAPI void
+e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e)
{
- char *thumb;
- char *ext;
-
- ext = strrchr(file, '.');
- if ((ext) && (!strcasecmp(ext, ".eap")))
- return 1;
+ if (!evas_list_find(_thumbnailers, e->client)) return;
+ _thumbnailers = evas_list_remove(_thumbnailers, e->client);
+}
- thumb = e_thumb_file_get(file);
- if ((thumb) && (ecore_file_exists(thumb)))
- {
- free(thumb);
- return 1;
- }
- return 0;
+/* local subsystem functions */
+static void
+_e_thumb_gen_begin(int objid, char *file, char *key, int w, int h)
+{
+ 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;
+ _thumbnailers = evas_list_remove_list(_thumbnailers, _thumbnailers);
+ _thumbnailers = evas_list_append(_thumbnailers, cli);
+ ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 1, objid, w, h, buf, l1 + 1
+ l2 + 1);
}
-EAPI int *
-_e_thumb_image_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int
*hh, int *alpha, Evas_Object **im, Ecore_Evas **buf)
+static void
+_e_thumb_gen_end(int objid)
{
- Evas *evasbuf;
- int iw, ih;
+ Evas_List *l;
+ Ecore_Ipc_Client *cli;
- *buf = ecore_evas_buffer_new(1, 1);
- evasbuf = ecore_evas_get(*buf);
- *im = evas_object_image_add(evasbuf);
- evas_object_image_file_set(*im, file, NULL);
- iw = 0; ih = 0;
- evas_object_image_size_get(*im, &iw, &ih);
- *alpha = evas_object_image_alpha_get(*im);
- if ((iw > 0) && (ih > 0))
+ /* send thumb cancel */
+ for (l = _thumbnailers; l; l = l->next)
{
- *ww = w;
- *hh = (w * ih) / iw;
- if (*hh > h)
- {
- *hh = h;
- *ww = (h * iw) / ih;
- }
- ecore_evas_resize(*buf, *ww, *hh);
- evas_object_image_fill_set(*im, 0, 0, *ww, *hh);
- evas_object_resize(*im, *ww, *hh);
- evas_object_move(*im, 0, 0);
- evas_object_show(*im);
-
- return (int *)ecore_evas_buffer_pixels_get(*buf);
+ cli = l->data;
+ ecore_ipc_client_send(cli, E_IPC_DOMAIN_THUMB, 2, objid, 0, 0, NULL, 0);
}
- return NULL;
}
-/* thumbnail an e17 background and return pixel data */
-const int *
-_e_thumb_ebg_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int *hh,
int *alpha, Evas_Object **im, Ecore_Evas **buf)
+static void
+_e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- Evas *evasbuf;
- Evas_Object *wallpaper;
- const int *pixels;
-
- *ww = 640;
- *hh = 480;
- *alpha = 0;
-
- w = 640;
- h = 480;
+ E_Thumb *eth;
- *buf = ecore_evas_buffer_new(w, h);
- evasbuf = ecore_evas_get(*buf);
-
- wallpaper = edje_object_add(evasbuf);
-
- edje_object_file_set(wallpaper, file, "desktop/background");
-
- /* wallpaper */
- evas_object_move(wallpaper, 0, 0);
- evas_object_resize(wallpaper, w, h);
-
- evas_object_show(wallpaper);
-
- pixels = ecore_evas_buffer_pixels_get(*buf);
-
- evas_object_del(wallpaper);
- return pixels;
+ 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)
+ {
+ _e_thumb_gen_end(eth->objid);
+ _pending--;
+ if (_pending == 0) _e_thumb_thumbnailers_kill();
+ }
+ if (eth->queued)
+ _thumb_queue = evas_list_remove(_thumb_queue, eth);
+ E_FREE(eth->file);
+ E_FREE(eth->key);
+ free(eth);
}
-/* thumbnail an e17 theme and return pixel data */
-const int *
-_e_thumb_etheme_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int
*hh, int *alpha, Evas_Object **im, Ecore_Evas **buf)
+static void
+_e_thumb_hash_add(int objid, Evas_Object *obj)
{
- Evas *evasbuf;
- Evas_Object *wallpaper, *window, *clock, *start, **pager, *init;
- const int *pixels;
- int is_init;
+ char buf[32];
- *ww = 640;
- *hh = 480;
- *alpha = 0;
-
- w = 640;
- h = 480;
-
- *buf = ecore_evas_buffer_new(w, h);
- evasbuf = ecore_evas_get(*buf);
-
- is_init = e_util_edje_collection_exists(file, "init/splash");
- if (is_init)
- {
- init = edje_object_add(evasbuf);
- edje_object_file_set(init, file, "init/splash");
- evas_object_move(init, 0, 0);
- evas_object_resize(init, w, h);
- evas_object_show(init);
- pixels = ecore_evas_buffer_pixels_get(*buf);
- evas_object_del(init);
- }
- else
- {
- wallpaper = edje_object_add(evasbuf);
- window = edje_object_add(evasbuf);
- clock = edje_object_add(evasbuf);
- start = edje_object_add(evasbuf);
- pager = E_NEW(Evas_Object*, 3);
- pager[0] = edje_object_add(evasbuf);
- pager[1] = edje_object_add(evasbuf);
- pager[2] = edje_object_add(evasbuf);
-
- edje_object_file_set(wallpaper, file, "desktop/background");
- edje_object_file_set(window, file, "widgets/border/default/border");
- edje_object_file_set(clock, file, "modules/clock/main");
- edje_object_file_set(clock, file, "modules/clock/main");
- edje_object_file_set(start, file, "modules/start/main");
- edje_object_file_set(pager[0], file, "modules/pager/main");
- edje_object_file_set(pager[1], file, "modules/pager/desk");
- edje_object_file_set(pager[2], file, "modules/pager/window");
- edje_object_part_text_set(window, "title_text", file);
- edje_object_part_swallow(pager[0], "items", pager[1]);
- edje_object_part_swallow(pager[1], "items", pager[2]);
-
- /* wallpaper */
- evas_object_move(wallpaper, 0, 0);
- evas_object_resize(wallpaper, w, h);
- /* main window */
- evas_object_move(window, (w * 0.1), (h * 0.05));
- evas_object_resize(window, w * 0.8, h * 0.75);
- /* clock */
- evas_object_move(clock, (w * 0.9), (h * 0.9));
- evas_object_resize(clock, w * 0.1, h * 0.1);
- /* start */
- evas_object_move(start, 0.1, (h * 0.9));
- evas_object_resize(start, w * 0.1, h * 0.1);
- /* pager */
- evas_object_move(pager[0], (w * 0.3), (h * 0.9));
- evas_object_resize(pager[0], w * 0.1, h * 0.1);
-
- evas_object_show(wallpaper);
- evas_object_show(window);
- evas_object_show(clock);
- evas_object_show(start);
- evas_object_show(pager[0]);
- evas_object_show(pager[1]);
- evas_object_show(pager[2]);
-
- pixels = ecore_evas_buffer_pixels_get(*buf);
-
- evas_object_del(wallpaper);
- evas_object_del(window);
- evas_object_del(clock);
- evas_object_del(start);
- evas_object_del(pager[0]);
- evas_object_del(pager[1]);
- evas_object_del(pager[2]);
- free(pager);
- }
-
- return pixels;
+ snprintf(buf, sizeof(buf), "%i", objid);
+ _thumbs = evas_hash_add(_thumbs, buf, obj);
}
-/* create and save a thumb to disk */
-EAPI int
-e_thumb_create(char *file, Evas_Coord w, Evas_Coord h)
+static void
+_e_thumb_hash_del(int objid)
{
- Eet_File *ef;
- char *thumbpath, *ext;
- Evas_Object *im = NULL;
- const int *data;
- int size, ww, hh;
- Ecore_Evas *buf;
- int alpha;
-
- ext = strrchr(file, '.');
- if ((ext) && (!strcasecmp(ext, ".eap")))
- return 1;
-
- thumbpath = e_thumb_file_get(file);
- if (!thumbpath)
- return -1;
-
- if (ext)
- {
- if (!strcasecmp(ext, ".edj"))
- {
- /* for now, this function does both the bg and theme previews */
- data = _e_thumb_etheme_create(file, w, h, &ww, &hh, &alpha, &im,
&buf);
- }
- else
- data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im,
&buf);
- }
- else
- data = _e_thumb_image_create(file, w, h, &ww, &hh, &alpha, &im, &buf);
+ char buf[32];
- if (data)
- {
- ef = eet_open(thumbpath, EET_FILE_MODE_WRITE);
- if (!ef)
- {
- free(thumbpath);
- if (im) evas_object_del(im);
- ecore_evas_free(buf);
- return -1;
- }
- free(thumbpath);
-
- eet_write(ef, "/thumbnail/orig_path", file, strlen(file), 1);
- if ((size = eet_data_image_write(ef, "/thumbnail/data",
- (void *)data, ww, hh, alpha,
- 0, 91, 1)) <= 0)
- {
- if (im) evas_object_del(im);
- ecore_evas_free(buf);
- eet_close(ef);
- return -1;
- }
- eet_close(ef);
- }
- if (im) evas_object_del(im);
- ecore_evas_free(buf);
- return 1;
+ snprintf(buf, sizeof(buf), "%i", objid);
+ _thumbs = evas_hash_del(_thumbs, buf, NULL);
}
-/* get evas object containing image of the thumb */
-EAPI Evas_Object *
-e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord
height, int shrink)
+static Evas_Object *
+_e_thumb_hash_find(int objid)
{
- Eet_File *ef;
- char *thumb, *ext;
- Evas_Object *im = NULL;
-
-#define DEF_THUMB_RETURN im = evas_object_rectangle_add(evas); \
- evas_object_color_set(im, 255, 255, 255, 255); \
- evas_object_resize(im, width, height); \
- return im
-
- D(("e_thumb_evas_object_get: (%s)\n", file));
-
- /* eap thumbnailer */
- ext = strrchr(file, '.');
- if (ext)
- {
- if (!strcasecmp(ext, ".eap"))
- {
- E_App *app;
-
- D(("e_thumb_evas_object_get: eap found\n"));
- app = e_app_new(file, 0);
- D(("e_thumb_evas_object_get: eap loaded\n"));
- if (!app)
- {
- D(("e_thumb_evas_object_get: invalid eap\n"));
- DEF_THUMB_RETURN;
- }
- else
- {
- D(("e_thumb_evas_object_get: creating eap thumb\n"));
- im = e_icon_add(evas);
- e_icon_file_edje_set(im, file, "icon");
- e_object_unref(E_OBJECT(app));
- D(("e_thumb_evas_object_get: returning eap thumb\n"));
- return im;
- }
- }
- }
-
- /* saved thumb */
- /* TODO: add ability to fetch thumbs from freedesktop dirs */
- if (!e_thumb_exists(file))
- {
- if (!e_thumb_create(file, width, height))
- {
- DEF_THUMB_RETURN;
- }
- }
+ char buf[32];
- thumb = e_thumb_file_get(file);
- if (!thumb)
- {
- DEF_THUMB_RETURN;
- }
-
- ef = eet_open(thumb, EET_FILE_MODE_READ);
- if (!ef)
- {
- eet_close(ef);
- free(thumb);
- DEF_THUMB_RETURN;
- }
-
- im = e_icon_add(evas);
- e_icon_file_key_set(im, thumb, "/thumbnail/data");
- if (shrink)
- {
- Evas_Coord sw, sh;
-
- e_icon_size_get(im, &sw, &sh);
- evas_object_resize(im, sw, sh);
- }
- e_icon_fill_inside_set(im, 1);
- free(thumb);
- eet_close(ef);
- return im;
-}
-
-/* return hash for a file */
-static char *
-_e_thumb_file_id(char *file)
-{
- char s[256], *sp;
- const char *chmap =
- "0123456789abcdef"
- "ghijklmnopqrstuv"
- "[EMAIL PROTECTED]&*()"
- "[];',.{}<>?-=_+|";
- unsigned int id[4], i;
- struct stat st;
-
- if (stat(file, &st) < 0)
- return NULL;
-
- id[0] = st.st_ino;
- id[1] = st.st_dev;
- id[2] = (st.st_size & 0xffffffff);
- id[3] = (st.st_mtime & 0xffffffff);
-
- sp = s;
- for (i = 0; i < 4; i++)
- {
- unsigned int t, tt;
- int j;
-
- t = id[i];
- j = 32;
- while (j > 0)
- {
- tt = t & ((1 << 6) - 1);
- *sp = chmap[tt];
- t >>= 6;
- j -= 6;
- sp++;
- }
- }
- *sp = 0;
- return strdup(s);
+ snprintf(buf, sizeof(buf), "%i", objid);
+ return evas_hash_find(_thumbs, buf);
}
-/* generate a thumb from the list of queued thumbs */
static void
-_e_thumb_generate(void)
+_e_thumb_thumbnailers_kill(void)
{
- E_Thumb_Item *t;
+ Evas_List *l;
- if ((!thumb_files) || (pid != -1)) return;
- pid = fork();
- if (pid == 0)
- {
- /* reset signal handlers for the child */
- signal(SIGSEGV, SIG_DFL);
- signal(SIGILL, SIG_DFL);
- signal(SIGFPE, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
-
- t = thumb_files->data;
- if (!e_thumb_exists(t->path))
- e_thumb_create(t->path, t->w, t->h);
- eet_clearcache();
- exit(0);
- }
+ for (l = _thumbnailers_exe; l; l = l->next)
+ ecore_exe_terminate(l->data);
}
-/* called when a thumb is generated */
static int
-_e_thumb_cb_exe_exit(void *data, int type, void *event)
+_e_thumb_cb_exe_event_del(void *data, int type, void *event)
{
Ecore_Exe_Event_Del *ev;
- E_Thumb_Item *t;
- char *ext;
+ Evas_List *l;
ev = event;
- if (ev->pid != pid) return 1;
- if (!thumb_files)
+ for (l = _thumbnailers_exe; l; l = l->next)
{
- pid = -1;
- return 1;
- }
-
- t = thumb_files->data;
- thumb_files = evas_list_remove_list(thumb_files, thumb_files);
-
- ext = strrchr(t->path, '.');
- if ((ext) && (strcasecmp(ext, ".eap")))
- ext = NULL;
-
- if ((ext) || (ecore_file_exists(t->path)))
- {
- Evas_Coord w, h;
- Evas_Object *tmp;
- void *data;
-
- tmp = e_thumb_evas_object_get(t->path,
- t->evas,
- t->w,
- t->h,
- 1);
- if (tmp && t)
+ if (l->data == ev->exe)
{
- data = e_icon_data_get(tmp, &w, &h);
- e_icon_data_set(t->obj, data, w, h);
- evas_object_del(tmp);
- if(t->cb)
- t->cb(t->obj, t->data);
- free(t);
+ _thumbnailers_exe = evas_list_remove_list(_thumbnailers_exe, l);
+ break;
}
}
-
- pid = -1;
- _e_thumb_generate();
return 1;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_thumb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_thumb.h 8 Dec 2005 07:57:07 -0000 1.5
+++ e_thumb.h 8 Jul 2006 09:18:04 -0000 1.6
@@ -10,14 +10,15 @@
EAPI int e_thumb_init(void);
EAPI int e_thumb_shutdown(void);
-EAPI const char *e_thumb_dir_get(void);
-EAPI char *e_thumb_file_get(char *file);
-EAPI void e_thumb_geometry_get(char *file, int *w, int *h,
int from_eet);
-EAPI int e_thumb_exists(char *file);
-EAPI int e_thumb_create(char *file, Evas_Coord w, Evas_Coord
h);
-EAPI Evas_Object *e_thumb_evas_object_get(char *file, Evas *evas,
Evas_Coord width, Evas_Coord height, int shrink);
-EAPI Evas_Object *e_thumb_generate_begin(char *path, Evas_Coord w,
Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void
*data), void *data);
-EAPI void e_thumb_generate_end(char *path);
-
+
+EAPI Evas_Object *e_thumb_icon_add(Evas *evas);
+EAPI void e_thumb_icon_file_set(Evas_Object *obj, char *file,
char *key);
+EAPI void e_thumb_icon_size_set(Evas_Object *obj, int w, int
h);
+EAPI void e_thumb_icon_begin(Evas_Object *obj);
+EAPI void e_thumb_icon_end(Evas_Object *obj);
+
+EAPI void e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e);
+EAPI void e_thumb_client_del(Ecore_Ipc_Event_Client_Del *e);
+
#endif
#endif
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs