Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src Modified Files: entropy_core.c entropy_thumbnailer_engine.c notification_engine.c plugin_helper.c Log Message: * Big reorginisation. Thumbnailers now have tasks distributed to them by distribution_thumbnailers. This was to enable multiple thumbnailers to take a stab at an image. Therefore, we now have a demonstration: Entropy can now, with the aid of evfs, thumbnail images on evfs-devices (at the moment, this is only useful with samba). Ftp,tar, etc will follow soon. =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_core.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- entropy_core.c 22 Dec 2005 04:34:40 -0000 1.32 +++ entropy_core.c 2 Jan 2006 09:05:41 -0000 1.33 @@ -23,6 +23,7 @@ static int requests = 0; static long file_cache_size = 0; +static entropy_plugin* distrib_plugin = NULL; /* FIXME - handle distrib plugins better*/ entropy_core* core_core; #define FILE_FREE_QUEUE_SIZE 500; @@ -196,6 +197,7 @@ core->layout_gui_events = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); //printf("Creating the global layout object..\n"); + /*Create the global layout object*/ layout = entropy_malloc(sizeof(entropy_gui_component_instance)); layout->core = core; core->layout_global = layout; @@ -203,6 +205,9 @@ /*Init the mime register */ core->entropy_thumbnailers = entropy_thumbnailers_register_init(); + core->entropy_thumbnailers_child = entropy_thumbnailers_register_init(); + + core->mime_plugins = entropy_mime_register_init(); /*Load plugins*/ @@ -514,6 +519,9 @@ return "entropy_gui_event_file_stat_available"; } else if (!strcmp(event, ENTROPY_GUI_EVENT_FILE_PROGRESS)) { return "entropy_gui_event_file_progress"; + } else if (!strcmp(event, ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE)) { + return "entropy_gui_event_thumbnail_available"; + } else { return ""; } @@ -555,9 +563,29 @@ } - if (type == ENTROPY_PLUGIN_THUMBNAILER) { + if (type == ENTROPY_PLUGIN_THUMBNAILER_DISTRIBUTION) { + entropy_gui_component_instance* instance; //printf(" ----------------------- Thumbnailer Plugin, registering with engine..\n"); - entropy_plugin_thumbnailer_register(core, plugin); + // + entropy_plugin_init = dlsym(plugin->dl_ref, "entropy_plugin_init"); + instance = (*entropy_plugin_init)(core); + instance->plugin = plugin; + + gui_event_callback = dlsym(plugin->dl_ref, "gui_event_callback"); + plugin->gui_event_callback_p = gui_event_callback; + + entropy_plugin_thumbnailer_register(core, plugin, THUMBNAILER_DISTRIBUTION); + } else if (type == ENTROPY_PLUGIN_THUMBNAILER) { + entropy_gui_component_instance* instance; + + entropy_plugin_init = dlsym(plugin->dl_ref, "entropy_plugin_init"); + instance = (*entropy_plugin_init)(core); + instance->plugin = plugin; + + gui_event_callback = dlsym(plugin->dl_ref, "gui_event_callback"); + plugin->gui_event_callback_p = gui_event_callback; + + entropy_plugin_thumbnailer_register(core, plugin, THUMBNAILER_CHILD); } else if (type == ENTROPY_PLUGIN_MIME) { //printf("MIME Identifier Plugin, registering with engine..\n"); entropy_plugin_mime_register(core->mime_plugins, plugin); @@ -636,7 +664,7 @@ ecore_list_append(mime_plugins, plugin); } -void entropy_plugin_thumbnailer_register(entropy_core* core, entropy_plugin* plugin) { +void entropy_plugin_thumbnailer_register(entropy_core* core, entropy_plugin* plugin, int type) { /*First off, query the plugin to see what MIME types it handles*/ char* mime_type; Ecore_List* (*entropy_thumbnailer_plugin_mime_types_get)(); @@ -648,17 +676,29 @@ mime_types = (*entropy_thumbnailer_plugin_mime_types_get)(); ecore_list_goto_first(mime_types); while ( (mime_type = ecore_list_next(mime_types)) ) { - //printf (" Loading mime_type for this thumbnailer '%s'\n", mime_type); - ecore_hash_set(core->entropy_thumbnailers, mime_type, plugin); + if (type == THUMBNAILER_DISTRIBUTION) { + ecore_hash_set(core->entropy_thumbnailers, mime_type, plugin); + distrib_plugin = plugin; + } else if (type == THUMBNAILER_CHILD) { + Ecore_List* list = NULL; + + if (! (list = ecore_hash_get(core_core->entropy_thumbnailers_child, mime_type))) { + list = ecore_list_new(); + ecore_hash_set(core->entropy_thumbnailers_child, mime_type,list); + } + ecore_list_append(list, plugin); + + + /*Assume for now that all distribution plugins can handle proxying to all child thumbnailers + * This is a pretty big jump - but *generally* you'll only have one distribution plugin + * FIXME - maybe. + */ + ecore_hash_set(core->entropy_thumbnailers, mime_type, distrib_plugin); + } } /*Clean up the list that we got from the plugin*/ ecore_list_destroy(mime_types); - - - - - } entropy_generic_file* entropy_generic_file_clone(entropy_generic_file* file) { @@ -775,7 +815,7 @@ if (!lay_hash) { - //printf("Error: Attempted to raise event for unregistered layout container\n"); + printf("Error: Attempted to raise event for unregistered layout container\n"); entropy_free(event); return; } @@ -977,6 +1017,27 @@ iter); } entropy_notify_event_destroy(ev); + + + /*A thumbnail has been made available*/ + } else if (!strcmp(event->event_type,ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE)) { + entropy_notify_event* ev = entropy_notify_event_new(); + ev->event_type = ENTROPY_NOTIFY_THUMBNAIL_REQUEST; + + + /*Call the requestors*/ + ecore_list_goto_first(el); + while ( (iter = ecore_list_next(el)) ) { + //printf( "Calling callback at : %p\n", iter->plugin->gui_event_callback_p); + + if (iter->active) (*iter->plugin->gui_event_callback_p) + (ev, + iter, + event->data, /*An entropy_thumb*/ + iter); + } + entropy_notify_event_destroy(ev); + } else if (!strcmp(event->event_type,ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS_EXTERNAL)) { Ecore_List* file_list; @@ -1239,23 +1300,23 @@ } - printf("EVFS says that this file descends through '%s'\n", uri); + /*printf("EVFS says that this file descends through '%s'\n", uri);*/ if (drill_down || file->parent) { /*If we're a 'drill-down', we're at the root - so request the root*/ if (drill_down) { uri_retrieve = entropy_core_descent_for_mime_get(core_core,file->mime_type); snprintf(uri_build, 255, "#%s:///", uri_retrieve); - printf("URI build says: '%s'\n", uri_build); + /*printf("URI build says: '%s'\n", uri_build);*/ strcat(uri, uri_build); } else if (file->parent) { - printf("Retrieving mime-descend from parent...'%s' for file with name '%s'\n", - file->parent->mime_type, file->parent->filename); + /*printf("Retrieving mime-descend from parent...'%s' for file with name '%s'\n", + file->parent->mime_type, file->parent->filename);*/ uri_retrieve = entropy_core_descent_for_mime_get(core_core,file->parent->mime_type); /*Special case handler for the root dir - FIXME*/ - printf("Path: '%s', filename '%s'\n", file->path, file->filename); + /*printf("Path: '%s', filename '%s'\n", file->path, file->filename);*/ if (!strcmp(file->path,"/")) { snprintf(uri_build, 255, "#%s://%s%s", uri_retrieve, file->path, file->filename); } else { =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_thumbnailer_engine.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- entropy_thumbnailer_engine.c 20 Oct 2005 08:45:54 -0000 1.1 +++ entropy_thumbnailer_engine.c 2 Jan 2006 09:05:41 -0000 1.2 @@ -1,5 +1,17 @@ #include "include/entropy.h" -entropy_plugin* entropy_thumbnailer_retrieve(Ecore_Hash* thumbnail_plugins, char* mime_type) { - return (entropy_plugin*)ecore_hash_get(thumbnail_plugins, mime_type); +entropy_plugin* entropy_thumbnailer_retrieve(char* mime_type) { + return (entropy_plugin*)ecore_hash_get(entropy_core_get_core()->entropy_thumbnailers, mime_type); +} + +Ecore_List* entropy_thumbnailer_child_retrieve(char* mime_type) { + return (entropy_plugin*)ecore_hash_get(entropy_core_get_core()->entropy_thumbnailers_child, mime_type); +} + +entropy_thumbnail_request* entropy_thumbnail_request_new() { + return calloc(1, sizeof(entropy_thumbnail_request)); +} + +void entropy_thumbnail_request_destroy(entropy_thumbnail_request* request) { + free(request); } =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/notification_engine.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- notification_engine.c 24 Nov 2005 04:03:13 -0000 1.4 +++ notification_engine.c 2 Jan 2006 09:05:41 -0000 1.5 @@ -153,7 +153,7 @@ } - usleep(500); /*Allow the CPU to have a rest*/ + usleep(50); /*Allow the CPU to have a rest*/ } pthread_mutex_unlock(¬ify->loop_mutex); =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugin_helper.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- plugin_helper.c 30 Dec 2005 06:47:30 -0000 1.3 +++ plugin_helper.c 2 Jan 2006 09:05:41 -0000 1.4 @@ -94,3 +94,10 @@ return plugin_list; } + +void entropy_plugin_filesystem_file_remove(entropy_plugin* plugin, entropy_generic_file* file) { + void (*del_func)(entropy_generic_file* source); + del_func = dlsym(plugin->dl_ref, "entropy_filesystem_file_remove"); + + (*del_func)(file); +} ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs