Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: ewl_icon_local_viewer.c mime.c thumbnail_generic.c thumbnail_system.c Log Message: * Make the structure viewer's descent-object navigation work * Scale thumbnail images properly according to aspect ratio =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ewl_icon_local_viewer.c 27 Oct 2005 12:12:22 -0000 1.15 +++ ewl_icon_local_viewer.c 29 Oct 2005 02:00:19 -0000 1.16 @@ -5,6 +5,9 @@ #include <dlfcn.h> #include <time.h> +#define DONT_DO_MIME 0 +#define DO_MIME 1 + typedef struct gui_file gui_file; struct gui_file { entropy_generic_file* file; @@ -529,7 +532,7 @@ } -gui_file* ewl_icon_local_viewer_add_icon(entropy_gui_component_instance* comp, entropy_generic_file* list_item) { +gui_file* ewl_icon_local_viewer_add_icon(entropy_gui_component_instance* comp, entropy_generic_file* list_item, int do_mime) { entropy_icon_viewer* view = comp->data; @@ -554,6 +557,27 @@ ecore_hash_set(view->gui_hash, list_item, gui_object); ecore_hash_set(view->icon_hash, icon, gui_object); + if (do_mime == DO_MIME) { + char* mime; + entropy_plugin* thumb; + + mime = entropy_mime_file_identify(comp->core->mime_plugins, list_item); + + + if (mime && strcmp(mime, ENTROPY_NULL_MIME)) { + thumb = entropy_thumbnailer_retrieve(comp->core->entropy_thumbnailers, mime); + } else { + thumb = NULL; + } + + if (thumb) { + entropy_notify_event* ev = entropy_notify_request_register(comp->core->notify, comp, ENTROPY_NOTIFY_THUMBNAIL_REQUEST,thumb, "entropy_thumbnailer_thumbnail_get", list_item,NULL); + entropy_notify_event_callback_add(ev, (void*)gui_event_callback, comp); + entropy_notify_event_commit(comp->core->notify, ev); + } + + } + return gui_object; } @@ -598,7 +622,7 @@ ecore_list_goto_first(el); while ( (list_item = ecore_list_next(el)) ) { - ewl_icon_local_viewer_add_icon(comp, list_item); + ewl_icon_local_viewer_add_icon(comp, list_item, DONT_DO_MIME); } event_keys = ecore_hash_keys(view->gui_hash); @@ -687,7 +711,7 @@ case ENTROPY_NOTIFY_FILE_CREATE: { //printf ("Received file create event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename); - ewl_icon_local_viewer_add_icon(comp, (entropy_generic_file*)ret); + ewl_icon_local_viewer_add_icon(comp, (entropy_generic_file*)ret, DO_MIME); } break; =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/mime.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- mime.c 27 Oct 2005 10:23:59 -0000 1.4 +++ mime.c 29 Oct 2005 02:00:19 -0000 1.5 @@ -39,6 +39,7 @@ ecore_hash_set(mime_hash, ".tgz", "application/x-gtar"); ecore_hash_set(mime_hash, ".bz2", "application/x-bzip2"); ecore_hash_set(mime_hash, ".tar", "application/x-tar"); + ecore_hash_set(mime_hash, ".txt", "text/plain"); } =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/thumbnail_generic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- thumbnail_generic.c 27 Oct 2005 07:16:35 -0000 1.2 +++ thumbnail_generic.c 29 Oct 2005 02:00:19 -0000 1.3 @@ -151,13 +151,24 @@ imlib_context_set_image(image); - imlib_context_set_cliprect(0,0,w,h); + { + iw = imlib_image_get_width(); + ih = imlib_image_get_height(); + + if (iw>ih) { + w = 64; + h = (64*ih)/iw; + } else { + h = 64; + w = (64*iw)/ih; + } + + imlib_context_set_cliprect(0,0,w,h); + thumbnail = imlib_create_cropped_scaled_image(0,0,iw,ih,w,h); + + imlib_free_image(); /*Free the master image*/ + } - iw = imlib_image_get_width(); - ih = imlib_image_get_height(); - - thumbnail = imlib_create_cropped_scaled_image(0,0,iw,ih,w,h); - imlib_free_image(); /*Free the master image*/ imlib_context_set_image(thumbnail); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/thumbnail_system.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- thumbnail_system.c 27 Oct 2005 10:23:59 -0000 1.3 +++ thumbnail_system.c 29 Oct 2005 02:00:19 -0000 1.4 @@ -30,6 +30,7 @@ ecore_list_append(types, "video/mpeg"); ecore_list_append(types, "application/x-bzip2"); ecore_list_append(types, "application/x-tar"); + ecore_list_append(types, "text/plain"); //ecore_list_append(types, "video/x-msvideo"); } @@ -76,11 +77,14 @@ strcpy(thumb->thumbnail_filename, PACKAGE_DATA_DIR "/icons/bz2.png"); } else if (!strcmp(file->mime_type, "application/x-tar")) { strcpy(thumb->thumbnail_filename, PACKAGE_DATA_DIR "/icons/tar.png"); + } else if (!strcmp(file->mime_type, "text/plain")) { + strcpy(thumb->thumbnail_filename, PACKAGE_DATA_DIR "/icons/txt.png"); } + thumb->parent = file; file->thumbnail = thumb; ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs