Enlightenment CVS committal

Author  : chaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        Makefile.am action_simple.c etk_list_viewer.c 
        etk_structure_viewer.c ewl_icon_local_viewer.c 
        ewl_list_viewer.c filesystem.c layout_etk_simple.c 
        layout_ewl_simple.c remote_thumbnailer.c thumbnail_generic.c 
        thumbnailer.c 


Log Message:
Whoa! Lots of while-you-were sleeping CVS downtime changes:

* Extractor based plugin - middle click a file to try!
* Remove pthread nastiness, and begin making *everything* async
* Lots of bug fixes
* Much improved file cache reference tracking - more stable entropy
* Loads more

===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- Makefile.am 11 Mar 2006 07:11:34 -0000      1.25
+++ Makefile.am 28 Mar 2006 10:31:15 -0000      1.26
@@ -18,17 +18,25 @@
 SYSTEM_THUMBNAILER_L = system_thumbnailer.la
 ACTION_SIMPLE_L = action_simple.la
 
+if HAVE_EXTRACTOR
+METADATA_EXTRACT_L = metadata_extract.la
+else
+METADATA_EXTRACT_L =
+endif
+
 if HAVE_ETK
 LAYOUT_ETK_L = layout_etk_simple.la
 ETK_STRUCTURE_VIEWER_L = etk_structure_viewer.la
 ETK_LIST_VIEWER_L = etk_list.la
+ETK_METADATA_L = etk_metadata.la
 else
 LAYOUT_ETK_L =
 ETK_LIST_VIEWER_L =
 ETK_STRUCTURE_VIEWER_L =
+ETK_METADATA_L =
 endif
 
-pkg_LTLIBRARIES                = $(MIME_L) $(THUMBNAILER_L) $(POSIX_L) 
$(LAYOUT_L) $(EWL_LOCAL_ICON_L) $(STRUCTURE_VIEWER_L) $(SYSTEM_THUMBNAILER_L) 
$(ACTION_SIMPLE_L) $(LAYOUT_ETK_L) $(EWL_LIST_L) $(REMOTE_THUMBNAILER_L) 
$(DISTRIB_THUMBNAILER_L) $(ETK_STRUCTURE_VIEWER_L) $(ETK_LIST_VIEWER_L)
+pkg_LTLIBRARIES                = $(MIME_L) $(THUMBNAILER_L) $(POSIX_L) 
$(LAYOUT_L) $(EWL_LOCAL_ICON_L) $(STRUCTURE_VIEWER_L) $(SYSTEM_THUMBNAILER_L) 
$(ACTION_SIMPLE_L) $(LAYOUT_ETK_L) $(EWL_LIST_L) $(REMOTE_THUMBNAILER_L) 
$(DISTRIB_THUMBNAILER_L) $(ETK_STRUCTURE_VIEWER_L) $(ETK_LIST_VIEWER_L) 
$(METADATA_EXTRACT_L) $(ETK_METADATA_L)
 
 ewl_local_icon_la_SOURCES      =       $(top_srcdir)/src/entropy_gui.c \
                                        
$(top_srcdir)/src/dialogs/ewl_progress_dialog.c \
@@ -50,6 +58,11 @@
 ewl_list_la_LDFLAGS      = -module -avoid-version
 ewl_list_la_LIBADD       = @EWL_LIBS@
 
+metadata_extract_la_SOURCES = metadata_extract.c
+metadata_extract_la_CFLAGS = @extractor_cflags@
+metadata_extract_la_LDFLAGS = -module -avoid-version
+metadata_extract_la_LIBADD = @extractor_libs@
+
 
 structure_viewer_la_SOURCES    = $(top_srcdir)/src/entropy_gui.c \
                                structure_viewer.c 
$(top_srcdir)/src/entropy_debug.c
@@ -98,36 +111,42 @@
 etk_list_la_LDFLAGS      = -module -avoid-version
 etk_list_la_LIBADD       = @ETK_LIBS@
 
+
+etk_metadata_la_SOURCES = etk_meta_plugin.c
+etk_metadata_la_CFLAGS       = @ETK_CFLAGS@
+etk_metadata_la_LDFLAGS      = -module -avoid-version
+etk_metadata_la_LIBADD       = @ETK_LIBS@
 endif
 
 mime_la_SOURCES                = mime.c $(top_srcdir)/src/entropy_core.c
-mime_la_CFLAGS                        = @EVFS_CFLAGS@
+mime_la_CFLAGS                        = @EVFS_CFLAGS@ 
 mime_la_LDFLAGS                = -module -avoid-version
+mime_la_LIBADD                = 
 
 imlib_thumbnailer_la_SOURCES   = thumbnailer.c thumbnail_generic.c md5.c 
$(top_srcdir)/src/entropy_debug.c
-imlib_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@
+imlib_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@  
 imlib_thumbnailer_la_LDFLAGS   = -module -avoid-version
-imlib_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@
+imlib_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@  
 
 remote_thumbnailer_la_SOURCES   = remote_thumbnailer.c thumbnail_generic.c 
md5.c $(top_srcdir)/src/entropy_debug.c
-remote_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@
+remote_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@  
 remote_thumbnailer_la_LDFLAGS   = -module -avoid-version
-remote_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@
+remote_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@  
 
 distrib_thumbnailer_la_SOURCES   = distribution_thumbnailer.c 
thumbnail_generic.c md5.c $(top_srcdir)/src/entropy_debug.c
-distrib_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@
+distrib_thumbnailer_la_CFLAGS    = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@  
 distrib_thumbnailer_la_LDFLAGS   = -module -avoid-version
-distrib_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@
+distrib_thumbnailer_la_LIBADD    = @IMLIB2_LIBS@ @ECORE_LIBS@ @PNG_LIBS@ 
@EPSILON_LIBS@  
 
 
 system_thumbnailer_la_SOURCES  = thumbnail_system.c thumbnail_generic.c 
$(top_srcdir)/src/entropy_debug.c
-system_thumbnailer_la_CFLAGS   = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@
+system_thumbnailer_la_CFLAGS   = @ECORE_CFLAGS@ @IMLIB2_CFLAGS@ 
@EPSILON_CFLAGS@  
 system_thumbnailer_la_LDFLAGS  = -module -avoid-version
-system_thumbnailer_la_LIBADD   = @ECORE_LIBS@ @EPSILON_LIBS@
+system_thumbnailer_la_LIBADD   = @ECORE_LIBS@ @EPSILON_LIBS@  
 
 
 posix_la_SOURCES               = filesystem.c $(top_srcdir)/src/entropy_debug.c
-posix_la_CFLAGS                = @EVFS_CFLAGS@
+posix_la_CFLAGS                = @EVFS_CFLAGS@  
 posix_la_LDFLAGS               = -module -avoid-version
-posix_la_LIBADD                = @EVFS_LIBS@
+posix_la_LIBADD                = @EVFS_LIBS@  
 
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/action_simple.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- action_simple.c     19 Mar 2006 05:41:08 -0000      1.11
+++ action_simple.c     28 Mar 2006 10:31:15 -0000      1.12
@@ -26,7 +26,7 @@
        /*A function to replace %p (path), %pf (path+filename), and %u (uri), 
with their
         * real equivalents*/
        int i=0;
-       char* str = calloc(1,sizeof(char)*PATH_MAX);
+       char* str = entropy_malloc(sizeof(char)*PATH_MAX);
        char* currStr = exe;
 
        while (currStr) {
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/etk_list_viewer.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- etk_list_viewer.c   19 Mar 2006 05:41:08 -0000      1.47
+++ etk_list_viewer.c   28 Mar 2006 10:31:15 -0000      1.48
@@ -420,7 +420,7 @@
    etk_container_add(ETK_CONTAINER(drag), table);
   
 
-   types = calloc(1, sizeof(char*));
+   types = entropy_malloc(sizeof(char*));
    num_types = 1;
    types[0] = strdup("text/uri-list");
     
@@ -530,6 +530,15 @@
            entropy_core_gui_event_get (ENTROPY_GUI_EVENT_ACTION_FILE);
          gui_event->data = file->file;
          entropy_core_layout_notify_event (file->instance, gui_event, 
ENTROPY_EVENT_GLOBAL);
+   } else if (event->button == 2) {
+       etk_tree_row_select(row);
+       printf("MetaData request\n");
+
+         gui_event = entropy_malloc (sizeof (entropy_gui_event));
+         gui_event->event_type =
+           entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_METADATA);
+         gui_event->data = file->file;
+         entropy_core_layout_notify_event (file->instance, gui_event, 
ENTROPY_EVENT_GLOBAL);
    } else if (event->button == 3) {
        etk_tree_row_select(row);
        etk_menu_popup(ETK_MENU(viewer->popup));
@@ -585,6 +594,9 @@
                        request->file = file;
                        request->instance = instance;
 
+                       /*Add a reference to this file, so it doesn't get 
cleaned up*/
+                       entropy_core_file_cache_add_reference (file->md5);
+
                        entropy_notify_event *ev =
                          entropy_notify_request_register 
(instance->core->notify, instance,
                                   ENTROPY_NOTIFY_THUMBNAIL_REQUEST,
@@ -596,7 +608,7 @@
                                   instance);
                        entropy_notify_event_cleanup_add (ev, request);
 
-                       entropy_notify_event_commit (instance->core->notify, 
ev);
+                       entropy_notify_event_commit (ev);
            }
   }
 
@@ -650,7 +662,6 @@
 
   if (!file->retrieved_stat) {
          /*And request the properties...*/
-
          entropy_core_file_cache_add_reference (file->md5);
          
          gui_event = entropy_malloc (sizeof (entropy_gui_event));
@@ -741,8 +752,6 @@
                                col5, date_buffer,
                                NULL);
                etk_tree_thaw(ETK_TREE(viewer->tree));
-
-               entropy_core_file_cache_remove_reference (file_stat->file->md5);
        }
      }
      break;                                     
@@ -751,7 +760,8 @@
          entropy_generic_file* file = el;
          entropy_gui_event *gui_event = NULL;
          
-                                              
+         entropy_core_file_cache_add_reference (file->md5);
+         
          /*And request the properties...*/
          gui_event = entropy_malloc (sizeof (entropy_gui_event));
          gui_event->event_type =
@@ -828,8 +838,9 @@
                  etk_tree_thaw(ETK_TREE(viewer->tree));
 
                } else {
-                 printf ("ERR: Couldn't find a hash reference for this 
file!\n");
+                 /*printf ("ERR: Couldn't find a hash reference for this 
file!\n");*/
                }
+
              }
            }                           //End case
            break;                                          
@@ -890,7 +901,7 @@
 
   /*DND Setup*/
    dnd_types_num = 1;
-   dnd_types = calloc(dnd_types_num, sizeof(char*));
+   dnd_types = entropy_malloc(dnd_types_num* sizeof(char*));
    dnd_types[0] = strdup("text/uri-list");  
   etk_widget_dnd_source_set(viewer->tree, ETK_TRUE);
   //etk_widget_dnd_drag_data_set(viewer->tree, dnd_types, dnd_types_num, "This 
is the drag data!", strlen("This is the drag data!") + 1);
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/etk_structure_viewer.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- etk_structure_viewer.c      21 Mar 2006 09:43:52 -0000      1.20
+++ etk_structure_viewer.c      28 Mar 2006 10:31:15 -0000      1.21
@@ -207,6 +207,7 @@
                          if (!ecore_hash_get(viewer->row_folder_hash, file)) {
                                  /*We need the file's mime type, 
                                   * so get it here if it's not here 
already...*/
+                                 /*printf("STRUCTURE REFERENCES FILE: %p\n", 
file);*/
                                  if (!strlen (file->mime_type)) {
                                    entropy_mime_file_identify 
(comp->core->mime_plugins, file);
                                  }
@@ -339,7 +340,7 @@
 
          /*Accept drops*/
           dnd_types_num = 1;
-          dnd_types = calloc(dnd_types_num, sizeof(char*));
+          dnd_types = entropy_malloc(dnd_types_num * sizeof(char*));
           dnd_types[0] = strdup("text/uri-list");  
           etk_widget_dnd_types_set(  
ETK_WIDGET(((Etk_Tree_Row*)parent_visual)->tree), 
                                dnd_types, dnd_types_num);
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- ewl_icon_local_viewer.c     19 Mar 2006 05:41:08 -0000      1.62
+++ ewl_icon_local_viewer.c     28 Mar 2006 10:31:15 -0000      1.63
@@ -849,7 +849,7 @@
        entropy_notify_event_callback_add (ev, (void *) gui_event_callback,
                                           comp);
        entropy_notify_event_cleanup_add (ev, request);
-       entropy_notify_event_commit (comp->core->notify, ev);
+       entropy_notify_event_commit (ev);
       }
 
     }
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/ewl_list_viewer.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_list_viewer.c   19 Mar 2006 00:35:26 -0000      1.11
+++ ewl_list_viewer.c   28 Mar 2006 10:31:15 -0000      1.12
@@ -678,7 +678,7 @@
                                           comp);
        entropy_notify_event_cleanup_add (ev, request);
 
-       entropy_notify_event_commit (comp->core->notify, ev);
+       entropy_notify_event_commit (ev);
       }
 
     }
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/filesystem.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- filesystem.c        19 Mar 2006 05:41:08 -0000      1.57
+++ filesystem.c        28 Mar 2006 10:31:15 -0000      1.58
@@ -296,11 +296,12 @@
                          /*Register a new listener for this file */
                          listener = entropy_malloc (sizeof 
(entropy_file_listener));
                          listener->file = file;
-                         listener->count = 0;
+                         listener->count = 1;
                          entropy_core_file_cache_add (md5, listener);
                        }
                        else {
                          file = listener->file;
+                         entropy_core_file_cache_add_reference 
(listener->file->md5);
                          entropy_free (md5);   /*We don't need this one, we're 
returning an old ref */
                        }
                
@@ -393,7 +394,7 @@
        entropy_gui_event* gui_event;
        entropy_file_operation* op;
 
-       printf("EVFS requested feedback on an operation!\n");
+       printf("EVFS requested feedback on an operation!, id %ld\n",  
data->op->id);
 
       /*Find who called us */
       uri =
@@ -675,12 +676,15 @@
            /*Register a new listener for this file */
            listener = entropy_malloc (sizeof (entropy_file_listener));
            listener->file = ef;
-           listener->count = 0;
+           listener->count = 1;
 
 
            entropy_core_file_cache_add (md5, listener);
          }
          else {
+            entropy_core_file_cache_add_reference (listener->file->md5);
+                 
+       
            ecore_list_append (el, listener->file);
            entropy_free (md5); /*We don't need this one, we're returning an 
old ref */
          }
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/layout_etk_simple.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- layout_etk_simple.c 22 Mar 2006 11:04:52 -0000      1.31
+++ layout_etk_simple.c 28 Mar 2006 10:31:15 -0000      1.32
@@ -294,7 +294,7 @@
          ecore_hash_set(_etk_layout_structure_plugin_reference, structure_obj, 
layouts);
   }
 
-  struct_ref = calloc(1, sizeof(_layout_etk_row_structure_plugin));
+  struct_ref = entropy_malloc(sizeof(_layout_etk_row_structure_plugin));
   struct_ref->row = row;
   struct_ref->structure_plugin = structure;
 
@@ -313,8 +313,18 @@
   void *(*local_plugin_init) (entropy_core * core,
                                  entropy_gui_component_instance *,
                                  void *data);
-  
   entropy_plugin *local;
+
+  entropy_gui_component_instance*
+         (*metadata_plugin_init) (entropy_core * core,
+                                 entropy_gui_component_instance *,
+                                 void* parent_visual,
+                                 void *data);
+
+  
+  entropy_plugin *meta;
+  entropy_gui_component_instance* meta_instance;
+         
   Etk_Tree_Col* col;
   Etk_Widget* vbox;
   Etk_Widget* menubar;
@@ -431,6 +441,9 @@
    menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Delete this 
location"),
                   ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL);
    etk_signal_connect("activated", ETK_OBJECT(menu_item), 
ETK_CALLBACK(_etk_layout_location_delete_confirm_cb), layout);
+   menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add a new 
location"),
+                  ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL);
+   
 
   for (structures = entropy_config_standard_structures_parse (layout, NULL); 
structures; ) {
          structure = structures->data;
@@ -440,10 +453,22 @@
 
   /*Initialise the list view*/
   local = 
entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW);
-  local_plugin_init =
-      dlsym (local->dl_ref, "entropy_plugin_init");   
-  instance = (*local_plugin_init)(core, layout,NULL);
-  instance->plugin = local;
+  if (local) {
+         local_plugin_init =
+             dlsym (local->dl_ref, "entropy_plugin_init");   
+         instance = (*local_plugin_init)(core, layout,NULL);
+         instance->plugin = local;
+   }
+
+
+  /*Initialise the metadata plugin*/
+  meta = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, 
ENTROPY_PLUGIN_GUI_COMPONENT_INFO_PROVIDER);
+  if (meta) {
+         metadata_plugin_init = 
+         dlsym(meta->dl_ref, "entropy_plugin_init");
+         meta_instance = 
(*metadata_plugin_init)(core,layout,layout->gui_object,NULL);
+         meta_instance->plugin = meta;
+  }
 
   etk_paned_add2(ETK_PANED(gui->paned), instance->gui_object, ETK_TRUE);
 
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- layout_ewl_simple.c 22 Mar 2006 11:04:52 -0000      1.53
+++ layout_ewl_simple.c 28 Mar 2006 10:31:15 -0000      1.54
@@ -472,7 +472,7 @@
   Ewl_Widget *hbox;
   entropy_plugin *structure;
   entropy_ewl_layout_header_uri *header =
-    calloc (1, sizeof (entropy_ewl_layout_header_uri));
+    entropy_malloc (sizeof (entropy_ewl_layout_header_uri));
   void *(*structure_plugin_init) (entropy_core * core,
                                  entropy_gui_component_instance *, 
                                  void* parent_visual,
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/remote_thumbnailer.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- remote_thumbnailer.c        14 Mar 2006 13:05:43 -0000      1.10
+++ remote_thumbnailer.c        28 Mar 2006 10:31:15 -0000      1.11
@@ -54,7 +54,7 @@
                     entropy_gui_component_instance * requester);
   copy_func = dlsym (plugin->dl_ref, "entropy_filesystem_file_copy");
 
-  /*This thumbnailer is only for remotel files */
+  /*This thumbnailer is only for remote files */
   if (!strcmp (request->file->uri_base, "file"))
     return NULL;
 
@@ -118,12 +118,12 @@
         * the user*/
         void (*operation_func)(long id,int response);
         entropy_plugin* plugin;
-       long id = (long)obj;
+       entropy_file_operation* op = (entropy_file_operation*)obj;
 
         //FIXME
         plugin = entropy_plugins_type_get_first( ENTROPY_PLUGIN_BACKEND_FILE 
,ENTROPY_PLUGIN_SUB_TYPE_ALL);
         operation_func = dlsym(plugin->dl_ref, 
"entropy_filesystem_operation_respond");
-        (*operation_func)( id, ENTROPY_USER_INTERACTION_RESPONSE_YES );
+        (*operation_func)( op->id, ENTROPY_USER_INTERACTION_RESPONSE_YES );
 
   }
   break; 
@@ -140,7 +140,7 @@
 
        entropy_gui_component_instance *instance = NULL;
 
-       //printf("From: %s/%s\n", progress->file_from->path, 
progress->file_from->filename);
+       /*printf("From: %s/%s\n", progress->file_from->path, 
progress->file_from->filename);*/
        
        md5 = md5_entropy_path_file (progress->file_from->uri_base, 
progress->file_from->path, progress->file_from->filename);
        instance = ecore_hash_get (file_instance_hash, md5);
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/thumbnail_generic.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- thumbnail_generic.c 19 Mar 2006 05:41:08 -0000      1.7
+++ thumbnail_generic.c 28 Mar 2006 10:31:15 -0000      1.8
@@ -10,6 +10,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <Epsilon.h>
+#include <X11/Xlib.h>
+#include <Ecore_X.h>
 
 
 static char *thumbnail_path = NULL;    //Make this central to the core, so it 
can be configurable
@@ -17,14 +19,11 @@
 entropy_thumbnail *
 entropy_thumbnail_new ()
 {
-  entropy_thumbnail *thumb = calloc (1,sizeof (entropy_thumbnail));
+  entropy_thumbnail *thumb = entropy_malloc (sizeof (entropy_thumbnail));
 
   thumb->text = ecore_hash_new (ecore_str_hash, ecore_str_compare);
   thumb->keys = 0;
 
-  allocated_thumbnails++;
-  print_allocation ();
-
   return thumb;
 }
 
@@ -49,8 +48,6 @@
   char *pos;
   Epsilon *e;
 
-
-
   strcpy (thumb_path_and_name, e_file->path);
   pos = thumb_path_and_name + strlen (thumb_path_and_name);
   strcpy (pos, "/");
@@ -61,7 +58,6 @@
   if (epsilon_exists (e) == EPSILON_FAIL) {
     epsilon_generate (e);
   }
-
 
   if (epsilon_exists (e)) {
     thumb_struct = entropy_thumbnail_new ();
===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/thumbnailer.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- thumbnailer.c       21 Feb 2006 10:45:18 -0000      1.4
+++ thumbnailer.c       28 Mar 2006 10:31:15 -0000      1.5
@@ -1,6 +1,10 @@
 #include "entropy.h"
+#include "Epsilon_Request.h"
+#include <Epsilon.h>
 
 static Ecore_List *types = NULL;
+static Ecore_Event_Handler *thumb_done = NULL;
+static Ecore_Hash *_ecore_thumb_file_instance_hash = NULL;
 #define THUMBNAILER_LOCAL_PLUGIN "file"
 
 int
@@ -30,6 +34,54 @@
   return types;
 }
 
+int thumb_complete_cb(void *data, int type, void *event)
+{
+        Epsilon_Request *thumb = event;
+       entropy_thumbnail* thumbnail;
+       entropy_gui_event* gui_event;
+       entropy_gui_component_instance* instance = NULL;
+       entropy_file_request* req;
+       char* md5;
+
+
+       md5 = md5_entropy_local_file(thumb->path);
+
+        /*printf("\n! EVENT ! THUMB %s -> %s  (%s), COMPLETE ! STATUS %d ! %d 
REMAINING !\n\n",
+                        thumb->path, thumb->dest, md5, thumb->status,  1);*/
+       
+       req = ecore_hash_get(_ecore_thumb_file_instance_hash, md5);
+       
+       if (req) {
+               instance = req->requester;
+               ecore_hash_remove(_ecore_thumb_file_instance_hash, md5);
+
+               thumbnail = entropy_thumbnail_new();
+               strcpy(thumbnail->thumbnail_filename, thumb->dest);
+               thumbnail->parent = req->file;
+               req->file->thumbnail = thumbnail;
+
+           gui_event = entropy_malloc (sizeof (entropy_gui_event));
+           gui_event->event_type =
+             entropy_core_gui_event_get
+             (ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE);
+           gui_event->data = thumbnail;
+           //
+           /*Call the callback stuff */
+           entropy_core_layout_notify_event (instance, gui_event,
+                                             ENTROPY_EVENT_LOCAL);
+
+               entropy_core_file_cache_remove_reference(req->file->md5);
+
+               free(md5);
+               free(req);
+       } else {
+               printf("Couldn't file local ref! *****\n");
+       }
+
+        return 0;
+}
+
+
 entropy_gui_component_instance *
 entropy_plugin_init (entropy_core * core)
 {
@@ -41,20 +93,43 @@
   instance->layout_parent = layout;
   instance->core = core;
 
+  _ecore_thumb_file_instance_hash = ecore_hash_new (ecore_str_hash, 
ecore_str_compare);
+
+  epsilon_thumb_init();
+
+  thumb_done = ecore_event_handler_add(EPSILON_EVENT_DONE, thumb_complete_cb, 
NULL);
+
   return instance;
 }
 
 entropy_thumbnail *
 entropy_thumbnailer_thumbnail_get (entropy_thumbnail_request * request)
 {
-  entropy_thumbnail *thumb;
+  entropy_thumbnail *thumb = NULL;
+  char buffer[PATH_MAX];
+  entropy_file_request* o_request;
 
   /*This thumbnailer is only for local files */
   if (strcmp (request->file->uri_base, THUMBNAILER_LOCAL_PLUGIN))
     return NULL;
 
   if (!request->file->thumbnail) {
-    thumb = entropy_thumbnail_create (request->file);
+    /*thumb = entropy_thumbnail_create (request->file);*/
+    /*printf("Ecore thumb: request: '%s/%s'\n", request->file->path, 
request->file->filename);*/
+
+    snprintf(buffer,PATH_MAX, "%s/%s", request->file->path, 
request->file->filename);
+
+    /*FIXME this assumes that only one instance will request a thumb at one 
time*/
+    o_request = entropy_malloc(sizeof(entropy_file_request));  
+    o_request->file = request->file;
+    o_request->requester = request->instance;
+    
+    ecore_hash_set (_ecore_thumb_file_instance_hash, request->file->md5, 
o_request);
+    
+    entropy_core_file_cache_add_reference(request->file->md5);
+
+    /*printf("'%s' (%s)...\n", buffer, request->file->md5);*/
+    epsilon_add(buffer, NULL, EPSILON_THUMB_NORMAL, NULL);
   }
   else {
     return request->file->thumbnail;
@@ -62,17 +137,15 @@
   /*Set the file up for this thumbnail. TODO this probably violates convention 
to do this here,
    * but we create the thumbnail downstream, and from here, so there's not 
much choice.. */
 
-  if (thumb) {
-    /*printf("Created thumbnail '%s'\n", thumb->thumbnail_filename); */
+  /*if (thumb) {
     thumb->parent = request->file;
     request->file->thumbnail = thumb;
   }
   else {
-    //printf ("Returned thumb was null, assuming error...\n");
     return NULL;
-  }
+  }*/
 
-  return thumb;
+  return NULL;
 }
 
 void




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to