From 718a3eaafcae22dff9994a9b862b30e2c1b035fe Mon Sep 17 00:00:00 2001 From: codewarrior Date: Fri, 21 Oct 2005 09:52:46 +0000 Subject: [PATCH] - fix eap thumbnailing SVN revision: 17730 --- src/bin/e_fileman_file.c | 9 +++++---- src/bin/e_fileman_icon.c | 12 ++++++++--- src/bin/e_thumb.c | 43 ++++++++++++++++++++++++++++++++-------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/bin/e_fileman_file.c b/src/bin/e_fileman_file.c index 579c00631..9a6daf044 100644 --- a/src/bin/e_fileman_file.c +++ b/src/bin/e_fileman_file.c @@ -145,7 +145,8 @@ e_fm_file_is_image(E_Fm_File *file) if (!ext) return 0; D(("e_fm_file_is_image: (%p)\n", file)); - return (!strcasecmp(ext, ".jpg")) || (!strcasecmp(ext, ".png")); + return (!strcasecmp(ext, ".jpg")) || (!strcasecmp(ext, ".png")) + || (!strcasecmp(ext, ".jpeg")) || (!strcasecmp(ext, ".eap")); } int @@ -160,18 +161,18 @@ e_fm_file_can_exec(E_Fm_File *file) if(!strcasecmp(ext, ".eap")) { D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name)); - return TRUE; + return 1; } } if(ecore_file_can_exec(file->path)) { D(("e_fm_file_can_exec: true (%p) (%s)\n", file, file->name)); - return TRUE; + return 1; } D(("e_fm_file_can_exec: false (%p) (%s)\n", file, file->name)); - return FALSE; + return 0; } int diff --git a/src/bin/e_fileman_icon.c b/src/bin/e_fileman_icon.c index 1300af1d8..998a429bf 100644 --- a/src/bin/e_fileman_icon.c +++ b/src/bin/e_fileman_icon.c @@ -336,7 +336,7 @@ _e_fm_icon_smart_show(Evas_Object *obj) if (e_fm_file_is_image(sd->file)) { sd->thumb_path = e_thumb_file_get(sd->file->path); - if (ecore_file_exists(sd->thumb_path)) + if (e_thumb_exists(sd->file->path)) sd->image_object = e_thumb_evas_object_get(sd->file->path, sd->evas, sd->w, @@ -485,7 +485,8 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event) { Ecore_Event_Exe_Exit *ev; E_Smart_Data *sd; - + char *ext; + ev = event; if (ev->pid != pid) return 1; if (!thumb_files) return 1; @@ -493,7 +494,12 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event) sd = thumb_files->data; thumb_files = evas_list_remove_list(thumb_files, thumb_files); - if (ecore_file_exists(sd->thumb_path)) + ext = strrchr(sd->file->name, "."); + if(ext) + if(strcasecmp(ext, ".eap")) + ext = NULL; + + if (ecore_file_exists(sd->thumb_path) || ext) { if (sd->image_object) evas_object_del(sd->image_object); sd->image_object = e_thumb_evas_object_get(sd->file->path, diff --git a/src/bin/e_thumb.c b/src/bin/e_thumb.c index b54944d7f..540d63419 100644 --- a/src/bin/e_thumb.c +++ b/src/bin/e_thumb.c @@ -4,6 +4,12 @@ #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 + static char *_e_thumb_file_id(char *file); static char *thumb_path = NULL; @@ -56,18 +62,26 @@ e_thumb_file_get(char *file) return strdup(thumb); } -/* check wether a file has a saved thumb */ +/* return true if the saved thumb exists OR if its an eap */ int e_thumb_exists(char *file) { char *thumb; - int ret; + char *ext; + + ext = strrchr(file, '.'); + if(ext) + if(!strcasecmp(ext, ".eap")) + return 1; thumb = e_thumb_file_get(file); - ret = ecore_file_exists(thumb); - free(thumb); + if(ecore_file_exists(thumb)) + { + free(thumb); + return 1; + } - return ret; + return 0; } /* create and save a thumb to disk */ @@ -75,7 +89,7 @@ int e_thumb_create(char *file, Evas_Coord w, Evas_Coord h) { Eet_File *ef; - char *thumbpath; + char *thumbpath, *ext; Evas_Object *im; const int *data; int size, iw, ih, ww, hh; @@ -83,6 +97,13 @@ e_thumb_create(char *file, Evas_Coord w, Evas_Coord h) Evas *evasbuf; int alpha; + ext = strrchr(file, '.'); + if(ext) + { + if(!strcasecmp(ext, ".eap")) + return 1; + } + thumbpath = e_thumb_file_get(file); if (!thumbpath) { @@ -155,6 +176,8 @@ e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord hei evas_object_resize(im, width, height); \ return im + D(("e_thumb_evas_object_get: (%s)\n", file)); + /* eap thumbnailer */ ext = strrchr(file, '.'); if(ext) @@ -162,18 +185,22 @@ e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord hei 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 = edje_object_add(evas); edje_object_file_set(im, file, "icon"); e_object_unref(E_OBJECT(app)); + D(("e_thumb_evas_object_get: returning eap thumb\n")); return im; } }