eio: Add mime_type property in Eio_Model

This commit is contained in:
Larry Jr 2016-06-05 21:21:43 -03:00 committed by Felipe Magno de Almeida
parent c33caa86ab
commit 1ba06bb642
6 changed files with 33 additions and 12 deletions

View File

@ -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])

View File

@ -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

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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;