summaryrefslogtreecommitdiff
path: root/src/modules/ecordova/linux
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-03 22:06:16 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-03 22:06:16 -0200
commit2ed2b84d6b5c6b9e43151b5fabf5e8f7eabc1b62 (patch)
tree76b1e1231c9183967f7e82346cedb6df20111be8 /src/modules/ecordova/linux
parent9f641d1b69c05656f5e8ca78be274a98cdf44407 (diff)
ecordova: Removed constructors
Diffstat (limited to 'src/modules/ecordova/linux')
-rw-r--r--src/modules/ecordova/linux/ecordova_console.c8
-rw-r--r--src/modules/ecordova/linux/ecordova_directoryentry.c41
-rw-r--r--src/modules/ecordova/linux/ecordova_directoryreader.c19
-rw-r--r--src/modules/ecordova/linux/ecordova_entry.c97
-rw-r--r--src/modules/ecordova/linux/ecordova_entry_private.h5
-rw-r--r--src/modules/ecordova/linux/ecordova_fileentry.c23
-rw-r--r--src/modules/ecordova/linux/ecordova_filereader.c15
-rw-r--r--src/modules/ecordova/linux/ecordova_filetransfer.c22
-rw-r--r--src/modules/ecordova/linux/ecordova_filewriter.c27
9 files changed, 120 insertions, 137 deletions
diff --git a/src/modules/ecordova/linux/ecordova_console.c b/src/modules/ecordova/linux/ecordova_console.c
index 53ffed0d75..1baa282302 100644
--- a/src/modules/ecordova/linux/ecordova_console.c
+++ b/src/modules/ecordova/linux/ecordova_console.c
@@ -7,7 +7,6 @@
7 7
8#include "ecordova_console_private.h" 8#include "ecordova_console_private.h"
9 9
10#include <stdbool.h>
11#include <stdint.h> 10#include <stdint.h>
12#include <stdlib.h> 11#include <stdlib.h>
13 12
@@ -59,13 +58,6 @@ _ecordova_console_eo_base_constructor(Eo *obj, Ecordova_Console_Data *pd)
59} 58}
60 59
61static void 60static void
62_ecordova_console_constructor(Eo *obj EINA_UNUSED,
63 Ecordova_Console_Data *pd EINA_UNUSED)
64{
65 DBG("(%p)", obj);
66}
67
68static void
69_ecordova_console_eo_base_destructor(Eo *obj, 61_ecordova_console_eo_base_destructor(Eo *obj,
70 Ecordova_Console_Data *pd EINA_UNUSED) 62 Ecordova_Console_Data *pd EINA_UNUSED)
71{ 63{
diff --git a/src/modules/ecordova/linux/ecordova_directoryentry.c b/src/modules/ecordova/linux/ecordova_directoryentry.c
index e1bd724e59..dfa4e0d876 100644
--- a/src/modules/ecordova/linux/ecordova_directoryentry.c
+++ b/src/modules/ecordova/linux/ecordova_directoryentry.c
@@ -46,7 +46,7 @@ extern int _ecordova_log_dom;
46#define MY_CLASS_NAME "Ecordova_DirectoryEntry" 46#define MY_CLASS_NAME "Ecordova_DirectoryEntry"
47 47
48static void _remove_notify(Eo *, void *); 48static void _remove_notify(Eo *, void *);
49static bool _is_absolute(const char *); 49static Eina_Bool _is_absolute(const char *);
50static void _directory_get(Eo *, void *); 50static void _directory_get(Eo *, void *);
51static void _file_get(Eo *, void *); 51static void _file_get(Eo *, void *);
52static void _eio_directory_get_cb(void *, Eio_File *, const Eina_Stat *); 52static void _eio_directory_get_cb(void *, Eio_File *, const Eina_Stat *);
@@ -65,24 +65,9 @@ _ecordova_directoryentry_eo_base_constructor(Eo *obj,
65 65
66 pd->obj = obj; 66 pd->obj = obj;
67 67
68 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 68 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
69} 69 ecordova_entry_file_is_set(EINA_FALSE);
70 70 return obj;
71static void
72_ecordova_directoryentry_constructor(Eo *obj,
73 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED,
74 const char *name,
75 const char *path,
76 Ecordova_FileSystem *file_system,
77 const char *url)
78{
79 DBG("(%p)", obj);
80 eo_do_super(obj, MY_CLASS, ecordova_entry_constructor(EINA_FALSE,
81 EINA_TRUE,
82 name,
83 path,
84 file_system,
85 url));
86} 71}
87 72
88static void 73static void
@@ -102,7 +87,7 @@ _ecordova_directoryentry_reader_create(Eo *obj,
102 EINA_SAFETY_ON_NULL_RETURN_VAL(super, NULL); 87 EINA_SAFETY_ON_NULL_RETURN_VAL(super, NULL);
103 88
104 return eo_add(ECORDOVA_DIRECTORYREADER_CLASS, NULL, 89 return eo_add(ECORDOVA_DIRECTORYREADER_CLASS, NULL,
105 ecordova_directoryreader_constructor(super->native)); 90 ecordova_directoryreader_native_set(super->native));
106} 91}
107 92
108static void 93static void
@@ -147,7 +132,8 @@ _eio_directory_get_cb(void *user_data,
147 Eio_Operation_Data *data = user_data; 132 Eio_Operation_Data *data = user_data;
148 DBG("(%p)", data->pd->obj); 133 DBG("(%p)", data->pd->obj);
149 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL, 134 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
150 ecordova_directoryentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem? 135 ecordova_entry_name_set(data->name),
136 ecordova_entry_path_set(data->path));
151 137
152 data->success_cb(data->pd->obj, directory); 138 data->success_cb(data->pd->obj, directory);
153 _data_free(data); 139 _data_free(data);
@@ -160,7 +146,8 @@ _eio_file_get_cb(void *user_data,
160{ 146{
161 Eio_Operation_Data *data = user_data; 147 Eio_Operation_Data *data = user_data;
162 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL, 148 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
163 ecordova_fileentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem? 149 ecordova_entry_name_set(data->name),
150 ecordova_entry_path_set(data->path));
164 151
165 data->success_cb(data->pd->obj, file); 152 data->success_cb(data->pd->obj, file);
166 _data_free(data); 153 _data_free(data);
@@ -225,7 +212,8 @@ _eio_create_file_cb(void *user_data,
225 fclose(fd); 212 fclose(fd);
226 213
227 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL, 214 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
228 ecordova_fileentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem? 215 ecordova_entry_name_set(data->name),
216 ecordova_entry_path_set(data->path));
229 data->success_cb(data->pd->obj, file); 217 data->success_cb(data->pd->obj, file);
230 _data_free(data); 218 _data_free(data);
231} 219}
@@ -236,7 +224,8 @@ _eio_mkdir_cb(void *user_data, Eio_File *handler EINA_UNUSED)
236 Eio_Operation_Data *data = user_data; 224 Eio_Operation_Data *data = user_data;
237 DBG("(%p)", data->pd->obj); 225 DBG("(%p)", data->pd->obj);
238 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL, 226 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
239 ecordova_directoryentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem? 227 ecordova_entry_name_set(data->name),
228 ecordova_entry_path_set(data->path));
240 data->success_cb(data->pd->obj, directory); 229 data->success_cb(data->pd->obj, directory);
241 _data_free(data); 230 _data_free(data);
242} 231}
@@ -267,7 +256,7 @@ _ecordova_directoryentry_recursively_remove(Eo *obj,
267 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS); 256 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
268 EINA_SAFETY_ON_NULL_RETURN(super); 257 EINA_SAFETY_ON_NULL_RETURN(super);
269 258
270 _entry_remove(super, _remove_notify, _error_notify, true); 259 _entry_remove(super, _remove_notify, _error_notify, EINA_TRUE);
271} 260}
272 261
273static void 262static void
@@ -310,7 +299,7 @@ _remove_notify(Eo *obj, void *data EINA_UNUSED)
310 eo_event_callback_call(ECORDOVA_DIRECTORYENTRY_EVENT_REMOVE_SUCCESS, NULL)); 299 eo_event_callback_call(ECORDOVA_DIRECTORYENTRY_EVENT_REMOVE_SUCCESS, NULL));
311} 300}
312 301
313static bool 302static Eina_Bool
314_is_absolute(const char *path) 303_is_absolute(const char *path)
315{ 304{
316 // TODO: not multiplatform 305 // TODO: not multiplatform
diff --git a/src/modules/ecordova/linux/ecordova_directoryreader.c b/src/modules/ecordova/linux/ecordova_directoryreader.c
index 7164887751..cc781a3364 100644
--- a/src/modules/ecordova/linux/ecordova_directoryreader.c
+++ b/src/modules/ecordova/linux/ecordova_directoryreader.c
@@ -70,15 +70,20 @@ _ecordova_directoryreader_eo_base_constructor(Eo *obj,
70} 70}
71 71
72static void 72static void
73_ecordova_directoryreader_constructor(Eo *obj, 73_ecordova_directoryreader_native_set(Eo *obj,
74 Ecordova_DirectoryReader_Data *pd, 74 Ecordova_DirectoryReader_Data *pd,
75 const char *native) 75 const char *native)
76{ 76{
77 DBG("(%p) url=%s", obj, native); 77 DBG("(%p) url=%s", obj, native);
78 fprintf(stderr, "%s:%s:%d\n", __func__, __FILE__, __LINE__); fflush(stderr);
79 pd->native = strdup(native); 78 pd->native = strdup(native);
80} 79}
81 80
81static const char*
82_ecordova_directoryreader_native_get(Eo *obj EINA_UNUSED, Ecordova_DirectoryReader_Data *pd)
83{
84 return pd->native;
85}
86
82static void 87static void
83_ecordova_directoryreader_eo_base_destructor(Eo *obj, 88_ecordova_directoryreader_eo_base_destructor(Eo *obj,
84 Ecordova_DirectoryReader_Data *pd) 89 Ecordova_DirectoryReader_Data *pd)
@@ -149,13 +154,15 @@ _main_cb(void *user_data,
149 case EINA_FILE_DIR: 154 case EINA_FILE_DIR:
150 { 155 {
151 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL, 156 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
152 ecordova_directoryentry_constructor(name, path, NULL, info->path)); // TODO: filesystem? 157 ecordova_entry_name_set(name),
158 ecordova_entry_path_set(path));
153 break; 159 break;
154 } 160 }
155 case EINA_FILE_REG: 161 case EINA_FILE_REG:
156 { 162 {
157 entry = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL, 163 entry = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
158 ecordova_fileentry_constructor(name, path, NULL, info->path)); // TODO: filesystem? 164 ecordova_entry_name_set(name),
165 ecordova_entry_path_set(path));
159 break; 166 break;
160 } 167 }
161 // TODO: case EINA_FILE_LNK ? 168 // TODO: case EINA_FILE_LNK ?
diff --git a/src/modules/ecordova/linux/ecordova_entry.c b/src/modules/ecordova/linux/ecordova_entry.c
index 0d2e31c7ee..b405efc235 100644
--- a/src/modules/ecordova/linux/ecordova_entry.c
+++ b/src/modules/ecordova/linux/ecordova_entry.c
@@ -52,12 +52,14 @@ static void _remove_notify(Eo *, void *);
52static Eina_Bool _eio_remove_non_recursively_filter_cb(void *, Eio_File *, const Eina_File_Direct_Info *); 52static Eina_Bool _eio_remove_non_recursively_filter_cb(void *, Eio_File *, const Eina_File_Direct_Info *);
53static void _parent_get_cb(void *, Eio_File *, const Eina_Stat *); 53static void _parent_get_cb(void *, Eio_File *, const Eina_Stat *);
54static void _parent_get_notify(Eo *, void *); 54static void _parent_get_notify(Eo *, void *);
55static void _sync_native(Ecordova_Entry_Data* pd);
55 56
56static Eo_Base * 57static Eo_Base *
57_ecordova_entry_eo_base_constructor(Eo *obj, Ecordova_Entry_Data *pd) 58_ecordova_entry_eo_base_constructor(Eo *obj, Ecordova_Entry_Data *pd)
58{ 59{
59 DBG("(%p)", obj); 60 DBG("(%p)", obj);
60 61
62 pd->is_file = EINA_TRUE;
61 pd->obj = obj; 63 pd->obj = obj;
62 pd->name = NULL; 64 pd->name = NULL;
63 pd->path = NULL; 65 pd->path = NULL;
@@ -69,30 +71,6 @@ _ecordova_entry_eo_base_constructor(Eo *obj, Ecordova_Entry_Data *pd)
69} 71}
70 72
71static void 73static void
72_ecordova_entry_constructor(Eo *obj,
73 Ecordova_Entry_Data *pd,
74 Eina_Bool file_is,
75 Eina_Bool directory_is,
76 const char *name,
77 const char *path,
78 Ecordova_FileSystem *file_system,
79 const char *url)
80{
81 EINA_SAFETY_ON_NULL_RETURN(name);
82 EINA_SAFETY_ON_NULL_RETURN(path);
83 //EINA_SAFETY_ON_NULL_RETURN(file_system);
84 EINA_SAFETY_ON_NULL_RETURN(url);
85 DBG("(%p) name=%s, path=%s, url=%s", obj, name, path, url);
86
87 pd->is_file = file_is;
88 pd->is_directory = directory_is;
89 pd->name = strdup(name);
90 pd->path = strdup(path);
91 pd->file_system = eo_ref(file_system);
92 pd->native = strdup(url);
93}
94
95static void
96_ecordova_entry_eo_base_destructor(Eo *obj, Ecordova_Entry_Data *pd) 74_ecordova_entry_eo_base_destructor(Eo *obj, Ecordova_Entry_Data *pd)
97{ 75{
98 DBG("(%p)", obj); 76 DBG("(%p)", obj);
@@ -145,7 +123,6 @@ _ecordova_entry_move(Eo *obj EINA_UNUSED,
145 data->path = strdup(dest_dir->native); 123 data->path = strdup(dest_dir->native);
146 124
147 // TODO: file_system? 125 // TODO: file_system?
148
149 size_t len = strlen(data->path) + 1 + strlen(data->name) + 1; 126 size_t len = strlen(data->path) + 1 + strlen(data->name) + 1;
150 data->native = malloc(len); 127 data->native = malloc(len);
151 EINA_SAFETY_ON_NULL_GOTO(data->native, on_error); 128 EINA_SAFETY_ON_NULL_GOTO(data->native, on_error);
@@ -231,14 +208,14 @@ static void
231_ecordova_entry_remove(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd) 208_ecordova_entry_remove(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
232{ 209{
233 DBG("(%p)", obj); 210 DBG("(%p)", obj);
234 _entry_remove(pd, _remove_notify, _error_notify, false); 211 _entry_remove(pd, _remove_notify, _error_notify, EINA_FALSE);
235} 212}
236 213
237void 214void
238_entry_remove(Ecordova_Entry_Data *pd, 215_entry_remove(Ecordova_Entry_Data *pd,
239 Ecordova_Entry_Success_Callback success_cb, 216 Ecordova_Entry_Success_Callback success_cb,
240 Ecordova_Entry_Error_Callback error_cb, 217 Ecordova_Entry_Error_Callback error_cb,
241 bool recursively) 218 Eina_Bool recursively)
242{ 219{
243 DBG("(%p)", pd->obj); 220 DBG("(%p)", pd->obj);
244 221
@@ -304,10 +281,8 @@ _parent_get_notify(Eo *obj, void *data)
304 Ecordova_DirectoryEntry *parent = 281 Ecordova_DirectoryEntry *parent =
305 eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, 282 eo_add(ECORDOVA_DIRECTORYENTRY_CLASS,
306 NULL, 283 NULL,
307 ecordova_directoryentry_constructor(name, 284 ecordova_entry_name_set(name),
308 path, 285 ecordova_entry_path_set(path));
309 NULL, // TODO: filesystem ?
310 url));
311 free(name); 286 free(name);
312 free(path); 287 free(path);
313 free(url); 288 free(url);
@@ -325,7 +300,31 @@ _ecordova_entry_file_is_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
325static Eina_Bool 300static Eina_Bool
326_ecordova_entry_directory_is_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd) 301_ecordova_entry_directory_is_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
327{ 302{
328 return pd->is_directory; 303 return !pd->is_file;
304}
305
306static void
307_ecordova_entry_file_is_set(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd, Eina_Bool is_file)
308{
309 pd->is_file = is_file;
310}
311
312static void
313_ecordova_entry_directory_is_set(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd, Eina_Bool is_dir)
314{
315 pd->is_file = !is_dir;
316}
317
318static void
319_ecordova_entry_name_set(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd, const char* name)
320{
321 if(pd->name)
322 free(pd->name);
323 pd->name = strdup(name);
324 if(pd->path)
325 {
326 _sync_native(pd);
327 }
329} 328}
330 329
331static const char * 330static const char *
@@ -340,6 +339,18 @@ _ecordova_entry_path_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
340 return pd->path; 339 return pd->path;
341} 340}
342 341
342static void
343_ecordova_entry_path_set(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd, const char* path)
344{
345 if(pd->path)
346 free(pd->path);
347 pd->path = strdup(path);
348 if(pd->name)
349 {
350 _sync_native(pd);
351 }
352}
353
343void 354void
344_metadata_get(Ecordova_Entry_Data *pd, 355_metadata_get(Ecordova_Entry_Data *pd,
345 Ecordova_Entry_Success_Callback success_cb, 356 Ecordova_Entry_Success_Callback success_cb,
@@ -428,17 +439,13 @@ _eio_copied_cb(void *user_data, Eio_File *handler EINA_UNUSED)
428 if (data->pd->is_file) 439 if (data->pd->is_file)
429 entry = eo_add(ECORDOVA_FILEENTRY_CLASS, 440 entry = eo_add(ECORDOVA_FILEENTRY_CLASS,
430 NULL, 441 NULL,
431 ecordova_fileentry_constructor(data->name, 442 ecordova_entry_name_set(data->name),
432 data->path, 443 ecordova_entry_path_set(data->path));
433 data->pd->file_system,
434 data->native));
435 else 444 else
436 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, 445 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS,
437 NULL, 446 NULL,
438 ecordova_directoryentry_constructor(data->name, 447 ecordova_entry_name_set(data->name),
439 data->path, 448 ecordova_entry_path_set(data->path));
440 data->pd->file_system,
441 data->native));
442 449
443 data->success_cb(data->pd->obj, entry); 450 data->success_cb(data->pd->obj, entry);
444 451
@@ -537,6 +544,16 @@ _translate_errno(int error)
537 return -1; 544 return -1;
538} 545}
539 546
547void _sync_native(Ecordova_Entry_Data* pd)
548{
549 if(pd->native)
550 free(pd->native);
551 size_t len = strlen(pd->path) + 1 + strlen(pd->name) + 1;
552 pd->native = malloc(len);
553 if(pd->native)
554 snprintf(pd->native, len, "%s/%s", pd->path, pd->name);
555}
556
540#include "undefs.h" 557#include "undefs.h"
541 558
542#define ecordova_entry_class_get ecordova_entry_impl_class_get 559#define ecordova_entry_class_get ecordova_entry_impl_class_get
diff --git a/src/modules/ecordova/linux/ecordova_entry_private.h b/src/modules/ecordova/linux/ecordova_entry_private.h
index a50f250f81..c9a7117cac 100644
--- a/src/modules/ecordova/linux/ecordova_entry_private.h
+++ b/src/modules/ecordova/linux/ecordova_entry_private.h
@@ -5,8 +5,6 @@
5 5
6#include <Eio.h> 6#include <Eio.h>
7 7
8#include <stdbool.h>
9
10typedef struct _Ecordova_Entry_Data Ecordova_Entry_Data; 8typedef struct _Ecordova_Entry_Data Ecordova_Entry_Data;
11 9
12/** 10/**
@@ -16,7 +14,6 @@ struct _Ecordova_Entry_Data
16{ 14{
17 Eo *obj; 15 Eo *obj;
18 Eina_Bool is_file; 16 Eina_Bool is_file;
19 Eina_Bool is_directory;
20 char *name; 17 char *name;
21 char *path; 18 char *path;
22 Ecordova_FileSystem *file_system; 19 Ecordova_FileSystem *file_system;
@@ -42,7 +39,7 @@ typedef struct
42Eio_Operation_Data *_data_new(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback); 39Eio_Operation_Data *_data_new(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback);
43void _data_free(Eio_Operation_Data *); 40void _data_free(Eio_Operation_Data *);
44void _metadata_get(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback); 41void _metadata_get(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback);
45void _entry_remove(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback, bool); 42void _entry_remove(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback, Eina_Bool);
46void _error_notify(Eo *, int); 43void _error_notify(Eo *, int);
47void _eio_error_cb(void *, Eio_File *, int); 44void _eio_error_cb(void *, Eio_File *, int);
48void _eio_removed_cb(void *, Eio_File *); 45void _eio_removed_cb(void *, Eio_File *);
diff --git a/src/modules/ecordova/linux/ecordova_fileentry.c b/src/modules/ecordova/linux/ecordova_fileentry.c
index 273c28dac3..7ab349ee40 100644
--- a/src/modules/ecordova/linux/ecordova_fileentry.c
+++ b/src/modules/ecordova/linux/ecordova_fileentry.c
@@ -49,24 +49,9 @@ _ecordova_fileentry_eo_base_constructor(Eo *obj, Ecordova_FileEntry_Data *pd)
49 49
50 pd->obj = obj; 50 pd->obj = obj;
51 51
52 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 52 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
53} 53 ecordova_entry_file_is_set(EINA_TRUE);
54 54 return obj;
55static void
56_ecordova_fileentry_constructor(Eo *obj,
57 Ecordova_FileEntry_Data *pd EINA_UNUSED,
58 const char *name,
59 const char *path,
60 Ecordova_FileSystem *file_system,
61 const char *url)
62{
63 DBG("(%p)", obj);
64 eo_do_super(obj, MY_CLASS, ecordova_entry_constructor(EINA_TRUE,
65 EINA_FALSE,
66 name,
67 path,
68 file_system,
69 url));
70} 55}
71 56
72static void 57static void
@@ -128,7 +113,7 @@ _writer_create(Eo *obj, void *data)
128 const Ecordova_Metadata *metadata = data; 113 const Ecordova_Metadata *metadata = data;
129 Ecordova_File *file = _create_file(obj, metadata); 114 Ecordova_File *file = _create_file(obj, metadata);
130 Ecordova_FileWriter *writer = eo_add(ECORDOVA_FILEWRITER_CLASS, NULL, 115 Ecordova_FileWriter *writer = eo_add(ECORDOVA_FILEWRITER_CLASS, NULL,
131 ecordova_filewriter_constructor(file)); 116 ecordova_filewriter_file_set(file));
132 117
133 eo_do(obj, 118 eo_do(obj,
134 eo_event_callback_call(ECORDOVA_FILEENTRY_EVENT_CREATE_WRITER, writer)); 119 eo_event_callback_call(ECORDOVA_FILEENTRY_EVENT_CREATE_WRITER, writer));
diff --git a/src/modules/ecordova/linux/ecordova_filereader.c b/src/modules/ecordova/linux/ecordova_filereader.c
index 70f26af4ff..5407ef6bf4 100644
--- a/src/modules/ecordova/linux/ecordova_filereader.c
+++ b/src/modules/ecordova/linux/ecordova_filereader.c
@@ -7,6 +7,10 @@
7 7
8#include <Eio.h> 8#include <Eio.h>
9 9
10#ifdef EAPI
11#undef EAPI
12#endif
13
10#ifdef _WIN32 14#ifdef _WIN32
11# ifdef DLL_EXPORT 15# ifdef DLL_EXPORT
12# define EAPI __declspec(dllexport) 16# define EAPI __declspec(dllexport)
@@ -58,14 +62,9 @@ _ecordova_filereader_eo_base_constructor(Eo *obj, Ecordova_FileReader_Data *pd)
58 pd->offset = 0; 62 pd->offset = 0;
59 pd->length = 0; 63 pd->length = 0;
60 64
61 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 65 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
62} 66 ecordova_entry_file_is_set(EINA_TRUE);
63 67 return obj;
64static void
65_ecordova_filereader_constructor(Eo *obj EINA_UNUSED,
66 Ecordova_FileReader_Data *pd EINA_UNUSED)
67{
68 DBG("(%p)", obj);
69} 68}
70 69
71static void 70static void
diff --git a/src/modules/ecordova/linux/ecordova_filetransfer.c b/src/modules/ecordova/linux/ecordova_filetransfer.c
index 72bb4f040b..9eaaa681e1 100644
--- a/src/modules/ecordova/linux/ecordova_filetransfer.c
+++ b/src/modules/ecordova/linux/ecordova_filetransfer.c
@@ -80,14 +80,9 @@ _ecordova_filetransfer_eo_base_constructor(Eo *obj,
80 pd->obj = obj; 80 pd->obj = obj;
81 pd->job = NULL; 81 pd->job = NULL;
82 82
83 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 83 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
84} 84 eo_do(obj, ecordova_entry_file_is_set(EINA_TRUE));
85 85 return obj;
86static void
87_ecordova_filetransfer_constructor(Eo *obj EINA_UNUSED,
88 Ecordova_FileTransfer_Data *pd EINA_UNUSED)
89{
90 DBG("(%p)", obj);
91} 86}
92 87
93static void 88static void
@@ -228,8 +223,8 @@ _download_progress_cb(void *data,
228 DBG("(%p)", pd->obj); 223 DBG("(%p)", pd->obj);
229 Ecordova_ProgressEvent event = { 224 Ecordova_ProgressEvent event = {
230 .type = "download", 225 .type = "download",
231 .cancelable = true, 226 .cancelable = EINA_TRUE,
232 .length_computable = true, 227 .length_computable = EINA_TRUE,
233 .loaded = dlnow, 228 .loaded = dlnow,
234 .total = dltotal, 229 .total = dltotal,
235 .target = pd->obj 230 .target = pd->obj
@@ -253,7 +248,8 @@ _download_completion_cb(void *data, const char *file, int status)
253 split_path(NULL, file, &path, &name, &native); 248 split_path(NULL, file, &path, &name, &native);
254 249
255 Ecordova_FileEntry *file_entry = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL, 250 Ecordova_FileEntry *file_entry = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
256 ecordova_fileentry_constructor(name, path, NULL, native)); // TODO: filesystem? 251 ecordova_entry_name_set(name),
252 ecordova_entry_path_set(path));
257 eo_do(pd->obj, 253 eo_do(pd->obj,
258 eo_event_callback_call(ECORDOVA_FILETRANSFER_EVENT_DOWNLOAD_SUCCESS, file_entry)); 254 eo_event_callback_call(ECORDOVA_FILETRANSFER_EVENT_DOWNLOAD_SUCCESS, file_entry));
259 eo_unref(file_entry); 255 eo_unref(file_entry);
@@ -491,8 +487,8 @@ _url_progress_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
491 487
492 Ecordova_ProgressEvent event = { 488 Ecordova_ProgressEvent event = {
493 .type = "upload", 489 .type = "upload",
494 .cancelable = false, 490 .cancelable = EINA_FALSE,
495 .length_computable = true, 491 .length_computable = EINA_TRUE,
496 .loaded = url_progress->up.now, 492 .loaded = url_progress->up.now,
497 .total = url_progress->up.total, 493 .total = url_progress->up.total,
498 .target = pd->obj 494 .target = pd->obj
diff --git a/src/modules/ecordova/linux/ecordova_filewriter.c b/src/modules/ecordova/linux/ecordova_filewriter.c
index fd048d1f06..735b317419 100644
--- a/src/modules/ecordova/linux/ecordova_filewriter.c
+++ b/src/modules/ecordova/linux/ecordova_filewriter.c
@@ -5,7 +5,6 @@
5#include "ecordova_filewriter_private.h" 5#include "ecordova_filewriter_private.h"
6#include "ecordova_entry_private.h" 6#include "ecordova_entry_private.h"
7 7
8#include <stdbool.h>
9#include <unistd.h> 8#include <unistd.h>
10 9
11#ifdef EAPI 10#ifdef EAPI
@@ -44,8 +43,8 @@ extern int _ecordova_log_dom;
44 43
45static void _write_cb(void *, Ecore_Thread *); 44static void _write_cb(void *, Ecore_Thread *);
46static void _truncate_cb(void *, Ecore_Thread *); 45static void _truncate_cb(void *, Ecore_Thread *);
47static bool _stream_init(Ecordova_FileWriter_Data *); 46static Eina_Bool _stream_init(Ecordova_FileWriter_Data *);
48static bool _offset_set(Ecordova_FileWriter_Data *); 47static Eina_Bool _offset_set(Ecordova_FileWriter_Data *);
49static void _write_end_cb(void *, Ecore_Thread *); 48static void _write_end_cb(void *, Ecore_Thread *);
50static void _write_abort_cb(void *, Ecore_Thread *); 49static void _write_abort_cb(void *, Ecore_Thread *);
51static void _write_progress_cb(void *, Ecore_Thread *, void *); 50static void _write_progress_cb(void *, Ecore_Thread *, void *);
@@ -68,13 +67,15 @@ _ecordova_filewriter_eo_base_constructor(Eo *obj,
68 pd->data_size = 0; 67 pd->data_size = 0;
69 pd->truncate_size = 0; 68 pd->truncate_size = 0;
70 69
71 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor()); 70 eo_do_super(obj, MY_CLASS, obj = eo_constructor());
71 eo_do(obj, ecordova_entry_file_is_set(EINA_TRUE));
72 return obj;
72} 73}
73 74
74static void 75static void
75_ecordova_filewriter_constructor(Eo *obj, 76_ecordova_filewriter_file_set(Eo *obj,
76 Ecordova_FileWriter_Data *pd, 77 Ecordova_FileWriter_Data *pd,
77 Ecordova_File *file) 78 Ecordova_File *file)
78{ 79{
79 DBG("(%p)", obj); 80 DBG("(%p)", obj);
80 EINA_SAFETY_ON_NULL_RETURN(file); 81 EINA_SAFETY_ON_NULL_RETURN(file);
@@ -278,30 +279,30 @@ _truncate_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
278 pd->offset = MIN(pd->offset, pd->truncate_size); 279 pd->offset = MIN(pd->offset, pd->truncate_size);
279} 280}
280 281
281static bool 282static Eina_Bool
282_stream_init(Ecordova_FileWriter_Data *pd) 283_stream_init(Ecordova_FileWriter_Data *pd)
283{ 284{
284 pd->stream = fopen(pd->url, "rb+"); 285 pd->stream = fopen(pd->url, "rb+");
285 if (!pd->stream) 286 if (!pd->stream)
286 { 287 {
287 pd->error = _translate_errno(errno); 288 pd->error = _translate_errno(errno);
288 return false; 289 return EINA_FALSE;
289 } 290 }
290 291
291 return true; 292 return EINA_TRUE;
292} 293}
293 294
294static bool 295static Eina_Bool
295_offset_set(Ecordova_FileWriter_Data *pd) 296_offset_set(Ecordova_FileWriter_Data *pd)
296{ 297{
297 int error = fseek(pd->stream, pd->offset, SEEK_SET); 298 int error = fseek(pd->stream, pd->offset, SEEK_SET);
298 if (error) 299 if (error)
299 { 300 {
300 pd->error = _translate_errno(errno); 301 pd->error = _translate_errno(errno);
301 return false; 302 return EINA_FALSE;
302 } 303 }
303 304
304 return true; 305 return EINA_TRUE;
305} 306}
306 307
307static void 308static void