felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1ba06bb6429d61997140759b38a5d75bf54a4546

commit 1ba06bb6429d61997140759b38a5d75bf54a4546
Author: Larry Jr <larry....@gmail.com>
Date:   Sun Jun 5 21:21:43 2016 -0300

    eio: Add mime_type property in Eio_Model
---
 configure.ac                      |  5 +++--
 src/Makefile.am                   |  2 +-
 src/examples/elementary/filemvc.c |  2 +-
 src/lib/eio/eio_main.c            |  6 ++++++
 src/lib/eio/eio_model.c           | 24 ++++++++++++++++++------
 src/lib/eio/eio_model_private.h   |  6 ++++--
 6 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7a27416..c411a83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4673,6 +4673,7 @@ EFL_INTERNAL_DEPEND_PKG([EIO], [eo])
 EFL_INTERNAL_DEPEND_PKG([EIO], [eina])
 EFL_INTERNAL_DEPEND_PKG([EIO], [efl])
 EFL_INTERNAL_DEPEND_PKG([EIO], [emile])
+EFL_INTERNAL_DEPEND_PKG([EIO], [efreet-mime])
 
 EFL_ADD_LIBS([EIO], [-lm])
 
@@ -4858,9 +4859,9 @@ EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-input])
 EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf])
 EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf-evas])
 EFL_INTERNAL_DEPEND_PKG([EDJE], [embryo])
-EFL_INTERNAL_DEPEND_PKG([EDJE], [eio])
 EFL_INTERNAL_DEPEND_PKG([EDJE], [emile])
 EFL_INTERNAL_DEPEND_PKG([EDJE], [efreet])
+EFL_INTERNAL_DEPEND_PKG([EDJE], [eio])
 
 EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_physics}], [ephysics])
 EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_multisense}], [ecore-audio])
@@ -5418,11 +5419,11 @@ EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ethumb_client])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [emotion])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-imf])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-con])
-EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eio])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eldbus])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-mime])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-trash])
+EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eio])
 EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [elocation])
 
 EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_x11_any}], [ecore_x])
diff --git a/src/Makefile.am b/src/Makefile.am
index 50839cb..1ab50e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,8 +61,8 @@ include Makefile_Ecore_Evas.am
 include Makefile_Ecore_Audio.am
 include Makefile_Ecore_Avahi.am
 include Makefile_Embryo.am
-include Makefile_Eio.am
 include Makefile_Efreet.am
+include Makefile_Eio.am
 include Makefile_Ecore_Buffer.am
 include Makefile_EPhysics.am
 include Makefile_Edje.am
diff --git a/src/examples/elementary/filemvc.c 
b/src/examples/elementary/filemvc.c
index 75fe652..eb33d55 100644
--- a/src/examples/elementary/filemvc.c
+++ b/src/examples/elementary/filemvc.c
@@ -168,7 +168,7 @@ elm_main(int argc, char **argv)
    genlist = elm_genlist_add(win);
    priv.fileview = eo_add(ELM_VIEW_LIST_CLASS, NULL, 
elm_view_list_genlist_set(eo_self, genlist, ELM_GENLIST_ITEM_NONE, 
"double_label"));
    elm_view_list_property_connect(priv.fileview, "filename", "elm.text");
-   elm_view_list_property_connect(priv.fileview, "size", "elm.text.sub");
+   elm_view_list_property_connect(priv.fileview, "mime_type", "elm.text.sub");
 
    evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
    _widget_init(genlist);
diff --git a/src/lib/eio/eio_main.c b/src/lib/eio/eio_main.c
index a22e515..b399d9b 100644
--- a/src/lib/eio/eio_main.c
+++ b/src/lib/eio/eio_main.c
@@ -19,6 +19,8 @@
 #include "eio_private.h"
 #include "Eio.h"
 
+#include <Efreet_Mime.h>
+
 /*============================================================================*
  *                                  Local                                     *
  
*============================================================================*/
@@ -315,6 +317,8 @@ eio_init(void)
 
    eio_monitor_init();
 
+   efreet_mime_init();
+
    eina_log_timing(_eio_log_dom_global,
                   EINA_LOG_STATE_STOP,
                   EINA_LOG_STATE_INIT);
@@ -360,6 +364,8 @@ eio_shutdown(void)
           CRI("We couldn't terminate in less than 30s some pending IO. This 
can led to some crash.");
      }
 
+   efreet_mime_shutdown();
+
    eio_monitor_shutdown();
 
    eina_condition_free(&(memory_pool_cond));
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c
index 258a7ce..e9f2ad8 100644
--- a/src/lib/eio/eio_model.c
+++ b/src/lib/eio/eio_model.c
@@ -9,6 +9,7 @@
 #include <Ecore.h>
 #include <Ecore_File.h>
 #include <Eo.h>
+#include <Efreet_Mime.h>
 
 #include "eio_private.h"
 #include "eio_model.h"
@@ -261,23 +262,33 @@ _eio_model_efl_model_property_get(Eo *obj EINA_UNUSED, 
Eio_Model_Data *priv, con
         return;
      }
 
-   if(!strcmp("filename", property))
+   if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_FILENAME], property) == 0)
      {
         value = basename(priv->path);
         property_name = EIO_MODEL_PROP_FILENAME;
      }
-   else if(!strcmp("path", property))
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_PATH], property) == 0)
      {
         value = priv->path;
         property_name = EIO_MODEL_PROP_PATH;
      }
-   else if(!strcmp("mtime", property))
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_MIME_TYPE], property) 
== 0)
+     {
+        value = efreet_mime_type_get(priv->path);
+        if (value == NULL)
+          {
+             eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_NOT_FOUND);
+             return;
+          }
+        property_name = EIO_MODEL_PROP_MIME_TYPE;
+     }
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_MTIME], property) == 0)
      property_name = EIO_MODEL_PROP_MTIME;
-   else if(!strcmp("is_dir", property))
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_IS_DIR], property) == 0)
      property_name = EIO_MODEL_PROP_IS_DIR;
-   else if(!strcmp("is_lnk", property))
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_IS_LNK], property) == 0)
      property_name = EIO_MODEL_PROP_IS_LNK;
-   else if(!strcmp("size", property))
+   else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_SIZE], property) == 0)
      property_name = EIO_MODEL_PROP_SIZE;
    else
      {
@@ -289,6 +300,7 @@ _eio_model_efl_model_property_get(Eo *obj EINA_UNUSED, 
Eio_Model_Data *priv, con
      {
      case EIO_MODEL_PROP_FILENAME:
      case EIO_MODEL_PROP_PATH:
+     case EIO_MODEL_PROP_MIME_TYPE:
        {
           Eina_Value* v = eina_promise_owner_buffer_get(promise);
           eina_value_setup(v, EINA_VALUE_TYPE_STRING);
diff --git a/src/lib/eio/eio_model_private.h b/src/lib/eio/eio_model_private.h
index edf64fb..5641e8f 100644
--- a/src/lib/eio/eio_model_private.h
+++ b/src/lib/eio/eio_model_private.h
@@ -1,7 +1,7 @@
 #ifndef _EIO_MODEL_PRIVATE_H
 #define _EIO_MODEL_PRIVATE_H
 
-#define PROP_LIST_SIZE 7
+#define PROP_LIST_SIZE 8
 
 typedef struct _Eio_Model_Data                 Eio_Model_Data;
 typedef struct _Eio_Model_Monitor_Data         Eio_Model_Monitor_Data;
@@ -21,6 +21,7 @@ typedef enum _Eio_Property_Name {
    EIO_MODEL_PROP_IS_DIR,
    EIO_MODEL_PROP_IS_LNK,
    EIO_MODEL_PROP_SIZE,
+   EIO_MODEL_PROP_MIME_TYPE,
    EIO_MODEL_PROP_LAST
 } _Eio_Property_Name;
 
@@ -31,7 +32,8 @@ static const char* _eio_model_prop_names[] =
    [EIO_MODEL_PROP_MTIME]     = "mtime",
    [EIO_MODEL_PROP_IS_DIR]    = "is_dir",
    [EIO_MODEL_PROP_IS_LNK]    = "is_lnk",
-   [EIO_MODEL_PROP_SIZE]      = "size"
+   [EIO_MODEL_PROP_SIZE]      = "size",
+   [EIO_MODEL_PROP_MIME_TYPE] = "mime_type"
 };
 
 typedef struct _Eio_Property_Promise _Eio_Property_Promise;

-- 


Reply via email to