Re: [E-devel] E FM Mime patch

2007-07-16 Thread The Rasterman
On Mon, 09 Jul 2007 21:52:06 -0500 Nick Hughart <[EMAIL PROTECTED]> babbled:

in cvs.

> I have slightly integrated the new efreet_mime stuff into e_fm.  For now 
> it is fairly simple and I have just wrapped efreet_mime_globs_type_get 
> inside of e_fm_mime_filename_get and removed a lot of duplicated code.

that's fine.

> More can be done, but figured this would be an easier patch to get in 
> for now.  I have also changed the mime type of directories to 
> inode/directory as it is what the current mime spec calls for.  There is 
> more that can be done and I would be interested in discussing further 
> changes.  I believe that having magic checking for local files will make 
> more users happy, but if that doesn't interest you then at least having 
> the fallbacks and special file types would be good.

magic checks for local files are still VERY VERY VERY expensive. imho i would
want to avoid them in almost all cases. per file it means seeking the disk head
at least 1 or 2 times or more - parsing data etc. even on local file systems
this can and will slow things down a lot - and it can lock up e itself into
doing the work. this should be done by enlightenment_fm (the child proc that
currently lists dirs and monitors for file changes and stat()'s file to get
their basic fs info). then at least it can't block E. but it will cause
directory listing to slow down - a fair bit. in the vast majority of cases
extension/glob matching will work perfectly well.

> I am willing to do the implementation and testing to see how bad/good 
> this all works.  If anyone has a remote NFS server (preferably outside 
> the US) it would be helpful for my testing :)

they might be crazy enough to do that... simple way to test - add a usleep
(50); into every magic file check. then you will have an idea of what it
might be like on a slow fs. :)

-- 
- Codito, ergo sum - "I code, therefore I am" --
The Rasterman (Carsten Haitzler)[EMAIL PROTECTED]
裸好多
Tokyo, Japan (東京 日本)

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] E FM Mime patch

2007-07-09 Thread Nick Hughart
I have slightly integrated the new efreet_mime stuff into e_fm.  For now 
it is fairly simple and I have just wrapped efreet_mime_globs_type_get 
inside of e_fm_mime_filename_get and removed a lot of duplicated code.  
More can be done, but figured this would be an easier patch to get in 
for now.  I have also changed the mime type of directories to 
inode/directory as it is what the current mime spec calls for.  There is 
more that can be done and I would be interested in discussing further 
changes.  I believe that having magic checking for local files will make 
more users happy, but if that doesn't interest you then at least having 
the fallbacks and special file types would be good.


I am willing to do the implementation and testing to see how bad/good 
this all works.  If anyone has a remote NFS server (preferably outside 
the US) it would be helpful for my testing :)
Index: configure.in
===
RCS file: /cvs/e/e17/apps/e/configure.in,v
retrieving revision 1.167
diff -u -r1.167 configure.in
--- configure.in8 Jul 2007 03:57:51 -   1.167
+++ configure.in10 Jul 2007 02:06:07 -
@@ -175,6 +175,7 @@
   eet
   embryo
   efreet
+  efreet-mime
 ])
 
 # ecore-txt is really only needed by the temperature module,
Index: src/bin/e.h
===
RCS file: /cvs/e/e17/apps/e/src/bin/e.h,v
retrieving revision 1.66
diff -u -r1.66 e.h
--- src/bin/e.h 16 Jun 2007 16:18:45 -  1.66
+++ src/bin/e.h 10 Jul 2007 02:06:07 -
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if HAVE___ATTRIBUTE__
 #define __UNUSED__ __attribute__((unused))
Index: src/bin/e_fm.c
===
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.190
diff -u -r1.190 e_fm.c
--- src/bin/e_fm.c  22 Jun 2007 07:35:47 -  1.190
+++ src/bin/e_fm.c  10 Jul 2007 02:06:08 -
@@ -383,6 +383,7 @@
 NULL); /* data*/
 //   _e_fm2_client_spawn();
e_fm2_custom_file_init();
+   efreet_mime_init();
return 1;
 }
 
@@ -394,6 +395,7 @@
E_FREE(_e_fm2_meta_path);
e_fm2_custom_file_shutdown();
_e_storage_volume_edd_shutdown();
+   efreet_mime_shutdown();
return 1;
 }
 
@@ -3600,7 +3602,7 @@

if (S_ISDIR(ic->info.statinfo.st_mode))
  {
-   ic->info.mime = evas_stringshare_add("x-directory/normal");
+   ic->info.mime = evas_stringshare_add("inode/directory");
  }
if (!ic->info.mime)
  {
Index: src/bin/e_fm_mime.c
===
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm_mime.c,v
retrieving revision 1.11
diff -u -r1.11 e_fm_mime.c
--- src/bin/e_fm_mime.c 12 Nov 2006 03:08:48 -  1.11
+++ src/bin/e_fm_mime.c 10 Jul 2007 02:06:08 -
@@ -3,21 +3,8 @@
  */
 #include "e.h"
 
-typedef struct _E_Mime E_Mime;
-
-struct _E_Mime
-{
-   const char *glob;
-   const char *mime;
-};
-
 /* local subsystem functions */
 static Evas_Bool _e_fm_mime_icon_foreach(Evas_Hash *hash, const char *key, 
void *data, void *fdata);
-static void _e_fm_mime_all_free(void);
-static void _e_fm_mime_update(void);
-static int _e_fm_mime_glob_remove(const char *glob);
-static void _e_fm_mime_mime_types_load(char *file);
-static void _e_fm_mime_shared_mimeinfo_globs_load(char *file);
 
 static Evas_List *mimes = NULL;
 static Evas_Hash *icon_map = NULL;
@@ -26,33 +13,7 @@
 EAPI const char *
 e_fm_mime_filename_get(const char *fname)
 {
-   Evas_List *l;
-   E_Mime *mime;
-   
-   _e_fm_mime_update();
-   /* case senstive match first */
-   for (l = mimes; l; l = l->next)
- {
-   mime = l->data;
-   if (e_util_glob_match(fname, mime->glob))
- {
-mimes = evas_list_remove_list(mimes, l);
-mimes = evas_list_prepend(mimes, mime);
-return mime->mime;
- }
- }
-   /* case insenstive match second */
-   for (l = mimes; l; l = l->next)
- {
-   mime = l->data;
-   if (e_util_glob_case_match(fname, mime->glob))
- {
-mimes = evas_list_remove_list(mimes, l);
-mimes = evas_list_prepend(mimes, mime);
-return mime->mime;
- }
- }
-   return NULL;
+   return efreet_mime_globs_type_get(fname);
 }
 
 /* returns:
@@ -165,229 +126,4 @@
freelist = fdata;
*freelist = evas_list_append(*freelist, data);
return 1;
-}
-
-static void
-_e_fm_mime_all_free(void)
-{
-   E_Mime *mime;
-   
-   while (mimes)
- {
-   mime = mimes->data;
-   mimes = evas_list_remove_list(mimes, mimes);
-   evas_stringshare_del(mime->glob);
-   evas_stringshare_del(mime->mime);
-   free(mime);
- }
-}
-
-static void
-_e_fm_mime_update(void)
-{
-   static double last_t = 0.0, t;
-   char buf[4096];
-   const char *homedir;
-   int reload = 0;
-   time_t ch_times[6] = {0, 0, 0, 0, 0, 0};