Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_io_manager.c ewl_misc.c 


Log Message:
- use efreet-mime 

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_io_manager.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ewl_io_manager.c    29 Mar 2007 19:25:09 -0000      1.11
+++ ewl_io_manager.c    2 Jul 2007 22:26:13 -0000       1.12
@@ -6,6 +6,7 @@
 #include "ewl_macros.h"
 #include "ewl_debug.h"
 
+#include <Efreet_Mime.h>
 #include <dlfcn.h>
 
 static Ecore_Hash *ewl_io_manager_plugins = NULL;
@@ -132,44 +133,16 @@
 const char *
 ewl_io_manager_uri_mime_type_get(const char *uri)
 {
-       char *ptr = NULL;
+       const char *mime = NULL;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("uri", uri, NULL);
 
-       /* XXX i'm cheating for now, fix this up later to use something like
-        * xdgmime */
+       mime = efreet_mime_get(uri, EFREET_MIME_FLAG_GLOB |
+                                       EFREET_MIME_FLAG_TYPES |
+                                       EFREET_MIME_FLAG_MAGIC);
 
-       ptr = strrchr(uri, '.');
-       if (!ptr) DRETURN_PTR(NULL, DLEVEL_STABLE);
-
-       if (!strcasecmp(ptr, ".txt")) 
-       {
-               DRETURN_PTR("text/plain", DLEVEL_STABLE);
-       }
-       if (!strcasecmp(ptr, ".c") || !strcasecmp(ptr, ".h")
-               || !strcasecmp(ptr, ".cpp"))
-       {
-               DRETURN_PTR("text/c", DLEVEL_STABLE);
-       }
-       else if (!strcasecmp(ptr, ".rtf"))
-       {
-               DRETURN_PTR("application/rtf", DLEVEL_STABLE);
-       }
-       else if (!strcasecmp(ptr, ".html"))
-       {
-               DRETURN_PTR("text/html", DLEVEL_STABLE);
-       }
-       else if (!strcasecmp(ptr, ".png"))
-       {
-               DRETURN_PTR("image/png", DLEVEL_STABLE);
-       }
-       else if (!strcasecmp(ptr, ".jpeg") || !strcasecmp(ptr, ".jpg"))
-       {
-               DRETURN_PTR("image/jpeg", DLEVEL_STABLE);
-       }
-
-       DRETURN_PTR(NULL, DLEVEL_STABLE);
+       DRETURN_PTR(mime, DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_misc.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -3 -r1.95 -r1.96
--- ewl_misc.c  4 Jun 2007 18:37:34 -0000       1.95
+++ ewl_misc.c  2 Jul 2007 22:26:13 -0000       1.96
@@ -7,6 +7,7 @@
 #include "ewl_private.h"
 #include "ewl_debug.h"
 #include <Efreet.h>
+#include <Efreet_Mime.h>
 
 #ifdef __GLIBC__
 #include <execinfo.h>
@@ -171,6 +172,12 @@
                goto ERROR;
        }
        ecore_list_prepend(shutdown_queue, efreet_shutdown);
+
+       if (!efreet_mime_init()) {
+               fprintf(stderr, "Could not initialize Efreet_Mime.\n");
+               goto ERROR;
+       }
+       ecore_list_prepend(shutdown_queue, efreet_mime_shutdown);
 
        if (!ecore_string_init()) {
                fprintf(stderr, "Could not initialize Ecore Strings.\n");



-------------------------------------------------------------------------
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-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to