summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_model_private.h
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-10-25 18:04:31 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-04-30 14:21:12 -0700
commit4a54ae0b0ad25dc3a8f55ccf5cd531b1ca0dcaae (patch)
treed62f4237778fb34c067ce6541996fb7d783387ac /src/lib/eio/eio_model_private.h
parentbba8fbe4495e3911284805c8ae93fbf186145e60 (diff)
eio: migrate to the new efl.model API.
Diffstat (limited to '')
-rw-r--r--src/lib/eio/eio_model_private.h103
1 files changed, 47 insertions, 56 deletions
diff --git a/src/lib/eio/eio_model_private.h b/src/lib/eio/eio_model_private.h
index 762d3e6..c0ac50a 100644
--- a/src/lib/eio/eio_model_private.h
+++ b/src/lib/eio/eio_model_private.h
@@ -4,8 +4,9 @@
4#define PROP_LIST_SIZE 8 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_Info Eio_Model_Info;
8 8
9typedef struct _Eio_Model_Monitor_Data Eio_Model_Monitor_Data;
9struct _Eio_Model_Monitor_Data 10struct _Eio_Model_Monitor_Data
10{ 11{
11 Ecore_Event_Handler *ecore_child_add_handler[3]; 12 Ecore_Event_Handler *ecore_child_add_handler[3];
@@ -14,70 +15,60 @@ struct _Eio_Model_Monitor_Data
14 int mon_event_child_del[3]; /**< plus EIO_MONITOR_ERROR */ 15 int mon_event_child_del[3]; /**< plus EIO_MONITOR_ERROR */
15}; 16};
16 17
17typedef enum _Eio_Property_Name { 18// FIXME: Would be more efficient to introduce an Eina_Path that assemble
18 EIO_MODEL_PROP_FILENAME = 0, 19// an array of stringshare instead of using one mega stringshare directly.
19 EIO_MODEL_PROP_PATH,
20 EIO_MODEL_PROP_MTIME,
21 EIO_MODEL_PROP_IS_DIR,
22 EIO_MODEL_PROP_IS_LNK,
23 EIO_MODEL_PROP_SIZE,
24 EIO_MODEL_PROP_MIME_TYPE,
25 EIO_MODEL_PROP_LAST
26} _Eio_Property_Name;
27
28static const char* _eio_model_prop_names[] =
29{
30 [EIO_MODEL_PROP_FILENAME] = "filename",
31 [EIO_MODEL_PROP_PATH] = "path",
32 [EIO_MODEL_PROP_MTIME] = "mtime",
33 [EIO_MODEL_PROP_IS_DIR] = "is_dir",
34 [EIO_MODEL_PROP_IS_LNK] = "is_lnk",
35 [EIO_MODEL_PROP_SIZE] = "size",
36 [EIO_MODEL_PROP_MIME_TYPE] = "mime_type"
37};
38 20
39typedef struct _Eio_Property_Promise _Eio_Property_Promise; 21struct _Eio_Model_Info
40struct _Eio_Property_Promise
41{ 22{
42 _Eio_Property_Name property; 23 Eina_Stringshare *path;
43 Efl_Promise* promise; 24 Eo *object;
44};
45 25
46typedef struct _Eio_Children_Slice_Promise _Eio_Children_Slice_Promise; 26 size_t path_length;
47struct _Eio_Children_Slice_Promise 27 size_t name_length;
48{ 28 size_t name_start;
49 unsigned start; 29
50 unsigned count; 30 Eina_File_Type type;
51 Efl_Promise* promise; 31
32 Eina_Bool parent_ref : 1;
33 Eina_Bool child_ref : 1;
52}; 34};
53 35
54typedef struct _Eio_Model_Data _Eio_Model_Data;
55struct _Eio_Model_Data 36struct _Eio_Model_Data
56{ 37{
57 Eo *obj; 38 Efl_Loop *loop;
39 Eio_Model *self;
40
58 Eina_Stringshare *path; 41 Eina_Stringshare *path;
59 Eina_Array *properties_name; 42
60 Eina_Bool is_listed : 1; 43 Eio_Model_Info *info;
61 Eina_Bool is_listing : 1; 44 Eina_Stat *st;
62 Eina_List *children_list; 45 const char *mime_type;
63 Eina_List *property_promises; 46
64 Eina_List *children_promises; 47 struct {
65 Eina_List *count_promises; 48 Eio_File *stat; // Move to use efl.io.manager.stat
66 /**< EIO data */ 49 Eina_Future *listing; // Move to use efl.io.manager.direct_ls
67 Eio_File *stat_file; 50 Eio_File *move;
68 Eio_File *listing_file; 51 Eio_File *del;
69 Eio_File *move_file; 52 Eina_Future *mime;
70 Eio_File *del_file; 53 } request;
71 Eio_Monitor *monitor; 54
55 struct {
56 EflIoFilter cb;
57 Eina_Free_Cb free;
58 void *data;
59 } filter;
60
72 Eio_Model_Monitor_Data mon; 61 Eio_Model_Monitor_Data mon;
73 int cb_count_child_add; /**< monitor reference counter for child add event */ 62
74 int cb_count_child_del; /**< monitor reference counter for child del event*/ 63 Eio_Monitor *monitor; // Notification stuff
75 unsigned int count; 64 // FIXME: would be interesting to figure a more efficient structure for holding files
76 Eio_Filter_Direct_Cb filter_cb; 65 Eina_List *parent;
77 void *filter_userdata; 66 Eina_List *files; // Eio_Model_Info
78 Eina_Spinlock filter_lock; /**< filter callback is called from another thread */ 67
79 68 Eina_Error error;
80 Eina_List *fetching_mime; 69
70 Eina_Bool listed : 1;
71 Eina_Bool delete_me : 1;
81}; 72};
82 73
83#endif 74#endif