summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2016-06-05 21:21:43 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-05 22:08:06 -0300
commit1ba06bb6429d61997140759b38a5d75bf54a4546 (patch)
tree0656fa783f1bdc8892aedc0fa3dd13621edef1de
parentc33caa86ab04fd32a32d6b7227c143343267fb56 (diff)
eio: Add mime_type property in Eio_Model
-rw-r--r--configure.ac5
-rw-r--r--src/Makefile.am2
-rw-r--r--src/examples/elementary/filemvc.c2
-rw-r--r--src/lib/eio/eio_main.c6
-rw-r--r--src/lib/eio/eio_model.c24
-rw-r--r--src/lib/eio/eio_model_private.h6
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])
4673EFL_INTERNAL_DEPEND_PKG([EIO], [eina]) 4673EFL_INTERNAL_DEPEND_PKG([EIO], [eina])
4674EFL_INTERNAL_DEPEND_PKG([EIO], [efl]) 4674EFL_INTERNAL_DEPEND_PKG([EIO], [efl])
4675EFL_INTERNAL_DEPEND_PKG([EIO], [emile]) 4675EFL_INTERNAL_DEPEND_PKG([EIO], [emile])
4676EFL_INTERNAL_DEPEND_PKG([EIO], [efreet-mime])
4676 4677
4677EFL_ADD_LIBS([EIO], [-lm]) 4678EFL_ADD_LIBS([EIO], [-lm])
4678 4679
@@ -4858,9 +4859,9 @@ EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-input])
4858EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf]) 4859EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf])
4859EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf-evas]) 4860EFL_INTERNAL_DEPEND_PKG([EDJE], [ecore-imf-evas])
4860EFL_INTERNAL_DEPEND_PKG([EDJE], [embryo]) 4861EFL_INTERNAL_DEPEND_PKG([EDJE], [embryo])
4861EFL_INTERNAL_DEPEND_PKG([EDJE], [eio])
4862EFL_INTERNAL_DEPEND_PKG([EDJE], [emile]) 4862EFL_INTERNAL_DEPEND_PKG([EDJE], [emile])
4863EFL_INTERNAL_DEPEND_PKG([EDJE], [efreet]) 4863EFL_INTERNAL_DEPEND_PKG([EDJE], [efreet])
4864EFL_INTERNAL_DEPEND_PKG([EDJE], [eio])
4864 4865
4865EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_physics}], [ephysics]) 4866EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_physics}], [ephysics])
4866EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_multisense}], [ecore-audio]) 4867EFL_OPTIONAL_INTERNAL_DEPEND_PKG([EDJE], [${want_multisense}], [ecore-audio])
@@ -5418,11 +5419,11 @@ EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ethumb_client])
5418EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [emotion]) 5419EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [emotion])
5419EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-imf]) 5420EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-imf])
5420EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-con]) 5421EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [ecore-con])
5421EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eio])
5422EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eldbus]) 5422EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eldbus])
5423EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet]) 5423EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet])
5424EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-mime]) 5424EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-mime])
5425EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-trash]) 5425EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [efreet-trash])
5426EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [eio])
5426EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [elocation]) 5427EFL_INTERNAL_DEPEND_PKG([ELEMENTARY], [elocation])
5427 5428
5428EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ELEMENTARY], [${want_x11_any}], [ecore_x]) 5429EFL_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
61include Makefile_Ecore_Audio.am 61include Makefile_Ecore_Audio.am
62include Makefile_Ecore_Avahi.am 62include Makefile_Ecore_Avahi.am
63include Makefile_Embryo.am 63include Makefile_Embryo.am
64include Makefile_Eio.am
65include Makefile_Efreet.am 64include Makefile_Efreet.am
65include Makefile_Eio.am
66include Makefile_Ecore_Buffer.am 66include Makefile_Ecore_Buffer.am
67include Makefile_EPhysics.am 67include Makefile_EPhysics.am
68include Makefile_Edje.am 68include 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)
168 genlist = elm_genlist_add(win); 168 genlist = elm_genlist_add(win);
169 priv.fileview = eo_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(eo_self, genlist, ELM_GENLIST_ITEM_NONE, "double_label")); 169 priv.fileview = eo_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(eo_self, genlist, ELM_GENLIST_ITEM_NONE, "double_label"));
170 elm_view_list_property_connect(priv.fileview, "filename", "elm.text"); 170 elm_view_list_property_connect(priv.fileview, "filename", "elm.text");
171 elm_view_list_property_connect(priv.fileview, "size", "elm.text.sub"); 171 elm_view_list_property_connect(priv.fileview, "mime_type", "elm.text.sub");
172 172
173 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv); 173 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
174 _widget_init(genlist); 174 _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 @@
19#include "eio_private.h" 19#include "eio_private.h"
20#include "Eio.h" 20#include "Eio.h"
21 21
22#include <Efreet_Mime.h>
23
22/*============================================================================* 24/*============================================================================*
23 * Local * 25 * Local *
24 *============================================================================*/ 26 *============================================================================*/
@@ -315,6 +317,8 @@ eio_init(void)
315 317
316 eio_monitor_init(); 318 eio_monitor_init();
317 319
320 efreet_mime_init();
321
318 eina_log_timing(_eio_log_dom_global, 322 eina_log_timing(_eio_log_dom_global,
319 EINA_LOG_STATE_STOP, 323 EINA_LOG_STATE_STOP,
320 EINA_LOG_STATE_INIT); 324 EINA_LOG_STATE_INIT);
@@ -360,6 +364,8 @@ eio_shutdown(void)
360 CRI("We couldn't terminate in less than 30s some pending IO. This can led to some crash."); 364 CRI("We couldn't terminate in less than 30s some pending IO. This can led to some crash.");
361 } 365 }
362 366
367 efreet_mime_shutdown();
368
363 eio_monitor_shutdown(); 369 eio_monitor_shutdown();
364 370
365 eina_condition_free(&(memory_pool_cond)); 371 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 @@
9#include <Ecore.h> 9#include <Ecore.h>
10#include <Ecore_File.h> 10#include <Ecore_File.h>
11#include <Eo.h> 11#include <Eo.h>
12#include <Efreet_Mime.h>
12 13
13#include "eio_private.h" 14#include "eio_private.h"
14#include "eio_model.h" 15#include "eio_model.h"
@@ -261,23 +262,33 @@ _eio_model_efl_model_property_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, con
261 return; 262 return;
262 } 263 }
263 264
264 if(!strcmp("filename", property)) 265 if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_FILENAME], property) == 0)
265 { 266 {
266 value = basename(priv->path); 267 value = basename(priv->path);
267 property_name = EIO_MODEL_PROP_FILENAME; 268 property_name = EIO_MODEL_PROP_FILENAME;
268 } 269 }
269 else if(!strcmp("path", property)) 270 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_PATH], property) == 0)
270 { 271 {
271 value = priv->path; 272 value = priv->path;
272 property_name = EIO_MODEL_PROP_PATH; 273 property_name = EIO_MODEL_PROP_PATH;
273 } 274 }
274 else if(!strcmp("mtime", property)) 275 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_MIME_TYPE], property) == 0)
276 {
277 value = efreet_mime_type_get(priv->path);
278 if (value == NULL)
279 {
280 eina_promise_owner_error_set(promise, EFL_MODEL_ERROR_NOT_FOUND);
281 return;
282 }
283 property_name = EIO_MODEL_PROP_MIME_TYPE;
284 }
285 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_MTIME], property) == 0)
275 property_name = EIO_MODEL_PROP_MTIME; 286 property_name = EIO_MODEL_PROP_MTIME;
276 else if(!strcmp("is_dir", property)) 287 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_IS_DIR], property) == 0)
277 property_name = EIO_MODEL_PROP_IS_DIR; 288 property_name = EIO_MODEL_PROP_IS_DIR;
278 else if(!strcmp("is_lnk", property)) 289 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_IS_LNK], property) == 0)
279 property_name = EIO_MODEL_PROP_IS_LNK; 290 property_name = EIO_MODEL_PROP_IS_LNK;
280 else if(!strcmp("size", property)) 291 else if(strcmp(_eio_model_prop_names[EIO_MODEL_PROP_SIZE], property) == 0)
281 property_name = EIO_MODEL_PROP_SIZE; 292 property_name = EIO_MODEL_PROP_SIZE;
282 else 293 else
283 { 294 {
@@ -289,6 +300,7 @@ _eio_model_efl_model_property_get(Eo *obj EINA_UNUSED, Eio_Model_Data *priv, con
289 { 300 {
290 case EIO_MODEL_PROP_FILENAME: 301 case EIO_MODEL_PROP_FILENAME:
291 case EIO_MODEL_PROP_PATH: 302 case EIO_MODEL_PROP_PATH:
303 case EIO_MODEL_PROP_MIME_TYPE:
292 { 304 {
293 Eina_Value* v = eina_promise_owner_buffer_get(promise); 305 Eina_Value* v = eina_promise_owner_buffer_get(promise);
294 eina_value_setup(v, EINA_VALUE_TYPE_STRING); 306 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 @@
1#ifndef _EIO_MODEL_PRIVATE_H 1#ifndef _EIO_MODEL_PRIVATE_H
2#define _EIO_MODEL_PRIVATE_H 2#define _EIO_MODEL_PRIVATE_H
3 3
4#define PROP_LIST_SIZE 7 4#define PROP_LIST_SIZE 8
5 5
6typedef struct _Eio_Model_Data Eio_Model_Data; 6typedef struct _Eio_Model_Data Eio_Model_Data;
7typedef struct _Eio_Model_Monitor_Data Eio_Model_Monitor_Data; 7typedef struct _Eio_Model_Monitor_Data Eio_Model_Monitor_Data;
@@ -21,6 +21,7 @@ typedef enum _Eio_Property_Name {
21 EIO_MODEL_PROP_IS_DIR, 21 EIO_MODEL_PROP_IS_DIR,
22 EIO_MODEL_PROP_IS_LNK, 22 EIO_MODEL_PROP_IS_LNK,
23 EIO_MODEL_PROP_SIZE, 23 EIO_MODEL_PROP_SIZE,
24 EIO_MODEL_PROP_MIME_TYPE,
24 EIO_MODEL_PROP_LAST 25 EIO_MODEL_PROP_LAST
25} _Eio_Property_Name; 26} _Eio_Property_Name;
26 27
@@ -31,7 +32,8 @@ static const char* _eio_model_prop_names[] =
31 [EIO_MODEL_PROP_MTIME] = "mtime", 32 [EIO_MODEL_PROP_MTIME] = "mtime",
32 [EIO_MODEL_PROP_IS_DIR] = "is_dir", 33 [EIO_MODEL_PROP_IS_DIR] = "is_dir",
33 [EIO_MODEL_PROP_IS_LNK] = "is_lnk", 34 [EIO_MODEL_PROP_IS_LNK] = "is_lnk",
34 [EIO_MODEL_PROP_SIZE] = "size" 35 [EIO_MODEL_PROP_SIZE] = "size",
36 [EIO_MODEL_PROP_MIME_TYPE] = "mime_type"
35}; 37};
36 38
37typedef struct _Eio_Property_Promise _Eio_Property_Promise; 39typedef struct _Eio_Property_Promise _Eio_Property_Promise;