Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        ewl_icon_local_viewer.c filesystem.c 


Log Message:
* Create the concept of 'bulk event commit'.  Should make directory changes 
faster

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_icon_local_viewer.c     27 Oct 2005 07:17:26 -0000      1.14
+++ ewl_icon_local_viewer.c     27 Oct 2005 12:12:22 -0000      1.15
@@ -162,7 +162,7 @@
        ewl_widget_show(text);
 
        text = ewl_text_new();
-       snprintf(itext, 100, "%d kb", file_stat->stat_obj->st_size / 1024);
+       snprintf(itext, 100, "%d kb", (int)(file_stat->stat_obj->st_size / 
1024));
        ewl_text_text_set(EWL_TEXT(text), itext);
        ewl_container_child_append(EWL_CONTAINER(hbox), text);
        ewl_widget_show(text);
@@ -529,45 +529,33 @@
 }
 
 
-void 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) {
                entropy_icon_viewer* view = comp->data;
        
-               entropy_plugin* thumb;
+               
                Ewl_IconBox_Icon* icon;
                gui_file* gui_object;
 
                if (!ecore_hash_get(view->gui_hash, list_item)) {       
                         entropy_core_file_cache_add_reference(comp->core, 
list_item->md5);                     
-                        char* mime;
-                        /*printf("%s\n", list_item->filename);*/
-                        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;
-                       }
                        icon = ewl_iconbox_icon_add(EWL_ICONBOX(view->iconbox), 
list_item->filename, PACKAGE_DATA_DIR "/icons/default.png");
+                       ewl_callback_append(EWL_WIDGET(icon), 
EWL_CALLBACK_MOUSE_DOWN, icon_click_cb, view);
                        
 
                        gui_object = gui_file_new();
                        gui_object->file = list_item;
                        gui_object->thumbnail = NULL;
-                       gui_object->instance = comp; /*This instance associated 
with this icon, for clicks*/
+                       gui_object->instance = comp;
                        gui_object->icon = EWL_WIDGET(icon);
 
-                       ewl_callback_append(EWL_WIDGET(icon), 
EWL_CALLBACK_MOUSE_DOWN, icon_click_cb, view); 
+                        
                
                        ecore_hash_set(view->gui_hash, list_item, gui_object);
                        ecore_hash_set(view->icon_hash, icon, gui_object);
+
+                       return gui_object;
                        
-                       /*If thre's a thumbnailer for this, Register request to 
thumbnail for this filename*/
-                       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);
-                       }
                }
                        
 }
@@ -578,6 +566,13 @@
      switch (eevent->event_type) {     
        case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL:
        case ENTROPY_NOTIFY_FILELIST_REQUEST: {
+               Ecore_List* event_keys;
+               Ecore_List* events;
+               entropy_generic_file* event_file;
+               char* mime;
+               entropy_plugin* thumb;
+               
+                                                     
                Ecore_List* el = (Ecore_List*)ret;
                entropy_file_request* request = eevent->data; /*A file 
request's data is the dest dir*/
                
@@ -597,10 +592,6 @@
                view->gui_hash = ecore_hash_new(ecore_direct_hash, 
ecore_direct_compare);       
                view->icon_hash = ecore_hash_new(ecore_direct_hash, 
ecore_direct_compare);
 
-
-               
-               
-               
                /*Clear the view, if there's anything to nuke*/
                ewl_iconbox_clear(EWL_ICONBOX(view->iconbox));
 
@@ -610,6 +601,34 @@
                        ewl_icon_local_viewer_add_icon(comp, list_item);
                }
 
+               event_keys = ecore_hash_keys(view->gui_hash);
+               events = ecore_list_new();
+               while ( (event_file=ecore_list_remove_first(event_keys))) {
+
+                        /*printf("%s\n", list_item->filename);*/
+                        mime = 
entropy_mime_file_identify(comp->core->mime_plugins, event_file);
+
+                       
+                        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", 
event_file,NULL);
+                       
+                               entropy_notify_event_callback_add(ev, 
(void*)gui_event_callback, comp);
+                               
+                               ecore_list_append(events, ev);
+                       }
+
+               }
+               ecore_list_destroy(event_keys);
+
+               /*Now insert all these events inside one lock*/
+               entropy_notify_event_bulk_commit(comp->core->notify,events);
+
 
                /*Before we begin, see if our file hash is initialized, if so - 
we must destroy it first*/
                /*TODO*/
@@ -618,16 +637,17 @@
 
 
 
-               /*First, see if there is a custom BG image for this folder*/
+               /*See if there is a custom BG image for this folder*/
                if (entropy_config_str_get("iconbox_viewer", 
view->current_dir)) {
                        ewl_iconbox_background_set(EWL_ICONBOX(view->iconbox), 
entropy_config_str_get("iconbox_viewer", view->current_dir));
                } else {
                        ewl_iconbox_background_set(EWL_ICONBOX(view->iconbox), 
NULL);
                }
 
-               /*Goto the root*/
+               /*Goto the root of the iconbox*/
                ewl_iconbox_scrollpane_recalculate(EWL_ICONBOX(view->iconbox));
                ewl_iconbox_scrollpane_goto_root(EWL_ICONBOX(view->iconbox));
+
        }
        break;
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/filesystem.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- filesystem.c        24 Oct 2005 03:10:23 -0000      1.4
+++ filesystem.c        27 Oct 2005 12:12:22 -0000      1.5
@@ -483,6 +483,8 @@
                        }
                }
                closedir(dir);
+
+               return entropy_generic_file_list_sort(el);
        } else { /*Not a posix call for a dir list - don't use our local optim 
function */
                entropy_file_request* new_request; /*We need to make a copy of 
the request object
                                                     because the original will 
be destroyed*/
@@ -518,7 +520,7 @@
        }
 
        
-       return entropy_generic_file_list_sort(el);      
+               
 }
 
 void entropy_plugin_backend_file_deregister_file_list() {




-------------------------------------------------------
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

Reply via email to