summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-10-29 17:06:29 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-10-29 17:06:29 -0200
commit308b29c3203d711474f1e7cd6b61ae96827d3e5e (patch)
tree4d36aa90a6e44620a8cfe30264d1ac0d5e3f1176
parent74f70e020995860f8427633b5872c70ed27e0c0d (diff)
ecordova: Moved to tizen modules
-rw-r--r--src/Makefile_Ecordova.am86
-rw-r--r--src/lib/ecordova/ecordova_dialogs.c75
-rw-r--r--src/lib/ecordova/ecordova_dialogs_private.h16
-rw-r--r--src/lib/ecordova/ecordova_directoryentry.c324
-rw-r--r--src/lib/ecordova/ecordova_directoryentry_private.h18
-rw-r--r--src/lib/ecordova/ecordova_directoryreader.c161
-rw-r--r--src/lib/ecordova/ecordova_directoryreader_private.h18
-rw-r--r--src/lib/ecordova/ecordova_entry.c506
-rw-r--r--src/lib/ecordova/ecordova_entry_private.h53
-rw-r--r--src/lib/ecordova/ecordova_file.c128
-rw-r--r--src/lib/ecordova/ecordova_file_private.h23
-rw-r--r--src/lib/ecordova/ecordova_fileentry.c109
-rw-r--r--src/lib/ecordova/ecordova_fileentry_private.h16
-rw-r--r--src/lib/ecordova/ecordova_filereader.c272
-rw-r--r--src/lib/ecordova/ecordova_filereader_private.h26
-rw-r--r--src/lib/ecordova/ecordova_filesystem.c38
-rw-r--r--src/lib/ecordova/ecordova_filesystem_private.h16
-rw-r--r--src/lib/ecordova/ecordova_filewriter.c357
-rw-r--r--src/lib/ecordova/ecordova_filewriter_private.h26
-rw-r--r--src/lib/ecordova/ecordova_main.c3
-rw-r--r--src/lib/ecordova/ecordova_splashscreen.c51
-rw-r--r--src/lib/ecordova/ecordova_splashscreen_private.h16
-rw-r--r--src/modules/ecordova/linux/ecordova_filetransfer.c (renamed from src/lib/ecordova/ecordova_filetransfer.c)34
-rw-r--r--src/modules/ecordova/linux/ecordova_filetransfer_private.h (renamed from src/lib/ecordova/ecordova_filetransfer_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_batterystatus.c (renamed from src/lib/ecordova/ecordova_batterystatus.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_batterystatus_private.h (renamed from src/lib/ecordova/ecordova_batterystatus_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contact.c (renamed from src/lib/ecordova/ecordova_contact.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contact_private.h (renamed from src/lib/ecordova/ecordova_contact_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactaddress.c (renamed from src/lib/ecordova/ecordova_contactaddress.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactaddress_private.h (renamed from src/lib/ecordova/ecordova_contactaddress_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactfield.c (renamed from src/lib/ecordova/ecordova_contactfield.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactfield_private.h (renamed from src/lib/ecordova/ecordova_contactfield_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactname.c (renamed from src/lib/ecordova/ecordova_contactname.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactname_private.h (renamed from src/lib/ecordova/ecordova_contactname_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactorganization.c (renamed from src/lib/ecordova/ecordova_contactorganization.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contactorganization_private.h (renamed from src/lib/ecordova/ecordova_contactorganization_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts.c (renamed from src/lib/ecordova/ecordova_contacts.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_private.h (renamed from src/lib/ecordova/ecordova_contacts_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_record_utils.c (renamed from src/lib/ecordova/ecordova_contacts_record_utils.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_record_utils.h (renamed from src/lib/ecordova/ecordova_contacts_record_utils.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_device.c (renamed from src/lib/ecordova/ecordova_device.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_device_private.h (renamed from src/lib/ecordova/ecordova_device_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_devicemotion.c (renamed from src/lib/ecordova/ecordova_devicemotion.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_devicemotion_private.h (renamed from src/lib/ecordova/ecordova_devicemotion_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_deviceorientation.c (renamed from src/lib/ecordova/ecordova_deviceorientation.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_deviceorientation_private.h (renamed from src/lib/ecordova/ecordova_deviceorientation_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_geolocation.c (renamed from src/lib/ecordova/ecordova_geolocation.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_geolocation_private.h (renamed from src/lib/ecordova/ecordova_geolocation_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_globalization.c (renamed from src/lib/ecordova/ecordova_globalization.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_globalization_private.h (renamed from src/lib/ecordova/ecordova_globalization_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_inappbrowser.c (renamed from src/lib/ecordova/ecordova_inappbrowser.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_inappbrowser_private.h (renamed from src/lib/ecordova/ecordova_inappbrowser_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_networkinformation.c (renamed from src/lib/ecordova/ecordova_networkinformation.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_networkinformation_private.h (renamed from src/lib/ecordova/ecordova_networkinformation_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_systeminfo.c (renamed from src/lib/ecordova/ecordova_systeminfo.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_systeminfo_private.h (renamed from src/lib/ecordova/ecordova_systeminfo_private.h)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_tizen.c17
-rw-r--r--src/modules/ecordova/tizen/ecordova_vibration.c (renamed from src/lib/ecordova/ecordova_vibration.c)0
-rw-r--r--src/modules/ecordova/tizen/ecordova_vibration_private.h (renamed from src/lib/ecordova/ecordova_vibration_private.h)0
-rw-r--r--src/tests/ecordova/ecordova_contacts_test.c8
-rw-r--r--src/tests/ecordova/ecordova_suite.c4
61 files changed, 101 insertions, 2300 deletions
diff --git a/src/Makefile_Ecordova.am b/src/Makefile_Ecordova.am
index 63c741c839..5004fa0861 100644
--- a/src/Makefile_Ecordova.am
+++ b/src/Makefile_Ecordova.am
@@ -107,30 +107,6 @@ lib_ecordova_libecordova_la_LIBADD = @ECORDOVA_LIBS@ @EFL_LIBS@
107lib_ecordova_libecordova_la_DEPENDENCIES = @ECORDOVA_INTERNAL_LIBS@ @EFL_INTERNAL_LIBS@ 107lib_ecordova_libecordova_la_DEPENDENCIES = @ECORDOVA_INTERNAL_LIBS@ @EFL_INTERNAL_LIBS@
108lib_ecordova_libecordova_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ 108lib_ecordova_libecordova_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
109 109
110# if HAVE_TIZEN_CONFIGURATION_MANAGER
111# ecordovatizenpkgdir = $(libdir)/ecordova/tizen/$(MODULE_ARCH)
112# ecordovatizenpkg_LTLIBRARIES = modules/ecordova/tizen/module.la
113
114# # Workaround for broken parallel install support in automake (relink issue)
115# # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
116# install_ecordovatizenpkgLTLIBRARIES = install-ecordovatizenpkgLTLIBRARIES
117# $(install_ecordovatizenpkgLTLIBRARIES): install-libLTLIBRARIES
118
119# modules_ecordova_tizen_module_la_SOURCES = \
120# modules/ecordova/tizen/ecordova_tizen.c
121# modules_ecordova_tizen_module_la_CPPFLAGS = \
122# -I$(top_builddir)/src/lib/efl \
123# @ECORDOVA_CFLAGS@ \
124# @TIZEN_CONFIGURATION_MANAGER_CFLAGS@
125# modules_ecordova_tizen_module_la_LIBADD = \
126# @USE_ECORDOVA_LIBS@ \
127# @TIZEN_CONFIGURATION_MANAGER_LIBS@
128# modules_ecordova_tizen_module_la_DEPENDENCIES = \
129# @USE_ECORDOVA_INTERNAL_LIBS@
130# modules_ecordova_tizen_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
131# modules_ecordova_tizen_module_la_LIBTOOLFLAGS = --tag=disable-static
132# endif
133
134ecordovalinuxpkgdir = $(libdir)/ecordova/linux/$(MODULE_ARCH) 110ecordovalinuxpkgdir = $(libdir)/ecordova/linux/$(MODULE_ARCH)
135ecordovalinuxpkg_LTLIBRARIES = modules/ecordova/linux/module.la 111ecordovalinuxpkg_LTLIBRARIES = modules/ecordova/linux/module.la
136 112
@@ -148,6 +124,7 @@ modules/ecordova/linux/ecordova_entry.c \
148modules/ecordova/linux/ecordova_fileentry.c \ 124modules/ecordova/linux/ecordova_fileentry.c \
149modules/ecordova/linux/ecordova_file.c \ 125modules/ecordova/linux/ecordova_file.c \
150modules/ecordova/linux/ecordova_filereader.c \ 126modules/ecordova/linux/ecordova_filereader.c \
127modules/ecordova/linux/ecordova_filetransfer.c \
151modules/ecordova/linux/ecordova_filewriter.c 128modules/ecordova/linux/ecordova_filewriter.c
152modules_ecordova_linux_module_la_CPPFLAGS = \ 129modules_ecordova_linux_module_la_CPPFLAGS = \
153-I$(top_builddir)/src/lib/efl \ 130-I$(top_builddir)/src/lib/efl \
@@ -159,6 +136,39 @@ modules_ecordova_linux_module_la_DEPENDENCIES = \
159modules_ecordova_linux_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ 136modules_ecordova_linux_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
160modules_ecordova_linux_module_la_LIBTOOLFLAGS = --tag=disable-static 137modules_ecordova_linux_module_la_LIBTOOLFLAGS = --tag=disable-static
161 138
139if HAVE_TIZEN_CONFIGURATION_MANAGER
140
141ecordovatizenpkgdir = $(libdir)/ecordova/tizen/$(MODULE_ARCH)
142ecordovatizenpkg_LTLIBRARIES = modules/ecordova/tizen/module.la
143
144# Workaround for broken parallel install support in automake (relink issue)
145# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328
146install_ecordovatizenpkgLTLIBRARIES = install-ecordovatizenpkgLTLIBRARIES
147$(install_ecordovatizenpkgLTLIBRARIES): install-libLTLIBRARIES
148
149modules_ecordova_tizen_module_la_SOURCES = \
150modules/ecordova/tizen/ecordova_tizen.c \
151modules/ecordova/tizen/ecordova_console.c \
152modules/ecordova/tizen/ecordova_directoryentry.c \
153modules/ecordova/tizen/ecordova_directoryreader.c \
154modules/ecordova/tizen/ecordova_entry.c \
155modules/ecordova/tizen/ecordova_fileentry.c \
156modules/ecordova/tizen/ecordova_file.c \
157modules/ecordova/tizen/ecordova_filereader.c \
158modules/ecordova/tizen/ecordova_filetransfer.c \
159modules/ecordova/tizen/ecordova_filewriter.c
160modules_ecordova_tizen_module_la_CPPFLAGS = \
161-I$(top_builddir)/src/lib/efl \
162@ECORDOVA_CFLAGS@ -DEFL_ECORDOVA_BUILD
163modules_ecordova_tizen_module_la_LIBADD = \
164@USE_ECORDOVA_LIBS@
165modules_ecordova_tizen_module_la_DEPENDENCIES = \
166@USE_ECORDOVA_INTERNAL_LIBS@
167modules_ecordova_tizen_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
168modules_ecordova_tizen_module_la_LIBTOOLFLAGS = --tag=disable-static
169
170endif
171
162### Unit tests 172### Unit tests
163 173
164if EFL_ENABLE_TESTS 174if EFL_ENABLE_TESTS
@@ -176,39 +186,21 @@ tests/ecordova/ecordova_entry_test.c \
176tests/ecordova/ecordova_file_test.c \ 186tests/ecordova/ecordova_file_test.c \
177tests/ecordova/ecordova_filereader_test.c \ 187tests/ecordova/ecordova_filereader_test.c \
178tests/ecordova/ecordova_filewriter_test.c \ 188tests/ecordova/ecordova_filewriter_test.c \
179tests/ecordova/ecordova_fileentry_test.c 189tests/ecordova/ecordova_filetransfer_test.c \
180 190tests/ecordova/ecordova_fileentry_test.c \
181$(tests_ecordova_ecordova_suite_SOURCES:%.c=%.$(OBJEXT)): modules/ecordova/linux/module.la
182
183#tests/ecordova/ecordova_suite.h \
184tests/ecordova/ecordova_contacts_test.c \ 191tests/ecordova/ecordova_contacts_test.c \
185tests/ecordova/ecordova_contacts_test.h \
186tests/ecordova/ecordova_device_test.c \ 192tests/ecordova/ecordova_device_test.c \
187tests/ecordova/ecordova_device_test.h \
188tests/ecordova/ecordova_devicemotion_test.c \ 193tests/ecordova/ecordova_devicemotion_test.c \
189tests/ecordova/ecordova_devicemotion_test.h \
190tests/ecordova/ecordova_deviceorientation_test.c \ 194tests/ecordova/ecordova_deviceorientation_test.c \
191tests/ecordova/ecordova_deviceorientation_test.h \
192tests/ecordova/ecordova_geolocation_test.c \ 195tests/ecordova/ecordova_geolocation_test.c \
193tests/ecordova/ecordova_geolocation_test.h \
194tests/ecordova/ecordova_batterystatus_test.c \ 196tests/ecordova/ecordova_batterystatus_test.c \
195tests/ecordova/ecordova_batterystatus_test.h \
196tests/ecordova/ecordova_console_test.c \
197tests/ecordova/ecordova_console_test.h \
198tests/ecordova/ecordova_filetransfer_test.c \
199tests/ecordova/ecordova_filetransfer_test.h \
200tests/ecordova/ecordova_media_test.c \ 197tests/ecordova/ecordova_media_test.c \
201tests/ecordova/ecordova_media_test.h \
202tests/ecordova/ecordova_networkinformation_test.c \ 198tests/ecordova/ecordova_networkinformation_test.c \
203tests/ecordova/ecordova_networkinformation_test.h \
204tests/ecordova/ecordova_vibration_test.c \ 199tests/ecordova/ecordova_vibration_test.c \
205tests/ecordova/ecordova_vibration_test.h \
206tests/ecordova/ecordova_entry_test.c \
207tests/ecordova/ecordova_entry_test.h \
208tests/ecordova/ecordova_mediafile_test.c \ 200tests/ecordova/ecordova_mediafile_test.c \
209tests/ecordova/ecordova_mediafile_test.h \ 201tests/ecordova/ecordova_globalization_test.c
210tests/ecordova/ecordova_globalization_test.c \ 202
211tests/ecordova/ecordova_globalization_test.h 203$(tests_ecordova_ecordova_suite_SOURCES:%.c=%.$(OBJEXT)): modules/ecordova/linux/module.la
212 204
213tests_ecordova_ecordova_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 205tests_ecordova_ecordova_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
214-DTESTS_SRC_DIR=\"$(abs_top_srcdir)/src/tests/ecordova\" \ 206-DTESTS_SRC_DIR=\"$(abs_top_srcdir)/src/tests/ecordova\" \
diff --git a/src/lib/ecordova/ecordova_dialogs.c b/src/lib/ecordova/ecordova_dialogs.c
deleted file mode 100644
index 96b660ad9d..0000000000
--- a/src/lib/ecordova/ecordova_dialogs.c
+++ /dev/null
@@ -1,75 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_dialogs_private.h"
6
7#define MY_CLASS ECORDOVA_DIALOGS_CLASS
8#define MY_CLASS_NAME "Ecordova_Dialogs"
9
10static Eo_Base *
11_ecordova_dialogs_eo_base_constructor(Eo *obj, Ecordova_Dialogs_Data *pd)
12{
13 DBG("(%p)", obj);
14
15 pd->obj = obj;
16
17 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
18}
19
20static void
21_ecordova_dialogs_constructor(Eo *obj EINA_UNUSED,
22 Ecordova_Dialogs_Data *pd EINA_UNUSED)
23{
24 DBG("(%p)", obj);
25}
26
27static void
28_ecordova_dialogs_eo_base_destructor(Eo *obj,
29 Ecordova_Dialogs_Data *pd EINA_UNUSED)
30{
31 DBG("(%p)", obj);
32
33 eo_do_super(obj, MY_CLASS, eo_destructor());
34}
35
36static void
37_ecordova_dialogs_alert(Eo *obj EINA_UNUSED,
38 Ecordova_Dialogs_Data *pd EINA_UNUSED,
39 const char *message EINA_UNUSED,
40 const char *title EINA_UNUSED,
41 Eina_List *buttons EINA_UNUSED)
42{
43 ERR("Not implemented.");
44}
45
46static void
47_ecordova_dialogs_confirm(Eo *obj EINA_UNUSED,
48 Ecordova_Dialogs_Data *pd EINA_UNUSED,
49 const char *message EINA_UNUSED,
50 const char *title EINA_UNUSED,
51 Eina_List *buttons EINA_UNUSED)
52{
53 ERR("Not implemented.");
54}
55
56static void
57_ecordova_dialogs_prompt(Eo *obj EINA_UNUSED,
58 Ecordova_Dialogs_Data *pd EINA_UNUSED,
59 const char *message EINA_UNUSED,
60 const char *title EINA_UNUSED,
61 Eina_List *buttons EINA_UNUSED,
62 const char *default_text EINA_UNUSED)
63{
64 ERR("Not implemented.");
65}
66
67static void
68_ecordova_dialogs_beep(Eo *obj EINA_UNUSED,
69 Ecordova_Dialogs_Data *pd EINA_UNUSED,
70 int times EINA_UNUSED)
71{
72 ERR("Not implemented.");
73}
74
75#include "ecordova_dialogs.eo.c"
diff --git a/src/lib/ecordova/ecordova_dialogs_private.h b/src/lib/ecordova/ecordova_dialogs_private.h
deleted file mode 100644
index 3bc664ee45..0000000000
--- a/src/lib/ecordova/ecordova_dialogs_private.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ECORDOVA_DIALOGS_PRIVATE_H
2#define _ECORDOVA_DIALOGS_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_Dialogs_Data Ecordova_Dialogs_Data;
7
8/**
9 * Ecordova.Dialogs private data
10 */
11struct _Ecordova_Dialogs_Data
12{
13 Eo *obj;
14};
15
16#endif
diff --git a/src/lib/ecordova/ecordova_directoryentry.c b/src/lib/ecordova/ecordova_directoryentry.c
deleted file mode 100644
index 44d6de7e60..0000000000
--- a/src/lib/ecordova/ecordova_directoryentry.c
+++ /dev/null
@@ -1,324 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_directoryentry_private.h"
6#include "ecordova_entry_private.h"
7
8#include <Ecore_File.h>
9
10#include <stdio.h>
11
12#define MY_CLASS ECORDOVA_DIRECTORYENTRY_CLASS
13#define MY_CLASS_NAME "Ecordova_DirectoryEntry"
14
15static void _remove_notify(Eo *, void *);
16static bool _is_absolute(const char *);
17static void _directory_get(Eo *, void *);
18static void _file_get(Eo *, void *);
19static void _eio_directory_get_cb(void *, Eio_File *, const Eina_Stat *);
20static void _eio_file_get_cb(void *, Eio_File *, const Eina_Stat *);
21static void _eio_create_directory_cb(void *, Eio_File *, int);
22static void _eio_fail_if_path_exists_cb(void *, Eio_File *, const Eina_Stat *);
23static void _eio_mkdir_cb(void *, Eio_File *);
24static void _set_data_path_name_native(Eio_Operation_Data *, const char *);
25static void _eio_create_file_cb(void *, Eio_File *, int);
26
27static Eo_Base *
28_ecordova_directoryentry_eo_base_constructor(Eo *obj,
29 Ecordova_DirectoryEntry_Data *pd)
30{
31 DBG("(%p)", obj);
32
33 pd->obj = obj;
34
35 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
36}
37
38static void
39_ecordova_directoryentry_constructor(Eo *obj,
40 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED,
41 const char *name,
42 const char *path,
43 Ecordova_FileSystem *file_system,
44 const char *url)
45{
46 DBG("(%p)", obj);
47 eo_do_super(obj, MY_CLASS, ecordova_entry_constructor(EINA_FALSE,
48 EINA_TRUE,
49 name,
50 path,
51 file_system,
52 url));
53}
54
55static void
56_ecordova_directoryentry_eo_base_destructor(Eo *obj EINA_UNUSED,
57 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED)
58{
59 DBG("(%p)", obj);
60
61 eo_do_super(obj, MY_CLASS, eo_destructor());
62}
63
64static Ecordova_DirectoryReader *
65_ecordova_directoryentry_reader_create(Eo *obj,
66 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED)
67{
68 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
69 EINA_SAFETY_ON_NULL_RETURN_VAL(super, NULL);
70
71 return eo_add(ECORDOVA_DIRECTORYREADER_CLASS, NULL,
72 ecordova_directoryreader_constructor(super->native));
73}
74
75static void
76_ecordova_directoryentry_directory_get(Eo *obj,
77 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED,
78 const char *path,
79 Ecordova_FileFlags flags)
80{
81 DBG("(%p)", obj);
82 EINA_SAFETY_ON_NULL_RETURN(path);
83
84 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
85 EINA_SAFETY_ON_NULL_RETURN(super);
86
87 Eio_Operation_Data *data = _data_new(super, _directory_get, _error_notify);
88 _set_data_path_name_native(data, path);
89
90 Eio_Stat_Cb eio_stat_cb = _eio_directory_get_cb;
91 Eio_Error_Cb eio_error_cb = _eio_error_cb;
92
93 if (ECORDOVA_FILEFLAGS_CREATE & flags)
94 {
95 eio_error_cb = _eio_create_directory_cb;
96 if (ECORDOVA_FILEFLAGS_EXCLUSIVE & flags)
97 eio_stat_cb = _eio_fail_if_path_exists_cb;
98 }
99
100 super->pending = eina_list_append(super->pending, data);
101
102 data->file = eio_file_direct_stat(data->native,
103 eio_stat_cb,
104 eio_error_cb,
105 data);
106 EINA_SAFETY_ON_NULL_RETURN(data->file);
107}
108
109static void
110_eio_directory_get_cb(void *user_data,
111 Eio_File *handler EINA_UNUSED,
112 const Eina_Stat *stat EINA_UNUSED)
113{
114 Eio_Operation_Data *data = user_data;
115 DBG("(%p)", data->pd->obj);
116 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
117 ecordova_directoryentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem?
118
119 data->success_cb(data->pd->obj, directory);
120 _data_free(data);
121}
122
123static void
124_eio_file_get_cb(void *user_data,
125 Eio_File *handler EINA_UNUSED,
126 const Eina_Stat *stat EINA_UNUSED)
127{
128 Eio_Operation_Data *data = user_data;
129 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
130 ecordova_fileentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem?
131
132 data->success_cb(data->pd->obj, file);
133 _data_free(data);
134}
135
136static void
137_eio_fail_if_path_exists_cb(void *user_data,
138 Eio_File *handler EINA_UNUSED,
139 const Eina_Stat *stat EINA_UNUSED)
140{
141 Eio_Operation_Data *data = user_data;
142 DBG("(%p)", data->pd->obj);
143 Ecordova_FileError file_error = ECORDOVA_FILEERROR_PATH_EXISTS_ERR;
144 eo_do(data->pd->obj,
145 eo_event_callback_call(ECORDOVA_ENTRY_EVENT_ERROR, &file_error));
146 _data_free(data);
147}
148
149static void
150_eio_create_directory_cb(void *user_data,
151 Eio_File *handler EINA_UNUSED,
152 int error)
153{
154 Eio_Operation_Data *data = user_data;
155 DBG("(%p)", data->pd->obj);
156 if (ENOENT != error)
157 {
158 _error_notify(data->pd->obj, error);
159 _data_free(data);
160 return;
161 }
162
163 data->file = eio_file_mkdir(data->native,
164 0777,
165 _eio_mkdir_cb,
166 _eio_error_cb,
167 data);
168}
169
170static void
171_eio_create_file_cb(void *user_data,
172 Eio_File *handler EINA_UNUSED,
173 int error)
174{
175 Eio_Operation_Data *data = user_data;
176 DBG("(%p)", data->pd->obj);
177 if (ENOENT != error)
178 {
179 _error_notify(data->pd->obj, error);
180 _data_free(data);
181 return;
182 }
183
184 // TODO: Create the file in a background thread
185 FILE *fd = fopen(data->native, "ab+");
186 if (!fd)
187 {
188 _error_notify(data->pd->obj, errno);
189 _data_free(data);
190 return;
191 }
192 fclose(fd);
193
194 Ecordova_FileEntry *file = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
195 ecordova_fileentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem?
196 data->success_cb(data->pd->obj, file);
197 _data_free(data);
198}
199
200static void
201_eio_mkdir_cb(void *user_data, Eio_File *handler EINA_UNUSED)
202{
203 Eio_Operation_Data *data = user_data;
204 DBG("(%p)", data->pd->obj);
205 Ecordova_DirectoryEntry *directory = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
206 ecordova_directoryentry_constructor(data->name, data->path, NULL, data->native)); // TODO: filesystem?
207 data->success_cb(data->pd->obj, directory);
208 _data_free(data);
209}
210
211static void
212_directory_get(Eo *obj, void *data)
213{
214 Ecordova_DirectoryEntry *directory = data;
215 eo_do(obj,
216 eo_event_callback_call(ECORDOVA_DIRECTORYENTRY_EVENT_DIRECTORY_GET, directory));
217 eo_unref(directory);
218}
219
220static void
221_file_get(Eo *obj, void *data)
222{
223 Ecordova_FileEntry *file = data;
224 eo_do(obj, eo_event_callback_call(ECORDOVA_DIRECTORYENTRY_EVENT_FILE_GET, file));
225 eo_unref(file);
226}
227
228static void
229_ecordova_directoryentry_recursively_remove(Eo *obj,
230 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED)
231{
232 DBG("(%p)", obj);
233
234 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
235 EINA_SAFETY_ON_NULL_RETURN(super);
236
237 _entry_remove(super, _remove_notify, _error_notify, true);
238}
239
240static void
241_ecordova_directoryentry_file_get(Eo *obj,
242 Ecordova_DirectoryEntry_Data *pd EINA_UNUSED,
243 const char *path,
244 Ecordova_FileFlags flags)
245{
246 EINA_SAFETY_ON_NULL_RETURN(path);
247 DBG("(%p) path=%s", obj, path);
248
249 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
250 EINA_SAFETY_ON_NULL_RETURN(super);
251
252 Eio_Operation_Data *data = _data_new(super, _file_get, _error_notify);
253 _set_data_path_name_native(data, path);
254
255 Eio_Stat_Cb eio_stat_cb = _eio_file_get_cb;
256 Eio_Error_Cb eio_error_cb = _eio_error_cb;
257
258 if (ECORDOVA_FILEFLAGS_CREATE & flags)
259 {
260 eio_error_cb = _eio_create_file_cb;
261 if (ECORDOVA_FILEFLAGS_EXCLUSIVE & flags)
262 eio_stat_cb = _eio_fail_if_path_exists_cb;
263 }
264
265 super->pending = eina_list_append(super->pending, data);
266
267 data->file = eio_file_direct_stat(data->native,
268 eio_stat_cb,
269 eio_error_cb,
270 data);
271}
272
273static void
274_remove_notify(Eo *obj, void *data EINA_UNUSED)
275{
276 eo_do(obj,
277 eo_event_callback_call(ECORDOVA_DIRECTORYENTRY_EVENT_REMOVE_SUCCESS, NULL));
278}
279
280static bool
281_is_absolute(const char *path)
282{
283 // TODO: not multiplatform
284 return path[0] == '/';
285}
286
287static void
288_set_data_path_name_native(Eio_Operation_Data *data, const char *path)
289{
290 EINA_SAFETY_ON_NULL_RETURN(data);
291 EINA_SAFETY_ON_NULL_RETURN(path);
292 split_path(data->pd->native, path, &data->path, &data->name, &data->native);
293}
294
295void
296split_path(const char *working_dir,
297 const char *path,
298 char **dir,
299 char **name,
300 char **url)
301{
302 EINA_SAFETY_ON_NULL_RETURN(path);
303 EINA_SAFETY_ON_NULL_RETURN(dir);
304 EINA_SAFETY_ON_NULL_RETURN(name);
305 EINA_SAFETY_ON_NULL_RETURN(url);
306
307 if (!working_dir || _is_absolute(path))
308 *url = eina_file_path_sanitize(path);
309 else
310 {
311 size_t len = strlen(working_dir) + 1 + strlen(path) + 1;
312 char buffer[len];
313 snprintf(buffer, len, "%s/%s", working_dir, path); // TODO: path separator ?
314 *url = eina_file_path_sanitize(buffer);
315 }
316
317 const char *nameonly = ecore_file_file_get(*url);
318 EINA_SAFETY_ON_NULL_RETURN(nameonly);
319 *name = strdup(nameonly);
320
321 *dir = ecore_file_dir_get(*url);
322}
323
324#include "ecordova_directoryentry.eo.c"
diff --git a/src/lib/ecordova/ecordova_directoryentry_private.h b/src/lib/ecordova/ecordova_directoryentry_private.h
deleted file mode 100644
index 2a5ac5472b..0000000000
--- a/src/lib/ecordova/ecordova_directoryentry_private.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ECORDOVA_DIRECTORYENTRY_PRIVATE_H
2#define _ECORDOVA_DIRECTORYENTRY_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_DirectoryEntry_Data Ecordova_DirectoryEntry_Data;
7
8/**
9 * Ecordova.DirectoryEntry private data
10 */
11struct _Ecordova_DirectoryEntry_Data
12{
13 Eo *obj;
14};
15
16void split_path(const char *, const char *, char **, char **, char **);
17
18#endif
diff --git a/src/lib/ecordova/ecordova_directoryreader.c b/src/lib/ecordova/ecordova_directoryreader.c
deleted file mode 100644
index b92fcc9f50..0000000000
--- a/src/lib/ecordova/ecordova_directoryreader.c
+++ /dev/null
@@ -1,161 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_directoryreader_private.h"
6#include "ecordova_entry_private.h"
7
8#define MY_CLASS ECORDOVA_DIRECTORYREADER_CLASS
9#define MY_CLASS_NAME "Ecordova_DirectoryReader"
10
11typedef struct
12{
13 Ecordova_DirectoryReader_Data *pd;
14 Eio_File *file;
15 Eina_List *entries;
16} DirectoryReader_Data;
17
18static Eina_Bool _filter_cb(void *, Eio_File *, const Eina_File_Direct_Info *);
19static void _main_cb(void *, Eio_File *, const Eina_File_Direct_Info *);
20static void _done_cb(void *, Eio_File *);
21static void _error_cb(void *, Eio_File *, int);
22static void _directory_data_free(DirectoryReader_Data *);
23
24static Eo_Base *
25_ecordova_directoryreader_eo_base_constructor(Eo *obj,
26 Ecordova_DirectoryReader_Data *pd)
27{
28 DBG("(%p)", obj);
29
30 pd->obj = obj;
31 pd->native = NULL;
32 pd->pending = NULL;
33
34 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
35}
36
37static void
38_ecordova_directoryreader_constructor(Eo *obj,
39 Ecordova_DirectoryReader_Data *pd,
40 const char *native)
41{
42 DBG("(%p) url=%s", obj, native);
43 pd->native = strdup(native);
44}
45
46static void
47_ecordova_directoryreader_eo_base_destructor(Eo *obj,
48 Ecordova_DirectoryReader_Data *pd)
49{
50 DBG("(%p)", obj);
51
52 free(pd->native);
53
54 DirectoryReader_Data *data;
55 EINA_LIST_FREE(pd->pending, data)
56 {
57 eio_file_cancel(data->file);
58 _directory_data_free(data);
59 }
60
61 eo_do_super(obj, MY_CLASS, eo_destructor());
62}
63
64static void
65_ecordova_directoryreader_entries_read(Eo *obj,
66 Ecordova_DirectoryReader_Data *pd)
67{
68 DBG("(%p)", obj);
69
70 DirectoryReader_Data *data = calloc(1, sizeof(DirectoryReader_Data));
71 data->pd = pd;
72 data->file = eio_file_stat_ls(pd->native,
73 _filter_cb,
74 _main_cb,
75 _done_cb,
76 _error_cb,
77 data);
78
79 pd->pending = eina_list_append(pd->pending, data);
80}
81
82static Eina_Bool
83_filter_cb(void *data EINA_UNUSED,
84 Eio_File *handler EINA_UNUSED,
85 const Eina_File_Direct_Info *info EINA_UNUSED)
86{
87 return EINA_TRUE;
88}
89
90static void
91_main_cb(void *user_data,
92 Eio_File *handler EINA_UNUSED,
93 const Eina_File_Direct_Info *info)
94{
95 DirectoryReader_Data *data = user_data;
96 Ecordova_Entry *entry = NULL;
97
98 size_t len = info->path_length - info->name_length - 1;
99 char path[len + 1];
100 strncpy(path, info->path, len);
101 path[len] = '\0';
102
103 const char *name = &info->path[info->name_start];
104
105 switch (info->type)
106 {
107 case EINA_FILE_DIR:
108 {
109 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS, NULL,
110 ecordova_directoryentry_constructor(name, path, NULL, info->path)); // TODO: filesystem?
111 break;
112 }
113 case EINA_FILE_REG:
114 {
115 entry = eo_add(ECORDOVA_FILEENTRY_CLASS, NULL,
116 ecordova_fileentry_constructor(name, path, NULL, info->path)); // TODO: filesystem?
117 break;
118 }
119 // TODO: case EINA_FILE_LNK ?
120 default: break;
121 }
122
123 if (entry)
124 data->entries = eina_list_append(data->entries, entry);
125}
126
127static void
128_done_cb(void *user_data, Eio_File *handler EINA_UNUSED)
129{
130 DirectoryReader_Data *data = user_data;
131 data->pd->pending = eina_list_remove(data->pd->pending, data);
132
133 eo_do(data->pd->obj,
134 eo_event_callback_call(ECORDOVA_DIRECTORYREADER_EVENT_SUCCESS,
135 data->entries));
136 _directory_data_free(data);
137}
138
139static void
140_error_cb(void *user_data, Eio_File *handler EINA_UNUSED, int error)
141{
142 DirectoryReader_Data *data = user_data;
143 data->pd->pending = eina_list_remove(data->pd->pending, data);
144
145 Ecordova_FileError file_error = _translate_errno(error);
146 eo_do(data->pd->obj,
147 eo_event_callback_call(ECORDOVA_DIRECTORYREADER_EVENT_ERROR,
148 &file_error));
149 _directory_data_free(data);
150}
151
152static void
153_directory_data_free(DirectoryReader_Data *data)
154{
155 Ecordova_Entry *entry;
156 EINA_LIST_FREE(data->entries, entry)
157 eo_unref(entry);
158 free(data);
159}
160
161#include "ecordova_directoryreader.eo.c"
diff --git a/src/lib/ecordova/ecordova_directoryreader_private.h b/src/lib/ecordova/ecordova_directoryreader_private.h
deleted file mode 100644
index b12467cbf5..0000000000
--- a/src/lib/ecordova/ecordova_directoryreader_private.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ECORDOVA_DIRECTORYREADER_PRIVATE_H
2#define _ECORDOVA_DIRECTORYREADER_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_DirectoryReader_Data Ecordova_DirectoryReader_Data;
7
8/**
9 * Ecordova.DirectoryReader private data
10 */
11struct _Ecordova_DirectoryReader_Data
12{
13 Eo *obj;
14 char *native;
15 Eina_List *pending;
16};
17
18#endif
diff --git a/src/lib/ecordova/ecordova_entry.c b/src/lib/ecordova/ecordova_entry.c
deleted file mode 100644
index ed5acb9f50..0000000000
--- a/src/lib/ecordova/ecordova_entry.c
+++ /dev/null
@@ -1,506 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_entry_private.h"
6#include "ecordova_directoryentry_private.h"
7
8#define MY_CLASS ECORDOVA_ENTRY_CLASS
9#define MY_CLASS_NAME "Ecordova_Entry"
10
11static void _eio_stat_cb(void *, Eio_File *, const Eina_Stat *);
12static void _eio_moved_cb(void *, Eio_File *);
13static void _eio_copied_cb(void *, Eio_File *);
14static void _metadata_notify(Eo *, void *);
15static void _move_notify(Eo *, void *);
16static void _copy_notify(Eo *, void *);
17static void _remove_notify(Eo *, void *);
18static Eina_Bool _eio_remove_non_recursively_filter_cb(void *, Eio_File *, const Eina_File_Direct_Info *);
19static void _parent_get_cb(void *, Eio_File *, const Eina_Stat *);
20static void _parent_get_notify(Eo *, void *);
21
22static Eo_Base *
23_ecordova_entry_eo_base_constructor(Eo *obj, Ecordova_Entry_Data *pd)
24{
25 DBG("(%p)", obj);
26
27 pd->obj = obj;
28 pd->name = NULL;
29 pd->path = NULL;
30 pd->file_system = NULL;
31 pd->native = NULL;
32 pd->pending = NULL;
33
34 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
35}
36
37static void
38_ecordova_entry_constructor(Eo *obj,
39 Ecordova_Entry_Data *pd,
40 Eina_Bool file_is,
41 Eina_Bool directory_is,
42 const char *name,
43 const char *path,
44 Ecordova_FileSystem *file_system,
45 const char *url)
46{
47 EINA_SAFETY_ON_NULL_RETURN(name);
48 EINA_SAFETY_ON_NULL_RETURN(path);
49 //EINA_SAFETY_ON_NULL_RETURN(file_system);
50 EINA_SAFETY_ON_NULL_RETURN(url);
51 DBG("(%p) name=%s, path=%s, url=%s", obj, name, path, url);
52
53 pd->is_file = file_is;
54 pd->is_directory = directory_is;
55 pd->name = strdup(name);
56 pd->path = strdup(path);
57 pd->file_system = eo_ref(file_system);
58 pd->native = strdup(url);
59}
60
61static void
62_ecordova_entry_eo_base_destructor(Eo *obj, Ecordova_Entry_Data *pd)
63{
64 DBG("(%p)", obj);
65
66 free(pd->name);
67 free(pd->path);
68 eo_unref(pd->file_system);
69 free(pd->native);
70
71 Eio_Operation_Data *data;
72 EINA_LIST_FREE(pd->pending, data)
73 {
74 eio_file_cancel(data->file);
75 _data_free(data);
76 }
77
78 eo_do_super(obj, MY_CLASS, eo_destructor());
79}
80
81static void
82_ecordova_entry_metadata_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
83{
84 DBG("(%p)", obj);
85 _metadata_get(pd, _metadata_notify, _error_notify);
86}
87
88static void
89_ecordova_entry_metadata_set(Eo *obj EINA_UNUSED,
90 Ecordova_Entry_Data *pd EINA_UNUSED,
91 Ecordova_Metadata *metadata EINA_UNUSED)
92{
93 ERR("Not implemented.");
94}
95
96static void
97_ecordova_entry_move(Eo *obj EINA_UNUSED,
98 Ecordova_Entry_Data *pd,
99 Ecordova_DirectoryEntry *parent,
100 const char *new_name)
101{
102 DBG("(%p)", obj);
103 EINA_SAFETY_ON_NULL_RETURN(parent);
104 if (!new_name) new_name = pd->name;
105
106 Eio_Operation_Data *data = _data_new(pd, _move_notify, _error_notify);
107
108 Ecordova_Entry_Data *dest_dir = eo_data_scope_get(parent, ECORDOVA_ENTRY_CLASS);
109
110 data->name = strdup(new_name);
111 data->path = strdup(dest_dir->native);
112
113 // TODO: file_system?
114
115 size_t len = strlen(data->path) + 1 + strlen(data->name) + 1;
116 data->native = malloc(len);
117 EINA_SAFETY_ON_NULL_GOTO(data->native, on_error);
118 snprintf(data->native, len, "%s/%s", data->path, new_name);
119
120 if (pd->is_file)
121 {
122 DBG("Moving file from %s to %s", pd->native, data->native);
123 data->file = eio_file_move(pd->native,
124 data->native,
125 _eio_progress_cb,
126 _eio_moved_cb,
127 _eio_error_cb,
128 data);
129 }
130 else
131 {
132 DBG("Moving directory from %s to %s", pd->native, data->native);
133 data->file = eio_dir_move(pd->native,
134 data->native,
135 _eio_filter_cb,
136 _eio_progress_cb,
137 _eio_moved_cb,
138 _eio_error_cb,
139 data);
140 }
141
142 pd->pending = eina_list_append(pd->pending, data);
143 return;
144
145on_error:
146 _data_free(data);
147}
148
149static void
150_ecordova_entry_copy(Eo *obj EINA_UNUSED,
151 Ecordova_Entry_Data *pd,
152 Ecordova_DirectoryEntry *parent,
153 const char *new_name)
154{
155 DBG("(%p)", obj);
156 EINA_SAFETY_ON_NULL_RETURN(parent);
157 if (!new_name) new_name = pd->name;
158
159 Eio_Operation_Data *data = _data_new(pd, _copy_notify, _error_notify);
160
161 Ecordova_Entry_Data *dest_dir = eo_data_scope_get(parent, ECORDOVA_ENTRY_CLASS);
162
163 data->name = strdup(new_name);
164 data->path = strdup(dest_dir->native);
165
166 // TODO: file_system?
167
168 size_t len = strlen(data->path) + 1 + strlen(data->name) + 1;
169 data->native = malloc(len);
170 EINA_SAFETY_ON_NULL_GOTO(data->native, on_error);
171 snprintf(data->native, len, "%s/%s", data->path, new_name);
172
173 if (pd->is_file)
174 data->file = eio_file_copy(pd->native,
175 data->native,
176 _eio_progress_cb,
177 _eio_copied_cb,
178 _eio_error_cb,
179 data);
180 else
181 data->file = eio_dir_copy(pd->native,
182 data->native,
183 _eio_filter_cb,
184 _eio_progress_cb,
185 _eio_copied_cb,
186 _eio_error_cb,
187 data);
188
189 pd->pending = eina_list_append(pd->pending, data);
190 return;
191
192on_error:
193 _data_free(data);
194}
195
196static void
197_ecordova_entry_remove(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
198{
199 DBG("(%p)", obj);
200 _entry_remove(pd, _remove_notify, _error_notify, false);
201}
202
203void
204_entry_remove(Ecordova_Entry_Data *pd,
205 Ecordova_Entry_Success_Callback success_cb,
206 Ecordova_Entry_Error_Callback error_cb,
207 bool recursively)
208{
209 DBG("(%p)", pd->obj);
210
211 Eio_Operation_Data *data = _data_new(pd, success_cb, error_cb);
212
213 // TODO: file_system?
214
215 if (pd->is_file)
216 data->file = eio_file_unlink(pd->native,
217 _eio_removed_cb,
218 _eio_error_cb,
219 data);
220 else
221 {
222 Eio_Filter_Direct_Cb filter_cb =
223 recursively ? _eio_filter_cb
224 : _eio_remove_non_recursively_filter_cb;
225
226 data->file = eio_dir_unlink(pd->native,
227 filter_cb,
228 _eio_progress_cb,
229 _eio_removed_cb,
230 _eio_error_cb,
231 data);
232 }
233
234 pd->pending = eina_list_append(pd->pending, data);
235}
236
237static void
238_ecordova_entry_parent_get(Eo *obj, Ecordova_Entry_Data *pd)
239{
240 DBG("(%p)", obj);
241
242 Eio_Operation_Data *data = _data_new(pd, _parent_get_notify, _error_notify);
243
244 data->file = eio_file_direct_stat(pd->native,
245 _parent_get_cb,
246 _eio_error_cb,
247 data);
248
249 pd->pending = eina_list_append(pd->pending, data);
250 }
251
252static void
253_parent_get_cb(void *user_data,
254 Eio_File *handler EINA_UNUSED,
255 const Eina_Stat *stat EINA_UNUSED)
256{
257 Eio_Operation_Data *data = user_data;
258 data->success_cb(data->pd->obj, data->pd);
259 _data_free(data);
260}
261
262static void
263_parent_get_notify(Eo *obj, void *data)
264{
265 Ecordova_Entry_Data *pd = data;
266
267 char *name, *path, *url;
268 split_path(NULL, pd->path, &path, &name, &url);
269
270 Ecordova_DirectoryEntry *parent =
271 eo_add(ECORDOVA_DIRECTORYENTRY_CLASS,
272 NULL,
273 ecordova_directoryentry_constructor(name,
274 path,
275 NULL, // TODO: filesystem ?
276 url));
277 free(name);
278 free(path);
279 free(url);
280
281 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_PARENT_GET, parent));
282 eo_unref(parent);
283}
284
285static Eina_Bool
286_ecordova_entry_file_is_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
287{
288 return pd->is_file;
289}
290
291static Eina_Bool
292_ecordova_entry_directory_is_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
293{
294 return pd->is_directory;
295}
296
297static const char *
298_ecordova_entry_name_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
299{
300 return pd->name;
301}
302
303static const char *
304_ecordova_entry_path_get(Eo *obj EINA_UNUSED, Ecordova_Entry_Data *pd)
305{
306 return pd->path;
307}
308
309void
310_metadata_get(Ecordova_Entry_Data *pd,
311 Ecordova_Entry_Success_Callback success_cb,
312 Ecordova_Entry_Error_Callback error_cb)
313{
314 DBG("(%p)", pd->obj);
315
316 Eio_Operation_Data *data = _data_new(pd, success_cb, error_cb);
317
318 data->file = eio_file_direct_stat(pd->native,
319 _eio_stat_cb,
320 _eio_error_cb,
321 data);
322
323 pd->pending = eina_list_append(pd->pending, data);
324}
325
326static void
327_eio_stat_cb(void *user_data,
328 Eio_File *handler EINA_UNUSED,
329 const Eina_Stat *stat)
330{
331 Eio_Operation_Data *data = user_data;
332 Ecordova_Metadata metadata = {
333 .modification_date = (time_t)stat->mtime,
334 .size = stat->size
335 };
336
337 data->success_cb(data->pd->obj, &metadata);
338 _data_free(data);
339}
340
341static void
342_metadata_notify(Eo *obj, void *data)
343{
344 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_METADATA_GET, data));
345}
346
347void
348_eio_error_cb(void *user_data,
349 Eio_File *handler EINA_UNUSED,
350 int error)
351{
352 Eio_Operation_Data *data = user_data;
353 DBG("(%p)", data->pd->obj);
354 data->error_cb(data->pd->obj, error);
355 _data_free(data);
356}
357
358void
359_eio_progress_cb(void *data EINA_UNUSED,
360 Eio_File *handler EINA_UNUSED,
361 const Eio_Progress *info EINA_UNUSED)
362{
363}
364
365static void
366_eio_moved_cb(void *user_data, Eio_File *handler EINA_UNUSED)
367{
368 Eio_Operation_Data *data = user_data;
369 free(data->pd->path);
370 free(data->pd->name);
371 free(data->pd->native);
372 data->pd->path = data->path;
373 data->pd->name = data->name;
374 data->pd->native = data->native;
375 data->path = NULL;
376 data->name = NULL;
377 data->native = NULL;
378
379 data->success_cb(data->pd->obj, data->pd->obj);
380 _data_free(data);
381}
382
383static void
384_move_notify(Eo *obj, void *data)
385{
386 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_MOVE_SUCCESS, data));
387}
388
389static void
390_eio_copied_cb(void *user_data, Eio_File *handler EINA_UNUSED)
391{
392 Eio_Operation_Data *data = user_data;
393 Ecordova_Entry *entry = NULL;
394 if (data->pd->is_file)
395 entry = eo_add(ECORDOVA_FILEENTRY_CLASS,
396 NULL,
397 ecordova_fileentry_constructor(data->name,
398 data->path,
399 data->pd->file_system,
400 data->native));
401 else
402 entry = eo_add(ECORDOVA_DIRECTORYENTRY_CLASS,
403 NULL,
404 ecordova_directoryentry_constructor(data->name,
405 data->path,
406 data->pd->file_system,
407 data->native));
408
409 data->success_cb(data->pd->obj, entry);
410
411 eo_unref(entry);
412 _data_free(data);
413}
414
415static void
416_copy_notify(Eo *obj, void *data)
417{
418 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_COPY_SUCCESS, data));
419}
420
421void
422_eio_removed_cb(void *user_data, Eio_File *handler EINA_UNUSED)
423{
424 Eio_Operation_Data *data = user_data;
425 data->success_cb(data->pd->obj, NULL);
426 _data_free(data);
427}
428
429static void
430_remove_notify(Eo *obj, void *data)
431{
432 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_REMOVE_SUCCESS, data));
433}
434
435Eina_Bool
436_eio_filter_cb(void *data EINA_UNUSED,
437 Eio_File *handler EINA_UNUSED,
438 const Eina_File_Direct_Info *info EINA_UNUSED)
439{
440 return EINA_TRUE;
441}
442
443static Eina_Bool
444_eio_remove_non_recursively_filter_cb(void *user_data,
445 Eio_File *handler EINA_UNUSED,
446 const Eina_File_Direct_Info *info EINA_UNUSED)
447{
448 Eio_Operation_Data *data = user_data;
449 DBG("filter_cb: %s", info->path);
450 if (++data->count != 1)
451 {
452 eio_file_cancel(handler);
453 return EINA_FALSE;
454 }
455
456 return EINA_TRUE;
457}
458
459Eio_Operation_Data *
460_data_new(Ecordova_Entry_Data *pd,
461 Ecordova_Entry_Success_Callback success_cb,
462 Ecordova_Entry_Error_Callback error_cb)
463{
464 Eio_Operation_Data *data = calloc(1, sizeof(Eio_Operation_Data));
465 data->pd = pd;
466 data->success_cb = success_cb;
467 data->error_cb = error_cb;
468 return data;
469}
470
471void
472_data_free(Eio_Operation_Data *data)
473{
474 EINA_SAFETY_ON_NULL_RETURN(data);
475
476 data->pd->pending = eina_list_remove(data->pd->pending, data);
477 free(data->path);
478 free(data->name);
479 free(data->native);
480 free(data);
481}
482
483void
484_error_notify(Eo *obj, int error)
485{
486 Ecordova_FileError file_error = _translate_errno(error);
487 eo_do(obj, eo_event_callback_call(ECORDOVA_ENTRY_EVENT_ERROR, &file_error));
488}
489
490Ecordova_FileError
491_translate_errno(int error)
492{
493 // TODO: translate other errors
494 switch (error)
495 {
496 case EPERM:
497 case EACCES:
498 return ECORDOVA_FILEERROR_SECURITY_ERR;
499 case ENOENT:
500 return ECORDOVA_FILEERROR_NOT_FOUND_ERR;
501 }
502
503 return -1;
504}
505
506#include "ecordova_entry.eo.c"
diff --git a/src/lib/ecordova/ecordova_entry_private.h b/src/lib/ecordova/ecordova_entry_private.h
deleted file mode 100644
index 5bcf00aac4..0000000000
--- a/src/lib/ecordova/ecordova_entry_private.h
+++ /dev/null
@@ -1,53 +0,0 @@
1#ifndef _ECORDOVA_ENTRY_PRIVATE_H
2#define _ECORDOVA_ENTRY_PRIVATE_H
3
4#include "ecordova_private.h"
5
6#include <Eio.h>
7
8#include <stdbool.h>
9
10typedef struct _Ecordova_Entry_Data Ecordova_Entry_Data;
11
12/**
13 * Ecordova.Entry private data
14 */
15struct _Ecordova_Entry_Data
16{
17 Eo *obj;
18 Eina_Bool is_file;
19 Eina_Bool is_directory;
20 char *name;
21 char *path;
22 Ecordova_FileSystem *file_system;
23 char *native;
24 Eina_List *pending;
25};
26
27typedef void(*Ecordova_Entry_Success_Callback)(Eo *, void *);
28typedef void(*Ecordova_Entry_Error_Callback)(Eo *, int);
29
30typedef struct
31{
32 Ecordova_Entry_Data *pd;
33 Eio_File *file;
34 char *path;
35 char *name;
36 char *native;
37 Ecordova_Entry_Success_Callback success_cb;
38 Ecordova_Entry_Error_Callback error_cb;
39 unsigned long count;
40} Eio_Operation_Data;
41
42Eio_Operation_Data *_data_new(Ecordova_Entry_Data *, Ecordova_Entry_Success_Callback, Ecordova_Entry_Error_Callback);
43void _data_free(Eio_Operation_Data *);
44void _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);
46void _error_notify(Eo *, int);
47void _eio_error_cb(void *, Eio_File *, int);
48void _eio_removed_cb(void *, Eio_File *);
49Eina_Bool _eio_filter_cb(void *, Eio_File *, const Eina_File_Direct_Info *);
50void _eio_progress_cb(void *, Eio_File *, const Eio_Progress *);
51Ecordova_FileError _translate_errno(int);
52
53#endif
diff --git a/src/lib/ecordova/ecordova_file.c b/src/lib/ecordova/ecordova_file.c
deleted file mode 100644
index 69f5a61eb2..0000000000
--- a/src/lib/ecordova/ecordova_file.c
+++ /dev/null
@@ -1,128 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_file_private.h"
6
7#define MY_CLASS ECORDOVA_FILE_CLASS
8#define MY_CLASS_NAME "Ecordova_File"
9
10static Eo_Base *
11_ecordova_file_eo_base_constructor(Eo *obj, Ecordova_File_Data *pd)
12{
13 DBG("(%p)", obj);
14
15 pd->obj = obj;
16
17 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
18}
19
20static void
21_ecordova_file_constructor(Eo *obj,
22 Ecordova_File_Data *pd,
23 const char *name,
24 const char *url,
25 const char *type,
26 time_t last_modified_date,
27 long size)
28{
29 DBG("(%p)", obj);
30 pd->name = name ? strdup(name) : strdup("");
31 pd->url = url ? strdup(url) : NULL;
32 pd->type = type ? strdup(type) : NULL;
33 pd->modified_date = last_modified_date;
34 pd->size = size;
35
36 pd->start = 0;
37 pd->end = pd->size;
38}
39
40static void
41_ecordova_file_eo_base_destructor(Eo *obj, Ecordova_File_Data *pd)
42{
43 DBG("(%p)", obj);
44
45 free(pd->name);
46 free(pd->url);
47 free(pd->type);
48
49 eo_do_super(obj, MY_CLASS, eo_destructor());
50}
51
52static Ecordova_File *
53_ecordova_file_slice(Eo *obj EINA_UNUSED,
54 Ecordova_File_Data *pd,
55 long start,
56 long end)
57{
58 DBG("(%p) start=%ld end=%ld", obj, start, end);
59 long size = pd->end - pd->start;
60 long new_start = 0;
61 long new_end = size;
62
63 if (start < 0)
64 new_start = MAX(size + start, 0);
65 else
66 new_start = MIN(size, start);
67
68 if (end < 0)
69 new_end = MAX(size + end, 0);
70 else
71 new_end = MIN(end, size);
72
73 if (new_start > new_end)
74 {
75 long aux = new_start;
76 new_start = new_end;
77 new_end = aux;
78 }
79
80 Ecordova_File *new_file = eo_add(MY_CLASS, NULL,
81 ecordova_file_constructor(pd->name,
82 pd->url,
83 pd->type,
84 pd->modified_date,
85 pd->size));
86 EINA_SAFETY_ON_NULL_RETURN_VAL(new_file, NULL);
87
88 Ecordova_File_Data *new_file_pd = eo_data_scope_get(new_file, MY_CLASS);
89 EINA_SAFETY_ON_NULL_GOTO(new_file_pd, on_error);
90
91 new_file_pd->start = pd->start + new_start;
92 new_file_pd->end = pd->start + new_end;
93 return new_file;
94
95on_error:
96 eo_unref(new_file);
97 return NULL;
98}
99
100static const char *
101_ecordova_file_name_get(Eo *obj EINA_UNUSED, Ecordova_File_Data *pd)
102{
103 DBG("(%p)", obj);
104 return pd->name;
105}
106
107static const char *
108_ecordova_file_url_get(Eo *obj EINA_UNUSED, Ecordova_File_Data *pd)
109{
110 DBG("(%p)", obj);
111 return pd->url;
112}
113
114static long
115_ecordova_file_start_get(Eo *obj EINA_UNUSED, Ecordova_File_Data *pd)
116{
117 DBG("(%p)", obj);
118 return pd->start;
119}
120
121static long
122_ecordova_file_end_get(Eo *obj EINA_UNUSED, Ecordova_File_Data *pd)
123{
124 DBG("(%p)", obj);
125 return pd->end;
126}
127
128#include "ecordova_file.eo.c"
diff --git a/src/lib/ecordova/ecordova_file_private.h b/src/lib/ecordova/ecordova_file_private.h
deleted file mode 100644
index 9e17c1805b..0000000000
--- a/src/lib/ecordova/ecordova_file_private.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _ECORDOVA_FILE_PRIVATE_H
2#define _ECORDOVA_FILE_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_File_Data Ecordova_File_Data;
7
8/**
9 * Ecordova.File private data
10 */
11struct _Ecordova_File_Data
12{
13 Eo *obj;
14 char *name;
15 char *url;
16 char *type;
17 time_t modified_date;
18 long size;
19 long start;
20 long end;
21};
22
23#endif
diff --git a/src/lib/ecordova/ecordova_fileentry.c b/src/lib/ecordova/ecordova_fileentry.c
deleted file mode 100644
index 337be04c7d..0000000000
--- a/src/lib/ecordova/ecordova_fileentry.c
+++ /dev/null
@@ -1,109 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_fileentry_private.h"
6#include "ecordova_entry_private.h"
7
8#define MY_CLASS ECORDOVA_FILEENTRY_CLASS
9#define MY_CLASS_NAME "Ecordova_FileEntry"
10
11static void _file_notify(Eo *, void *);
12static void _writer_create(Eo *, void *);
13
14static Eo_Base *
15_ecordova_fileentry_eo_base_constructor(Eo *obj, Ecordova_FileEntry_Data *pd)
16{
17 DBG("(%p)", obj);
18
19 pd->obj = obj;
20
21 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
22}
23
24static void
25_ecordova_fileentry_constructor(Eo *obj,
26 Ecordova_FileEntry_Data *pd EINA_UNUSED,
27 const char *name,
28 const char *path,
29 Ecordova_FileSystem *file_system,
30 const char *url)
31{
32 DBG("(%p)", obj);
33 eo_do_super(obj, MY_CLASS, ecordova_entry_constructor(EINA_TRUE,
34 EINA_FALSE,
35 name,
36 path,
37 file_system,
38 url));
39}
40
41static void
42_ecordova_fileentry_eo_base_destructor(Eo *obj,
43 Ecordova_FileEntry_Data *pd EINA_UNUSED)
44{
45 DBG("(%p)", obj);
46
47 eo_do_super(obj, MY_CLASS, eo_destructor());
48}
49
50static void
51_ecordova_fileentry_writer_create(Eo *obj,
52 Ecordova_FileEntry_Data *pd EINA_UNUSED)
53{
54 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
55 EINA_SAFETY_ON_NULL_RETURN(super);
56
57 _metadata_get(super, _writer_create, _error_notify);
58}
59
60static void
61_ecordova_fileentry_file(Eo *obj, Ecordova_FileEntry_Data *pd EINA_UNUSED)
62{
63 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
64 EINA_SAFETY_ON_NULL_RETURN(super);
65
66 _metadata_get(super, _file_notify, _error_notify);
67}
68
69static Ecordova_File *
70_create_file(Eo *obj, const Ecordova_Metadata *metadata)
71{
72 Ecordova_Entry_Data *super = eo_data_scope_get(obj, ECORDOVA_ENTRY_CLASS);
73 EINA_SAFETY_ON_NULL_RETURN_VAL(super, NULL);
74
75 return eo_add(ECORDOVA_FILE_CLASS, NULL,
76 ecordova_file_constructor(super->name,
77 super->native,
78 NULL, //< TODO: mime-type?
79 metadata->modification_date,
80 metadata->size));
81}
82
83static void
84_file_notify(Eo *obj, void *data)
85{
86 const Ecordova_Metadata *metadata = data;
87
88 Ecordova_File *file = _create_file(obj, metadata);
89
90 eo_do(obj, eo_event_callback_call(ECORDOVA_FILEENTRY_EVENT_FILE, file));
91 eo_unref(file);
92}
93
94static void
95_writer_create(Eo *obj, void *data)
96{
97 const Ecordova_Metadata *metadata = data;
98 Ecordova_File *file = _create_file(obj, metadata);
99 Ecordova_FileWriter *writer = eo_add(ECORDOVA_FILEWRITER_CLASS, NULL,
100 ecordova_filewriter_constructor(file));
101
102 eo_do(obj,
103 eo_event_callback_call(ECORDOVA_FILEENTRY_EVENT_CREATE_WRITER, writer));
104
105 eo_unref(writer);
106 eo_unref(file);
107}
108
109#include "ecordova_fileentry.eo.c"
diff --git a/src/lib/ecordova/ecordova_fileentry_private.h b/src/lib/ecordova/ecordova_fileentry_private.h
deleted file mode 100644
index 832aeb881c..0000000000
--- a/src/lib/ecordova/ecordova_fileentry_private.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ECORDOVA_FILEENTRY_PRIVATE_H
2#define _ECORDOVA_FILEENTRY_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_FileEntry_Data Ecordova_FileEntry_Data;
7
8/**
9 * Ecordova.FileEntry private data
10 */
11struct _Ecordova_FileEntry_Data
12{
13 Eo *obj;
14};
15
16#endif
diff --git a/src/lib/ecordova/ecordova_filereader.c b/src/lib/ecordova/ecordova_filereader.c
deleted file mode 100644
index e90bde02d5..0000000000
--- a/src/lib/ecordova/ecordova_filereader.c
+++ /dev/null
@@ -1,272 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_filereader_private.h"
6#include "ecordova_entry_private.h"
7
8#include <Eio.h>
9
10#define MY_CLASS ECORDOVA_FILEREADER_CLASS
11#define MY_CLASS_NAME "Ecordova_FileReader"
12
13static void _read_cb(void *, Ecore_Thread *);
14static void _progress_notify(size_t, size_t, Eo *, Ecore_Thread *);
15static void _read_progress_cb(void *, Ecore_Thread *, void *);
16static void _read_end_cb(void *, Ecore_Thread *);
17static void _read_abort_cb(void *, Ecore_Thread *);
18
19static Eo_Base *
20_ecordova_filereader_eo_base_constructor(Eo *obj, Ecordova_FileReader_Data *pd)
21{
22 DBG("(%p)", obj);
23
24 pd->obj = obj;
25 pd->error = 0;
26 pd->state = ECORDOVA_FILEREADER_STATE_EMPTY;
27 pd->result = NULL;
28 pd->result_length = 0;
29 pd->thread = NULL;
30 pd->url = NULL;
31 pd->offset = 0;
32 pd->length = 0;
33
34 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
35}
36
37static void
38_ecordova_filereader_constructor(Eo *obj EINA_UNUSED,
39 Ecordova_FileReader_Data *pd EINA_UNUSED)
40{
41 DBG("(%p)", obj);
42}
43
44static void
45_ecordova_filereader_eo_base_destructor(Eo *obj, Ecordova_FileReader_Data *pd)
46{
47 DBG("(%p)", obj);
48
49 if (pd->thread) ERR("%s", "Destructing without aborting first");
50
51 free(pd->result);
52 free(pd->url);
53
54 eo_do_super(obj, MY_CLASS, eo_destructor());
55}
56
57static void
58_ecordova_filereader_abort(Eo *obj, Ecordova_FileReader_Data *pd)
59{
60 DBG("(%p)", obj);
61
62 if (ECORDOVA_FILEREADER_STATE_DONE == pd->state ||
63 ECORDOVA_FILEREADER_STATE_EMPTY == pd->state)
64 return;
65 pd->error = ECORDOVA_FILEERROR_ABORT_ERR;
66 pd->state = ECORDOVA_FILEREADER_STATE_DONE;
67
68 if (pd->thread)
69 ecore_thread_cancel(pd->thread);
70}
71
72static Ecordova_FileError
73_ecordova_filereader_read(Eo *obj,
74 Ecordova_FileReader_Data *pd,
75 Ecordova_File *file)
76{
77 DBG("(%p)", obj);
78 EINA_SAFETY_ON_NULL_RETURN_VAL(file, ECORDOVA_FILEERROR_SYNTAX_ERR);
79
80 if (ECORDOVA_FILEREADER_STATE_LOADING == pd->state)
81 return ECORDOVA_FILEERROR_INVALID_STATE_ERR;
82 pd->state = ECORDOVA_FILEREADER_STATE_LOADING;
83 pd->error = 0;
84
85 const char *url;
86 eo_do(file,
87 url = ecordova_file_url_get(),
88 pd->offset = ecordova_file_start_get(),
89 pd->length = ecordova_file_end_get() - pd->offset);
90 EINA_SAFETY_ON_NULL_RETURN_VAL(url, ECORDOVA_FILEERROR_SYNTAX_ERR);
91 pd->url = strdup(url);
92
93 Ecordova_ProgressEvent loadstart = {.type = "loadstart", .target = obj};
94 eo_do(obj, eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_LOAD_START, &loadstart));
95
96 pd->thread = ecore_thread_feedback_run(_read_cb,
97 _read_progress_cb,
98 _read_end_cb,
99 _read_abort_cb,
100 pd,
101 EINA_FALSE);
102 return 0;
103}
104
105static Ecordova_FileError
106_ecordova_filereader_error_get(Eo *obj, Ecordova_FileReader_Data *pd)
107{
108 DBG("(%p)", obj);
109 return pd->error;
110}
111
112static const char *
113_ecordova_filereader_result_get(Eo *obj, Ecordova_FileReader_Data *pd)
114{
115 DBG("(%p)", obj);
116 return pd->result;
117}
118
119static size_t
120_ecordova_filereader_length_get(Eo *obj, Ecordova_FileReader_Data *pd)
121{
122 DBG("(%p)", obj);
123 return pd->result_length;
124}
125
126static Ecordova_FileReader_State
127_ecordova_filereader_state_get(Eo *obj, Ecordova_FileReader_Data *pd)
128{
129 DBG("(%p)", obj);
130 return pd->state;
131}
132
133static void
134_read_cb(void *data, Ecore_Thread *thread)
135{
136 Ecordova_FileReader_Data *pd = data;
137 DBG("(%p)", pd->obj);
138
139 if (ecore_thread_check(thread))
140 return;
141
142 FILE *stream = fopen(pd->url, "rb");
143 if (!stream)
144 {
145 pd->error = _translate_errno(errno);
146 return;
147 }
148
149 if (pd->offset > 0)
150 {
151 int error = fseek(stream, pd->offset, SEEK_SET);
152 if (error)
153 {
154 pd->error = _translate_errno(errno);
155 goto on_error;
156 }
157 }
158
159 _progress_notify(0, pd->length, pd->obj, thread);
160 if (ecore_thread_check(thread))
161 goto on_error;
162
163 pd->result = pd->result ? realloc(pd->result, pd->length * sizeof(char))
164 : malloc(pd->length * sizeof(char));
165 if (NULL == pd->result)
166 {
167 pd->error = _translate_errno(errno);
168 goto on_error;
169 }
170
171 pd->result_length = 0;
172 size_t total = pd->length;
173 char *buffer = pd->result;
174 do
175 {
176 size_t read = fread(buffer, sizeof(char), total, stream);
177 if (!read)
178 {
179 pd->error = _translate_errno(errno);
180 goto on_error;
181 }
182
183 buffer += read;
184 total -= read;
185 pd->result_length += read;
186
187 _progress_notify(pd->length - total, pd->length, pd->obj, thread);
188 if (ecore_thread_check(thread))
189 goto on_error;
190 }
191 while (total > 0);
192
193on_error:
194 fclose(stream);
195}
196
197static void
198_progress_notify(size_t read, size_t total, Eo *obj, Ecore_Thread *thread)
199{
200 DBG("(%p)", obj);
201 Ecordova_ProgressEvent *progress = malloc(sizeof(Ecordova_ProgressEvent));
202 *progress = (Ecordova_ProgressEvent)
203 {
204 .type = "progress",
205 .length_computable = EINA_TRUE,
206 .loaded = read,
207 .total = total,
208 .target = obj
209 };
210 if (!ecore_thread_feedback(thread, progress))
211 free(progress);
212}
213
214static void
215_read_progress_cb(void *data,
216 Ecore_Thread *thread EINA_UNUSED,
217 void *msg_data)
218{
219 Ecordova_FileReader_Data *pd = data;
220 DBG("(%p)", pd->obj);
221 Ecordova_ProgressEvent *event = msg_data;
222 eo_do(pd->obj,
223 eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_PROGRESS, &event));
224 free(event);
225}
226
227static void
228_read_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
229{
230 Ecordova_FileReader_Data *pd = data;
231 DBG("(%p)", pd->obj);
232
233 // If DONE (cancelled), then don't do anything
234 if (ECORDOVA_FILEREADER_STATE_DONE == pd->state)
235 return;
236 pd->thread = NULL;
237 pd->state = ECORDOVA_FILEREADER_STATE_DONE;
238
239 if (pd->error)
240 {
241 Ecordova_ProgressEvent error = {.type = "error", .target = pd->obj};
242 eo_do(pd->obj,
243 eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_ERROR, &error));
244 }
245 else
246 {
247 Ecordova_ProgressEvent load = {.type = "load", .target = pd->obj};
248 eo_do(pd->obj,
249 eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_LOAD, &load));
250 }
251
252 Ecordova_ProgressEvent loadend = {.type = "loadend", .target = pd->obj};
253 eo_do(pd->obj,
254 eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_LOAD_END, &loadend));
255}
256
257static void
258_read_abort_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
259{
260 Ecordova_FileReader_Data *pd = data;
261 DBG("(%p)", pd->obj);
262
263 pd->thread = NULL;
264
265 Ecordova_ProgressEvent on_abort = {.type = "abort", .target = pd->obj};
266 eo_do(pd->obj, eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_ABORT, &on_abort));
267
268 Ecordova_ProgressEvent loadend = {.type = "loadend", .target = pd->obj};
269 eo_do(pd->obj, eo_event_callback_call(ECORDOVA_FILEREADER_EVENT_ON_LOAD_END, &loadend));
270}
271
272#include "ecordova_filereader.eo.c"
diff --git a/src/lib/ecordova/ecordova_filereader_private.h b/src/lib/ecordova/ecordova_filereader_private.h
deleted file mode 100644
index bff6857eca..0000000000
--- a/src/lib/ecordova/ecordova_filereader_private.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _ECORDOVA_FILEREADER_PRIVATE_H
2#define _ECORDOVA_FILEREADER_PRIVATE_H
3
4#include "ecordova_private.h"
5
6#include <Eio.h>
7
8typedef struct _Ecordova_FileReader_Data Ecordova_FileReader_Data;
9
10/**
11 * Ecordova.FileReader private data
12 */
13struct _Ecordova_FileReader_Data
14{
15 Eo *obj;
16 Ecordova_FileError error;
17 Ecordova_FileReader_State state;
18 char *result;
19 size_t result_length;
20 Ecore_Thread *thread;
21 char *url;
22 long offset;
23 long length;
24};
25
26#endif
diff --git a/src/lib/ecordova/ecordova_filesystem.c b/src/lib/ecordova/ecordova_filesystem.c
deleted file mode 100644
index 4086a84b68..0000000000
--- a/src/lib/ecordova/ecordova_filesystem.c
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_filesystem_private.h"
6
7#define MY_CLASS ECORDOVA_FILESYSTEM_CLASS
8#define MY_CLASS_NAME "Ecordova_FileSystem"
9
10static Eo_Base *
11_ecordova_filesystem_eo_base_constructor(Eo *obj, Ecordova_FileSystem_Data *pd)
12{
13 DBG("(%p)", obj);
14
15 pd->obj = obj;
16
17 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
18}
19
20static void
21_ecordova_filesystem_constructor(Eo *obj EINA_UNUSED,
22 Ecordova_FileSystem_Data *pd EINA_UNUSED,
23 const char *name EINA_UNUSED,
24 Ecordova_DirectoryEntry *root EINA_UNUSED)
25{
26 DBG("(%p)", obj);
27}
28
29static void
30_ecordova_filesystem_eo_base_destructor(Eo *obj,
31 Ecordova_FileSystem_Data *pd EINA_UNUSED)
32{
33 DBG("(%p)", obj);
34
35 eo_do_super(obj, MY_CLASS, eo_destructor());
36}
37
38#include "ecordova_filesystem.eo.c"
diff --git a/src/lib/ecordova/ecordova_filesystem_private.h b/src/lib/ecordova/ecordova_filesystem_private.h
deleted file mode 100644
index ef5756bdb3..0000000000
--- a/src/lib/ecordova/ecordova_filesystem_private.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ECORDOVA_FILESYSTEM_PRIVATE_H
2#define _ECORDOVA_FILESYSTEM_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_FileSystem_Data Ecordova_FileSystem_Data;
7
8/**
9 * Ecordova.FileSystem private data
10 */
11struct _Ecordova_FileSystem_Data
12{
13 Eo *obj;
14};
15
16#endif
diff --git a/src/lib/ecordova/ecordova_filewriter.c b/src/lib/ecordova/ecordova_filewriter.c
deleted file mode 100644
index 514e1f4456..0000000000
--- a/src/lib/ecordova/ecordova_filewriter.c
+++ /dev/null
@@ -1,357 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_filewriter_private.h"
6#include "ecordova_entry_private.h"
7
8#include <stdbool.h>
9#include <unistd.h>
10
11#define MY_CLASS ECORDOVA_FILEWRITER_CLASS
12#define MY_CLASS_NAME "Ecordova_FileWriter"
13
14static void _write_cb(void *, Ecore_Thread *);
15static void _truncate_cb(void *, Ecore_Thread *);
16static bool _stream_init(Ecordova_FileWriter_Data *);
17static bool _offset_set(Ecordova_FileWriter_Data *);
18static void _write_end_cb(void *, Ecore_Thread *);
19static void _write_abort_cb(void *, Ecore_Thread *);
20static void _write_progress_cb(void *, Ecore_Thread *, void *);
21static void _progress_notify(size_t, size_t, Eo *, Ecore_Thread *);
22
23static Eo_Base *
24_ecordova_filewriter_eo_base_constructor(Eo *obj,
25 Ecordova_FileWriter_Data *pd)
26{
27 DBG("(%p)", obj);
28
29 pd->obj = obj;
30 pd->error = 0;
31 pd->error = ECORDOVA_FILEWRITER_STATE_INIT;
32 pd->url = NULL;
33 pd->offset = 0;
34 pd->length = 0;
35 pd->stream = NULL;
36 pd->data = NULL;
37 pd->data_size = 0;
38 pd->truncate_size = 0;
39
40 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
41}
42
43static void
44_ecordova_filewriter_constructor(Eo *obj,
45 Ecordova_FileWriter_Data *pd,
46 Ecordova_File *file)
47{
48 DBG("(%p)", obj);
49 EINA_SAFETY_ON_NULL_RETURN(file);
50
51 eo_do(file,
52 pd->url = strdup(ecordova_file_url_get()),
53 pd->offset = ecordova_file_start_get(),
54 pd->length = ecordova_file_end_get() - pd->offset);
55}
56
57static void
58_ecordova_filewriter_eo_base_destructor(Eo *obj,
59 Ecordova_FileWriter_Data *pd)
60{
61 DBG("(%p)", obj);
62
63 if (pd->thread) ERR("%s", "Destructing without aborting first");
64
65 free(pd->url);
66 if (pd->stream)
67 fclose(pd->stream);
68 if (pd->data)
69 free(pd->data);
70
71 eo_do_super(obj, MY_CLASS, eo_destructor());
72}
73
74static Ecordova_FileError
75_ecordova_filewriter_abort(Eo *obj, Ecordova_FileWriter_Data *pd)
76{
77 DBG("(%p)", obj);
78
79 if (ECORDOVA_FILEWRITER_STATE_DONE == pd->state ||
80 ECORDOVA_FILEWRITER_STATE_INIT == pd->state)
81 return ECORDOVA_FILEERROR_INVALID_STATE_ERR;
82 pd->state = ECORDOVA_FILEWRITER_STATE_DONE;
83 pd->error = ECORDOVA_FILEERROR_ABORT_ERR;
84
85 if (pd->thread)
86 ecore_thread_cancel(pd->thread);
87
88 return 0;
89}
90
91static Ecordova_FileError
92_ecordova_filewriter_write(Eo *obj,
93 Ecordova_FileWriter_Data *pd,
94 const char *data,
95 long size)
96{
97 DBG("(%p)", obj);
98
99 if (ECORDOVA_FILEWRITER_STATE_WRITING == pd->state)
100 return ECORDOVA_FILEERROR_INVALID_STATE_ERR;
101 pd->state = ECORDOVA_FILEWRITER_STATE_WRITING;
102 pd->error = 0;
103
104 Ecordova_ProgressEvent writestart = {.type = "writestart", .target = obj};
105 eo_do(obj,
106 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_WRITE_START,
107 &writestart));
108
109 pd->data_size = size ? size : (long)strlen(data);
110 EINA_SAFETY_ON_FALSE_RETURN_VAL(pd->data_size > 0, ECORDOVA_FILEERROR_SYNTAX_ERR);
111
112 pd->data = pd->data ? realloc(pd->data, pd->data_size) : malloc(pd->data_size);
113 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->data, ECORDOVA_FILEERROR_SYNTAX_ERR);
114
115 memcpy(pd->data, data, pd->data_size);
116
117 pd->thread = ecore_thread_feedback_run(_write_cb,
118 _write_progress_cb,
119 _write_end_cb,
120 _write_abort_cb,
121 pd,
122 EINA_FALSE);
123 return 0;
124}
125
126static Ecordova_FileError
127_ecordova_filewriter_seek(Eo *obj, Ecordova_FileWriter_Data *pd, long offset)
128{
129 DBG("(%p)", obj);
130 if (ECORDOVA_FILEWRITER_STATE_WRITING == pd->state)
131 return ECORDOVA_FILEERROR_INVALID_STATE_ERR;
132
133 if (offset < 0)
134 pd->offset = MAX(offset + pd->length, 0);
135 else if (offset > pd->length)
136 pd->offset = pd->length;
137 else
138 pd->offset = offset;
139
140 return 0;
141}
142
143static Ecordova_FileError
144_ecordova_filewriter_truncate(Eo *obj, Ecordova_FileWriter_Data *pd, long size)
145{
146 DBG("(%p)", obj);
147
148 if (ECORDOVA_FILEWRITER_STATE_WRITING == pd->state)
149 return ECORDOVA_FILEERROR_INVALID_STATE_ERR;
150 pd->state = ECORDOVA_FILEWRITER_STATE_WRITING;
151 pd->error = 0;
152 pd->truncate_size = size;
153
154 pd->thread = ecore_thread_run(_truncate_cb,
155 _write_end_cb,
156 _write_abort_cb,
157 pd);
158 return 0;
159}
160
161static Ecordova_FileError
162_ecordova_filewriter_error_get(Eo *obj, Ecordova_FileWriter_Data *pd)
163{
164 DBG("(%p)", obj);
165 return pd->error;
166}
167
168static long
169_ecordova_filewriter_position_get(Eo *obj, Ecordova_FileWriter_Data *pd)
170{
171 DBG("(%p)", obj);
172 return pd->offset;
173}
174
175static Ecordova_FileWriter_State
176_ecordova_filewriter_state_get(Eo *obj, Ecordova_FileWriter_Data *pd)
177{
178 DBG("(%p)", obj);
179 return pd->state;
180}
181
182static void
183_write_cb(void *data, Ecore_Thread *thread)
184{
185 Ecordova_FileWriter_Data *pd = data;
186 DBG("(%p)", pd->obj);
187
188 if (ecore_thread_check(thread))
189 return;
190
191 if (!pd->stream && !_stream_init(pd))
192 return;
193
194 if (!_offset_set(pd))
195 return;
196
197 _progress_notify(0, pd->data_size, pd->obj, thread);
198 if (ecore_thread_check(thread))
199 return;
200
201 size_t total = pd->data_size;
202 char *buffer = pd->data;
203 do
204 {
205 size_t written = fwrite(buffer, sizeof(char), total, pd->stream);
206 if (!written)
207 {
208 pd->error = _translate_errno(errno);
209 return;
210 }
211
212 buffer += written;
213 total -= written;
214 pd->offset += written;
215
216 _progress_notify(pd->data_size - total, pd->data_size, pd->obj, thread);
217 if (ecore_thread_check(thread))
218 return;
219 }
220 while (total > 0);
221
222 pd->length = MAX(pd->offset, pd->length);
223}
224
225static void
226_truncate_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
227{
228 Ecordova_FileWriter_Data *pd = data;
229 DBG("(%p)", pd->obj);
230
231 if (ecore_thread_check(thread))
232 return;
233
234 if (!pd->stream && !_stream_init(pd))
235 return;
236
237 if (!_offset_set(pd))
238 return;
239
240 if (ftruncate(fileno(pd->stream), pd->truncate_size) != 0)
241 {
242 pd->error = _translate_errno(errno);
243 return;
244 }
245
246 pd->length = pd->truncate_size;
247 pd->offset = MIN(pd->offset, pd->truncate_size);
248}
249
250static bool
251_stream_init(Ecordova_FileWriter_Data *pd)
252{
253 pd->stream = fopen(pd->url, "rb+");
254 if (!pd->stream)
255 {
256 pd->error = _translate_errno(errno);
257 return false;
258 }
259
260 return true;
261}
262
263static bool
264_offset_set(Ecordova_FileWriter_Data *pd)
265{
266 int error = fseek(pd->stream, pd->offset, SEEK_SET);
267 if (error)
268 {
269 pd->error = _translate_errno(errno);
270 return false;
271 }
272
273 return true;
274}
275
276static void
277_progress_notify(size_t written, size_t total, Eo *obj, Ecore_Thread *thread)
278{
279 Ecordova_ProgressEvent *progress = malloc(sizeof(Ecordova_ProgressEvent));
280 *progress = (Ecordova_ProgressEvent)
281 {
282 .type = "progress",
283 .length_computable = EINA_TRUE,
284 .loaded = written,
285 .total = total,
286 .target = obj
287 };
288 if (!ecore_thread_feedback(thread, progress))
289 free(progress);
290}
291
292static void
293_write_progress_cb(void *data,
294 Ecore_Thread *thread EINA_UNUSED,
295 void *msg_data)
296{
297 Ecordova_FileWriter_Data *pd = data;
298 DBG("(%p)", pd->obj);
299 Ecordova_ProgressEvent *event = msg_data;
300 eo_do(pd->obj,
301 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_PROGRESS, &event));
302 free(event);
303}
304
305static void
306_write_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
307{
308 Ecordova_FileWriter_Data *pd = data;
309 DBG("(%p)", pd->obj);
310
311 // If DONE (cancelled), then don't do anything
312 if (ECORDOVA_FILEWRITER_STATE_DONE == pd->state)
313 return;
314 pd->thread = NULL;
315 pd->state = ECORDOVA_FILEWRITER_STATE_DONE;
316
317 if (pd->error)
318 {
319 Ecordova_ProgressEvent error = {.type = "error", .target = pd->obj};
320 eo_do(pd->obj,
321 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_ERROR,
322 &error));
323 }
324 else
325 {
326 Ecordova_ProgressEvent write = {.type = "write", .target = pd->obj};
327 eo_do(pd->obj,
328 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_WRITE,
329 &write));
330 }
331
332 Ecordova_ProgressEvent writeend = {.type = "writeend", .target = pd->obj};
333 eo_do(pd->obj,
334 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_WRITE_END,
335 &writeend));
336}
337
338static void
339_write_abort_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
340{
341 Ecordova_FileWriter_Data *pd = data;
342 DBG("(%p)", pd->obj);
343
344 pd->thread = NULL;
345
346 Ecordova_ProgressEvent on_abort = {.type = "abort", .target = pd->obj};
347 eo_do(pd->obj,
348 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_ABORT,
349 &on_abort));
350
351 Ecordova_ProgressEvent writeend = {.type = "writeend", .target = pd->obj};
352 eo_do(pd->obj,
353 eo_event_callback_call(ECORDOVA_FILEWRITER_EVENT_ON_WRITE_END,
354 &writeend));
355}
356
357#include "ecordova_filewriter.eo.c"
diff --git a/src/lib/ecordova/ecordova_filewriter_private.h b/src/lib/ecordova/ecordova_filewriter_private.h
deleted file mode 100644
index 459d1c671f..0000000000
--- a/src/lib/ecordova/ecordova_filewriter_private.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _ECORDOVA_FILEWRITER_PRIVATE_H
2#define _ECORDOVA_FILEWRITER_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_FileWriter_Data Ecordova_FileWriter_Data;
7
8/**
9 * Ecordova.FileWriter private data
10 */
11struct _Ecordova_FileWriter_Data
12{
13 Eo *obj;
14 Ecordova_FileError error;
15 Ecordova_FileWriter_State state;
16 char *url;
17 long offset;
18 long length;
19 FILE *stream;
20 char *data;
21 long data_size;
22 long truncate_size;
23 Ecore_Thread *thread;
24};
25
26#endif
diff --git a/src/lib/ecordova/ecordova_main.c b/src/lib/ecordova/ecordova_main.c
index 8ca4d0c31a..043a601406 100644
--- a/src/lib/ecordova/ecordova_main.c
+++ b/src/lib/ecordova/ecordova_main.c
@@ -280,6 +280,7 @@ ECORDOVA_CLASS_GET(fileentry)
280ECORDOVA_CLASS_GET(filewriter) 280ECORDOVA_CLASS_GET(filewriter)
281ECORDOVA_CLASS_GET(file) 281ECORDOVA_CLASS_GET(file)
282ECORDOVA_CLASS_GET(filereader) 282ECORDOVA_CLASS_GET(filereader)
283ECORDOVA_CLASS_GET(filetransfer)
283 284
284ECORDOVA_define_data(Console) 285ECORDOVA_define_data(Console)
285ECORDOVA_define_data(DirectoryEntry) 286ECORDOVA_define_data(DirectoryEntry)
@@ -289,6 +290,7 @@ ECORDOVA_define_data(FileEntry)
289ECORDOVA_define_data(FileWriter) 290ECORDOVA_define_data(FileWriter)
290ECORDOVA_define_data(File) 291ECORDOVA_define_data(File)
291ECORDOVA_define_data(FileReader) 292ECORDOVA_define_data(FileReader)
293ECORDOVA_define_data(FileTransfer)
292 294
293#undef EO_DEFINE_CLASS 295#undef EO_DEFINE_CLASS
294#define EO_DEFINE_CLASS(...) 296#define EO_DEFINE_CLASS(...)
@@ -304,3 +306,4 @@ ECORDOVA_define_data(FileReader)
304#include "ecordova_filewriter.eo.c" 306#include "ecordova_filewriter.eo.c"
305#include "ecordova_file.eo.c" 307#include "ecordova_file.eo.c"
306#include "ecordova_filereader.eo.c" 308#include "ecordova_filereader.eo.c"
309#include "ecordova_filetransfer.eo.c"
diff --git a/src/lib/ecordova/ecordova_splashscreen.c b/src/lib/ecordova/ecordova_splashscreen.c
deleted file mode 100644
index 6b3498d454..0000000000
--- a/src/lib/ecordova/ecordova_splashscreen.c
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecordova_splashscreen_private.h"
6
7#define MY_CLASS ECORDOVA_SPLASHSCREEN_CLASS
8#define MY_CLASS_NAME "Ecordova_Splashscreen"
9
10static Eo_Base *
11_ecordova_splashscreen_eo_base_constructor(Eo *obj,
12 Ecordova_Splashscreen_Data *pd)
13{
14 DBG("(%p)", obj);
15
16 pd->obj = obj;
17
18 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
19}
20
21static void
22_ecordova_splashscreen_constructor(Eo *obj EINA_UNUSED,
23 Ecordova_Splashscreen_Data *pd EINA_UNUSED)
24{
25 DBG("(%p)", obj);
26}
27
28static void
29_ecordova_splashscreen_eo_base_destructor(Eo *obj,
30 Ecordova_Splashscreen_Data *pd EINA_UNUSED)
31{
32 DBG("(%p)", obj);
33
34 eo_do_super(obj, MY_CLASS, eo_destructor());
35}
36
37static void
38_ecordova_splashscreen_show(Eo *obj EINA_UNUSED,
39 Ecordova_Splashscreen_Data *pd EINA_UNUSED)
40{
41 ERR("Not implemented.");
42}
43
44static void
45_ecordova_splashscreen_hide(Eo *obj EINA_UNUSED,
46 Ecordova_Splashscreen_Data *pd EINA_UNUSED)
47{
48 ERR("Not implemented.");
49}
50
51#include "ecordova_splashscreen.eo.c"
diff --git a/src/lib/ecordova/ecordova_splashscreen_private.h b/src/lib/ecordova/ecordova_splashscreen_private.h
deleted file mode 100644
index 5f1fc311c7..0000000000
--- a/src/lib/ecordova/ecordova_splashscreen_private.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ECORDOVA_SPLASHSCREEN_PRIVATE_H
2#define _ECORDOVA_SPLASHSCREEN_PRIVATE_H
3
4#include "ecordova_private.h"
5
6typedef struct _Ecordova_Splashscreen_Data Ecordova_Splashscreen_Data;
7
8/**
9 * Ecordova.Splashscreen private data
10 */
11struct _Ecordova_Splashscreen_Data
12{
13 Eo *obj;
14};
15
16#endif
diff --git a/src/lib/ecordova/ecordova_filetransfer.c b/src/modules/ecordova/linux/ecordova_filetransfer.c
index c0643e81f7..72bb4f040b 100644
--- a/src/lib/ecordova/ecordova_filetransfer.c
+++ b/src/modules/ecordova/linux/ecordova_filetransfer.c
@@ -7,6 +7,33 @@
7 7
8#include <Ecore_Con.h> 8#include <Ecore_Con.h>
9 9
10#ifdef _WIN32
11# ifdef DLL_EXPORT
12# define EAPI __declspec(dllexport)
13# else
14# define EAPI
15# endif /* ! DLL_EXPORT */
16#else
17# ifdef __GNUC__
18# if __GNUC__ >= 4
19# define EAPI __attribute__ ((visibility("default")))
20# else
21# define EAPI
22# endif
23# else
24# define EAPI
25# endif
26#endif /* ! _WIN32 */
27
28/* logging support */
29extern int _ecordova_log_dom;
30
31#define CRI(...) EINA_LOG_DOM_CRIT(_ecordova_log_dom, __VA_ARGS__)
32#define ERR(...) EINA_LOG_DOM_ERR(_ecordova_log_dom, __VA_ARGS__)
33#define WRN(...) EINA_LOG_DOM_WARN(_ecordova_log_dom, __VA_ARGS__)
34#define INF(...) EINA_LOG_DOM_INFO(_ecordova_log_dom, __VA_ARGS__)
35#define DBG(...) EINA_LOG_DOM_DBG(_ecordova_log_dom, __VA_ARGS__)
36
10#define MY_CLASS ECORDOVA_FILETRANSFER_CLASS 37#define MY_CLASS ECORDOVA_FILETRANSFER_CLASS
11#define MY_CLASS_NAME "Ecordova_FileTransfer" 38#define MY_CLASS_NAME "Ecordova_FileTransfer"
12 39
@@ -610,4 +637,11 @@ _already_in_progress_error_notify(Ecordova_FileTransfer_Data *pd,
610 eo_event_callback_call(ECORDOVA_FILETRANSFER_EVENT_ERROR, &error)); 637 eo_event_callback_call(ECORDOVA_FILETRANSFER_EVENT_ERROR, &error));
611} 638}
612 639
640#undef EOAPI
641#define EOAPI EAPI
642
643#include "undefs.h"
644
645#define ecordova_filetransfer_class_get ecordova_filetransfer_impl_class_get
646
613#include "ecordova_filetransfer.eo.c" 647#include "ecordova_filetransfer.eo.c"
diff --git a/src/lib/ecordova/ecordova_filetransfer_private.h b/src/modules/ecordova/linux/ecordova_filetransfer_private.h
index b17fe85e9a..b17fe85e9a 100644
--- a/src/lib/ecordova/ecordova_filetransfer_private.h
+++ b/src/modules/ecordova/linux/ecordova_filetransfer_private.h
diff --git a/src/lib/ecordova/ecordova_batterystatus.c b/src/modules/ecordova/tizen/ecordova_batterystatus.c
index a864e733df..a864e733df 100644
--- a/src/lib/ecordova/ecordova_batterystatus.c
+++ b/src/modules/ecordova/tizen/ecordova_batterystatus.c
diff --git a/src/lib/ecordova/ecordova_batterystatus_private.h b/src/modules/ecordova/tizen/ecordova_batterystatus_private.h
index f9ced32f04..f9ced32f04 100644
--- a/src/lib/ecordova/ecordova_batterystatus_private.h
+++ b/src/modules/ecordova/tizen/ecordova_batterystatus_private.h
diff --git a/src/lib/ecordova/ecordova_contact.c b/src/modules/ecordova/tizen/ecordova_contact.c
index 9b986c09e5..9b986c09e5 100644
--- a/src/lib/ecordova/ecordova_contact.c
+++ b/src/modules/ecordova/tizen/ecordova_contact.c
diff --git a/src/lib/ecordova/ecordova_contact_private.h b/src/modules/ecordova/tizen/ecordova_contact_private.h
index 4a1ddc8deb..4a1ddc8deb 100644
--- a/src/lib/ecordova/ecordova_contact_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contact_private.h
diff --git a/src/lib/ecordova/ecordova_contactaddress.c b/src/modules/ecordova/tizen/ecordova_contactaddress.c
index 23918f2432..23918f2432 100644
--- a/src/lib/ecordova/ecordova_contactaddress.c
+++ b/src/modules/ecordova/tizen/ecordova_contactaddress.c
diff --git a/src/lib/ecordova/ecordova_contactaddress_private.h b/src/modules/ecordova/tizen/ecordova_contactaddress_private.h
index 56715d34f1..56715d34f1 100644
--- a/src/lib/ecordova/ecordova_contactaddress_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contactaddress_private.h
diff --git a/src/lib/ecordova/ecordova_contactfield.c b/src/modules/ecordova/tizen/ecordova_contactfield.c
index 8397a1944d..8397a1944d 100644
--- a/src/lib/ecordova/ecordova_contactfield.c
+++ b/src/modules/ecordova/tizen/ecordova_contactfield.c
diff --git a/src/lib/ecordova/ecordova_contactfield_private.h b/src/modules/ecordova/tizen/ecordova_contactfield_private.h
index 408a40addc..408a40addc 100644
--- a/src/lib/ecordova/ecordova_contactfield_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contactfield_private.h
diff --git a/src/lib/ecordova/ecordova_contactname.c b/src/modules/ecordova/tizen/ecordova_contactname.c
index 87cdcbfaaf..87cdcbfaaf 100644
--- a/src/lib/ecordova/ecordova_contactname.c
+++ b/src/modules/ecordova/tizen/ecordova_contactname.c
diff --git a/src/lib/ecordova/ecordova_contactname_private.h b/src/modules/ecordova/tizen/ecordova_contactname_private.h
index ccdcd61cb8..ccdcd61cb8 100644
--- a/src/lib/ecordova/ecordova_contactname_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contactname_private.h
diff --git a/src/lib/ecordova/ecordova_contactorganization.c b/src/modules/ecordova/tizen/ecordova_contactorganization.c
index 50cbde09cf..50cbde09cf 100644
--- a/src/lib/ecordova/ecordova_contactorganization.c
+++ b/src/modules/ecordova/tizen/ecordova_contactorganization.c
diff --git a/src/lib/ecordova/ecordova_contactorganization_private.h b/src/modules/ecordova/tizen/ecordova_contactorganization_private.h
index 643b11792d..643b11792d 100644
--- a/src/lib/ecordova/ecordova_contactorganization_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contactorganization_private.h
diff --git a/src/lib/ecordova/ecordova_contacts.c b/src/modules/ecordova/tizen/ecordova_contacts.c
index c914ec08fb..c914ec08fb 100644
--- a/src/lib/ecordova/ecordova_contacts.c
+++ b/src/modules/ecordova/tizen/ecordova_contacts.c
diff --git a/src/lib/ecordova/ecordova_contacts_private.h b/src/modules/ecordova/tizen/ecordova_contacts_private.h
index 7a60b2328b..7a60b2328b 100644
--- a/src/lib/ecordova/ecordova_contacts_private.h
+++ b/src/modules/ecordova/tizen/ecordova_contacts_private.h
diff --git a/src/lib/ecordova/ecordova_contacts_record_utils.c b/src/modules/ecordova/tizen/ecordova_contacts_record_utils.c
index 09cab89d4f..09cab89d4f 100644
--- a/src/lib/ecordova/ecordova_contacts_record_utils.c
+++ b/src/modules/ecordova/tizen/ecordova_contacts_record_utils.c
diff --git a/src/lib/ecordova/ecordova_contacts_record_utils.h b/src/modules/ecordova/tizen/ecordova_contacts_record_utils.h
index 9e9aa2d55e..9e9aa2d55e 100644
--- a/src/lib/ecordova/ecordova_contacts_record_utils.h
+++ b/src/modules/ecordova/tizen/ecordova_contacts_record_utils.h
diff --git a/src/lib/ecordova/ecordova_device.c b/src/modules/ecordova/tizen/ecordova_device.c
index 0971292111..0971292111 100644
--- a/src/lib/ecordova/ecordova_device.c
+++ b/src/modules/ecordova/tizen/ecordova_device.c
diff --git a/src/lib/ecordova/ecordova_device_private.h b/src/modules/ecordova/tizen/ecordova_device_private.h
index 7bed6e5486..7bed6e5486 100644
--- a/src/lib/ecordova/ecordova_device_private.h
+++ b/src/modules/ecordova/tizen/ecordova_device_private.h
diff --git a/src/lib/ecordova/ecordova_devicemotion.c b/src/modules/ecordova/tizen/ecordova_devicemotion.c
index 3b6543cb42..3b6543cb42 100644
--- a/src/lib/ecordova/ecordova_devicemotion.c
+++ b/src/modules/ecordova/tizen/ecordova_devicemotion.c
diff --git a/src/lib/ecordova/ecordova_devicemotion_private.h b/src/modules/ecordova/tizen/ecordova_devicemotion_private.h
index fb75f4d810..fb75f4d810 100644
--- a/src/lib/ecordova/ecordova_devicemotion_private.h
+++ b/src/modules/ecordova/tizen/ecordova_devicemotion_private.h
diff --git a/src/lib/ecordova/ecordova_deviceorientation.c b/src/modules/ecordova/tizen/ecordova_deviceorientation.c
index 87a3d65dbe..87a3d65dbe 100644
--- a/src/lib/ecordova/ecordova_deviceorientation.c
+++ b/src/modules/ecordova/tizen/ecordova_deviceorientation.c
diff --git a/src/lib/ecordova/ecordova_deviceorientation_private.h b/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h
index a2f1c6dfea..a2f1c6dfea 100644
--- a/src/lib/ecordova/ecordova_deviceorientation_private.h
+++ b/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h
diff --git a/src/lib/ecordova/ecordova_geolocation.c b/src/modules/ecordova/tizen/ecordova_geolocation.c
index dff3e7b476..dff3e7b476 100644
--- a/src/lib/ecordova/ecordova_geolocation.c
+++ b/src/modules/ecordova/tizen/ecordova_geolocation.c
diff --git a/src/lib/ecordova/ecordova_geolocation_private.h b/src/modules/ecordova/tizen/ecordova_geolocation_private.h
index e31ad6eef6..e31ad6eef6 100644
--- a/src/lib/ecordova/ecordova_geolocation_private.h
+++ b/src/modules/ecordova/tizen/ecordova_geolocation_private.h
diff --git a/src/lib/ecordova/ecordova_globalization.c b/src/modules/ecordova/tizen/ecordova_globalization.c
index 9320c87cdb..9320c87cdb 100644
--- a/src/lib/ecordova/ecordova_globalization.c
+++ b/src/modules/ecordova/tizen/ecordova_globalization.c
diff --git a/src/lib/ecordova/ecordova_globalization_private.h b/src/modules/ecordova/tizen/ecordova_globalization_private.h
index 1df1384a87..1df1384a87 100644
--- a/src/lib/ecordova/ecordova_globalization_private.h
+++ b/src/modules/ecordova/tizen/ecordova_globalization_private.h
diff --git a/src/lib/ecordova/ecordova_inappbrowser.c b/src/modules/ecordova/tizen/ecordova_inappbrowser.c
index 4d6cc1686e..4d6cc1686e 100644
--- a/src/lib/ecordova/ecordova_inappbrowser.c
+++ b/src/modules/ecordova/tizen/ecordova_inappbrowser.c
diff --git a/src/lib/ecordova/ecordova_inappbrowser_private.h b/src/modules/ecordova/tizen/ecordova_inappbrowser_private.h
index 4526e8773b..4526e8773b 100644
--- a/src/lib/ecordova/ecordova_inappbrowser_private.h
+++ b/src/modules/ecordova/tizen/ecordova_inappbrowser_private.h
diff --git a/src/lib/ecordova/ecordova_networkinformation.c b/src/modules/ecordova/tizen/ecordova_networkinformation.c
index e89dc7018a..e89dc7018a 100644
--- a/src/lib/ecordova/ecordova_networkinformation.c
+++ b/src/modules/ecordova/tizen/ecordova_networkinformation.c
diff --git a/src/lib/ecordova/ecordova_networkinformation_private.h b/src/modules/ecordova/tizen/ecordova_networkinformation_private.h
index 1af4d1e22e..1af4d1e22e 100644
--- a/src/lib/ecordova/ecordova_networkinformation_private.h
+++ b/src/modules/ecordova/tizen/ecordova_networkinformation_private.h
diff --git a/src/lib/ecordova/ecordova_systeminfo.c b/src/modules/ecordova/tizen/ecordova_systeminfo.c
index 0dc4f7f971..0dc4f7f971 100644
--- a/src/lib/ecordova/ecordova_systeminfo.c
+++ b/src/modules/ecordova/tizen/ecordova_systeminfo.c
diff --git a/src/lib/ecordova/ecordova_systeminfo_private.h b/src/modules/ecordova/tizen/ecordova_systeminfo_private.h
index fceab8c631..fceab8c631 100644
--- a/src/lib/ecordova/ecordova_systeminfo_private.h
+++ b/src/modules/ecordova/tizen/ecordova_systeminfo_private.h
diff --git a/src/modules/ecordova/tizen/ecordova_tizen.c b/src/modules/ecordova/tizen/ecordova_tizen.c
index 17d82d6858..4607e4841c 100644
--- a/src/modules/ecordova/tizen/ecordova_tizen.c
+++ b/src/modules/ecordova/tizen/ecordova_tizen.c
@@ -4,10 +4,25 @@
4 4
5#include <Ecore.h> 5#include <Ecore.h>
6 6
7int _ecordova_log_dom;
8
9#define CRI(...) EINA_LOG_DOM_CRIT(_ecordova_log_dom, __VA_ARGS__)
10#define ERR(...) EINA_LOG_DOM_ERR(_ecordova_log_dom, __VA_ARGS__)
11#define WRN(...) EINA_LOG_DOM_WARN(_ecordova_log_dom, __VA_ARGS__)
12#define INF(...) EINA_LOG_DOM_INFO(_ecordova_log_dom, __VA_ARGS__)
13#define DBG(...) EINA_LOG_DOM_DBG(_ecordova_log_dom, __VA_ARGS__)
14
7static Eina_Bool 15static Eina_Bool
8_ecordova_tizen_init(void) 16_ecordova_tizen_init(void)
9{ 17{
10 return EINA_TRUE; 18 _ecordova_log_dom = eina_log_domain_register("ecordova_tizen", EINA_COLOR_CYAN);
19 if (_ecordova_log_dom < 0)
20 {
21 EINA_LOG_ERR("Unable to create an 'ecordova' log domain");
22 //goto on_error_1;
23 }
24
25 return EINA_TRUE;
11} 26}
12 27
13static void 28static void
diff --git a/src/lib/ecordova/ecordova_vibration.c b/src/modules/ecordova/tizen/ecordova_vibration.c
index 6d2427e1d5..6d2427e1d5 100644
--- a/src/lib/ecordova/ecordova_vibration.c
+++ b/src/modules/ecordova/tizen/ecordova_vibration.c
diff --git a/src/lib/ecordova/ecordova_vibration_private.h b/src/modules/ecordova/tizen/ecordova_vibration_private.h
index f2921bfa47..f2921bfa47 100644
--- a/src/lib/ecordova/ecordova_vibration_private.h
+++ b/src/modules/ecordova/tizen/ecordova_vibration_private.h
diff --git a/src/tests/ecordova/ecordova_contacts_test.c b/src/tests/ecordova/ecordova_contacts_test.c
index 29d40be36e..106e35efcb 100644
--- a/src/tests/ecordova/ecordova_contacts_test.c
+++ b/src/tests/ecordova/ecordova_contacts_test.c
@@ -6,7 +6,10 @@
6#include "ecordova_suite.h" 6#include "ecordova_suite.h"
7#include <Ecore.h> 7#include <Ecore.h>
8#include <ecore_timer.eo.h> 8#include <ecore_timer.eo.h>
9#include <contacts.h> 9#include <Ecordova.h>
10
11#ifdef HAVE_TIZEN_CONFIGURATION_MANAGER
12#include <contact.h>
10 13
11#define CHECK(x) {int ret = x; ck_assert_int_eq(CONTACTS_ERROR_NONE, ret);} 14#define CHECK(x) {int ret = x; ck_assert_int_eq(CONTACTS_ERROR_NONE, ret);}
12 15
@@ -244,12 +247,15 @@ START_TEST(find_by_name)
244 eo_unref(contacts); 247 eo_unref(contacts);
245} 248}
246END_TEST 249END_TEST
250#endif
247 251
248void 252void
249ecordova_contacts_test(TCase *tc) 253ecordova_contacts_test(TCase *tc)
250{ 254{
255#ifdef HAVE_TIZEN_CONFIGURATION_MANAGER
251 tcase_add_checked_fixture(tc, _setup, _teardown); 256 tcase_add_checked_fixture(tc, _setup, _teardown);
252 tcase_add_test(tc, find_all); 257 tcase_add_test(tc, find_all);
253 tcase_add_test(tc, find_by_id); 258 tcase_add_test(tc, find_by_id);
254 tcase_add_test(tc, find_by_name); 259 tcase_add_test(tc, find_by_name);
260#endif
255} 261}
diff --git a/src/tests/ecordova/ecordova_suite.c b/src/tests/ecordova/ecordova_suite.c
index 06a5a9d816..5f070698e6 100644
--- a/src/tests/ecordova/ecordova_suite.c
+++ b/src/tests/ecordova/ecordova_suite.c
@@ -9,7 +9,7 @@
9/* #include "ecordova_geolocation_test.h" */ 9/* #include "ecordova_geolocation_test.h" */
10/* #include "ecordova_batterystatus_test.h" */ 10/* #include "ecordova_batterystatus_test.h" */
11#include "ecordova_console_test.h" 11#include "ecordova_console_test.h"
12/* #include "ecordova_filetransfer_test.h" */ 12#include "ecordova_filetransfer_test.h"
13/* #include "ecordova_media_test.h" */ 13/* #include "ecordova_media_test.h" */
14/* #include "ecordova_networkinformation_test.h" */ 14/* #include "ecordova_networkinformation_test.h" */
15/* #include "ecordova_vibration_test.h" */ 15/* #include "ecordova_vibration_test.h" */
@@ -50,7 +50,7 @@ static const Ecordova_Test_Case etc[] = {
50 /* { "geolocation", ecordova_geolocation_test }, */ 50 /* { "geolocation", ecordova_geolocation_test }, */
51 /* { "batterystatus", ecordova_batterystatus_test }, */ 51 /* { "batterystatus", ecordova_batterystatus_test }, */
52 { "console", ecordova_console_test }, 52 { "console", ecordova_console_test },
53 /* { "filetransfer", ecordova_filetransfer_test }, */ 53 { "filetransfer", ecordova_filetransfer_test },
54 /* { "media", ecordova_media_test }, */ 54 /* { "media", ecordova_media_test }, */
55 /* { "networkinformation", ecordova_networkinformation_test }, */ 55 /* { "networkinformation", ecordova_networkinformation_test }, */
56 /* { "vibration", ecordova_vibration_test }, */ 56 /* { "vibration", ecordova_vibration_test }, */