Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : apps/exhibit

Dir     : e17/apps/exhibit/src/bin


Modified Files:
        exhibit.h exhibit_main.c exhibit_thumb.c exhibit_thumb.h 


Log Message:
Do away with out own forking thumbnailer and use epsilon_thumbd


===================================================================
RCS file: /cvs/e/e17/apps/exhibit/src/bin/exhibit.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- exhibit.h   3 Sep 2007 16:43:16 -0000       1.49
+++ exhibit.h   2 Oct 2007 21:05:00 -0000       1.50
@@ -13,6 +13,7 @@
 #include <Edje.h>
 #include <Ecore_Evas.h>
 #include <Epsilon.h>
+#include <Epsilon_Request.h>
 #include <Efreet_Mime.h>
 #include <etk/Etk.h>
 #include <stdio.h>
===================================================================
RCS file: /cvs/e/e17/apps/exhibit/src/bin/exhibit_main.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- exhibit_main.c      28 Sep 2007 22:02:58 -0000      1.128
+++ exhibit_main.c      2 Oct 2007 21:05:00 -0000       1.129
@@ -12,9 +12,6 @@
 /* defines the initial size and increment size that file list arrays have */
 #define FILELIST_SIZE 3000
 
-extern pid_t pid;
-extern Evas_List *thumb_list;
-
 typedef struct _Ex_Populate_Data Ex_Populate_Data;
 
 struct _Ex_Populate_Data
@@ -37,19 +34,6 @@
 static void _ex_main_window_key_down_cb(Etk_Object *object, void *event, void 
*data);
 static void _ex_main_window_resize_cb(Etk_Object *object, void *data);
 
-/*******
- * We are defining these here until Tree2 has them
- *******/
-#if 0
-/* This is implemented in etk_tree now */
-Etk_Tree_Row *etk_tree_selected_row_get(Etk_Tree *tree)
-{
-   if (!tree || !tree->last_selected_row || !tree->last_selected_row->selected)
-     return NULL;
-   return tree->last_selected_row;
-}
-#endif
-
 Evas_List *etk_tree_selected_rows_get(Etk_Tree *tree)
 {
    Evas_List *row_list = NULL;
@@ -410,8 +394,8 @@
 void
 _ex_main_itree_add(const char *file, const char *selected_file)
 {
-   Epsilon *ep;
    Etk_Tree_Row *row;
+   Ex_Thumb *thumb;
 
    if (!file)
      {
@@ -431,56 +415,25 @@
        return;
      }
    
-   ep = epsilon_new(file);
-   epsilon_thumb_size(ep, EPSILON_THUMB_NORMAL);
-   
-   if(epsilon_exists(ep) == EPSILON_OK)
-     {
-       char *thumb;
-
-       thumb = (char*) epsilon_thumb_file_get(ep);
-       row = etk_tree_row_append(ETK_TREE(e->cur_tab->itree), NULL, 
-                                  e->cur_tab->icol,
-                                  thumb, NULL, 
-                                  basename((char *) file), NULL);
-
-       if (selected_file)
-         {
-            if(!strcmp(selected_file, file))
-              {
-                 etk_tree_row_select(row);
-                 etk_tree_row_scroll_to(row, ETK_TRUE);
-              }
-         }
-       
-       E_FREE(thumb);
-     }
-   else 
+   thumb = calloc(1, sizeof(Ex_Thumb));
+   thumb->ep = NULL;
+   thumb->e = e;
+   thumb->name = strdup(basename((char *) file));
+   thumb->tab = e->cur_tab;
+   if(selected_file)
      {
-       Ex_Thumb *thumb;
-       
-       thumb = calloc(1, sizeof(Ex_Thumb));
-       thumb->ep = ep;
-       thumb->e = e;
-       thumb->name = strdup(basename((char *) file));
-       thumb->tab = e->cur_tab;
-       thumb_list = evas_list_append(thumb_list, thumb);       
-       if(selected_file)
-         {
-            if(!strcmp(selected_file, file))
-              thumb->selected = ETK_TRUE;
-         }
-       else
-         thumb->selected = ETK_FALSE;
-       
-       row = etk_tree_row_append(ETK_TREE(e->cur_tab->itree), NULL, 
-                                 e->cur_tab->icol,
-                                 PACKAGE_DATA_DIR"/gui.edj", "thumb_loading",
-                                 basename((char *) file), NULL);       
-       
-       if(pid == -1) _ex_thumb_generate();
+       if(!strcmp(selected_file, file))
+         thumb->selected = ETK_TRUE;
      }
+   else
+     thumb->selected = ETK_FALSE;
 
+   epsilon_add((char*)file, NULL, EPSILON_THUMB_NORMAL, thumb);
+   
+   row = etk_tree_row_append(ETK_TREE(e->cur_tab->itree), NULL, 
+        e->cur_tab->icol,
+        PACKAGE_DATA_DIR"/gui.edj", "thumb_loading",
+        basename((char *) file), NULL);
 }
 
 static void
@@ -1279,11 +1232,13 @@
    ecore_file_init();
    if(!_ex_options_init())
      fprintf(stderr, "WARNING: Exhibit could not set up its options files!\n"
-                    "         You will not be able to save your 
preferences.\n");
+          "         You will not be able to save your preferences.\n");
+
+   epsilon_thumb_init();
+
    event_handlers = evas_list_append(event_handlers,
-        ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _ex_thumb_exe_exit, 
NULL));
-   
-   epsilon_init();
+        ecore_event_handler_add(EPSILON_EVENT_DONE, _ex_thumb_complete, NULL));
+         
    if(argc > 1 + fullscreen + slideshow)
      _ex_main_window_show(argv[1 + fullscreen + slideshow], fullscreen, 
slideshow);
    else
===================================================================
RCS file: /cvs/e/e17/apps/exhibit/src/bin/exhibit_thumb.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- exhibit_thumb.c     2 Sep 2007 18:37:37 -0000       1.17
+++ exhibit_thumb.c     2 Oct 2007 21:05:00 -0000       1.18
@@ -4,22 +4,16 @@
 #include "exhibit.h"
 #include "exhibit_file.h"
 
-pid_t pid = -1;
-Evas_List *thumb_list;
-
 int
-_ex_thumb_exe_exit(void *data, int type, void *event)
-{
-   Ecore_Exe_Event_Del  *ev;
-   Ex_Thumb             *thumb;
-   char                 *ext;
-
-   ev = event;
-   if (ev->pid != pid) return 1;
-   if (!thumb_list) return 1;
+_ex_thumb_complete(void *data, int type, void *event)
+{   
+   Epsilon_Request *ev = event;
+   Ex_Thumb *thumb;
+   char *ext;
 
-   thumb = thumb_list->data;
-   thumb_list = evas_list_remove_list(thumb_list, thumb_list);
+   thumb = ev->data;
+   if (!thumb)
+     return 1;
 
    ext = strrchr(thumb->name, '.');
 
@@ -27,7 +21,7 @@
      {
        Etk_Tree_Row *row;
        
-       thumb->image = (char*)epsilon_thumb_file_get(thumb->ep);
+       thumb->image = (char*)ev->dest;
        row = _ex_image_find_row_from_file(thumb->tab, thumb->name);
        etk_tree_row_fields_set(row,
                                ETK_FALSE,
@@ -40,47 +34,18 @@
             etk_tree_row_select(row);
             etk_tree_row_scroll_to(row, ETK_TRUE);
          }
-       E_FREE(thumb->image);
-       E_FREE(thumb->name);
-       epsilon_free(thumb->ep);
+       E_FREE(thumb->name);    
        E_FREE(thumb);
      }
 
-   pid = -1;
-   _ex_thumb_generate();
    return 1;
 }
 
 void
-_ex_thumb_generate()
-{
-   Ex_Thumb *thumb;
-
-   if ((!thumb_list) || (pid != -1)) return;
-
-   pid = fork();
-   if (pid == 0)
-     {
-       /* reset signal handlers for the child */
-       signal(SIGSEGV, SIG_DFL);
-       signal(SIGILL, SIG_DFL);
-       signal(SIGFPE, SIG_DFL);
-       signal(SIGBUS, SIG_DFL);
-               
-       thumb = thumb_list->data;
-       if(_ex_file_is_ebg(thumb->name))
-         epsilon_key_set(thumb->ep, "e/desktop/background");
-       if(epsilon_generate(thumb->ep))
-         {
-            thumb->image = (char*)epsilon_thumb_file_get(thumb->ep);
-         }
-       exit(0);
-     }
-}
-
-void
 _ex_thumb_abort()
 {
+   /* TODO: reimplement */
+#if 0
    Evas_List *l;
    pid = -1;
    
@@ -99,12 +64,15 @@
             thumb_list = evas_list_remove_list(thumb_list, l);
          }
      }
+#endif
 }
 
 
 void
 _ex_thumb_abort_all()
 {
+   /* TODO: reimplement */
+#if 0   
    pid = -1;
    
    while(thumb_list)
@@ -119,6 +87,7 @@
        thumb_list = evas_list_remove_list(thumb_list, thumb_list);
      }
    evas_list_free(thumb_list);
+#endif   
 }
 
 void
@@ -148,13 +117,6 @@
    snprintf(file, sizeof(file), "%s%s",
            tab->dir, icol_string);
    
-   ep = epsilon_new(file);
-
-   /* For some reason, if we dont call this, something goes wrong
-    * Need to look into epsilon to see what this function is doing that makes
-    * everything work well.
-    */
-   epsilon_exists(ep);
    ecore_file_unlink(old_thumb);
    
    thumb = calloc(1, sizeof(Ex_Thumb));
@@ -162,8 +124,7 @@
    thumb->e = e;
    thumb->name = strdup(basename(icol_string));
    thumb->tab = e->cur_tab;
-   thumb_list = evas_list_append(thumb_list, thumb);
    thumb->selected = ETK_FALSE;
    etk_tree_model_cache_remove(thumb->tab->imodel, old_thumb, NULL);
-   if(pid == -1) _ex_thumb_generate();   
+   epsilon_add(file, NULL, EPSILON_THUMB_NORMAL, thumb);
 }
===================================================================
RCS file: /cvs/e/e17/apps/exhibit/src/bin/exhibit_thumb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- exhibit_thumb.h     3 May 2007 10:30:41 -0000       1.3
+++ exhibit_thumb.h     2 Oct 2007 21:05:00 -0000       1.4
@@ -5,6 +5,7 @@
 #define _EX_THUMB_H
 
 int         _ex_thumb_exe_exit(void *data, int type, void *event);
+int         _ex_thumb_complete(void *data, int type, void *event);
 void        _ex_thumb_generate();
 void        _ex_thumb_abort();
 void        _ex_thumb_abort_all();



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to