Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: layout_ewl_simple.c mime.c structure_viewer.c thumbnail_system.c Log Message: * Make MIME plugin use a hash - speed improvement * Start of tar support (experimental, currently non-functional) * Remove some debug statements =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- layout_ewl_simple.c 27 Oct 2005 07:24:00 -0000 1.9 +++ layout_ewl_simple.c 27 Oct 2005 10:23:59 -0000 1.10 @@ -291,7 +291,7 @@ Ewl_Widget* tree= gui->tree; - printf("Add URI: %s\n", uri); + //printf("Add URI: %s\n", uri); ewl_text_text_set(EWL_TEXT(label), name); image = ewl_image_new(); ewl_image_file_set(EWL_IMAGE(image), "../icons/chardevice.png", NULL); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/mime.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- mime.c 26 Oct 2005 06:57:00 -0000 1.3 +++ mime.c 27 Oct 2005 10:23:59 -0000 1.4 @@ -1,6 +1,6 @@ #include "entropy.h" - +Ecore_Hash* mime_hash; int entropy_plugin_type_get() { return ENTROPY_PLUGIN_MIME; } @@ -13,6 +13,36 @@ return ENTROPY_MIME_PLUGIN_PRIORITY_HIGH; } +void entropy_plugin_init(entropy_core* core) { + mime_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); + + ecore_hash_set(mime_hash, ".png", "image/png"); + ecore_hash_set(mime_hash, ".jpg", "image/jpeg"); + ecore_hash_set(mime_hash, ".gif", "image/gif"); + ecore_hash_set(mime_hash, ".pl", "text/x-perl"); + ecore_hash_set(mime_hash, ".wmv", "video/x-ms-wmv"); + ecore_hash_set(mime_hash, ".doc", "application/msword"); + ecore_hash_set(mime_hash, ".pdf", "application/pdf"); + ecore_hash_set(mime_hash, ".xls", "application/vnd.ms-excel"); + ecore_hash_set(mime_hash, ".gz", "application/x-gtar"); + ecore_hash_set(mime_hash, ".mp3", "audio/x-mp3"); + ecore_hash_set(mime_hash, ".java", "text/x-java"); + ecore_hash_set(mime_hash, ".jar", "application/x-jar"); + ecore_hash_set(mime_hash, ".xml", "text/xml"); + ecore_hash_set(mime_hash, ".htm", "text/html"); + ecore_hash_set(mime_hash, ".html", "text/html"); + ecore_hash_set(mime_hash, ".c", "text/csrc"); + ecore_hash_set(mime_hash, ".mpg", "video/mpeg"); + ecore_hash_set(mime_hash, ".mpe", "video/mpeg"); + ecore_hash_set(mime_hash, ".mpeg", "video/mpeg"); + ecore_hash_set(mime_hash, ".avi", "video/x-msvideo"); + 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"); + + +} + char* entropy_mime_plugin_identify_file(char* path, char* filename) { char fullname[1024]; @@ -46,34 +76,10 @@ /*printf ("MIME: %s\n", pos);*/ if (pos) { /*printf("Finding extension %s\n", pos);*/ - if (!strcmp(pos, ".png")) type = "image/png"; - else if (!strcmp(pos, ".jpg")) type = "image/jpeg"; - else if (!strcmp(pos, ".gif")) type = "image/gif"; - else if (!strcmp(pos, ".pl")) type = "text/x-perl"; - else if (!strcmp(pos, ".wmv")) type = "video/x-ms-wmv"; - else if (!strcmp(pos, ".doc")) type = "application/msword"; - else if (!strcmp(pos, ".pdf")) type = "application/pdf"; - else if (!strcmp(pos, ".xls")) type = "application/vnd.ms-excel"; - else if (!strcmp(pos, ".gz")) type = "application/x-gtar"; - else if (!strcmp(pos, ".mp3")) type = "audio/x-mp3"; - else if (!strcmp(pos, ".java")) type = "text/x-java"; - else if (!strcmp(pos, ".jar")) type = "application/x-jar"; - else if (!strcmp(pos, ".xml")) type = "text/xml"; - else if (!strcmp(pos, ".htm")) type = "text/html"; - else if (!strcmp(pos, ".html")) type = "text/html"; - else if (!strcmp(pos, ".c")) type = "text/csrc"; - else if (!strcmp(pos, ".mpg")) type = "video/mpeg"; - else if (!strcmp(pos, ".mpe")) type = "video/mpeg"; - else if (!strcmp(pos, ".mpeg")) type = "video/mpeg"; - else if (!strcmp(pos, ".avi")) type = "video/x-msvideo"; - else if (!strcmp(pos, ".tgz")) type = "application/x-gtar"; - else if (!strcmp(pos, ".bz2")) type= "application/x-bzip2"; - - + type = ecore_hash_get(mime_hash,pos); + } - - free(ifile); return type; } =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/structure_viewer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- structure_viewer.c 24 Oct 2005 03:10:23 -0000 1.3 +++ structure_viewer.c 27 Oct 2005 10:23:59 -0000 1.4 @@ -89,7 +89,7 @@ ecore_list_goto_first(el); while ( (file = ecore_list_next(el)) ) { - if (file->filetype == FILE_FOLDER) { + if (file->filetype == FILE_FOLDER || !strcmp(file->mime_type, "application/x-tar")) { char *c = entropy_malloc(sizeof(char)); *c = 1; =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/thumbnail_system.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- thumbnail_system.c 26 Oct 2005 06:57:00 -0000 1.2 +++ thumbnail_system.c 27 Oct 2005 10:23:59 -0000 1.3 @@ -29,6 +29,7 @@ ecore_list_append(types, "text/csrc"); ecore_list_append(types, "video/mpeg"); ecore_list_append(types, "application/x-bzip2"); + ecore_list_append(types, "application/x-tar"); //ecore_list_append(types, "video/x-msvideo"); } @@ -73,10 +74,13 @@ strcpy(thumb->thumbnail_filename, PACKAGE_DATA_DIR "/icons/mpeg.png"); } else if (!strcmp(file->mime_type, "application/x-bzip2")) { 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"); } + 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