- thumbnails are back in, still a few mime types to be added.


SVN revision: 20544
This commit is contained in:
jlzapata 2006-02-17 13:36:31 +00:00 committed by jlzapata
parent ed4e6849f1
commit 8714162645
3 changed files with 30 additions and 9 deletions

View File

@ -143,8 +143,7 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
file->icon_object = obj; file->icon_object = obj;
/* FIXME fix this */ /* FIXME fix this */
#if 0 if (sd->file->mime->thumbnail)
if (e_fm_file_can_preview(sd->file))
{ {
sd->thumb_path = e_thumb_file_get(sd->file->path); sd->thumb_path = e_thumb_file_get(sd->file->path);
if (e_thumb_exists(sd->file->path)) if (e_thumb_exists(sd->file->path))
@ -174,7 +173,7 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
} }
else else
{ {
sd->thumb_object = e_thumb_generate_begin(sd->file->path, sd->iw, sd->thumb_object = sd->file->mime->thumbnail(sd->file->path, sd->iw,
sd->ih, sd->evas, sd->ih, sd->evas,
&sd->thumb_object, &sd->thumb_object,
_e_fm_icon_thumb_generate_cb, _e_fm_icon_thumb_generate_cb,
@ -184,7 +183,6 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
} }
} }
else else
#endif
{ {
_e_fm_icon_icon_mime_get(sd); _e_fm_icon_icon_mime_get(sd);
} }

View File

@ -66,7 +66,14 @@
* %h => hover file (might be the current directory, other file, whatever) * %h => hover file (might be the current directory, other file, whatever)
* *
* *
* * FUTURE
* ======
* a new approach can be made, but is too expensive for what e17 currently needs.
* the mime subsystem can be in fact independent from e_fileman_smart (the function calls
* are very simple to change, just pass always an Evas_List of files, and the E_Fm_File hover,
* instead of the E_Fileman_Smart). What is complicated is how to pass the data to the internal
* actions, and if we should define the internal actions here or in the component that will
* use the mime subsytem.
* *
*/ */
@ -82,6 +89,8 @@ static void _e_fm_mime_action_internal_folder_open(E_Fm_Smart_Data
static void _e_fm_mime_action_internal_folder_open_other(E_Fm_Smart_Data *data); static void _e_fm_mime_action_internal_folder_open_other(E_Fm_Smart_Data *data);
static void _e_fm_mime_action_internal_copy_to(E_Fm_Smart_Data *data); static void _e_fm_mime_action_internal_copy_to(E_Fm_Smart_Data *data);
static void _e_fm_mime_action_internal_move_to(E_Fm_Smart_Data *data); static void _e_fm_mime_action_internal_move_to(E_Fm_Smart_Data *data);
/* definitions of 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);
static int init_count = 0; static int init_count = 0;
@ -198,6 +207,7 @@ e_fm_mime_init(void)
entry->parent = l2; entry->parent = l2;
entry->level = 3; entry->level = 3;
entry->suffix = strdup("jpg"); entry->suffix = strdup("jpg");
entry->thumbnail = &_e_fm_mime_thumbnail_evas;
entries = evas_list_append(entries,entry); entries = evas_list_append(entries,entry);
/* png */ /* png */
@ -207,6 +217,7 @@ e_fm_mime_init(void)
entry->parent = l2; entry->parent = l2;
entry->level = 3; entry->level = 3;
entry->suffix = strdup("png"); entry->suffix = strdup("png");
entry->thumbnail = &_e_fm_mime_thumbnail_evas;
entries = evas_list_append(entries,entry); entries = evas_list_append(entries,entry);
} }
@ -322,7 +333,7 @@ e_fm_mime_set(E_Fm_File *file)
continue; continue;
if(!strcmp(suffix,entry->suffix)) if(!strcmp(suffix,entry->suffix))
{ {
printf("found by suffix %s\n", suffix); //printf("found by suffix %s\n", suffix);
file->mime = entry; file->mime = entry;
} }
free(suffix); free(suffix);
@ -625,3 +636,16 @@ _e_fm_mime_action_internal_move_to(E_Fm_Smart_Data *sd)
printf("going to move to %s\n", sd->operation.hover->path); printf("going to move to %s\n", sd->operation.hover->path);
} }
/* 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 *r;
r = e_thumb_generate_begin(path, w,
h, evas, tmp, cb,
data);
return r;
}

View File

@ -6,7 +6,6 @@
typedef struct _E_Fm_Mime_Entry E_Fm_Mime_Entry; typedef struct _E_Fm_Mime_Entry E_Fm_Mime_Entry;
typedef struct _E_Fm_Mime_Action E_Fm_Mime_Action; typedef struct _E_Fm_Mime_Action E_Fm_Mime_Action;
typedef int (*E_Fm_Mime_Thumbnail_Function) (E_Fm_File*);
typedef int (*E_Fm_Mime_Preview_Function) (E_Fm_File*); typedef int (*E_Fm_Mime_Preview_Function) (E_Fm_File*);
#if 0 #if 0
@ -36,9 +35,9 @@ struct _E_Fm_Mime_Entry
char *suffix; char *suffix;
int type; int type;
/* to thumbnail this file type */ /* to thumbnail this file type */
E_Fm_Mime_Thumbnail_Function preview; Evas_Object * (*thumbnail) (char *path, Evas_Coord w, Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data);
/* to preview this file type */ /* to preview this file type */
E_Fm_Mime_Preview_Function thumbnail; E_Fm_Mime_Preview_Function preview;
}; };