summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:09 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:10 -0500
commit6326e18b3fb2a4757f8ffa22be5d55a75da23049 (patch)
tree31d586b52638aa0d0b1c759869a8e3368c9daf5d /src/lib
parent7924660d54500285d3844bfa384394c683825cd9 (diff)
efl.file: improve api a bit
Summary: the previous implementation/api had a number of issues: * "file" property contained both "file" and "key" values - also performed file loading operation * "load_error" property which was specific to image objects * no methods for controlling file loading/unloading this patch attempts the following changes: * split "file" property into "file" and "key" properties - also remove "key" from existing "mmap" property * remove "load_error" * directly return error codes from operations * add "load" and "unload" methods for directly controlling load state * add implicit file loading if file/mmap is set during construction * rewrite all efl.file implementations to move file loading into load() method * rewrite all usage of efl.file api based on these changes * add C extension functions to mimic previous behavior ref T7577 Reviewers: segfaultxavi, bu5hm4n, cedric Reviewed By: segfaultxavi Subscribers: vitor.sousa, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7577 Differential Revision: https://phab.enlightenment.org/D8018
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/efl_io_file.c30
-rw-r--r--src/lib/ecore/efl_io_file.eo1
-rw-r--r--src/lib/ecore_con/ecore_con_url.c2
-rw-r--r--src/lib/ecore_file/ecore_file_download.c10
-rw-r--r--src/lib/edje/edje_calc.c8
-rw-r--r--src/lib/edje/edje_edit.c38
-rw-r--r--src/lib/edje/edje_edit.eo3
-rw-r--r--src/lib/edje/edje_legacy.c3
-rw-r--r--src/lib/edje/edje_load.c43
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_smart.c45
-rw-r--r--src/lib/edje/efl_canvas_layout.eo11
-rw-r--r--src/lib/efl/Efl.h1
-rw-r--r--src/lib/efl/interfaces/efl_file.c208
-rw-r--r--src/lib/efl/interfaces/efl_file.eo143
-rw-r--r--src/lib/efl/interfaces/efl_file.h10
-rw-r--r--src/lib/efl/interfaces/efl_gfx_image.eo8
-rw-r--r--src/lib/efl/interfaces/meson.build4
-rw-r--r--src/lib/elementary/efl_ui_bg.c68
-rw-r--r--src/lib/elementary/efl_ui_bg.eo3
-rw-r--r--src/lib/elementary/efl_ui_image.c302
-rw-r--r--src/lib/elementary/efl_ui_image.eo8
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c131
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.eo3
-rw-r--r--src/lib/elementary/efl_ui_layout.c87
-rw-r--r--src/lib/elementary/efl_ui_layout.eo2
-rw-r--r--src/lib/elementary/efl_ui_popup.c24
-rw-r--r--src/lib/elementary/efl_ui_popup_part_backwall.eo2
-rw-r--r--src/lib/elementary/efl_ui_selection_manager.c4
-rw-r--r--src/lib/elementary/efl_ui_text.c53
-rw-r--r--src/lib/elementary/efl_ui_text.eo3
-rw-r--r--src/lib/elementary/efl_ui_text_factory_images.c16
-rw-r--r--src/lib/elementary/efl_ui_video.c26
-rw-r--r--src/lib/elementary/efl_ui_video.eo2
-rw-r--r--src/lib/elementary/efl_ui_widget.c50
-rw-r--r--src/lib/elementary/efl_ui_widget_part_bg.eo4
-rw-r--r--src/lib/elementary/efl_ui_win.c71
-rw-r--r--src/lib/elementary/efl_ui_win_part.eo4
-rw-r--r--src/lib/elementary/elm_entry.c66
-rw-r--r--src/lib/elementary/elm_entry.eo7
-rw-r--r--src/lib/elementary/elm_icon.c30
-rw-r--r--src/lib/elementary/elm_icon.eo2
-rw-r--r--src/lib/elementary/elm_photo.c74
-rw-r--r--src/lib/elementary/elm_photo.eo7
-rw-r--r--src/lib/elementary/elm_thumb.c100
-rw-r--r--src/lib/elementary/elm_thumb.eo4
-rw-r--r--src/lib/elementary/elm_widget_thumb.h1
-rw-r--r--src/lib/emotion/efl_canvas_video.eo4
-rw-r--r--src/lib/emotion/emotion_smart.c41
-rw-r--r--src/lib/evas/canvas/efl_canvas_image.c57
-rw-r--r--src/lib/evas/canvas/efl_canvas_image.eo3
-rw-r--r--src/lib/evas/canvas/efl_canvas_image_internal.eo1
-rw-r--r--src/lib/evas/canvas/efl_canvas_proxy.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c43
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.eo5
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_mesh.c47
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_mesh.eo3
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_texture.c22
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_texture.eo2
-rw-r--r--src/lib/evas/canvas/evas_image.eo2
-rw-r--r--src/lib/evas/canvas/evas_image_legacy.c43
-rw-r--r--src/lib/evas/canvas/evas_image_private.h7
-rw-r--r--src/lib/evas/canvas/evas_object_image.c6
63 files changed, 1195 insertions, 817 deletions
diff --git a/src/lib/ecore/efl_io_file.c b/src/lib/ecore/efl_io_file.c
index c8716d2..041db19 100644
--- a/src/lib/ecore/efl_io_file.c
+++ b/src/lib/ecore/efl_io_file.c
@@ -29,7 +29,6 @@
29 29
30typedef struct _Efl_Io_File_Data 30typedef struct _Efl_Io_File_Data
31{ 31{
32 const char *path;
33 uint32_t flags; 32 uint32_t flags;
34 uint32_t mode; 33 uint32_t mode;
35 uint64_t last_position; 34 uint64_t last_position;
@@ -123,7 +122,7 @@ _efl_io_file_efl_object_constructor(Eo *o, Efl_Io_File_Data *pd)
123} 122}
124 123
125EOLIAN static void 124EOLIAN static void
126_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd) 125_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd EINA_UNUSED)
127{ 126{
128 if (efl_io_closer_close_on_invalidate_get(o) && 127 if (efl_io_closer_close_on_invalidate_get(o) &&
129 (!efl_io_closer_closed_get(o))) 128 (!efl_io_closer_closed_get(o)))
@@ -134,8 +133,6 @@ _efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd)
134 } 133 }
135 134
136 efl_destructor(efl_super(o, MY_CLASS)); 135 efl_destructor(efl_super(o, MY_CLASS));
137
138 eina_stringshare_del(pd->path);
139} 136}
140 137
141EOLIAN static Efl_Object * 138EOLIAN static Efl_Object *
@@ -144,17 +141,18 @@ _efl_io_file_efl_object_finalize(Eo *o, Efl_Io_File_Data *pd)
144 int fd = efl_loop_fd_file_get(o); 141 int fd = efl_loop_fd_file_get(o);
145 if (fd < 0) 142 if (fd < 0)
146 { 143 {
147 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->path, NULL); 144 const char *path = efl_file_get(o);
145 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
148 146
149 if (pd->mode) 147 if (pd->mode)
150 fd = open(pd->path, pd->flags, pd->mode); 148 fd = open(path, pd->flags, pd->mode);
151 else 149 else
152 fd = open(pd->path, pd->flags); 150 fd = open(path, pd->flags);
153 151
154 if (fd < 0) 152 if (fd < 0)
155 { 153 {
156 eina_error_set(errno); 154 eina_error_set(errno);
157 ERR("Could not open file '%s': %s", pd->path, strerror(errno)); 155 ERR("Could not open file '%s': %s", path, strerror(errno));
158 return NULL; 156 return NULL;
159 } 157 }
160 158
@@ -164,22 +162,6 @@ _efl_io_file_efl_object_finalize(Eo *o, Efl_Io_File_Data *pd)
164 return efl_finalize(efl_super(o, MY_CLASS)); 162 return efl_finalize(efl_super(o, MY_CLASS));
165} 163}
166 164
167EOLIAN static Eina_Bool
168_efl_io_file_efl_file_file_set(Eo *o, Efl_Io_File_Data *pd, const char *file, const char *key EINA_UNUSED)
169{
170 EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_finalized_get(o), EINA_FALSE);
171
172 eina_stringshare_replace(&pd->path, file);
173 return EINA_TRUE;
174}
175
176EOLIAN static void
177_efl_io_file_efl_file_file_get(const Eo *o EINA_UNUSED, Efl_Io_File_Data *pd, const char **file, const char **key)
178{
179 if (file) *file = pd->path;
180 if (key) *key = NULL;
181}
182
183EOLIAN static Eina_Error 165EOLIAN static Eina_Error
184_efl_io_file_efl_io_reader_read(Eo *o, Efl_Io_File_Data *pd, Eina_Rw_Slice *rw_slice) 166_efl_io_file_efl_io_reader_read(Eo *o, Efl_Io_File_Data *pd, Eina_Rw_Slice *rw_slice)
185{ 167{
diff --git a/src/lib/ecore/efl_io_file.eo b/src/lib/ecore/efl_io_file.eo
index c663b72..269d46e 100644
--- a/src/lib/ecore/efl_io_file.eo
+++ b/src/lib/ecore/efl_io_file.eo
@@ -51,7 +51,6 @@ class @beta Efl.Io.File extends Efl.Loop_Fd implements Efl.File, Efl.Io.Reader_F
51 Efl.Object.destructor; 51 Efl.Object.destructor;
52 Efl.Object.finalize; 52 Efl.Object.finalize;
53 Efl.Loop_Fd.fd_file { set; } 53 Efl.Loop_Fd.fd_file { set; }
54 Efl.File.file { get; set; }
55 Efl.Io.Reader.read; 54 Efl.Io.Reader.read;
56 Efl.Io.Writer.write; 55 Efl.Io.Writer.write;
57 Efl.Io.Closer.close; 56 Efl.Io.Closer.close;
diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c
index 5f94ebf..b78498a 100644
--- a/src/lib/ecore_con/ecore_con_url.c
+++ b/src/lib/ecore_con/ecore_con_url.c
@@ -1177,7 +1177,7 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
1177 1177
1178 file = efl_add(EFL_IO_FILE_CLASS, efl_loop_get(url_con->dialer), 1178 file = efl_add(EFL_IO_FILE_CLASS, efl_loop_get(url_con->dialer),
1179 efl_name_set(efl_added, "upload-file"), 1179 efl_name_set(efl_added, "upload-file"),
1180 efl_file_set(efl_added, filename, NULL), 1180 efl_file_set(efl_added, filename),
1181 efl_io_file_flags_set(efl_added, O_RDONLY), 1181 efl_io_file_flags_set(efl_added, O_RDONLY),
1182 efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE), 1182 efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE),
1183 efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE)); 1183 efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE));
diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c
index 5466669..4b65c51 100644
--- a/src/lib/ecore_file/ecore_file_download.c
+++ b/src/lib/ecore_file/ecore_file_download.c
@@ -66,7 +66,7 @@ _ecore_file_download_copier_done(void *data, const Efl_Event *event EINA_UNUSED)
66 Efl_Net_Http_Status status = efl_net_dialer_http_response_status_get(job->input); 66 Efl_Net_Http_Status status = efl_net_dialer_http_response_status_get(job->input);
67 const char *file; 67 const char *file;
68 68
69 efl_file_get(job->output, &file, NULL); 69 file = efl_file_get(job->output);
70 70
71 DBG("Finished downloading %s (status=%d) -> %s", 71 DBG("Finished downloading %s (status=%d) -> %s",
72 efl_net_dialer_address_dial_get(job->input), 72 efl_net_dialer_address_dial_get(job->input),
@@ -92,7 +92,7 @@ _ecore_file_download_copier_error(void *data, const Efl_Event *event)
92 Eina_Error *perr = event->info; 92 Eina_Error *perr = event->info;
93 const char *file; 93 const char *file;
94 94
95 efl_file_get(job->output, &file, NULL); 95 file = efl_file_get(job->output);
96 96
97 WRN("Failed downloading %s (status=%d) -> %s: %s", 97 WRN("Failed downloading %s (status=%d) -> %s: %s",
98 efl_net_dialer_address_dial_get(job->input), 98 efl_net_dialer_address_dial_get(job->input),
@@ -127,7 +127,7 @@ _ecore_file_download_copier_progress(void *data, const Efl_Event *event EINA_UNU
127 127
128 if (!job->progress_cb) return; 128 if (!job->progress_cb) return;
129 129
130 efl_file_get(job->output, &file, NULL); 130 file = efl_file_get(job->output);
131 efl_net_dialer_http_progress_download_get(job->input, &dn, &dt); 131 efl_net_dialer_http_progress_download_get(job->input, &dn, &dt);
132 efl_net_dialer_http_progress_upload_get(job->input, &un, &ut); 132 efl_net_dialer_http_progress_upload_get(job->input, &un, &ut);
133 ret = job->progress_cb((void *)job->data, file, dt, dn, ut, un); 133 ret = job->progress_cb((void *)job->data, file, dt, dn, ut, un);
@@ -227,7 +227,7 @@ ecore_file_download_full(const char *url,
227 EINA_SAFETY_ON_NULL_GOTO(job->input, error_input); 227 EINA_SAFETY_ON_NULL_GOTO(job->input, error_input);
228 228
229 job->output = efl_add(EFL_IO_FILE_CLASS, loop, 229 job->output = efl_add(EFL_IO_FILE_CLASS, loop,
230 efl_file_set(efl_added, dst, NULL), 230 efl_file_set(efl_added, dst),
231 efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT), 231 efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT),
232 efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), 232 efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE),
233 efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE), 233 efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE),
@@ -309,7 +309,7 @@ ecore_file_download_abort(Ecore_File_Download_Job *job)
309 return; 309 return;
310 } 310 }
311 311
312 efl_file_get(job->output, &file, NULL); 312 file = efl_file_get(job->output);
313 DBG("Aborting download %s -> %s", 313 DBG("Aborting download %s -> %s",
314 efl_net_dialer_address_dial_get(job->input), 314 efl_net_dialer_address_dial_get(job->input),
315 file); 315 file);
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 1857990..18dd82d 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -3200,17 +3200,17 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U
3200 3200
3201 if (new_svg < 0) 3201 if (new_svg < 0)
3202 { 3202 {
3203 efl_file_set(ep->object, ed->file->path, src_key); 3203 efl_file_simple_load(ep->object, ed->file->path, src_key);
3204 } 3204 }
3205 else 3205 else
3206 { 3206 {
3207 snprintf(dest_key, sizeof(dest_key), "edje/vectors/%i", new_svg); 3207 snprintf(dest_key, sizeof(dest_key), "edje/vectors/%i", new_svg);
3208 3208
3209 efl_file_set(ep->object, ed->file->path, src_key); 3209 efl_file_simple_load(ep->object, ed->file->path, src_key);
3210 src_root = efl_canvas_vg_object_root_node_get(ep->object); 3210 src_root = efl_canvas_vg_object_root_node_get(ep->object);
3211 efl_ref(src_root); 3211 efl_ref(src_root);
3212 3212
3213 efl_file_set(ep->object, ed->file->path, dest_key); 3213 efl_file_simple_load(ep->object, ed->file->path, dest_key);
3214 dest_root = efl_canvas_vg_object_root_node_get(ep->object); 3214 dest_root = efl_canvas_vg_object_root_node_get(ep->object);
3215 efl_ref(dest_root); 3215 efl_ref(dest_root);
3216 3216
@@ -4927,7 +4927,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4927 proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry; 4927 proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry;
4928 if (proxy) 4928 if (proxy)
4929 { 4929 {
4930 efl_file_mmap_set(texture, ed->file->f, proxy); 4930 efl_file_simple_mmap_load(texture, ed->file->f, proxy);
4931 evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2); 4931 evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2);
4932 evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2); 4932 evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2);
4933 } 4933 }
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 010b1af..37133e3 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -238,11 +238,17 @@ _load_scripts(Eo *obj, Edje_Edit *eed)
238 return EINA_TRUE; 238 return EINA_TRUE;
239} 239}
240 240
241EOLIAN static Eina_Bool 241EOLIAN static Eina_Error
242_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group) 242_edje_edit_efl_file_load(Eo *obj, Edje_Edit *eed)
243{ 243{
244 Eina_Error err;
245
246 if (efl_file_loaded_get(obj)) return 0;
247
244 _edje_edit_data_clean(eed); 248 _edje_edit_data_clean(eed);
245 249
250 err = efl_file_load(efl_super(obj, MY_CLASS));
251 if (err) return err;
246 /* TODO and maybes: 252 /* TODO and maybes:
247 * * The whole point of this thing is keep track of stuff such as 253 * * The whole point of this thing is keep track of stuff such as
248 * strings to free and who knows what, so we need to take care 254 * strings to free and who knows what, so we need to take care
@@ -257,34 +263,10 @@ _edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const ch
257 * groups). 263 * groups).
258 * P.S. don't forget about mmap version below 264 * P.S. don't forget about mmap version below
259 */ 265 */
260 file = eina_vpath_resolve(file);
261
262 Eina_Bool int_ret;
263 int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group);
264
265 if (!int_ret)
266 return EINA_FALSE;
267
268 if (!_load_scripts(obj, eed))
269 return EINA_FALSE;
270
271 return EINA_TRUE;
272}
273
274EOLIAN static Eina_Bool
275_edje_edit_efl_file_mmap_set(Eo *obj, Edje_Edit *eed, const Eina_File *mmap, const char *group)
276{
277 _edje_edit_data_clean(eed);
278
279 Eina_Bool int_ret;
280 int_ret = efl_file_mmap_set(efl_super(obj, MY_CLASS), mmap, group);
281 if (!int_ret)
282 return EINA_FALSE;
283
284 if (!_load_scripts(obj, eed)) 266 if (!_load_scripts(obj, eed))
285 return EINA_FALSE; 267 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
286 268
287 return EINA_TRUE; 269 return 0;
288} 270}
289 271
290EAPI Evas_Object * 272EAPI Evas_Object *
diff --git a/src/lib/edje/edje_edit.eo b/src/lib/edje/edje_edit.eo
index a7bb40a..61ae265 100644
--- a/src/lib/edje/edje_edit.eo
+++ b/src/lib/edje/edje_edit.eo
@@ -10,7 +10,6 @@ class Edje.Edit extends Efl.Canvas.Layout
10 implements { 10 implements {
11 Efl.Object.constructor; 11 Efl.Object.constructor;
12 Efl.Object.destructor; 12 Efl.Object.destructor;
13 Efl.File.file { set; } 13 Efl.File.load;
14 Efl.File.mmap { set; }
15 } 14 }
16} 15}
diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index fead8b0..5906ff1 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -5,11 +5,8 @@
5EAPI Edje_Load_Error 5EAPI Edje_Load_Error
6edje_object_load_error_get(const Eo *obj) 6edje_object_load_error_get(const Eo *obj)
7{ 7{
8 Efl_Gfx_Image_Load_Error p = efl_file_load_error_get(obj);
9 Edje *ed; 8 Edje *ed;
10 9
11 if (p != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return EDJE_LOAD_ERROR_DOES_NOT_EXIST;
12
13 ed = _edje_fetch(obj); 10 ed = _edje_fetch(obj);
14 if (!ed) return EDJE_LOAD_ERROR_GENERIC; 11 if (!ed) return EDJE_LOAD_ERROR_GENERIC;
15 return ed->load_error; 12 return ed->load_error;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 360365c..9256d43 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -159,19 +159,21 @@ static int _sort_defined_boxes(const void *a, const void *b);
159 159
160/************************** API Routines **************************/ 160/************************** API Routines **************************/
161 161
162EOLIAN void 162EOLIAN const char *
163_efl_canvas_layout_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed, const char **file, const char **group) 163_efl_canvas_layout_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed)
164{ 164{
165 if (file) *file = ed->path; 165 return ed->path;
166 if (group) *group = ed->group;
167} 166}
168 167
169EOLIAN Efl_Gfx_Image_Load_Error 168EOLIAN const char *
170_efl_canvas_layout_efl_file_load_error_get(const Eo *obj, Edje *ed) 169_efl_canvas_layout_efl_file_group_get(Eo *obj EINA_UNUSED, Edje *ed)
171{ 170{
172 Efl_Gfx_Image_Load_Error p = efl_file_load_error_get(efl_super(obj, EFL_CANVAS_LAYOUT_CLASS)); 171 return ed->group;
172}
173 173
174 if (p != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return p; 174EOLIAN Efl_Gfx_Image_Load_Error
175_efl_canvas_layout_layout_load_error_get(const Eo *obj EINA_UNUSED, Edje *ed)
176{
175 switch (ed->load_error) 177 switch (ed->load_error)
176 { 178 {
177 case EDJE_LOAD_ERROR_NONE: return EFL_GFX_IMAGE_LOAD_ERROR_NONE; 179 case EDJE_LOAD_ERROR_NONE: return EFL_GFX_IMAGE_LOAD_ERROR_NONE;
@@ -184,8 +186,9 @@ _efl_canvas_layout_efl_file_load_error_get(const Eo *obj, Edje *ed)
184 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: return EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE; 186 case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: return EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE;
185 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION; 187 case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION;
186 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: return EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE; 188 case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: return EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE;
187 default: return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; 189 default: break;
188 } 190 }
191 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
189} 192}
190 193
191EAPI const char * 194EAPI const char *
@@ -761,7 +764,7 @@ _edje_devices_add(Edje *ed, Evas *tev)
761 _edje_device_changed_cb, ed); 764 _edje_device_changed_cb, ed);
762} 765}
763 766
764int 767Eina_Error
765_edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested) 768_edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested)
766{ 769{
767 Edje *ed; 770 Edje *ed;
@@ -782,12 +785,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
782 Edje_Nested_Support *st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL; 785 Edje_Nested_Support *st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL;
783 786
784 ed = _edje_fetch(obj); 787 ed = _edje_fetch(obj);
785 if (!ed) return 0; 788 if (!ed) return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
786 if (!group) group = ""; 789 if (!group) group = "";
787 if ((ed->file) && (ed->file->f == file) && 790 if ((ed->file) && (ed->file->f == file) &&
788 (ed->group) && (!strcmp(group, ed->group))) 791 (ed->group) && (!strcmp(group, ed->group)))
789 { 792 {
790 return 1; 793 return 0;
791 } 794 }
792 795
793 tev = evas_object_evas_get(obj); 796 tev = evas_object_evas_get(obj);
@@ -840,7 +843,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
840 { 843 {
841 ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE; 844 ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
842 _edje_file_del(ed); 845 _edje_file_del(ed);
843 return 0; 846 return EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE;
844 } 847 }
845 eina_array_step_set(&parts, sizeof (Eina_Array), 8); 848 eina_array_step_set(&parts, sizeof (Eina_Array), 8);
846 849
@@ -1009,7 +1012,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1009 eina_mempool_free(_edje_real_part_mp, rp); 1012 eina_mempool_free(_edje_real_part_mp, rp);
1010 evas_event_thaw(tev); 1013 evas_event_thaw(tev);
1011 evas_event_thaw_eval(tev); 1014 evas_event_thaw_eval(tev);
1012 return 0; 1015 return EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
1013 } 1016 }
1014 1017
1015 _edje_ref(ed); 1018 _edje_ref(ed);
@@ -1106,7 +1109,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1106 1109
1107 if (pd_mesh_node->mesh_node.mesh.primitive == EVAS_CANVAS3D_MESH_PRIMITIVE_NONE) 1110 if (pd_mesh_node->mesh_node.mesh.primitive == EVAS_CANVAS3D_MESH_PRIMITIVE_NONE)
1108 { 1111 {
1109 efl_file_set(mesh, ed->file->model_dir->entries[pd_mesh_node->mesh_node.mesh.id].entry, NULL); 1112 efl_file_simple_load(mesh, ed->file->model_dir->entries[pd_mesh_node->mesh_node.mesh.id].entry, NULL);
1110 } 1113 }
1111 else 1114 else
1112 { 1115 {
@@ -1460,6 +1463,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1460 1463
1461 do 1464 do
1462 { 1465 {
1466 Eina_Error load_error;
1463 child_obj = edje_object_add(ed->base.evas); 1467 child_obj = edje_object_add(ed->base.evas);
1464 edje_object_mirrored_set(child_obj, edje_object_mirrored_get(ed->obj)); 1468 edje_object_mirrored_set(child_obj, edje_object_mirrored_get(ed->obj));
1465 1469
@@ -1469,7 +1473,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1469 _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); 1473 _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE);
1470 } 1474 }
1471 1475
1472 if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested)) 1476 load_error = _edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested);
1477 if (load_error)
1473 { 1478 {
1474 ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'", 1479 ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'",
1475 rp->part->name, group_path_entry, eina_file_filename_get(file), source); 1480 rp->part->name, group_path_entry, eina_file_filename_get(file), source);
@@ -1724,11 +1729,11 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1724 eina_array_flush(&parts); 1729 eina_array_flush(&parts);
1725 evas_event_thaw(tev); 1730 evas_event_thaw(tev);
1726 evas_event_thaw_eval(tev); 1731 evas_event_thaw_eval(tev);
1727 return 1; 1732 return 0;
1728 } 1733 }
1729 evas_event_thaw(tev); 1734 evas_event_thaw(tev);
1730 evas_event_thaw_eval(tev); 1735 evas_event_thaw_eval(tev);
1731 return 0; 1736 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
1732 1737
1733on_error: 1738on_error:
1734 eina_list_free(textblocks); 1739 eina_list_free(textblocks);
@@ -1748,7 +1753,7 @@ on_error:
1748 } 1753 }
1749 evas_event_thaw(tev); 1754 evas_event_thaw(tev);
1750 evas_event_thaw_eval(tev); 1755 evas_event_thaw_eval(tev);
1751 return 0; 1756 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
1752} 1757}
1753 1758
1754void 1759void
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 25a0002..a92e5b1 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2572,7 +2572,7 @@ Eina_Bool _edje_signal_callback_disable(Edje_Signal_Callback_Group *cgp,
2572EAPI void _edje_edd_init(void); 2572EAPI void _edje_edd_init(void);
2573EAPI void _edje_edd_shutdown(void); 2573EAPI void _edje_edd_shutdown(void);
2574 2574
2575int _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested); 2575Eina_Error _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested);
2576 2576
2577void _edje_file_callbacks_del(Edje *ed, Evas *e); 2577void _edje_file_callbacks_del(Edje *ed, Evas *e);
2578void _edje_file_del(Edje *ed); 2578void _edje_file_del(Edje *ed);
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index b7ca9c0..14f3d50 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -95,7 +95,7 @@ _efl_canvas_layout_efl_object_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Ef
95 Edje_Load_Error error; 95 Edje_Load_Error error;
96 96
97 const char *file, *edje_group; 97 const char *file, *edje_group;
98 efl_file_get(eo_obj, &file, &edje_group); 98 efl_file_simple_get(eo_obj, &file, &edje_group);
99 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); 99 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
100 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); 100 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
101 101
@@ -402,50 +402,55 @@ _efl_canvas_layout_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Edje *e
402 _edje_recalc_do(ed); 402 _edje_recalc_do(ed);
403} 403}
404 404
405EOLIAN static Eina_Bool 405EOLIAN static Eina_Error
406_efl_canvas_layout_efl_file_mmap_set(Eo *obj, Edje *pd EINA_UNUSED, 406_efl_canvas_layout_efl_file_load(Eo *obj, Edje *ed)
407 const Eina_File *f, const char *key)
408{ 407{
409 Eina_Bool ret; 408 Eina_Error err;
410 Eina_Array *nested; 409 Eina_Array *nested;
411 410
412 ret = EINA_FALSE; 411 if (efl_file_loaded_get(obj)) return 0;
412
413 err = efl_file_load(efl_super(obj, MY_CLASS));
414 if (err)
415 {
416 if (err == ENOENT)
417 ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
418 else if (err == ENOMEM)
419 ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
420 else if ((err == EPERM) || (err == EACCES))
421 ed->load_error = EDJE_LOAD_ERROR_PERMISSION_DENIED;
422 else
423 ed->load_error = EDJE_LOAD_ERROR_GENERIC;
424 return err;
425 }
413 426
414 nested = eina_array_new(8); 427 nested = eina_array_new(8);
415 428
416 if (_edje_object_file_set_internal(obj, f, key, NULL, NULL, nested)) 429 err = _edje_object_file_set_internal(obj, efl_file_mmap_get(obj), efl_file_key_get(obj), NULL, NULL, nested);
417 ret = EINA_TRUE;
418 430
419 eina_array_free(nested); 431 eina_array_free(nested);
420 _edje_object_orientation_inform(obj); 432 _edje_object_orientation_inform(obj);
421 433
422 return ret; 434 return err;
423}
424
425EOLIAN static void
426_efl_canvas_layout_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Edje *pd,
427 const Eina_File **f, const char **key)
428{
429 if (f) *f = pd->file ? pd->file->f : NULL;
430 if (key) *key = pd->group;
431} 435}
432 436
433EAPI Eina_Bool 437EAPI Eina_Bool
434edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group) 438edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group)
435{ 439{
436 return efl_file_mmap_set(obj, file, group); 440 return efl_file_simple_mmap_load(obj, file, group);
437} 441}
438 442
439EAPI Eina_Bool 443EAPI Eina_Bool
440edje_object_file_set(Edje_Object *obj, const char *file, const char *group) 444edje_object_file_set(Edje_Object *obj, const char *file, const char *group)
441{ 445{
442 return efl_file_set(obj, file, group); 446 return efl_file_simple_load(obj, file, group);
443} 447}
444 448
445EAPI void 449EAPI void
446edje_object_file_get(const Edje_Object *obj, const char **file, const char **group) 450edje_object_file_get(const Edje_Object *obj, const char **file, const char **group)
447{ 451{
448 efl_file_get((Edje_Object *)obj, file, group); 452 if (file) *file = efl_file_get(obj);
453 if (group) *group = efl_file_key_get(obj);
449} 454}
450 455
451EOLIAN static void 456EOLIAN static void
diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo
index d61ef89..5acf87f 100644
--- a/src/lib/edje/efl_canvas_layout.eo
+++ b/src/lib/edje/efl_canvas_layout.eo
@@ -72,6 +72,14 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.
72 device: Efl.Input.Device; [[The seat device]] 72 device: Efl.Input.Device; [[The seat device]]
73 } 73 }
74 } 74 }
75 @property layout_load_error {
76 get {
77 [[Gets the (last) file loading error for a given object.]]
78 }
79 values {
80 error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]]
81 }
82 }
75 } 83 }
76 events { 84 events {
77 part,invalid @beta: string; [[Emitted when trying to use an invalid part. 85 part,invalid @beta: string; [[Emitted when trying to use an invalid part.
@@ -113,8 +121,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.
113 Efl.Ui.I18n.mirrored { set; get; } 121 Efl.Ui.I18n.mirrored { set; get; }
114 Efl.Ui.I18n.language { set; get; } 122 Efl.Ui.I18n.language { set; get; }
115 Efl.Gfx.Entity.scale { set; get; } 123 Efl.Gfx.Entity.scale { set; get; }
116 Efl.File.load_error { get; } 124 Efl.File.load;
117 Efl.File.mmap { get; set; }
118 Efl.Container.content_remove; 125 Efl.Container.content_remove;
119 Efl.Container.content_iterate; 126 Efl.Container.content_iterate;
120 Efl.Container.content_count; 127 Efl.Container.content_count;
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 46fd921..a398c11 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -82,6 +82,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
82#include "interfaces/efl_config.eo.h" 82#include "interfaces/efl_config.eo.h"
83#include "interfaces/efl_control.eo.h" 83#include "interfaces/efl_control.eo.h"
84#include "interfaces/efl_duplicate.eo.h" 84#include "interfaces/efl_duplicate.eo.h"
85#include "interfaces/efl_file.h"
85#include "interfaces/efl_file.eo.h" 86#include "interfaces/efl_file.eo.h"
86#include "interfaces/efl_file_save.eo.h" 87#include "interfaces/efl_file_save.eo.h"
87#include "interfaces/efl_gfx_image.eo.h" 88#include "interfaces/efl_gfx_image.eo.h"
diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c
index d1c86ee..3acdc17 100644
--- a/src/lib/efl/interfaces/efl_file.c
+++ b/src/lib/efl/interfaces/efl_file.c
@@ -7,56 +7,210 @@
7typedef struct _Efl_File_Data Efl_File_Data; 7typedef struct _Efl_File_Data Efl_File_Data;
8struct _Efl_File_Data 8struct _Efl_File_Data
9{ 9{
10 Efl_Gfx_Image_Load_Error error; 10 Eina_Stringshare *vpath; /* efl_file_set */
11 Eina_Stringshare *key; /* efl_file_key_set */
12 Eina_File *file; /* efl_file_mmap_set */
13 Eina_Bool file_opened : 1; /* if `file` was opened implicitly during load */
14 Eina_Bool setting : 1; /* set when this file is internally calling methods to avoid infinite recursion */
15 Eina_Bool loaded : 1; /* whether the currently set file properties have been loaded */
11}; 16};
12 17
13static Eina_Bool 18EOLIAN static void
14_efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file, const char *key) 19_efl_file_unload(Eo *obj, Efl_File_Data *pd)
15{ 20{
16 char *tmp = NULL; 21 if (!pd->loaded) return;
17 Eina_File *f = NULL; 22 if (!pd->file) return;
18 Eina_Bool r = EINA_FALSE; 23 if (!pd->file_opened) return;
24 pd->setting = 1;
25 eina_file_close(pd->file);
26 efl_file_mmap_set(obj, NULL);
27 pd->setting = 0;
28 pd->loaded = pd->file_opened = EINA_FALSE;
29}
19 30
20 pd->error = EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; 31EOLIAN static Eina_Error
32_efl_file_load(Eo *obj, Efl_File_Data *pd)
33{
34 Eina_Error ret = 0;
21 35
22 tmp = (char*)(file); 36 if (pd->loaded) return 0;
23 if (tmp) 37 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->vpath, ENOENT);
38 errno = 0;
39 if (!pd->file)
24 { 40 {
25 tmp = eina_vpath_resolve(tmp); 41 Eina_File *f;
42 f = eina_file_open(pd->vpath, EINA_FALSE);
43 if (!f) return errno;
44 pd->file_opened = EINA_TRUE;
45 pd->setting = 1;
46 ret = efl_file_mmap_set(obj, f);
47 pd->setting = 0;
48 if (ret) pd->file_opened = EINA_FALSE;
49 eina_file_close(f);
26 } 50 }
51 pd->loaded = !ret;
52 return ret;
53}
27 54
28 if (tmp) 55EOLIAN static Eina_Error
56_efl_file_mmap_set(Eo *obj, Efl_File_Data *pd, const Eina_File *f)
57{
58 Eina_Error err = 0;
59 Eina_File *file = NULL;
60
61 if (f == pd->file) return 0;
62 if (f)
63 {
64 file = eina_file_dup(f);
65 if (!file) return errno;
66 }
67 if (pd->file) eina_file_close(pd->file);
68 pd->file = file;
69 pd->loaded = EINA_FALSE;
70
71 if (!pd->setting)
29 { 72 {
30 f = eina_file_open(tmp, EINA_FALSE); 73 /* avoid infinite recursion */
31 if (!f) goto on_error; 74 pd->setting = 1;
75 err = efl_file_set(obj, eina_file_filename_get(pd->file));
76 pd->setting = 0;
32 } 77 }
78 return err;
79}
33 80
34 pd->error = EFL_GFX_IMAGE_LOAD_ERROR_NONE; 81EOLIAN static const Eina_File *
82_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
83{
84 return pd->file;
85}
35 86
36 r = efl_file_mmap_set(obj, f, key); 87EOLIAN static Eina_Error
37 if (f) eina_file_close(f); 88_efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file)
89{
90 char *tmp;
91 Eina_Error err = 0;
92 Eina_Bool same;
38 93
39 on_error: 94 tmp = (char*)(file);
95 if (tmp)
96 tmp = eina_vpath_resolve(tmp);
40 97
98 same = !eina_stringshare_replace(&pd->vpath, tmp ?: file);
41 free(tmp); 99 free(tmp);
42 return r; 100 if (same) return err;
101 pd->loaded = EINA_FALSE;
102 if (!pd->setting)
103 {
104 pd->setting = 1;
105 err = efl_file_mmap_set(obj, NULL);
106 pd->setting = 0;
107 }
108 return err;
43} 109}
44 110
45static void 111EOLIAN static Eina_Stringshare *
46_efl_file_file_get(const Eo *obj, Efl_File_Data *pd EINA_UNUSED, const char **file, const char **key) 112_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
47{ 113{
48 const Eina_File *f = NULL; 114 return pd->vpath;
115}
49 116
50 efl_file_mmap_get(obj, &f, key); 117EOLIAN static void
118_efl_file_key_set(Eo *obj EINA_UNUSED, Efl_File_Data *pd, const char *key)
119{
120 if (eina_stringshare_replace(&pd->key, key))
121 pd->loaded = 0;
122}
51 123
52 if (f && file) *file = eina_file_filename_get(f); 124EOLIAN static Eina_Stringshare *
53 else if (file) *file = NULL; 125_efl_file_key_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
126{
127 return pd->key;
128}
129
130EOLIAN static Eina_Bool
131_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
132{
133 return pd->loaded;
134}
135
136EOLIAN static void
137_efl_file_efl_object_destructor(Eo *obj, Efl_File_Data *pd)
138{
139 eina_stringshare_del(pd->vpath);
140 eina_stringshare_del(pd->key);
141 eina_file_close(pd->file);
142 efl_destructor(efl_super(obj, EFL_FILE_MIXIN));
143}
144
145EOLIAN static Eo *
146_efl_file_efl_object_finalize(Eo *obj, Efl_File_Data *pd)
147{
148 obj = efl_finalize(efl_super(obj, EFL_FILE_MIXIN));
149 if (!obj) return NULL;
150 if (pd->file || pd->vpath) efl_file_load(obj);
151 return obj;
152}
153
154////////////////////////////////////////////////////////////////////////////
155
156EAPI Eina_Bool
157efl_file_simple_load(Eo *obj, const char *file, const char *key)
158{
159 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
160 efl_ref(obj);
161 EINA_SAFETY_ON_TRUE_GOTO(efl_file_set(obj, file), fail);
162 efl_file_key_set(obj, key);
163 if (file)
164 {
165 if (efl_file_load(obj)) goto fail;
166 efl_unref(obj);
167 return EINA_TRUE;
168 }
169 efl_file_unload(obj);
170 efl_unref(obj);
171 return EINA_TRUE;
172fail:
173 efl_unref(obj);
174 return EINA_FALSE;
175}
176
177EAPI Eina_Bool
178efl_file_simple_mmap_load(Eo *obj, const Eina_File *file, const char *key)
179{
180 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
181 efl_ref(obj);
182 EINA_SAFETY_ON_TRUE_GOTO(efl_file_mmap_set(obj, file), fail);
183 efl_file_key_set(obj, key);
184 if (file)
185 {
186 if (efl_file_load(obj)) goto fail;
187 efl_unref(obj);
188 return EINA_TRUE;
189 }
190 efl_file_unload(obj);
191 efl_unref(obj);
192 return EINA_TRUE;
193fail:
194 efl_unref(obj);
195 return EINA_FALSE;
196}
197
198EAPI void
199efl_file_simple_get(const Eo *obj, const char **file, const char **key)
200{
201 efl_ref((Eo*)obj);
202 if (file) *file = efl_file_get(obj);
203 if (key) *key = efl_file_key_get(obj);
204 efl_unref((Eo*)obj);
54} 205}
55 206
56static Efl_Gfx_Image_Load_Error 207EAPI void
57_efl_file_load_error_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) 208efl_file_simple_mmap_get(const Eo *obj, const Eina_File **file, const char **key)
58{ 209{
59 return pd->error; 210 efl_ref((Eo*)obj);
211 if (file) *file = efl_file_mmap_get(obj);
212 if (key) *key = efl_file_key_get(obj);
213 efl_unref((Eo*)obj);
60} 214}
61 215
62#include "interfaces/efl_file.eo.c" 216#include "interfaces/efl_file.eo.c"
diff --git a/src/lib/efl/interfaces/efl_file.eo b/src/lib/efl/interfaces/efl_file.eo
index 8d98a00..985b3fd 100644
--- a/src/lib/efl/interfaces/efl_file.eo
+++ b/src/lib/efl/interfaces/efl_file.eo
@@ -1,93 +1,108 @@
1import eina_types; 1import eina_types;
2import efl_gfx_types; 2import efl_gfx_types;
3 3
4mixin @beta Efl.File { 4mixin @beta Efl.File requires Efl.Object {
5 [[Efl file interface]] 5 [[Efl file interface]]
6 methods { 6 methods {
7 @property load_error { 7 @property mmap {
8 set {
9 [[Set the mmaped file from where an object will fetch the real
10 data (it must be an Eina_File).
11
12 If mmap is set during object construction, the object will automatically
13 call @.load during the finalize phase of construction.
14
15 ]]
16
17 return: Eina.Error; [[0 on success, error code otherwise]]
18 }
8 get { 19 get {
9 [[Gets the (last) file loading error for a given object.]] 20 [[Get the mmaped file from where an object will fetch the real
21 data (it must be an Eina_File).
22
23 ]]
10 } 24 }
11 values { 25 values {
12 error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]] 26 f: ptr(const(Eina.File)); [[The handle to an Eina_File that will be used]]
13 } 27 }
14 } 28 }
15 @property mmap { 29 @property file {
16 set @pure_virtual { 30 set {
17 [[Set the source mmaped file from where an image object must fetch the real 31 [[Set the file path from where an object will fetch the data.
18 image data (it must be an Eina_File).
19
20 If the file supports multiple data stored in it (as Eet files do),
21 you can specify the key to be used as the index of the image in
22 this file.
23 32
24 @since 1.8]] 33 If file is set during object construction, the object will automatically
34 call @.load during the finalize phase of construction.
35 ]]
25 36
26 return: bool; [[$true on success, $false otherwise]] 37 return: Eina.Error; [[0 on success, error code otherwise]]
27 } 38 }
28 get @pure_virtual { 39 get {
29 [[Get the source mmaped file from where an image object must fetch the real 40 [[Retrieve the file path from where an object is to fetch the data.
30 image data (it must be an Eina_File).
31
32 If the file supports multiple data stored in it (as Eet files do),
33 you can get the key to be used as the index of the image in
34 this file.
35 41
36 @since 1.10]] 42 You must not modify the strings on the returned pointers.]]
37 } 43 }
38 values { 44 values {
39 f: ptr(const(Eina.File)); [[The handler to an Eina_File that will be used as image source]] 45 file: string; [[The file path.]]
40 key: string @optional; [[The group that the image belongs to, in case
41 it's an EET(including Edje case) file. This can be used
42 as a key inside evas image cache if this is a normal image
43 file not eet file.]]
44 } 46 }
45 } 47 }
46 @property file { 48 @property key {
47 set { 49 set {
48 [[Set the source file from where an image object must fetch the real 50 [[Set the key which corresponds to the target data within a file.
49 image data (it may be an Eet file, besides pure image ones). 51
50 52 Some filetypes can contain multiple data streams which are indexed by
51 If the file supports multiple data stored in it (as Eet files do), 53 a key. Use this property for such cases.
52 you can specify the key to be used as the index of the image in 54 ]]
53 this file.]]
54
55 /* FIXME-doc
56 * Example:
57 * @code
58 * img = evas_object_image_add(canvas);
59 * evas_object_image_file_set(img, "/path/to/img", NULL);
60 * err = evas_object_image_load_error_get(img);
61 * if (err != EVAS_LOAD_ERROR_NONE)
62 * {
63 * fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n",
64 * valid_path, evas_load_error_str(err));
65 * }
66 * else
67 * {
68 * evas_object_image_fill_set(img, 0, 0, w, h);
69 * evas_object_resize(img, w, h);
70 * evas_object_show(img);
71 * }
72 * @endcode
73 */
74
75 return: bool; [[$true on success, $false otherwise]]
76 } 55 }
77 get { 56 get {
78 [[Retrieve the source file from where an image object is to fetch the 57 [[Get the previously-set key which corresponds to the target data within a file.
79 real image data (it may be an Eet file, besides pure image ones).
80 58
81 You must not modify the strings on the returned pointers. 59 Some filetypes can contain multiple data streams which are indexed by
60 a key. Use this property for such cases.
82 61
83 Note: Use $null pointers on the file components you're not 62 You must not modify the strings on the returned pointers.]]
84 interested in: they'll be ignored by the function.]]
85 } 63 }
86 values { 64 values {
87 file: string; [[The image file path.]] 65 key: string; [[The group that the image belongs to, in case
88 key: string; [[The image key in $file (if its an Eet one), or 66 it's an EET(including Edje case) file. This can be used
89 $null, otherwise.]] 67 as a key inside evas image cache if this is a normal image
68 file not eet file.]]
90 } 69 }
91 } 70 }
71 @property loaded {
72 get {
73 [[Get the load state of the object.
74 ]]
75 }
76 values {
77 loaded: bool; [[True if the object is loaded, otherwise false.]]
78 }
79 }
80
81 load {
82 [[Perform all necessary operations to open and load file data into the object
83 using the @.file (or @.mmap) and @.key properties.
84
85 In the case where @.file.set has been called on an object, this will internally
86 open the file and call @.mmap.set on the object using the opened file handle.
87
88 Calling @.load on an object which has already performed file operations based on
89 the currently set properties will have no effect.]]
90
91 return: Eina.Error; [[0 on success, error code otherwise]]
92 }
93
94 unload {
95 [[Perform all necessary operations to unload file data from the object.
96
97 In the case where @.mmap.set has been externally called on an object, the file handle
98 stored in the object will be preserved.
99
100 Calling @.unload on an object which is not currently loaded will have no effect.
101 ]]
102 }
103 }
104 implements {
105 Efl.Object.destructor;
106 Efl.Object.finalize;
92 } 107 }
93} 108}
diff --git a/src/lib/efl/interfaces/efl_file.h b/src/lib/efl/interfaces/efl_file.h
new file mode 100644
index 0000000..d045714
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_file.h
@@ -0,0 +1,10 @@
1#ifndef _EFL_FILE_H
2# define _EFL_FILE_H
3
4/* add doc note about needing ref/unref when passing efl_part to these functions */
5EAPI Eina_Bool efl_file_simple_load(Eo *obj, const char *file, const char *key);
6EAPI Eina_Bool efl_file_simple_mmap_load(Eo *obj, const Eina_File *file, const char *key);
7EAPI void efl_file_simple_get(const Eo *obj, const char **file, const char **key);
8EAPI void efl_file_simple_mmap_get(const Eo *obj, const Eina_File **file, const char **key);
9
10#endif
diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo b/src/lib/efl/interfaces/efl_gfx_image.eo
index 420bb81..eb23f3f 100644
--- a/src/lib/efl/interfaces/efl_gfx_image.eo
+++ b/src/lib/efl/interfaces/efl_gfx_image.eo
@@ -203,6 +203,14 @@ interface @beta Efl.Gfx.Image
203 see @Efl.Gfx.Image_Scale_Hint]] 203 see @Efl.Gfx.Image_Scale_Hint]]
204 } 204 }
205 } 205 }
206 @property image_load_error {
207 get {
208 [[Gets the (last) file loading error for a given object.]]
209 }
210 values {
211 error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]]
212 }
213 }
206 } 214 }
207 events { 215 events {
208 preload: void; [[Image data has been preloaded.]] 216 preload: void; [[Image data has been preloaded.]]
diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build
index 7483903..d91ea66 100644
--- a/src/lib/efl/interfaces/meson.build
+++ b/src/lib/efl/interfaces/meson.build
@@ -183,4 +183,8 @@ efl_src += files([
183# 'efl_common_internal.h' 183# 'efl_common_internal.h'
184#]) 184#])
185 185
186install_headers('efl_file.h',
187 install_dir : join_paths(dir_package_include, 'interfaces'),
188)
189
186eolian_include_directories += ['-I', meson.current_source_dir()] 190eolian_include_directories += ['-I', meson.current_source_dir()]
diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c
index 90bb506..54b29d9 100644
--- a/src/lib/elementary/efl_ui_bg.c
+++ b/src/lib/elementary/efl_ui_bg.c
@@ -210,48 +210,76 @@ _efl_ui_bg_efl_gfx_image_load_controller_load_size_get(const Eo *obj EINA_UNUSED
210EAPI Eina_Bool 210EAPI Eina_Bool
211elm_bg_file_set(Eo *obj, const char *file, const char *group) 211elm_bg_file_set(Eo *obj, const char *file, const char *group)
212{ 212{
213 return efl_file_set((Eo *) obj, file, group); 213 return efl_file_simple_load((Eo *) obj, file, group);
214} 214}
215 215
216EOLIAN static Eina_Bool 216EOLIAN static Eina_Error
217_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file, const char *key) 217_efl_ui_bg_efl_file_load(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
218{
219 return efl_file_load(sd->img);
220}
221
222EOLIAN static Eina_Error
223_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file)
218{ 224{
219 eina_stringshare_replace(&sd->file, file); 225 eina_stringshare_replace(&sd->file, file);
226
227 return efl_file_set(sd->img, file);
228}
229
230EOLIAN static void
231_efl_ui_bg_efl_file_key_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *key)
232{
220 eina_stringshare_replace(&sd->key, key); 233 eina_stringshare_replace(&sd->key, key);
221 234
222 return efl_file_set(sd->img, file, key); 235 efl_file_key_set(sd->img, key);
223} 236}
237
224EAPI void 238EAPI void
225elm_bg_file_get(const Eo *obj, const char **file, const char **group) 239elm_bg_file_get(const Eo *obj, const char **file, const char **group)
226{ 240{
227 efl_file_get((Eo *) obj, file, group); 241 efl_file_simple_get((Eo *) obj, file, group);
228} 242}
229 243
230EOLIAN static void 244EOLIAN static const char *
231_efl_ui_bg_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Data *sd, const char **file, const char **key) 245_efl_ui_bg_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Data *sd)
232{ 246{
233 if (elm_widget_is_legacy(obj)) 247 if (elm_widget_is_legacy(obj))
234 { 248 return sd->file;
235 if (file) *file = sd->file;
236 if (key) *key = sd->key;
237 return;
238 }
239 249
240 efl_file_get(sd->img, file, key); 250 return efl_file_get(sd->img);
241} 251}
242 252
243EOLIAN static Eina_Bool 253EOLIAN static const char *
254_efl_ui_bg_efl_file_key_get(const Eo *obj, Efl_Ui_Bg_Data *sd)
255{
256 if (elm_widget_is_legacy(obj))
257 return sd->key;
258
259 return efl_file_key_get(sd->img);
260}
261
262EOLIAN static Eina_Error
244_efl_ui_bg_efl_file_mmap_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, 263_efl_ui_bg_efl_file_mmap_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd,
245 const Eina_File *file, const char *key) 264 const Eina_File *file)
246{ 265{
247 return efl_file_mmap_set(sd->img, file, key); 266 return efl_file_mmap_set(sd->img, file);
248} 267}
249 268
250EOLIAN static void 269EOLIAN static const Eina_File *
251_efl_ui_bg_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, 270_efl_ui_bg_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
252 const Eina_File **file, const char **key)
253{ 271{
254 efl_file_mmap_get(sd->img, file, key); 272 return efl_file_mmap_get(sd->img);
273}
274
275
276EOLIAN static Eo *
277_efl_ui_bg_efl_object_finalize(Eo *obj, Efl_Ui_Bg_Data *sd)
278{
279 obj = efl_finalize(efl_super(obj, MY_CLASS));
280 if (!obj) return NULL;
281 if (efl_file_get(sd->img) || efl_file_mmap_get(sd->img)) efl_file_load(sd->img);
282 return obj;
255} 283}
256 284
257/* Internal EO APIs and hidden overrides */ 285/* Internal EO APIs and hidden overrides */
diff --git a/src/lib/elementary/efl_ui_bg.eo b/src/lib/elementary/efl_ui_bg.eo
index b928549..6809b7f 100644
--- a/src/lib/elementary/efl_ui_bg.eo
+++ b/src/lib/elementary/efl_ui_bg.eo
@@ -9,7 +9,10 @@ class @beta Efl.Ui.Bg extends Efl.Ui.Layout implements Efl.Gfx.Color, Efl.Gfx.Im
9 implements { 9 implements {
10 Efl.Object.constructor; 10 Efl.Object.constructor;
11 Efl.Object.destructor; 11 Efl.Object.destructor;
12 Efl.Object.finalize;
13 Efl.File.load;
12 Efl.File.file { get; set; } 14 Efl.File.file { get; set; }
15 Efl.File.key { get; set; }
13 Efl.File.mmap { get; set; } 16 Efl.File.mmap { get; set; }
14 Efl.Gfx.Color.color { get; set; } 17 Efl.Gfx.Color.color { get; set; }
15 Efl.Gfx.Image.scale_type { get; set; } 18 Efl.Gfx.Image.scale_type { get; set; }
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 90ec820..d4089ed 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -46,11 +46,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
46}; 46};
47 47
48static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params); 48static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
49static Eina_Bool _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file, const Eina_File *f, const char *key); 49static Eina_Error _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd);
50static void _efl_ui_image_remote_copier_cancel(Eo *obj, Efl_Ui_Image_Data *sd); 50static void _efl_ui_image_remote_copier_cancel(Eo *obj, Efl_Ui_Image_Data *sd);
51void _efl_ui_image_sizing_eval(Evas_Object *obj); 51void _efl_ui_image_sizing_eval(Evas_Object *obj);
52static void _efl_ui_image_model_properties_changed_cb(void *data, const Efl_Event *event); 52static void _efl_ui_image_model_properties_changed_cb(void *data, const Efl_Event *event);
53static void _on_size_hints_changed(void *data, const Efl_Event *e); 53static void _on_size_hints_changed(void *data, const Efl_Event *e);
54static Eina_Bool _efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url);
54 55
55static const Elm_Action key_actions[] = { 56static const Elm_Action key_actions[] = {
56 {"activate", _key_action_activate}, 57 {"activate", _key_action_activate},
@@ -396,7 +397,7 @@ static void
396_efl_ui_image_async_open_done(void *data, Ecore_Thread *thread) 397_efl_ui_image_async_open_done(void *data, Ecore_Thread *thread)
397{ 398{
398 Async_Open_Data *todo = data; 399 Async_Open_Data *todo = data;
399 Eina_Stringshare *file, *key; 400 const char *key;
400 Eina_Bool ok; 401 Eina_Bool ok;
401 Eina_File *f; 402 Eina_File *f;
402 void *map; 403 void *map;
@@ -414,19 +415,21 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread)
414 map = todo->map; 415 map = todo->map;
415 f = todo->f_open; 416 f = todo->f_open;
416 ok = f && map; 417 ok = f && map;
417 if (todo->file) file = todo->file;
418 else file = f ? eina_file_filename_get(f) : NULL;
419 418
420 if (ok) 419 if (ok)
421 { 420 {
422 if (sd->edje) 421 efl_file_key_set(sd->self, key);
422 ok = !efl_file_mmap_set(sd->self, f);
423 if (ok)
423 { 424 {
424 _prev_img_del(sd); 425 if (sd->edje)
425 ok = edje_object_mmap_set(sd->img, f, key); 426 {
427 _prev_img_del(sd);
428 ok = edje_object_mmap_set(sd->img, f, key);
429 }
430 else
431 ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd);
426 } 432 }
427 else
428 ok = _efl_ui_image_smart_internal_file_set
429 (sd->self, sd, file, f, key);
430 } 433 }
431 if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL); 434 if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL);
432 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL); 435 else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL);
@@ -437,18 +440,20 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread)
437 _async_open_data_free(todo); 440 _async_open_data_free(todo);
438} 441}
439 442
440static Eina_Bool 443static Eina_Error
441_efl_ui_image_async_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file, 444_efl_ui_image_async_file_set(Eo *obj, Efl_Ui_Image_Data *sd)
442 const Eina_File *f, const char *key)
443{ 445{
444 Async_Open_Data *todo; 446 Async_Open_Data *todo;
447 const char *file = efl_file_get(obj);
448 const char *key = efl_file_key_get(obj);
449 const Eina_File *f = efl_file_mmap_get(obj);
445 450
446 if (sd->async.th && 451 if (sd->async.th &&
447 ((file == sd->async.file) || 452 ((file == sd->async.file) ||
448 (file && sd->async.file && !strcmp(file, sd->async.file))) && 453 (file && sd->async.file && !strcmp(file, sd->async.file))) &&
449 ((key == sd->async.key) || 454 ((key == sd->async.key) ||
450 (key && sd->async.key && !strcmp(key, sd->async.key)))) 455 (key && sd->async.key && !strcmp(key, sd->async.key))))
451 return EINA_TRUE; 456 return 0;
452 457
453 todo = calloc(1, sizeof(Async_Open_Data)); 458 todo = calloc(1, sizeof(Async_Open_Data));
454 if (!todo) return EINA_FALSE; 459 if (!todo) return EINA_FALSE;
@@ -467,22 +472,28 @@ _efl_ui_image_async_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file,
467 sd->async.th = ecore_thread_run(_efl_ui_image_async_open_do, 472 sd->async.th = ecore_thread_run(_efl_ui_image_async_open_do,
468 _efl_ui_image_async_open_done, 473 _efl_ui_image_async_open_done,
469 _efl_ui_image_async_open_cancel, todo); 474 _efl_ui_image_async_open_cancel, todo);
470 if (sd->async.th) return EINA_TRUE; 475 if (sd->async.th) return 0;
471 476
472 _async_open_data_free(todo); 477 _async_open_data_free(todo);
473 _async_clear(sd); 478 _async_clear(sd);
474 DBG("Could not spawn an async thread!"); 479 DBG("Could not spawn an async thread!");
475 return EINA_FALSE; 480 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
476} 481}
477 482
478static Eina_Bool 483static Eina_Error
479_efl_ui_image_edje_file_set(Evas_Object *obj, 484_efl_ui_image_edje_file_set(Evas_Object *obj)
480 const char *file,
481 const Eina_File *f,
482 const char *group)
483{ 485{
486 Eina_Error err;
487 const Eina_File *f;
488 const char *key;
489
484 EFL_UI_IMAGE_DATA_GET(obj, sd); 490 EFL_UI_IMAGE_DATA_GET(obj, sd);
485 491
492 err = efl_file_load(efl_super(obj, MY_CLASS));
493 if (err) return err;
494
495 f = efl_file_mmap_get(obj);
496 key = efl_file_key_get(obj);
486 _prev_img_del(sd); 497 _prev_img_del(sd);
487 498
488 if (!sd->edje) 499 if (!sd->edje)
@@ -500,32 +511,23 @@ _efl_ui_image_edje_file_set(Evas_Object *obj,
500 511
501 if (!sd->async_enable) 512 if (!sd->async_enable)
502 { 513 {
503 if (f) 514 efl_file_key_set(sd->img, key);
504 { 515 err = efl_file_mmap_set(sd->img, f);
505 if (!edje_object_mmap_set(sd->img, f, group)) 516 if (!err) err = efl_file_load(sd->img);
506 { 517 if (err)
507 ERR("failed to set edje file '%s', group '%s': %s", file, group,
508 edje_load_error_str(edje_object_load_error_get(sd->img)));
509 return EINA_FALSE;
510 }
511 }
512 else
513 { 518 {
514 if (!edje_object_file_set(sd->img, file, group)) 519 ERR("failed to set edje file '%s', group '%s': %s", eina_file_filename_get(f), key,
515 { 520 edje_load_error_str(edje_object_load_error_get(sd->img)));
516 ERR("failed to set edje file '%s', group '%s': %s", file, group, 521 return err;
517 edje_load_error_str(edje_object_load_error_get(sd->img)));
518 return EINA_FALSE;
519 }
520 } 522 }
521 } 523 }
522 else 524 else
523 return _efl_ui_image_async_file_set(obj, sd, file, f, group); 525 return _efl_ui_image_async_file_set(obj, sd);
524 526
525 /* FIXME: do i want to update icon on file change ? */ 527 /* FIXME: do i want to update icon on file change ? */
526 _efl_ui_image_sizing_eval(obj); 528 _efl_ui_image_sizing_eval(obj);
527 529
528 return EINA_TRUE; 530 return 0;
529} 531}
530 532
531EOLIAN static void 533EOLIAN static void
@@ -547,7 +549,7 @@ _efl_ui_image_drag_n_drop_cb(void *elm_obj,
547 Elm_Selection_Data *drop) 549 Elm_Selection_Data *drop)
548{ 550{
549 Eina_Bool ret = EINA_FALSE; 551 Eina_Bool ret = EINA_FALSE;
550 ret = efl_file_set(obj, drop->data, NULL); 552 ret = efl_file_simple_load(obj, drop->data, NULL);
551 if (ret) 553 if (ret)
552 { 554 {
553 DBG("dnd: %s, %s, %s", elm_widget_type_get(elm_obj), 555 DBG("dnd: %s, %s, %s", elm_widget_type_get(elm_obj),
@@ -864,12 +866,33 @@ _efl_ui_image_efl_object_constructor(Eo *obj, Efl_Ui_Image_Data *pd)
864 return obj; 866 return obj;
865} 867}
866 868
867EOLIAN Eina_Bool 869static const Eina_Slice remote_uri[] = {
868_efl_ui_image_efl_file_mmap_set(Eo *obj, Efl_Ui_Image_Data *sd, 870 EINA_SLICE_STR_LITERAL("http://"),
869 const Eina_File *file, const char *key) 871 EINA_SLICE_STR_LITERAL("https://"),
872 EINA_SLICE_STR_LITERAL("ftp://"),
873 { }
874};
875
876static inline Eina_Bool
877_efl_ui_image_is_remote(const char *file)
870{ 878{
871 Eina_Bool ret = EINA_FALSE; 879 Eina_Slice s = EINA_SLICE_STR(file);
880 const Eina_Slice *itr;
881
882 for (itr = remote_uri; itr->mem; itr++)
883 if (eina_slice_startswith(s, *itr))
884 return EINA_TRUE;
885
886 return EINA_FALSE;
887}
888
889EOLIAN Eina_Error
890_efl_ui_image_efl_file_load(Eo *obj, Efl_Ui_Image_Data *sd)
891{
892 Eina_Error ret;
893 const char *file = efl_file_get(obj);
872 894
895 if (efl_file_loaded_get(obj)) return 0;
873 _async_cancel(sd); 896 _async_cancel(sd);
874 897
875 /* stop preloading as it may hit to-be-freed memory */ 898 /* stop preloading as it may hit to-be-freed memory */
@@ -879,48 +902,100 @@ _efl_ui_image_efl_file_mmap_set(Eo *obj, Efl_Ui_Image_Data *sd,
879 if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd); 902 if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd);
880 if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free); 903 if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free);
881 904
905 if (sd->anim)
906 {
907 ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
908 sd->play = EINA_FALSE;
909 sd->anim = EINA_FALSE;
910 }
911
912 if (file && _efl_ui_image_is_remote(file))
913 {
914 evas_object_hide(sd->img);
915 if (_efl_ui_image_download(obj, sd, file))
916 {
917 evas_object_smart_callback_call(obj, SIG_DOWNLOAD_START, NULL);
918 return 0;
919 }
920 }
921
882 if (!sd->async_enable) 922 if (!sd->async_enable)
883 ret = _efl_ui_image_smart_internal_file_set(obj, sd, eina_file_filename_get(file), file, key); 923 ret = _efl_ui_image_smart_internal_file_set(obj, sd);
884 else 924 else
885 ret = _efl_ui_image_async_file_set(obj, sd, eina_file_filename_get(file), file, key); 925 ret = _efl_ui_image_async_file_set(obj, sd);
886 926
887 return ret; 927 return ret;
888} 928}
889 929
890EOLIAN void 930EOLIAN void
891_efl_ui_image_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const Eina_File **file, const char **group) 931_efl_ui_image_efl_file_unload(Eo *obj, Efl_Ui_Image_Data *sd)
892{ 932{
893 if (sd->img) efl_file_mmap_get(sd->img, file, group); 933 _async_cancel(sd);
934
935 /* stop preloading as it may hit to-be-freed memory */
936 if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING)
937 evas_object_image_preload(sd->img, EINA_TRUE);
938
939 if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd);
940 if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free);
941
942 if (sd->anim)
943 {
944 ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
945 sd->play = EINA_FALSE;
946 sd->anim = EINA_FALSE;
947 }
948
949 if (sd->prev_img)
950 _prev_img_del(sd);
951 _efl_ui_image_file_set_do(obj);
952 efl_file_unload(sd->img);
953 efl_file_unload(efl_super(obj, MY_CLASS));
954 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
955 _prev_img_del(sd);
956 else
957 {
958 evas_object_hide(sd->img);
959 sd->preload_status = EFL_UI_IMAGE_PRELOADING;
960 evas_object_image_preload(sd->img, EINA_FALSE);
961 }
962
963 _efl_ui_image_sizing_eval(obj);
894} 964}
895 965
896static Eina_Bool 966static Eina_Error
897_efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd, 967_efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd)
898 const char *file, const Eina_File *f, const char *key)
899{ 968{
900 Evas_Load_Error err; 969 Eina_Error err;
970 const Eina_File *f;
971 const char *key;
972 const char *file = efl_file_get(obj);
901 973
902 if (eina_str_has_extension(file, ".edj")) 974 if (eina_str_has_extension(file, ".edj"))
903 return _efl_ui_image_edje_file_set(obj, file, f, key); 975 return _efl_ui_image_edje_file_set(obj);
976
977 err = efl_file_load(efl_super(obj, MY_CLASS));
978 if (err) return err;
979
980 f = efl_file_mmap_get(obj);
981 key = efl_file_key_get(obj);
904 982
905 _efl_ui_image_file_set_do(obj); 983 _efl_ui_image_file_set_do(obj);
906 984
907 if (f) 985 evas_object_image_mmap_set(sd->img, f, key);
908 evas_object_image_mmap_set(sd->img, f, key);
909 else
910 evas_object_image_file_set(sd->img, file, key);
911 986
912 err = evas_object_image_load_error_get(sd->img); 987 err = evas_object_image_load_error_get(sd->img);
913 if (err != EVAS_LOAD_ERROR_NONE) 988 if (err)
914 { 989 {
915 if (file || f) 990 if (file || f)
916 { 991 {
917 if (key) 992 if (key)
918 ERR("Failed to load image '%s' '%s': %s. (%p)", 993 ERR("Failed to load image '%s' '%s': %s. (%p)",
919 file ? file : eina_file_filename_get(f), key, 994 eina_file_filename_get(f), key,
920 evas_load_error_str(err), obj); 995 evas_load_error_str(err), obj);
921 else 996 else
922 ERR("Failed to load image '%s': %s. (%p)", 997 ERR("Failed to load image '%s': %s. (%p)",
923 file ? file : eina_file_filename_get(f), 998 eina_file_filename_get(f),
924 evas_load_error_str(err), obj); 999 evas_load_error_str(err), obj);
925 } 1000 }
926 else 1001 else
@@ -928,7 +1003,7 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd,
928 ERR("NULL image file passed! (%p)", obj); 1003 ERR("NULL image file passed! (%p)", obj);
929 } 1004 }
930 _prev_img_del(sd); 1005 _prev_img_del(sd);
931 return EINA_FALSE; 1006 return err;
932 } 1007 }
933 1008
934 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) 1009 if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED)
@@ -942,7 +1017,7 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd,
942 1017
943 _efl_ui_image_sizing_eval(obj); 1018 _efl_ui_image_sizing_eval(obj);
944 1019
945 return EINA_TRUE; 1020 return 0;
946} 1021}
947 1022
948static void 1023static void
@@ -979,7 +1054,7 @@ _efl_ui_image_remote_copier_done(void *data, const Efl_Event *event EINA_UNUSED)
979 Eina_File *f; 1054 Eina_File *f;
980 Eo *dialer; 1055 Eo *dialer;
981 const char *url; 1056 const char *url;
982 Eina_Bool ret = EINA_FALSE; 1057 Eina_Error ret;
983 1058
984 /* we're called from _efl_ui_image_remote_copier_cancel() */ 1059 /* we're called from _efl_ui_image_remote_copier_cancel() */
985 if (!sd->remote.copier) return; 1060 if (!sd->remote.copier) return;
@@ -997,11 +1072,11 @@ _efl_ui_image_remote_copier_done(void *data, const Efl_Event *event EINA_UNUSED)
997 eina_binbuf_string_get(sd->remote.binbuf), 1072 eina_binbuf_string_get(sd->remote.binbuf),
998 eina_binbuf_length_get(sd->remote.binbuf), 1073 eina_binbuf_length_get(sd->remote.binbuf),
999 EINA_FALSE); 1074 EINA_FALSE);
1000 1075 efl_file_mmap_set(obj, f);
1001 ret = _efl_ui_image_smart_internal_file_set(obj, sd, url, f, sd->remote.key); 1076 ret = _efl_ui_image_smart_internal_file_set(obj, sd);
1002 eina_file_close(f); 1077 eina_file_close(f);
1003 1078
1004 if (!ret) 1079 if (ret)
1005 { 1080 {
1006 Efl_Ui_Image_Error err = { 0, EINA_TRUE }; 1081 Efl_Ui_Image_Error err = { 0, EINA_TRUE };
1007 1082
@@ -1057,11 +1132,12 @@ EFL_CALLBACKS_ARRAY_DEFINE(_efl_ui_image_remote_copier_cbs,
1057 { EFL_IO_COPIER_EVENT_PROGRESS, _efl_ui_image_remote_copier_progress }); 1132 { EFL_IO_COPIER_EVENT_PROGRESS, _efl_ui_image_remote_copier_progress });
1058 1133
1059static Eina_Bool 1134static Eina_Bool
1060_efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url, const char *key) 1135_efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url)
1061{ 1136{
1062 Eo *dialer; 1137 Eo *dialer;
1063 Efl_Ui_Image_Error img_err = { ENOSYS, EINA_FALSE }; 1138 Efl_Ui_Image_Error img_err = { ENOSYS, EINA_FALSE };
1064 Eina_Error err; 1139 Eina_Error err;
1140 const char *key = efl_file_key_get(obj);
1065 1141
1066 dialer = efl_add(EFL_NET_DIALER_HTTP_CLASS, obj, 1142 dialer = efl_add(EFL_NET_DIALER_HTTP_CLASS, obj,
1067 efl_net_dialer_http_allow_redirects_set(efl_added, EINA_TRUE)); 1143 efl_net_dialer_http_allow_redirects_set(efl_added, EINA_TRUE));
@@ -1096,72 +1172,6 @@ _efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url, const ch
1096 return EINA_FALSE; 1172 return EINA_FALSE;
1097} 1173}
1098 1174
1099static const Eina_Slice remote_uri[] = {
1100 EINA_SLICE_STR_LITERAL("http://"),
1101 EINA_SLICE_STR_LITERAL("https://"),
1102 EINA_SLICE_STR_LITERAL("ftp://"),
1103 { }
1104};
1105
1106static inline Eina_Bool
1107_efl_ui_image_is_remote(const char *file)
1108{
1109 Eina_Slice s = EINA_SLICE_STR(file);
1110 const Eina_Slice *itr;
1111
1112 for (itr = remote_uri; itr->mem; itr++)
1113 if (eina_slice_startswith(s, *itr))
1114 return EINA_TRUE;
1115
1116 return EINA_FALSE;
1117}
1118
1119EOLIAN static Eina_Bool
1120_efl_ui_image_efl_file_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file, const char *key)
1121{
1122 Eina_Bool ret = EINA_FALSE;
1123
1124 _async_cancel(sd);
1125
1126 /* stop preloading as it may hit to-be-freed memory */
1127 if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING)
1128 evas_object_image_preload(sd->img, EINA_TRUE);
1129
1130 if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd);
1131 if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free);
1132
1133 if (sd->anim)
1134 {
1135 ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del);
1136 sd->play = EINA_FALSE;
1137 sd->anim = EINA_FALSE;
1138 }
1139
1140 if (!file)
1141 {
1142 if (sd->prev_img)
1143 _prev_img_del(sd);
1144 return _efl_ui_image_smart_internal_file_set(obj, sd, file, NULL, key);;
1145 }
1146
1147 if (_efl_ui_image_is_remote(file))
1148 {
1149 evas_object_hide(sd->img);
1150 if (_efl_ui_image_download(obj, sd, file, key))
1151 {
1152 evas_object_smart_callback_call(obj, SIG_DOWNLOAD_START, NULL);
1153 return EINA_TRUE;
1154 }
1155 }
1156
1157 if (!sd->async_enable)
1158 ret = _efl_ui_image_smart_internal_file_set(obj, sd, file, NULL, key);
1159 else
1160 ret = _efl_ui_image_async_file_set(obj, sd, file, NULL, key);
1161
1162 return ret;
1163}
1164
1165EOLIAN static const char* 1175EOLIAN static const char*
1166_efl_ui_image_efl_layout_group_group_data_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *key) 1176_efl_ui_image_efl_layout_group_group_data_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *key)
1167{ 1177{
@@ -1264,18 +1274,6 @@ _efl_ui_image_efl_layout_calc_calc_auto_update_hints_get(const Eo *obj EINA_UNUS
1264 return EINA_TRUE; 1274 return EINA_TRUE;
1265} 1275}
1266 1276
1267EOLIAN static void
1268_efl_ui_image_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char **file, const char **key)
1269{
1270 if (sd->async.th)
1271 {
1272 if (file) *file = sd->async.file;
1273 if (key) *key = sd->async.key;
1274 return;
1275 }
1276 efl_file_get(sd->img, file, key);
1277}
1278
1279#if 0 1277#if 0
1280// Kept for reference: wait for async open to complete - probably unused. 1278// Kept for reference: wait for async open to complete - probably unused.
1281static Eina_Bool 1279static Eina_Bool
@@ -1725,7 +1723,7 @@ _icon_freedesktop_set(Evas_Object *obj, const char *name, int size)
1725 if (sd->freedesktop.use) 1723 if (sd->freedesktop.use)
1726 { 1724 {
1727 sd->freedesktop.requested_size = size; 1725 sd->freedesktop.requested_size = size;
1728 efl_file_set(obj, path, NULL); 1726 efl_file_simple_load(obj, path, NULL);
1729 return EINA_TRUE; 1727 return EINA_TRUE;
1730 } 1728 }
1731 return EINA_FALSE; 1729 return EINA_FALSE;
@@ -1793,7 +1791,7 @@ _internal_efl_ui_image_icon_set(Evas_Object *obj, const char *name, Eina_Bool *f
1793 { 1791 {
1794 if (fdo) 1792 if (fdo)
1795 *fdo = EINA_FALSE; 1793 *fdo = EINA_FALSE;
1796 return efl_file_set(obj, name, NULL); 1794 return efl_file_simple_load(obj, name, NULL);
1797 } 1795 }
1798 1796
1799 /* if that fails, see if icon name is in the format size/name. if so, 1797 /* if that fails, see if icon name is in the format size/name. if so,
@@ -1875,13 +1873,13 @@ _update_viewmodel(Eo *obj, Efl_Ui_Image_Data *pd)
1875 { 1873 {
1876 eina_value_get(vfile, &f); 1874 eina_value_get(vfile, &f);
1877 1875
1878 efl_file_mmap_set(obj, f, key); 1876 efl_file_simple_mmap_load(obj, f, key);
1879 } 1877 }
1880 else 1878 else
1881 { 1879 {
1882 file = eina_value_to_string(vfile); 1880 file = eina_value_to_string(vfile);
1883 1881
1884 efl_file_set(obj, file, key); 1882 efl_file_simple_load(obj, file, key);
1885 } 1883 }
1886 } 1884 }
1887 1885
@@ -2010,7 +2008,7 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group)
2010 Eina_Bool ret = EINA_FALSE; 2008 Eina_Bool ret = EINA_FALSE;
2011 2009
2012 EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; 2010 EFL_UI_IMAGE_CHECK(obj) EINA_FALSE;
2013 ret = efl_file_set(obj, file, group); 2011 ret = efl_file_simple_load(obj, file, group);
2014 _efl_ui_image_sizing_eval(obj); 2012 _efl_ui_image_sizing_eval(obj);
2015 return ret; 2013 return ret;
2016} 2014}
@@ -2018,14 +2016,14 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group)
2018EAPI void 2016EAPI void
2019elm_image_file_get(const Eo *obj, const char **file, const char **group) 2017elm_image_file_get(const Eo *obj, const char **file, const char **group)
2020{ 2018{
2021 efl_file_get((Eo *) obj, file, group); 2019 efl_file_simple_get((Eo *) obj, file, group);
2022} 2020}
2023 2021
2024EAPI Eina_Bool 2022EAPI Eina_Bool
2025elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group) 2023elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group)
2026{ 2024{
2027 EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; 2025 EFL_UI_IMAGE_CHECK(obj) EINA_FALSE;
2028 return efl_file_mmap_set(obj, file, group); 2026 return efl_file_simple_mmap_load(obj, file, group);
2029} 2027}
2030 2028
2031EAPI Eina_Bool 2029EAPI Eina_Bool
diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo
index 7a19d04..109ef76 100644
--- a/src/lib/elementary/efl_ui_image.eo
+++ b/src/lib/elementary/efl_ui_image.eo
@@ -66,8 +66,8 @@ class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl.
66 the absolute path of an image file, this image will be used. 66 the absolute path of an image file, this image will be used.
67 Lookup order used by @.icon.set can be set using "icon_theme" in config. 67 Lookup order used by @.icon.set can be set using "icon_theme" in config.
68 68
69 Note: The image set by this function can be changed by 69 Note: The image set by this function is changed when
70 @Efl.File.file.set. 70 @Efl.File.load is called.
71 71
72 Note: This function does not accept relative icon path. 72 Note: This function does not accept relative icon path.
73 73
@@ -89,8 +89,8 @@ class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl.
89 } 89 }
90 implements { 90 implements {
91 Efl.Object.constructor; 91 Efl.Object.constructor;
92 Efl.File.file { get; set; } 92 Efl.File.load;
93 Efl.File.mmap { get; set; } 93 Efl.File.unload;
94 Efl.Gfx.Color.color { set; } 94 Efl.Gfx.Color.color { set; }
95 Efl.Gfx.Entity.visible { set; } 95 Efl.Gfx.Entity.visible { set; }
96 Efl.Gfx.Entity.position { set; } 96 Efl.Gfx.Entity.position { set; }
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index dc17dce..21d3d6f 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -2023,14 +2023,17 @@ _efl_ui_image_zoomable_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_Ima
2023 return ok; 2023 return ok;
2024} 2024}
2025 2025
2026static Eina_Bool 2026static Eina_Error
2027_img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, 2027_img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
2028 const char *file, const Eina_File *f, const char *group,
2029 Eina_Bool resize) 2028 Eina_Bool resize)
2030{ 2029{
2031 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 2030 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
2032 double tz; 2031 double tz;
2033 int w, h; 2032 int w, h;
2033 Eina_Error err;
2034
2035 err = efl_file_load(efl_super(obj, MY_CLASS));
2036 if (err) return err;
2034 2037
2035 sd->zoom = 1.0; 2038 sd->zoom = 1.0;
2036 evas_object_image_smooth_scale_set(sd->img, (sd->no_smooth == 0)); 2039 evas_object_image_smooth_scale_set(sd->img, (sd->no_smooth == 0));
@@ -2042,23 +2045,13 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
2042 sd->edje = edje_object_add(evas_object_evas_get(obj)); 2045 sd->edje = edje_object_add(evas_object_evas_get(obj));
2043 if (!resize) 2046 if (!resize)
2044 { 2047 {
2045 if (f) 2048 efl_file_key_set(sd->edje, efl_file_key_get(obj));
2049 err = efl_file_mmap_set(sd->edje, efl_file_mmap_get(obj));
2050 if (err)
2046 { 2051 {
2047 if (!edje_object_mmap_set(sd->edje, f, group)) 2052 ERR("failed to set edje file '%s', group '%s': %s", efl_file_get(obj), efl_file_key_get(obj),
2048 { 2053 edje_load_error_str(edje_object_load_error_get(sd->edje)));
2049 ERR("failed to set edje file '%s', group '%s': %s", sd->file, group, 2054 return err;
2050 edje_load_error_str(edje_object_load_error_get(sd->edje)));
2051 return EINA_FALSE;
2052 }
2053 }
2054 else if (file)
2055 {
2056 if (!edje_object_file_set(sd->edje, file, group))
2057 {
2058 ERR("failed to set edje file '%s', group '%s': %s", file, group,
2059 edje_load_error_str(edje_object_load_error_get(sd->edje)));
2060 return EINA_FALSE;
2061 }
2062 } 2055 }
2063 } 2056 }
2064 2057
@@ -2100,41 +2093,42 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
2100 sd->flip = EFL_FLIP_NONE; 2093 sd->flip = EFL_FLIP_NONE;
2101 sd->orientation_changed = EINA_FALSE; 2094 sd->orientation_changed = EINA_FALSE;
2102 2095
2103 return EINA_TRUE; 2096 return 0;
2104} 2097}
2105 2098
2106static Eina_Bool 2099static Eina_Error
2107_image_zoomable_edje_file_set(Evas_Object *obj, 2100_image_zoomable_edje_file_set(Evas_Object *obj)
2108 const char *file,
2109 const char *group)
2110{ 2101{
2111 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd); 2102 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd);
2112 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 2103 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC);
2113 2104
2114 if (file) eina_stringshare_replace(&sd->file, file); 2105 return _img_proxy_set(obj, sd, EINA_FALSE);
2115 return _img_proxy_set(obj, sd, file, NULL, group, EINA_FALSE);
2116} 2106}
2117 2107
2118static void 2108static Eina_Error
2119_internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Eina_File *f, const char *key, Evas_Load_Error *ret) 2109_internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret)
2120{ 2110{
2121 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 2111 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC);
2122 Evas_Load_Error err;
2123 int w, h; 2112 int w, h;
2124 double tz; 2113 double tz;
2114 Eina_Error err;
2115 const char *file;
2116
2117 err = efl_file_load(efl_super(obj, MY_CLASS));
2118 if (err) return err;
2119
2120 file = efl_file_get(obj);
2125 2121
2126 if (eina_str_has_extension(file, ".edj")) 2122 if (eina_str_has_extension(file, ".edj"))
2127 { 2123 {
2128 _image_zoomable_edje_file_set(obj, file, key); 2124 return _image_zoomable_edje_file_set(obj);
2129 return;
2130 } 2125 }
2131 2126
2132 // It is actually to late, we have lost the reference to the previous 2127 // It is actually to late, we have lost the reference to the previous
2133 // file descriptor already, so we can't know if the file changed. To 2128 // file descriptor already, so we can't know if the file changed. To
2134 // be safe we do for now just force a full reload on file_set and hope 2129 // be safe we do for now just force a full reload on file_set and hope
2135 // on evas to catch it, if there is no change. 2130 // on evas to catch it, if there is no change.
2136 eina_stringshare_replace(&sd->file, file); 2131 sd->f = eina_file_dup(efl_file_mmap_get(obj));
2137 sd->f = eina_file_dup(f);
2138 2132
2139 evas_object_image_smooth_scale_set(sd->img, (sd->no_smooth == 0)); 2133 evas_object_image_smooth_scale_set(sd->img, (sd->no_smooth == 0));
2140 evas_object_image_file_set(sd->img, NULL, NULL); 2134 evas_object_image_file_set(sd->img, NULL, NULL);
@@ -2145,7 +2139,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Ei
2145 { 2139 {
2146 ERR("Things are going bad for '%s' (%p) : %i", file, sd->img, err); 2140 ERR("Things are going bad for '%s' (%p) : %i", file, sd->img, err);
2147 if (ret) *ret = err; 2141 if (ret) *ret = err;
2148 return; 2142 return err;
2149 } 2143 }
2150 evas_object_image_size_get(sd->img, &w, &h); 2144 evas_object_image_size_get(sd->img, &w, &h);
2151 2145
@@ -2161,7 +2155,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Ei
2161 { 2155 {
2162 ERR("Things are going bad for '%s' (%p)", file, sd->img); 2156 ERR("Things are going bad for '%s' (%p)", file, sd->img);
2163 if (ret) *ret = err; 2157 if (ret) *ret = err;
2164 return; 2158 return err;
2165 } 2159 }
2166 2160
2167 evas_object_image_preload(sd->img, 0); 2161 evas_object_image_preload(sd->img, 0);
@@ -2189,6 +2183,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Ei
2189 sd->orientation_changed = EINA_FALSE; 2183 sd->orientation_changed = EINA_FALSE;
2190 2184
2191 if (ret) *ret = evas_object_image_load_error_get(sd->img); 2185 if (ret) *ret = evas_object_image_load_error_get(sd->img);
2186 return efl_gfx_image_load_error_get(sd->img);
2192} 2187}
2193 2188
2194static void 2189static void
@@ -2239,11 +2234,11 @@ _efl_ui_image_zoomable_remote_copier_done(void *data, const Efl_Event *event EIN
2239 eina_binbuf_string_get(sd->remote.binbuf), 2234 eina_binbuf_string_get(sd->remote.binbuf),
2240 eina_binbuf_length_get(sd->remote.binbuf), 2235 eina_binbuf_length_get(sd->remote.binbuf),
2241 EINA_FALSE); 2236 EINA_FALSE);
2242 2237 efl_file_mmap_set(obj, f);
2243 _internal_file_set(obj, sd, url, f, NULL, &ret);
2244 eina_file_close(f); 2238 eina_file_close(f);
2239 ret = _internal_file_set(obj, sd, &ret);
2245 2240
2246 if (ret != EVAS_LOAD_ERROR_NONE) 2241 if (ret)
2247 { 2242 {
2248 Elm_Photocam_Error err = { 0, EINA_TRUE }; 2243 Elm_Photocam_Error err = { 0, EINA_TRUE };
2249 2244
@@ -2352,11 +2347,10 @@ _efl_ui_image_zoomable_is_remote(const char *file)
2352 return EINA_FALSE; 2347 return EINA_FALSE;
2353} 2348}
2354 2349
2355static Evas_Load_Error 2350static Eina_Error
2356_efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, const char *key) 2351_efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret)
2357{ 2352{
2358 Evas_Load_Error ret = EVAS_LOAD_ERROR_NONE; 2353 const char *file = efl_file_get(obj);
2359
2360 ELM_SAFE_FREE(sd->edje, evas_object_del); 2354 ELM_SAFE_FREE(sd->edje, evas_object_del);
2361 eina_stringshare_replace(&sd->stdicon, NULL); 2355 eina_stringshare_replace(&sd->stdicon, NULL);
2362 2356
@@ -2382,21 +2376,24 @@ _efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd
2382 { 2376 {
2383 efl_event_callback_legacy_call 2377 efl_event_callback_legacy_call
2384 (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_DOWNLOAD_START, NULL); 2378 (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_DOWNLOAD_START, NULL);
2385 return ret; 2379 *ret = EVAS_LOAD_ERROR_NONE;
2380 return 0;
2386 } 2381 }
2387 } 2382 }
2388 2383
2389 _internal_file_set(obj, sd, file, NULL, key, &ret); 2384 return _internal_file_set(obj, sd, ret);
2390
2391 return ret;
2392} 2385}
2393 2386
2394EOLIAN static Eina_Bool 2387EOLIAN static Eina_Error
2395_efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, const char *key) 2388_efl_ui_image_zoomable_efl_file_load(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
2396{ 2389{
2397 Evas_Load_Error ret = _efl_ui_image_zoomable_file_set_internal(obj, sd, file, key); 2390 Evas_Load_Error ret;
2391 Eina_Error err;
2398 2392
2399 if (ret == EVAS_LOAD_ERROR_NONE) return EINA_TRUE; 2393 if (efl_file_loaded_get(obj)) return 0;
2394 err = _efl_ui_image_zoomable_file_set_internal(obj, sd, &ret);
2395
2396 if ((!ret) && (!err)) return 0;
2400 2397
2401 eina_error_set( 2398 eina_error_set(
2402 ret == EVAS_LOAD_ERROR_DOES_NOT_EXIST ? PHOTO_FILE_LOAD_ERROR_DOES_NOT_EXIST : 2399 ret == EVAS_LOAD_ERROR_DOES_NOT_EXIST ? PHOTO_FILE_LOAD_ERROR_DOES_NOT_EXIST :
@@ -2406,14 +2403,14 @@ _efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd
2406 ret == EVAS_LOAD_ERROR_UNKNOWN_FORMAT ? PHOTO_FILE_LOAD_ERROR_UNKNOWN_FORMAT : 2403 ret == EVAS_LOAD_ERROR_UNKNOWN_FORMAT ? PHOTO_FILE_LOAD_ERROR_UNKNOWN_FORMAT :
2407 PHOTO_FILE_LOAD_ERROR_GENERIC 2404 PHOTO_FILE_LOAD_ERROR_GENERIC
2408 ); 2405 );
2409 return EINA_FALSE; 2406 return err;
2410} 2407}
2411 2408
2412EOLIAN static void 2409EOLIAN static Eina_Error
2413_efl_ui_image_zoomable_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, const char **file, const char **key) 2410_efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file)
2414{ 2411{
2415 if (file) *file = sd->file; 2412 eina_stringshare_replace(&sd->file, file);
2416 if (key) *key = NULL; 2413 return efl_file_set(efl_super(obj, MY_CLASS), file);
2417} 2414}
2418 2415
2419EOLIAN static void 2416EOLIAN static void
@@ -2816,7 +2813,7 @@ _min_obj_size_get(Evas_Object *o, int *w, int *h)
2816 } 2813 }
2817} 2814}
2818 2815
2819static Eina_Bool 2816static Eina_Error
2820_image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style, Eina_Bool resize) 2817_image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style, Eina_Bool resize)
2821{ 2818{
2822 Elm_Theme *th = elm_widget_theme_get(o); 2819 Elm_Theme *th = elm_widget_theme_get(o);
@@ -2832,10 +2829,10 @@ _image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style,
2832 if (f) 2829 if (f)
2833 { 2830 {
2834 if (sd->f) eina_file_close(sd->f); 2831 if (sd->f) eina_file_close(sd->f);
2835 eina_stringshare_replace(&sd->file, eina_file_filename_get(f)); 2832 efl_file_key_set(o, buf);
2836 sd->f = eina_file_dup(f); 2833 efl_file_mmap_set(o, f);
2837 2834
2838 return _img_proxy_set(o, sd, NULL, f, buf, resize); 2835 return _img_proxy_set(o, sd, resize);
2839 } 2836 }
2840 2837
2841 ELM_SAFE_FREE(sd->edje, evas_object_del); 2838 ELM_SAFE_FREE(sd->edje, evas_object_del);
@@ -2843,7 +2840,7 @@ _image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style,
2843 WRN("Failed to set icon '%s'. Icon theme '%s' not found", group, buf); 2840 WRN("Failed to set icon '%s'. Icon theme '%s' not found", group, buf);
2844 ELM_SAFE_FREE(sd->f, eina_file_close); 2841 ELM_SAFE_FREE(sd->f, eina_file_close);
2845 2842
2846 return EINA_FALSE; 2843 return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION;
2847} 2844}
2848 2845
2849static Eina_Bool 2846static Eina_Bool
@@ -2851,7 +2848,7 @@ _icon_standard_set(Evas_Object *obj, const char *name, Eina_Bool resize)
2851{ 2848{
2852 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd); 2849 EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd);
2853 2850
2854 if (_image_zoomable_object_icon_set(obj, name, "default", resize)) 2851 if (!_image_zoomable_object_icon_set(obj, name, "default", resize))
2855 { 2852 {
2856 /* TODO: elm_unneed_efreet() */ 2853 /* TODO: elm_unneed_efreet() */
2857 sd->freedesktop.use = EINA_FALSE; 2854 sd->freedesktop.use = EINA_FALSE;
@@ -2902,7 +2899,7 @@ _icon_freedesktop_set(Evas_Object *obj, const char *name, int size)
2902 if (sd->freedesktop.use) 2899 if (sd->freedesktop.use)
2903 { 2900 {
2904 sd->freedesktop.requested_size = size; 2901 sd->freedesktop.requested_size = size;
2905 efl_file_set(obj, path, NULL); 2902 efl_file_simple_load(obj, path, NULL);
2906 return EINA_TRUE; 2903 return EINA_TRUE;
2907 } 2904 }
2908 return EINA_FALSE; 2905 return EINA_FALSE;
@@ -2970,7 +2967,7 @@ _internal_efl_ui_image_zoomable_icon_set(Evas_Object *obj, const char *name, Ein
2970 { 2967 {
2971 if (fdo) 2968 if (fdo)
2972 *fdo = EINA_FALSE; 2969 *fdo = EINA_FALSE;
2973 return efl_file_set(obj, name, NULL); 2970 return efl_file_simple_load(obj, name, NULL);
2974 } 2971 }
2975 2972
2976 /* if that fails, see if icon name is in the format size/name. if so, 2973 /* if that fails, see if icon name is in the format size/name. if so,
@@ -3362,7 +3359,7 @@ elm_photocam_file_set(Evas_Object *obj, const char *file)
3362{ 3359{
3363 ELM_PHOTOCAM_CHECK(obj) EVAS_LOAD_ERROR_NONE; 3360 ELM_PHOTOCAM_CHECK(obj) EVAS_LOAD_ERROR_NONE;
3364 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EVAS_LOAD_ERROR_NONE); 3361 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EVAS_LOAD_ERROR_NONE);
3365 if (efl_file_set(obj, file, NULL)) return EVAS_LOAD_ERROR_NONE; 3362 if (efl_file_simple_load(obj, file, NULL)) return EVAS_LOAD_ERROR_NONE;
3366 3363
3367 Eina_Error err = eina_error_get(); 3364 Eina_Error err = eina_error_get();
3368 return err == PHOTO_FILE_LOAD_ERROR_DOES_NOT_EXIST ? 3365 return err == PHOTO_FILE_LOAD_ERROR_DOES_NOT_EXIST ?
@@ -3381,9 +3378,7 @@ elm_photocam_file_set(Evas_Object *obj, const char *file)
3381EAPI const char* 3378EAPI const char*
3382elm_photocam_file_get(const Evas_Object *obj) 3379elm_photocam_file_get(const Evas_Object *obj)
3383{ 3380{
3384 const char *ret = NULL; 3381 return efl_file_get(obj);
3385 efl_file_get(obj, &ret, NULL);
3386 return ret;
3387} 3382}
3388 3383
3389EAPI void 3384EAPI void
diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo
index 1c458e1..e8781a9 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.eo
+++ b/src/lib/elementary/efl_ui_image_zoomable.eo
@@ -67,7 +67,8 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom,
67 Efl.Ui.Widget.widget_event; 67 Efl.Ui.Widget.widget_event;
68 Efl.Ui.Scrollable_Interactive.scroll; 68 Efl.Ui.Scrollable_Interactive.scroll;
69 Efl.Access.Widget.Action.elm_actions { get; } 69 Efl.Access.Widget.Action.elm_actions { get; }
70 Efl.File.file { get; set; } 70 Efl.File.load;
71 Efl.File.file { set; }
71 Efl.Orientation.orientation { get; set; } 72 Efl.Orientation.orientation { get; set; }
72 Efl.Orientation.flip { get; set; } 73 Efl.Orientation.flip { get; set; }
73 Efl.Layout.Group.group_size_min { get; } 74 Efl.Layout.Group.group_size_min { get; }
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index 13bdf53..14520e5 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -851,67 +851,70 @@ _parts_cursors_find(Efl_Ui_Layout_Data *sd,
851/* The public functions down here are meant to operate on whichever 851/* The public functions down here are meant to operate on whichever
852 * widget inheriting from elm_layout */ 852 * widget inheriting from elm_layout */
853 853
854EOLIAN static Eina_Bool 854EOLIAN static Eina_Error
855_efl_ui_layout_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *file, const char *group) 855_efl_ui_layout_efl_file_load(Eo *obj, Efl_Ui_Layout_Data *sd)
856{ 856{
857 Eina_Bool int_ret = EINA_FALSE; 857 Eina_Error err;
858 858
859 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 859 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
860 860
861 int_ret = 861 if (efl_file_loaded_get(obj)) return 0;
862 edje_object_file_set(wd->resize_obj, file, group); 862 err = efl_file_load(wd->resize_obj);
863 863
864 if (int_ret) 864 if (!err)
865 { 865 {
866 sd->file_set = EINA_TRUE; 866 sd->file_set = EINA_TRUE;
867 _visuals_refresh(obj, sd); 867 _visuals_refresh(obj, sd);
868 } 868 }
869 else 869 else
870 ERR("failed to set edje file '%s', group '%s': %s", 870 ERR("failed to set edje file '%s', group '%s': %s",
871 file, group, 871 efl_file_get(wd->resize_obj), efl_file_key_get(wd->resize_obj),
872 edje_load_error_str 872 edje_load_error_str
873 (edje_object_load_error_get(wd->resize_obj))); 873 (edje_object_load_error_get(wd->resize_obj)));
874 874
875 return int_ret; 875 return err;
876}
877
878EOLIAN static Eina_Error
879_efl_ui_layout_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *file)
880{
881 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC);
882 return efl_file_set(wd->resize_obj, file);
883}
884
885EOLIAN static const char *
886_efl_ui_layout_efl_file_file_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
887{
888 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
889 return efl_file_get(wd->resize_obj);
876} 890}
877 891
878EOLIAN static void 892EOLIAN static void
879_efl_ui_layout_efl_file_file_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **file, const char **group) 893_efl_ui_layout_efl_file_key_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *key)
880{ 894{
881 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 895 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
882 edje_object_file_get(wd->resize_obj, file, group); 896 return efl_file_key_set(wd->resize_obj, key);
883} 897}
884 898
885 899EOLIAN static const char *
886EOLIAN static Eina_Bool 900_efl_ui_layout_efl_file_key_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
887_efl_ui_layout_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Data *sd, const Eina_File *file, const char *group)
888{ 901{
889 Eina_Bool int_ret = EINA_FALSE; 902 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
903 return efl_file_key_get(wd->resize_obj);
904}
890 905
906EOLIAN static Eina_Error
907_efl_ui_layout_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const Eina_File *file)
908{
891 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 909 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
892 910 return efl_file_mmap_set(wd->resize_obj, file);
893 int_ret =
894 edje_object_mmap_set(wd->resize_obj, file, group);
895
896 if (int_ret)
897 {
898 sd->file_set = EINA_TRUE;
899 _visuals_refresh(obj, sd);
900 }
901 else
902 ERR("failed to set edje mmap file %p, group '%s': %s",
903 file, group,
904 edje_load_error_str
905 (edje_object_load_error_get(wd->resize_obj)));
906
907 return int_ret;
908} 911}
909 912
910EOLIAN static void 913EOLIAN static const Eina_File *
911_efl_ui_layout_efl_file_mmap_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const Eina_File **file, const char **group) 914_efl_ui_layout_efl_file_mmap_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED)
912{ 915{
913 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 916 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
914 efl_file_mmap_get(wd->resize_obj, file, group); 917 return efl_file_mmap_get(wd->resize_obj);
915} 918}
916 919
917EOLIAN static Efl_Ui_Theme_Apply_Result 920EOLIAN static Efl_Ui_Theme_Apply_Result
@@ -1971,7 +1974,7 @@ _efl_ui_layout_efl_object_dbg_info_get(Eo *eo_obj, Efl_Ui_Layout_Data *_pd EINA_
1971 Evas_Object *edje_obj = wd->resize_obj; 1974 Evas_Object *edje_obj = wd->resize_obj;
1972 Edje_Load_Error error; 1975 Edje_Load_Error error;
1973 1976
1974 efl_file_get(edje_obj, &file, &edje_group); 1977 efl_file_simple_get(edje_obj, &file, &edje_group);
1975 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); 1978 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
1976 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); 1979 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
1977 1980
@@ -2391,9 +2394,11 @@ EOLIAN static Efl_Object*
2391_efl_ui_layout_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED) 2394_efl_ui_layout_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED)
2392{ 2395{
2393 Eo *eo; 2396 Eo *eo;
2394 2397 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
2395 eo = efl_finalize(efl_super(obj, MY_CLASS)); 2398 eo = efl_finalize(efl_super(obj, MY_CLASS));
2396 efl_ui_widget_theme_apply(eo); 2399 efl_ui_widget_theme_apply(eo);
2400 if (efl_file_get(wd->resize_obj) || efl_file_mmap_get(wd->resize_obj))
2401 efl_file_load(wd->resize_obj);
2397 2402
2398 return eo; 2403 return eo;
2399} 2404}
@@ -2437,7 +2442,7 @@ _efl_ui_layout_efl_part_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUS
2437 type > EFL_CANVAS_LAYOUT_PART_TYPE_NONE) 2442 type > EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
2438 { 2443 {
2439 const char *file = NULL, *key = NULL; 2444 const char *file = NULL, *key = NULL;
2440 efl_file_get(wd->resize_obj, &file, &key); 2445 efl_file_simple_get(wd->resize_obj, &file, &key);
2441 WRN("Layout has a background but it's not a swallow: '%s'", 2446 WRN("Layout has a background but it's not a swallow: '%s'",
2442 elm_widget_theme_element_get(obj)); 2447 elm_widget_theme_element_get(obj));
2443 } 2448 }
@@ -2627,25 +2632,25 @@ elm_layout_add(Evas_Object *parent)
2627EAPI Eina_Bool 2632EAPI Eina_Bool
2628elm_layout_file_set(Eo *obj, const char *file, const char *group) 2633elm_layout_file_set(Eo *obj, const char *file, const char *group)
2629{ 2634{
2630 return efl_file_set((Eo *) obj, file, group); 2635 return efl_file_simple_load((Eo *) obj, file, group);
2631} 2636}
2632 2637
2633EAPI void 2638EAPI void
2634elm_layout_file_get(Eo *obj, const char **file, const char **group) 2639elm_layout_file_get(Eo *obj, const char **file, const char **group)
2635{ 2640{
2636 efl_file_get((Eo *) obj, file, group); 2641 efl_file_simple_get((Eo *) obj, file, group);
2637} 2642}
2638 2643
2639EAPI Eina_Bool 2644EAPI Eina_Bool
2640elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *group) 2645elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *group)
2641{ 2646{
2642 return efl_file_mmap_set((Eo *) obj, file, group); 2647 return efl_file_simple_mmap_load((Eo *) obj, file, group);
2643} 2648}
2644 2649
2645EAPI void 2650EAPI void
2646elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group) 2651elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group)
2647{ 2652{
2648 efl_file_mmap_get((Eo *) obj, file, group); 2653 efl_file_simple_mmap_get((Eo *) obj, file, group);
2649} 2654}
2650 2655
2651EAPI Eina_Bool 2656EAPI Eina_Bool
diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo
index 350fac5..b46af45 100644
--- a/src/lib/elementary/efl_ui_layout.eo
+++ b/src/lib/elementary/efl_ui_layout.eo
@@ -49,7 +49,9 @@ class @beta Efl.Ui.Layout extends Efl.Ui.Widget implements Efl.Container, Efl.Fi
49 Efl.Object.constructor; 49 Efl.Object.constructor;
50 Efl.Object.finalize; 50 Efl.Object.finalize;
51 Efl.File.file { get; set; } 51 Efl.File.file { get; set; }
52 Efl.File.key { get; set; }
52 Efl.File.mmap { get; set; } 53 Efl.File.mmap { get; set; }
54 Efl.File.load;
53 Efl.Canvas.Group.group_calculate; 55 Efl.Canvas.Group.group_calculate;
54 Efl.Layout.Calc.calc_freeze; 56 Efl.Layout.Calc.calc_freeze;
55 Efl.Layout.Calc.calc_thaw; 57 Efl.Layout.Calc.calc_thaw;
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 43150df..f48e304 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -351,12 +351,19 @@ _efl_ui_popup_part_backwall_repeat_events_get(const Eo *obj, void *_pd EINA_UNUS
351 return efl_canvas_object_repeat_events_get(sd->backwall); 351 return efl_canvas_object_repeat_events_get(sd->backwall);
352} 352}
353 353
354EOLIAN static Eina_Bool 354EOLIAN static Eina_Error
355_efl_ui_popup_part_backwall_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *group) 355_efl_ui_popup_part_backwall_efl_file_load(Eo *obj, void *_pd EINA_UNUSED)
356{ 356{
357 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); 357 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
358 Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS); 358 Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
359 359
360 Eina_Error err;
361
362 if (efl_file_loaded_get(obj)) return 0;
363
364 err = efl_file_load(efl_super(obj, MY_CLASS));
365 if (err) return err;
366
360 Eo *prev_obj = edje_object_part_swallow_get(sd->backwall, "efl.content"); 367 Eo *prev_obj = edje_object_part_swallow_get(sd->backwall, "efl.content");
361 if (prev_obj) 368 if (prev_obj)
362 { 369 {
@@ -366,16 +373,23 @@ _efl_ui_popup_part_backwall_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, co
366 } 373 }
367 374
368 Eo *image = elm_image_add(pd->obj); 375 Eo *image = elm_image_add(pd->obj);
369 Eina_Bool ret = elm_image_file_set(image, file, group); 376 Eina_Bool ret;
377 const Eina_File *f;
378
379 f = efl_file_mmap_get(obj);
380 if (f)
381 ret = elm_image_mmap_set(image, f, efl_file_key_get(obj));
382 else
383 ret = elm_image_file_set(image, efl_file_get(obj), efl_file_key_get(obj));
370 if (!ret) 384 if (!ret)
371 { 385 {
372 efl_del(image); 386 efl_del(image);
373 return EINA_FALSE; 387 return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
374 } 388 }
375 edje_object_part_swallow(sd->backwall, "efl.content", image); 389 edje_object_part_swallow(sd->backwall, "efl.content", image);
376 edje_object_signal_emit(sd->backwall, "efl,state,content,set", "efl"); 390 edje_object_signal_emit(sd->backwall, "efl,state,content,set", "efl");
377 391
378 return EINA_TRUE; 392 return 0;
379} 393}
380 394
381#include "efl_ui_popup_part_backwall.eo.c" 395#include "efl_ui_popup_part_backwall.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_part_backwall.eo b/src/lib/elementary/efl_ui_popup_part_backwall.eo
index 759e0f4..4a6a914 100644
--- a/src/lib/elementary/efl_ui_popup_part_backwall.eo
+++ b/src/lib/elementary/efl_ui_popup_part_backwall.eo
@@ -25,6 +25,6 @@ class @beta Efl.Ui.Popup_Part_Backwall extends Efl.Ui.Layout_Part implements Efl
25 } 25 }
26 } 26 }
27 implements { 27 implements {
28 Efl.File.file { set; } 28 Efl.File.load;
29 } 29 }
30} 30}
diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c
index d8064a4..aa48ba7 100644
--- a/src/lib/elementary/efl_ui_selection_manager.c
+++ b/src/lib/elementary/efl_ui_selection_manager.c
@@ -1205,7 +1205,7 @@ _x11_text_converter(char *target, void *data, int size EINA_UNUSED, void **data_
1205 } 1205 }
1206 else if (sel->format & EFL_UI_SELECTION_FORMAT_IMAGE) 1206 else if (sel->format & EFL_UI_SELECTION_FORMAT_IMAGE)
1207 { 1207 {
1208 efl_file_get(sel->request_obj, (const char **)data_ret, NULL); 1208 efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL);
1209 if (!*data_ret) *data_ret = strdup("No file"); 1209 if (!*data_ret) *data_ret = strdup("No file");
1210 else *data_ret = strdup(*data_ret); 1210 else *data_ret = strdup(*data_ret);
1211 1211
@@ -2487,7 +2487,7 @@ _wl_text_converter(char *target, Sel_Manager_Selection *sel, void *data, int siz
2487 else if (format & EFL_UI_SELECTION_FORMAT_IMAGE) 2487 else if (format & EFL_UI_SELECTION_FORMAT_IMAGE)
2488 { 2488 {
2489 sel_debug("Image %s\n", evas_object_type_get(sel->request_obj)); 2489 sel_debug("Image %s\n", evas_object_type_get(sel->request_obj));
2490 efl_file_get(sel->request_obj, (const char **)data_ret, NULL); 2490 efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL);
2491 if (!*data_ret) *data_ret = strdup("No file"); 2491 if (!*data_ret) *data_ret = strdup("No file");
2492 else *data_ret = strdup(*data_ret); 2492 else *data_ret = strdup(*data_ret);
2493 2493
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index f70bb65..57c2978 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -251,14 +251,13 @@ static void _selection_defer(Eo *obj, Efl_Ui_Text_Data *sd);
251static Eina_Position2D _decoration_calc_offset(Efl_Ui_Text_Data *sd); 251static Eina_Position2D _decoration_calc_offset(Efl_Ui_Text_Data *sd);
252 252
253static char * 253static char *
254_file_load(const char *file) 254_file_load(Eo *obj)
255{ 255{
256 Eina_File *f; 256 Eina_File *f;
257 char *text = NULL; 257 char *text = NULL;
258 void *tmp = NULL; 258 void *tmp = NULL;
259 259
260 f = eina_file_open(file, EINA_FALSE); 260 f = eina_file_dup(efl_file_mmap_get(obj));
261 if (!f) return NULL;
262 261
263 tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); 262 tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
264 if (!tmp) goto on_error; 263 if (!tmp) goto on_error;
@@ -282,29 +281,35 @@ _file_load(const char *file)
282} 281}
283 282
284static char * 283static char *
285_plain_load(const char *file) 284_plain_load(Eo *obj)
286{ 285{
287 return _file_load(file); 286 return _file_load(obj);
288} 287}
289 288
290static Eina_Bool 289static Eina_Error
291_load_do(Evas_Object *obj) 290_load_do(Evas_Object *obj)
292{ 291{
293 char *text; 292 char *text;
293 Eina_Error err = 0;
294 294
295 EFL_UI_TEXT_DATA_GET(obj, sd); 295 EFL_UI_TEXT_DATA_GET(obj, sd);
296 296
297 if (!sd->file) 297 if (!sd->file)
298 { 298 {
299 elm_object_text_set(obj, ""); 299 elm_object_text_set(obj, "");
300 return EINA_TRUE; 300 return 0;
301 } 301 }
302 302
303 switch (sd->format) 303 switch (sd->format)
304 { 304 {
305 /* Only available format */ 305 /* Only available format */
306 case ELM_TEXT_FORMAT_PLAIN_UTF8: 306 case ELM_TEXT_FORMAT_PLAIN_UTF8:
307 text = _plain_load(sd->file); 307 text = _plain_load(obj);
308 if (!text)
309 {
310 err = errno;
311 if (!err) err = ENOENT;
312 }
308 break; 313 break;
309 314
310 default: 315 default:
@@ -316,13 +321,10 @@ _load_do(Evas_Object *obj)
316 { 321 {
317 efl_text_set(obj, text); 322 efl_text_set(obj, text);
318 free(text); 323 free(text);
319 return EINA_TRUE; 324 return 0;
320 }
321 else
322 {
323 efl_text_set(obj, "");
324 return EINA_FALSE;
325 } 325 }
326 efl_text_set(obj, "");
327 return err;
326} 328}
327 329
328static void 330static void
@@ -2528,21 +2530,24 @@ _efl_ui_text_context_menu_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Da
2528 return !sd->context_menu; 2530 return !sd->context_menu;
2529} 2531}
2530 2532
2531EOLIAN static Eina_Bool 2533EOLIAN static Eina_Error
2532_efl_ui_text_efl_file_file_set(Eo *obj, Efl_Ui_Text_Data *sd, const char *file, const char *group EINA_UNUSED) 2534_efl_ui_text_efl_file_file_set(Eo *obj, Efl_Ui_Text_Data *sd, const char *file)
2533{ 2535{
2534 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
2535 if (sd->auto_save) _save_do(obj);
2536 eina_stringshare_replace(&sd->file, file); 2536 eina_stringshare_replace(&sd->file, file);
2537 Eina_Bool int_ret = _load_do(obj); 2537 return efl_file_set(efl_super(obj, MY_CLASS), file);
2538 return int_ret;
2539} 2538}
2540 2539
2541EOLIAN static void 2540EOLIAN static Eina_Error
2542_efl_ui_text_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char **file, const char **group) 2541_efl_ui_text_efl_file_load(Eo *obj, Efl_Ui_Text_Data *sd)
2543{ 2542{
2544 if (file) *file = sd->file; 2543 Eina_Error err;
2545 if (group) *group = NULL; 2544
2545 if (efl_file_loaded_get(obj)) return 0;
2546 err = efl_file_load(efl_super(obj, MY_CLASS));
2547 if (err) return err;
2548 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
2549 if (sd->auto_save) _save_do(obj);
2550 return _load_do(obj);
2546} 2551}
2547 2552
2548EOLIAN static void 2553EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo
index afb6094..7394a61 100644
--- a/src/lib/elementary/efl_ui_text.eo
+++ b/src/lib/elementary/efl_ui_text.eo
@@ -362,7 +362,8 @@ class @beta Efl.Ui.Text extends Efl.Ui.Layout implements Efl.Ui.Clickable,
362 Efl.Access.Editable.Text.cut; 362 Efl.Access.Editable.Text.cut;
363 Efl.Access.Editable.Text.delete; 363 Efl.Access.Editable.Text.delete;
364 Efl.Access.Editable.Text.paste; 364 Efl.Access.Editable.Text.paste;
365 Efl.File.file { get; set; } 365 Efl.File.file { set; }
366 Efl.File.load;
366 Efl.Text_Interactive.editable { set; } 367 Efl.Text_Interactive.editable { set; }
367 Efl.Part.part_get; 368 Efl.Part.part_get;
368 } 369 }
diff --git a/src/lib/elementary/efl_ui_text_factory_images.c b/src/lib/elementary/efl_ui_text_factory_images.c
index 54c5c43..38529e4 100644
--- a/src/lib/elementary/efl_ui_text_factory_images.c
+++ b/src/lib/elementary/efl_ui_text_factory_images.c
@@ -61,20 +61,20 @@ _efl_ui_text_factory_images_efl_canvas_text_factory_create(Eo *obj EINA_UNUSED,
61 e = eina_hash_find(pd->hash, key); 61 e = eina_hash_find(pd->hash, key);
62 if (e) 62 if (e)
63 { 63 {
64 efl_file_mmap_set(o, e->file, e->key); 64 efl_file_key_set(o, e->key);
65 if (efl_file_mmap_set(o, e->file)) goto error;
65 } 66 }
66 else 67 else
67 { 68 {
68 efl_file_set(o, key, NULL); 69 if (efl_file_set(o, key)) goto error;
69 }
70
71 if (efl_file_load_error_get(o) != EFL_GFX_IMAGE_LOAD_ERROR_NONE)
72 {
73 efl_del(o);
74 o = NULL;
75 } 70 }
71 if (efl_file_load(o)) goto error;
76 72
77 return o; 73 return o;
74
75error:
76 efl_del(o);
77 return NULL;
78} 78}
79 79
80EOLIAN static Eina_Bool 80EOLIAN static Eina_Bool
diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c
index 3d7bf74..ec9bce6 100644
--- a/src/lib/elementary/efl_ui_video.c
+++ b/src/lib/elementary/efl_ui_video.c
@@ -288,14 +288,19 @@ _efl_ui_video_efl_object_constructor(Eo *obj, Efl_Ui_Video_Data *_pd EINA_UNUSED
288 return obj; 288 return obj;
289} 289}
290 290
291EOLIAN static Eina_Bool 291EOLIAN static Eina_Error
292_efl_ui_video_efl_file_file_set(Eo *obj, Efl_Ui_Video_Data *sd, const char *filename, const char *key EINA_UNUSED) 292_efl_ui_video_efl_file_load(Eo *obj, Efl_Ui_Video_Data *sd)
293{ 293{
294 const char *file = efl_file_get(obj);
295 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST);
296
297 if (eina_streq(file, emotion_object_file_get(sd->emotion)) && efl_file_loaded_get(sd->emotion)) return 0;
298
294 if (sd->remember) emotion_object_last_position_save(sd->emotion); 299 if (sd->remember) emotion_object_last_position_save(sd->emotion);
295 sd->stop = EINA_FALSE; 300 sd->stop = EINA_FALSE;
296 if (!emotion_object_file_set(sd->emotion, filename)) return EINA_FALSE; 301 if (!emotion_object_file_set(sd->emotion, file)) return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
297 302
298 if (filename && ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://")))) 303 if (file && ((!strncmp(file, "file://", 7)) || (!strstr(file, "://"))))
299 emotion_object_last_position_load(sd->emotion); 304 emotion_object_last_position_load(sd->emotion);
300 305
301 if(elm_widget_is_legacy(obj)) 306 if(elm_widget_is_legacy(obj))
@@ -303,14 +308,7 @@ _efl_ui_video_efl_file_file_set(Eo *obj, Efl_Ui_Video_Data *sd, const char *file
303 else 308 else
304 elm_layout_signal_emit(obj, "efl,video,load", "efl"); 309 elm_layout_signal_emit(obj, "efl,video,load", "efl");
305 310
306 return EINA_TRUE; 311 return 0;
307}
308
309EOLIAN static void
310_efl_ui_video_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd EINA_UNUSED, const char **filename, const char **key EINA_UNUSED)
311{
312 if (filename)
313 *filename = emotion_object_file_get(sd->emotion);
314} 312}
315 313
316EOLIAN static Evas_Object* 314EOLIAN static Evas_Object*
@@ -454,13 +452,13 @@ elm_video_add(Evas_Object *parent)
454EAPI Eina_Bool 452EAPI Eina_Bool
455elm_video_file_set(Eo *obj, const char *filename) 453elm_video_file_set(Eo *obj, const char *filename)
456{ 454{
457 return efl_file_set((Eo *) obj, filename, NULL); 455 return efl_file_simple_load((Eo *) obj, filename, NULL);
458} 456}
459 457
460EAPI void 458EAPI void
461elm_video_file_get(Eo *obj, const char **filename) 459elm_video_file_get(Eo *obj, const char **filename)
462{ 460{
463 efl_file_get((Eo *) obj, filename, NULL); 461 efl_file_simple_get((Eo *) obj, filename, NULL);
464} 462}
465 463
466EAPI void 464EAPI void
diff --git a/src/lib/elementary/efl_ui_video.eo b/src/lib/elementary/efl_ui_video.eo
index 61cef8f..d418cb4 100644
--- a/src/lib/elementary/efl_ui_video.eo
+++ b/src/lib/elementary/efl_ui_video.eo
@@ -42,7 +42,7 @@ class @beta Efl.Ui.Video extends Efl.Ui.Layout implements Efl.Player, Efl.Access
42 } 42 }
43 implements { 43 implements {
44 Efl.Object.constructor; 44 Efl.Object.constructor;
45 Efl.File.file { get; set; } 45 Efl.File.load;
46 Efl.Ui.Widget.widget_event; 46 Efl.Ui.Widget.widget_event;
47 Efl.Access.Widget.Action.elm_actions { get; } 47 Efl.Access.Widget.Action.elm_actions { get; }
48 Efl.Player.start; 48 Efl.Player.start;
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 63797df..2f51767 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -6079,20 +6079,60 @@ efl_ui_widget_part_bg_get(const Eo *part_obj)
6079 return _efl_ui_widget_bg_get(pd->obj); 6079 return _efl_ui_widget_bg_get(pd->obj);
6080} 6080}
6081 6081
6082EOLIAN static Eina_Bool 6082EOLIAN static Eina_Error
6083_efl_ui_widget_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file, const char *key) 6083_efl_ui_widget_part_bg_efl_file_load(Eo *obj, void *pd EINA_UNUSED)
6084{
6085 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6086
6087 return efl_file_load(bg_obj);
6088}
6089
6090EOLIAN static const char *
6091_efl_ui_widget_part_bg_efl_file_file_get(const Eo *obj, void *pd EINA_UNUSED)
6092{
6093 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6094
6095 return efl_file_get(bg_obj);
6096}
6097
6098EOLIAN static Eina_Error
6099_efl_ui_widget_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file)
6100{
6101 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6102
6103 return efl_file_set(bg_obj, file);
6104}
6105
6106EOLIAN static const char *
6107_efl_ui_widget_part_bg_efl_file_key_get(const Eo *obj, void *pd EINA_UNUSED)
6084{ 6108{
6085 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); 6109 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6086 6110
6087 return efl_file_set(bg_obj, file, key); 6111 return efl_file_key_get(bg_obj);
6088} 6112}
6089 6113
6090EOLIAN static void 6114EOLIAN static void
6091_efl_ui_widget_part_bg_efl_file_file_get(const Eo *obj, void *pd EINA_UNUSED, const char **file, const char **key) 6115_efl_ui_widget_part_bg_efl_file_key_set(Eo *obj, void *pd EINA_UNUSED, const char *key)
6116{
6117 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6118
6119 efl_file_key_set(bg_obj, key);
6120}
6121
6122EOLIAN static const Eina_File *
6123_efl_ui_widget_part_bg_efl_file_mmap_get(const Eo *obj, void *pd EINA_UNUSED)
6124{
6125 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6126
6127 return efl_file_mmap_get(bg_obj);
6128}
6129
6130EOLIAN static Eina_Error
6131_efl_ui_widget_part_bg_efl_file_mmap_set(Eo *obj, void *pd EINA_UNUSED, const Eina_File *file)
6092{ 6132{
6093 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); 6133 Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
6094 6134
6095 efl_file_get(bg_obj, file, key); 6135 return efl_file_mmap_set(bg_obj, file);
6096} 6136}
6097 6137
6098EOLIAN static void 6138EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_widget_part_bg.eo b/src/lib/elementary/efl_ui_widget_part_bg.eo
index cbe42fd..94f87b8 100644
--- a/src/lib/elementary/efl_ui_widget_part_bg.eo
+++ b/src/lib/elementary/efl_ui_widget_part_bg.eo
@@ -4,7 +4,9 @@ class @beta Efl.Ui.Widget_Part_Bg extends Efl.Ui.Widget_Part implements Efl.File
4 data: null; 4 data: null;
5 implements { 5 implements {
6 Efl.File.file { get; set; } 6 Efl.File.file { get; set; }
7 //Efl.File.mmap { get; set; } 7 Efl.File.key { get; set; }
8 Efl.File.mmap { get; set; }
9 Efl.File.load;
8 Efl.Gfx.Color.color { set; get; } 10 Efl.Gfx.Color.color { set; get; }
9 Efl.Gfx.Image.scale_type { get; set; } 11 Efl.Gfx.Image.scale_type { get; set; }
10 } 12 }
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index fca343f..472e1bf 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5721,6 +5721,12 @@ _efl_ui_win_efl_object_finalize(Eo *obj, Efl_Ui_Win_Data *sd)
5721 if (!obj) return NULL; 5721 if (!obj) return NULL;
5722 obj = efl_finalize(efl_super(obj, MY_CLASS)); 5722 obj = efl_finalize(efl_super(obj, MY_CLASS));
5723 if (obj && resume) efl_event_callback_call(efl_loop_get(obj), EFL_APP_EVENT_RESUME, NULL); 5723 if (obj && resume) efl_event_callback_call(efl_loop_get(obj), EFL_APP_EVENT_RESUME, NULL);
5724 if (obj && (!elm_widget_is_legacy(obj)))
5725 {
5726 /* FIXME: if parts other than background are supported then this should change */
5727 if (efl_file_get(efl_part(obj, "background")) || efl_file_mmap_get(efl_part(obj, "background")))
5728 efl_file_load(efl_part(obj, "background"));
5729 }
5724 return obj; 5730 return obj;
5725} 5731}
5726 5732
@@ -7617,9 +7623,14 @@ _efl_ui_win_part_color_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char
7617 return EINA_FALSE; 7623 return EINA_FALSE;
7618} 7624}
7619 7625
7620static Eina_Bool 7626static Eina_Error
7621_efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const char *file, const char *key) 7627_efl_ui_win_part_file_load(Eo *obj, Efl_Ui_Win_Data *sd, Eo *part_obj, const char *part)
7622{ 7628{
7629 const char *file, *key;
7630
7631 if (efl_file_loaded_get(part_obj)) return 0;
7632 file = efl_file_get(part_obj);
7633 key = efl_file_key_get(part_obj);
7623 sd->legacy.forbidden = EINA_TRUE; 7634 sd->legacy.forbidden = EINA_TRUE;
7624 if (eina_streq(part, "background")) 7635 if (eina_streq(part, "background"))
7625 { 7636 {
@@ -7630,7 +7641,7 @@ _efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const
7630 { 7641 {
7631 bg = efl_add(EFL_UI_IMAGE_CLASS, obj); 7642 bg = efl_add(EFL_UI_IMAGE_CLASS, obj);
7632 efl_gfx_image_scale_type_set(bg, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE); 7643 efl_gfx_image_scale_type_set(bg, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE);
7633 ok = efl_file_set(bg, file, key); 7644 ok = efl_file_simple_load(bg, file, key);
7634 if (!ok) ELM_SAFE_DEL(bg); 7645 if (!ok) ELM_SAFE_DEL(bg);
7635 _elm_win_bg_set(sd, bg); 7646 _elm_win_bg_set(sd, bg);
7636 } 7647 }
@@ -7646,22 +7657,41 @@ _efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const
7646 return EINA_FALSE; 7657 return EINA_FALSE;
7647} 7658}
7648 7659
7649static Eina_Bool 7660static const char *
7650_efl_ui_win_part_file_get(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const char **file, const char **key) 7661_efl_ui_win_part_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const Eo *part_obj, const char *part EINA_UNUSED)
7651{ 7662{
7652 sd->legacy.forbidden = EINA_TRUE; 7663 sd->legacy.forbidden = EINA_TRUE;
7653 if (file) *file = NULL; 7664 return efl_file_get(efl_super(part_obj, EFL_UI_WIN_PART_CLASS));
7654 if (key) *key = NULL; 7665#if 0
7655 7666
7656 if (eina_streq(part, "background")) 7667 if (eina_streq(part, "background"))
7657 { 7668 {
7658 const Eo *bg = _efl_ui_win_content_get(obj, sd, "background"); 7669 const Eo *bg = _efl_ui_win_content_get(obj, sd, "background");
7659 efl_file_get(bg, file, key); 7670 return efl_file_get(bg);
7660 return EINA_TRUE;
7661 } 7671 }
7662 7672
7663 WIN_PART_ERR(part); 7673 WIN_PART_ERR(part);
7664 return EINA_FALSE; 7674 return NULL;
7675#endif
7676}
7677
7678static const char *
7679_efl_ui_win_part_file_key_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const Eo *part_obj, const char *part EINA_UNUSED)
7680{
7681 sd->legacy.forbidden = EINA_TRUE;
7682 return efl_file_key_get(efl_super(part_obj, EFL_UI_WIN_PART_CLASS));
7683/* NOTE; if more than one part is ever supported here then this section is needed */
7684#if 0
7685
7686 if (eina_streq(part, "background"))
7687 {
7688 const Eo *bg = _efl_ui_win_content_get(obj, sd, "background");
7689 return efl_file_get(bg);
7690 }
7691
7692 WIN_PART_ERR(part);
7693 return NULL;
7694#endif
7665} 7695}
7666 7696
7667/* Efl.Part begin */ 7697/* Efl.Part begin */
@@ -7686,22 +7716,31 @@ _efl_ui_win_part_efl_gfx_color_color_get(const Eo *obj, void *_pd EINA_UNUSED, i
7686 _efl_ui_win_part_color_get(pd->obj, sd, pd->part, r, g, b, a); 7716 _efl_ui_win_part_color_get(pd->obj, sd, pd->part, r, g, b, a);
7687} 7717}
7688 7718
7689static Eina_Bool 7719EOLIAN static const char *
7690_efl_ui_win_part_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *key) 7720_efl_ui_win_part_efl_file_file_get(const Eo *obj, void *_pd EINA_UNUSED)
7691{ 7721{
7692 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); 7722 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
7693 Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS); 7723 Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
7694 return _efl_ui_win_part_file_set(pd->obj, sd, pd->part, file, key); 7724 return _efl_ui_win_part_file_get(pd->obj, sd, obj, pd->part);
7695} 7725}
7696 7726
7697static void 7727EOLIAN static const char *
7698_efl_ui_win_part_efl_file_file_get(const Eo *obj, void *_pd EINA_UNUSED, const char **file, const char **key) 7728_efl_ui_win_part_efl_file_key_get(const Eo *obj, void *_pd EINA_UNUSED)
7729{
7730 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
7731 Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
7732 return _efl_ui_win_part_file_key_get(pd->obj, sd, obj, pd->part);
7733}
7734
7735EOLIAN static Eina_Error
7736_efl_ui_win_part_efl_file_load(Eo *obj, void *_pd EINA_UNUSED)
7699{ 7737{
7700 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); 7738 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
7701 Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS); 7739 Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
7702 _efl_ui_win_part_file_get(pd->obj, sd, pd->part, file, key); 7740 return _efl_ui_win_part_file_load(pd->obj, sd, obj, pd->part);
7703} 7741}
7704 7742
7743
7705ELM_PART_OVERRIDE(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data) 7744ELM_PART_OVERRIDE(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data)
7706ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data) 7745ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data)
7707ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data) 7746ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data)
diff --git a/src/lib/elementary/efl_ui_win_part.eo b/src/lib/elementary/efl_ui_win_part.eo
index 55919f7..ea9d09f 100644
--- a/src/lib/elementary/efl_ui_win_part.eo
+++ b/src/lib/elementary/efl_ui_win_part.eo
@@ -6,6 +6,8 @@ class @beta Efl.Ui.Win_Part extends Efl.Ui.Widget_Part implements Efl.Content, E
6 Efl.Content.content { get; set; } 6 Efl.Content.content { get; set; }
7 Efl.Content.content_unset; 7 Efl.Content.content_unset;
8 Efl.Gfx.Color.color { get; set; } 8 Efl.Gfx.Color.color { get; set; }
9 Efl.File.file { get; set; } 9 Efl.File.load;
10 Efl.File.file { get; }
11 Efl.File.key { get; }
10 } 12 }
11} 13}
diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index 336b0f7..4c42535 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -138,16 +138,14 @@ ok: // ok - return api
138} 138}
139 139
140static char * 140static char *
141_file_load(const char *file) 141_file_load(Eo *obj)
142{ 142{
143 Eina_File *f; 143 Eina_File *f;
144 char *text = NULL; 144 char *text = NULL;
145 void *tmp = NULL; 145 void *tmp = NULL;
146 size_t size; 146 size_t size;
147 147
148 f = eina_file_open(file, EINA_FALSE); 148 f = eina_file_dup(efl_file_mmap_get(obj));
149 if (!f) return NULL;
150
151 size = eina_file_size_get(f); 149 size = eina_file_size_get(f);
152 if (size) 150 if (size)
153 { 151 {
@@ -175,11 +173,11 @@ _file_load(const char *file)
175} 173}
176 174
177static char * 175static char *
178_plain_load(const char *file) 176_plain_load(Eo *obj)
179{ 177{
180 char *text; 178 char *text;
181 179
182 text = _file_load(file); 180 text = _file_load(obj);
183 if (text) 181 if (text)
184 { 182 {
185 char *text2; 183 char *text2;
@@ -192,47 +190,54 @@ _plain_load(const char *file)
192 return NULL; 190 return NULL;
193} 191}
194 192
195static Eina_Bool 193static Eina_Error
196_load_do(Evas_Object *obj) 194_load_do(Evas_Object *obj)
197{ 195{
198 char *text; 196 char *text;
197 Eina_Bool fail = EINA_FALSE;
198 Eina_Error err = 0;
199 199
200 ELM_ENTRY_DATA_GET(obj, sd); 200 ELM_ENTRY_DATA_GET(obj, sd);
201 201
202 if (!sd->file) 202 if (!sd->file)
203 { 203 {
204 elm_object_text_set(obj, ""); 204 elm_object_text_set(obj, "");
205 return EINA_TRUE; 205 return 0;
206 } 206 }
207 207
208 switch (sd->format) 208 switch (sd->format)
209 { 209 {
210 case ELM_TEXT_FORMAT_PLAIN_UTF8: 210 case ELM_TEXT_FORMAT_PLAIN_UTF8:
211 text = _plain_load(sd->file); 211 text = _plain_load(obj);
212 fail = !text;
212 break; 213 break;
213 214
214 case ELM_TEXT_FORMAT_MARKUP_UTF8: 215 case ELM_TEXT_FORMAT_MARKUP_UTF8:
215 text = _file_load(sd->file); 216 text = _file_load(obj);
217 fail = !text;
216 break; 218 break;
217 219
218 default: 220 default:
219 text = NULL; 221 text = NULL;
220 break; 222 break;
221 } 223 }
224 if (fail)
225 {
226 err = errno;
227 /* FIXME: this is more like a hint but not totally accurate... */
228 if (!err) err = ENOENT;
229 }
222 230
223 if (text) 231 if (text)
224 { 232 {
225 elm_object_text_set(obj, text); 233 elm_object_text_set(obj, text);
226 free(text); 234 free(text);
227 235
228 return EINA_TRUE; 236 return 0;
229 } 237 }
230 else 238 elm_object_text_set(obj, "");
231 {
232 elm_object_text_set(obj, "");
233 239
234 return EINA_FALSE; 240 return err;
235 }
236} 241}
237 242
238static void 243static void
@@ -4969,24 +4974,34 @@ elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
4969{ 4974{
4970 Eina_Bool ret; 4975 Eina_Bool ret;
4971 elm_obj_entry_file_text_format_set(obj, format); 4976 elm_obj_entry_file_text_format_set(obj, format);
4972 ret = efl_file_set(obj, file, NULL); 4977 ret = efl_file_simple_load(obj, file, NULL);
4973 return ret; 4978 return ret;
4974} 4979}
4975 4980
4976EOLIAN static Eina_Bool 4981EOLIAN static Eina_Error
4977_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file, const char *group EINA_UNUSED) 4982_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd)
4978{ 4983{
4984 Eina_Error err;
4985
4986 if (efl_file_loaded_get(obj)) return 0;
4987 err = efl_file_load(efl_super(obj, MY_CLASS));
4988 if (err) return err;
4979 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); 4989 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
4980 if (sd->auto_save) _save_do(obj); 4990 if (sd->auto_save) _save_do(obj);
4991 return _load_do(obj);
4992}
4993
4994EOLIAN static Eina_Error
4995_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file)
4996{
4981 eina_stringshare_replace(&sd->file, file); 4997 eina_stringshare_replace(&sd->file, file);
4982 Eina_Bool int_ret = _load_do(obj); 4998 return efl_file_set(efl_super(obj, MY_CLASS), file);
4983 return int_ret;
4984} 4999}
4985 5000
4986EAPI void 5001EAPI void
4987elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format) 5002elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
4988{ 5003{
4989 efl_file_get(obj, file, NULL); 5004 if (file) *file = efl_file_get(obj);
4990 if (format) 5005 if (format)
4991 { 5006 {
4992 ELM_ENTRY_DATA_GET(obj, sd); 5007 ELM_ENTRY_DATA_GET(obj, sd);
@@ -4996,13 +5011,6 @@ elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *f
4996} 5011}
4997 5012
4998EOLIAN static void 5013EOLIAN static void
4999_elm_entry_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char **file, const char **group)
5000{
5001 if (file) *file = sd->file;
5002 if (group) *group = NULL;
5003}
5004
5005EOLIAN static void
5006_elm_entry_file_save(Eo *obj, Elm_Entry_Data *sd) 5014_elm_entry_file_save(Eo *obj, Elm_Entry_Data *sd)
5007{ 5015{
5008 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); 5016 ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo
index f2e5e3b..d5cbe82 100644
--- a/src/lib/elementary/elm_entry.eo
+++ b/src/lib/elementary/elm_entry.eo
@@ -91,14 +91,14 @@ class Elm.Entry extends Efl.Ui.Layout implements Elm.Interface_Scrollable, Efl.U
91 91
92 Default is $ELM_TEXT_FORMAT_PLAIN_UTF8, if you want to use 92 Default is $ELM_TEXT_FORMAT_PLAIN_UTF8, if you want to use
93 $ELM_TEXT_FORMAT_MARKUP_UTF8 then you need to set the text format 93 $ELM_TEXT_FORMAT_MARKUP_UTF8 then you need to set the text format
94 before calling @Efl.File.file.set. 94 before calling @Efl.File.load.
95 95
96 You could also set it before a call to @.file_save 96 You could also set it before a call to @.file_save
97 in order to save with the given format. 97 in order to save with the given format.
98 ]] 98 ]]
99 99
100 set { 100 set {
101 [[Use it before calling @Efl.File.file.set or @.file_save.]] 101 [[Use it before calling @Efl.File.load or @.file_save.]]
102 } 102 }
103 values { 103 values {
104 format: Elm.Text_Format(Elm.Text_Format.plain_utf8); [[ The file format ]] 104 format: Elm.Text_Format(Elm.Text_Format.plain_utf8); [[ The file format ]]
@@ -897,7 +897,8 @@ class Elm.Entry extends Efl.Ui.Layout implements Elm.Interface_Scrollable, Efl.U
897 Efl.Access.Editable.Text.delete; 897 Efl.Access.Editable.Text.delete;
898 Efl.Access.Editable.Text.paste; 898 Efl.Access.Editable.Text.paste;
899 Efl.Access.Widget.Action.elm_actions { get; } 899 Efl.Access.Widget.Action.elm_actions { get; }
900 Efl.File.file { get; set; } 900 Efl.File.file { set; }
901 Efl.File.load;
901 Efl.Part.part_get; 902 Efl.Part.part_get;
902 } 903 }
903 events { 904 events {
diff --git a/src/lib/elementary/elm_icon.c b/src/lib/elementary/elm_icon.c
index 2d612af..6b00dcc 100644
--- a/src/lib/elementary/elm_icon.c
+++ b/src/lib/elementary/elm_icon.c
@@ -312,22 +312,25 @@ _edje_signals_free(Elm_Icon_Data *sd)
312 } 312 }
313} 313}
314 314
315EOLIAN static Eina_Bool 315EOLIAN static Eina_Error
316_elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const char *key) 316_elm_icon_efl_file_load(Eo *obj, Elm_Icon_Data *sd)
317{ 317{
318 Evas_Object *pclip; 318 Evas_Object *pclip;
319 const char *key;
320 Eina_Error err;
319 321
322 if (efl_file_loaded_get(obj)) return 0;
323 err = efl_file_load(efl_super(obj, MY_CLASS));
324 if (err) return err;
325
320 Efl_Ui_Image_Data *id = efl_data_scope_get(obj, EFL_UI_IMAGE_CLASS); 326 Efl_Ui_Image_Data *id = efl_data_scope_get(obj, EFL_UI_IMAGE_CLASS);
321 327
322 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
323
324 _edje_signals_free(sd); 328 _edje_signals_free(sd);
325 329
326 if (!sd->freedesktop.use) 330 if (!sd->freedesktop.use)
327 ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del); 331 ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del);
328 332
329 if (!sd->is_video) 333 if (!sd->is_video) return 0;
330 return efl_file_set(efl_super(obj, MY_CLASS), file, key);
331 334
332 /* parent's edje file setting path replicated here (we got .eet 335 /* parent's edje file setting path replicated here (we got .eet
333 * extension, so bypassing it) */ 336 * extension, so bypassing it) */
@@ -346,18 +349,21 @@ _elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const
346 evas_object_clip_set(id->img, pclip); 349 evas_object_clip_set(id->img, pclip);
347 id->edje = EINA_TRUE; 350 id->edje = EINA_TRUE;
348 } 351 }
349 352 key = efl_file_key_get(obj);
350 if (!edje_object_file_set(id->img, file, key)) 353 efl_file_key_set(id->img, key);
354 err = efl_file_mmap_set(id->img, efl_file_mmap_get(obj));
355 if (!err) err = efl_file_load(id->img);
356 if (err)
351 { 357 {
352 ERR("failed to set edje file '%s', group '%s': %s", file, key, 358 ERR("failed to set edje file '%s', group '%s': %s", efl_file_get(id->img), key,
353 edje_load_error_str 359 edje_load_error_str
354 (edje_object_load_error_get(id->img))); 360 (edje_object_load_error_get(id->img)));
355 return EINA_FALSE; 361 return err;
356 } 362 }
357 363
358 evas_object_geometry_set(id->img, id->img_x, id->img_y, id->img_w, id->img_h); 364 evas_object_geometry_set(id->img, id->img_x, id->img_y, id->img_w, id->img_h);
359 365
360 return EINA_TRUE; 366 return 0;
361} 367}
362 368
363EOLIAN static Efl_Ui_Theme_Apply_Result 369EOLIAN static Efl_Ui_Theme_Apply_Result
@@ -652,7 +658,7 @@ elm_icon_file_set(Evas_Object *obj,
652 ELM_ICON_CHECK(obj) EINA_FALSE; 658 ELM_ICON_CHECK(obj) EINA_FALSE;
653 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); 659 EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
654 660
655 return efl_file_set(obj, file, group); 661 return efl_file_simple_load(obj, file, group);
656} 662}
657 663
658EAPI void 664EAPI void
diff --git a/src/lib/elementary/elm_icon.eo b/src/lib/elementary/elm_icon.eo
index 35ce8a9..a933381 100644
--- a/src/lib/elementary/elm_icon.eo
+++ b/src/lib/elementary/elm_icon.eo
@@ -10,7 +10,7 @@ class Elm.Icon extends Efl.Ui.Image implements Efl.Ui.Legacy
10 class.constructor; 10 class.constructor;
11 Efl.Object.constructor; 11 Efl.Object.constructor;
12 Efl.Ui.Widget.theme_apply; 12 Efl.Ui.Widget.theme_apply;
13 Efl.File.file { set; } 13 Efl.File.load;
14 } 14 }
15 events { 15 events {
16 thumb,done: void; [[Called when thumb nailing is successfully done]] 16 thumb,done: void; [[Called when thumb nailing is successfully done]]
diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c
index 53300f9..0130385 100644
--- a/src/lib/elementary/elm_photo.c
+++ b/src/lib/elementary/elm_photo.c
@@ -315,6 +315,17 @@ elm_photo_add(Evas_Object *parent)
315} 315}
316 316
317EOLIAN static Eo * 317EOLIAN static Eo *
318_elm_photo_efl_object_finalize(Eo *obj, Elm_Photo_Data *sd)
319{
320 obj = efl_finalize(efl_super(obj, MY_CLASS));
321 if (!obj) return NULL;
322 if (efl_file_get(sd->icon) || efl_file_mmap_get(sd->icon))
323 efl_file_load(sd->icon);
324
325 return obj;
326}
327
328EOLIAN static Eo *
318_elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED) 329_elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
319{ 330{
320 obj = efl_constructor(efl_super(obj, MY_CLASS)); 331 obj = efl_constructor(efl_super(obj, MY_CLASS));
@@ -325,50 +336,61 @@ _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
325 return obj; 336 return obj;
326} 337}
327 338
328EOLIAN static void 339EOLIAN static Eina_Error
329_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char **file, const char **key EINA_UNUSED) 340_elm_photo_efl_file_load(Eo *obj, Elm_Photo_Data *sd)
330{
331 efl_file_get(sd->icon, file, NULL);
332}
333
334EOLIAN static Eina_Bool
335_elm_photo_efl_file_file_set(Eo *obj, Elm_Photo_Data *sd, const char *file, const char *key EINA_UNUSED)
336{ 341{
342 const char *file = efl_file_get(sd->icon);
343 Eina_Error err = 0;
337 if (!file) 344 if (!file)
338 { 345 {
339 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE; 346 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE;
340 } 347 }
341 else 348 else
342 { 349 {
343 if (!elm_image_file_set(sd->icon, file, NULL)) return EINA_FALSE; 350 if (efl_file_loaded_get(obj)) return 0;
351 err = efl_file_load(sd->icon);
352 if (err) return err;
344 } 353 }
345 354
346 _sizing_eval(obj); 355 _sizing_eval(obj);
347 356
348 return EINA_TRUE; 357 return 0;
349} 358}
350 359
351EOLIAN static void 360EOLIAN static const Eina_File *
352_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File **file, const char **key EINA_UNUSED) 361_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
353{ 362{
354 efl_file_mmap_get(sd->icon, file, key); 363 return efl_file_mmap_get(sd->icon);
355} 364}
356 365
357EOLIAN static Eina_Bool 366EOLIAN static Eina_Error
358_elm_photo_efl_file_mmap_set(Eo *obj, Elm_Photo_Data *sd, const Eina_File *file, const char *key EINA_UNUSED) 367_elm_photo_efl_file_mmap_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File *file)
359{ 368{
360 if (!file) 369 return efl_file_mmap_set(sd->icon, file);
361 { 370}
362 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE;
363 }
364 else
365 {
366 if (!efl_file_mmap_set(sd->icon, file, NULL)) return EINA_FALSE;
367 }
368 371
369 _sizing_eval(obj); 372EOLIAN static Eina_Error
373_elm_photo_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file)
374{
375 return efl_file_set(sd->icon, file);
376}
370 377
371 return EINA_TRUE; 378EOLIAN static const char *
379_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
380{
381 return efl_file_get(sd->icon);
382}
383
384EOLIAN static void
385_elm_photo_efl_file_key_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *key)
386{
387 return efl_file_key_set(sd->icon, key);
388}
389
390EOLIAN static const char *
391_elm_photo_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
392{
393 return efl_file_key_get(sd->icon);
372} 394}
373 395
374static void 396static void
@@ -380,7 +402,7 @@ _elm_photo_class_constructor(Efl_Class *klass)
380EAPI Eina_Bool 402EAPI Eina_Bool
381elm_photo_file_set(Eo *obj, const char *file) 403elm_photo_file_set(Eo *obj, const char *file)
382{ 404{
383 return efl_file_set((Eo *) obj, file, NULL); 405 return efl_file_simple_load((Eo *) obj, file, NULL);
384} 406}
385 407
386/* Legacy deprecated functions */ 408/* Legacy deprecated functions */
diff --git a/src/lib/elementary/elm_photo.eo b/src/lib/elementary/elm_photo.eo
index 3ceb6d7..7263119 100644
--- a/src/lib/elementary/elm_photo.eo
+++ b/src/lib/elementary/elm_photo.eo
@@ -7,8 +7,11 @@ class Elm.Photo extends Efl.Ui.Widget implements Efl.File, Efl.Ui.Clickable, Efl
7 implements { 7 implements {
8 class.constructor; 8 class.constructor;
9 Efl.Object.constructor; 9 Efl.Object.constructor;
10 Efl.File.file { set; get; } 10 Efl.Object.finalize;
11 Efl.File.mmap { set; get; } 11 Efl.File.file { get; set; }
12 Efl.File.key { get; set; }
13 Efl.File.mmap { get; set; }
14 Efl.File.load;
12 Efl.Ui.Widget.theme_apply; 15 Efl.Ui.Widget.theme_apply;
13 Efl.Ui.Draggable.drag_target { get; set; } 16 Efl.Ui.Draggable.drag_target { get; set; }
14 } 17 }
diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c
index 2671772..a36abe7 100644
--- a/src/lib/elementary/elm_thumb.c
+++ b/src/lib/elementary/elm_thumb.c
@@ -582,6 +582,14 @@ elm_thumb_add(Evas_Object *parent)
582} 582}
583 583
584EOLIAN static Eo * 584EOLIAN static Eo *
585_elm_thumb_efl_object_finalize(Eo *obj, Elm_Thumb_Data *sd)
586{
587 obj = efl_finalize(efl_super(obj, MY_CLASS));
588 if (sd->file) efl_file_load(obj);
589 return obj;
590}
591
592EOLIAN static Eo *
585_elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd) 593_elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd)
586{ 594{
587 obj = efl_constructor(efl_super(obj, MY_CLASS)); 595 obj = efl_constructor(efl_super(obj, MY_CLASS));
@@ -594,53 +602,71 @@ _elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd)
594 return obj; 602 return obj;
595} 603}
596 604
605EOLIAN static Eina_Error
606_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file)
607{
608 if (eina_stringshare_replace(&(sd->file), file))
609 sd->loaded = EINA_FALSE;
610 return 0;
611}
612
613EOLIAN static void
614_elm_thumb_efl_file_key_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *key)
615{
616 if (eina_stringshare_replace(&(sd->key), key))
617 sd->loaded = EINA_FALSE;
618}
619
620EOLIAN static const char *
621_elm_thumb_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
622{
623 return sd->file;
624}
625
626EOLIAN static const char *
627_elm_thumb_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
628{
629 return sd->key;
630}
631
597EOLIAN static Eina_Bool 632EOLIAN static Eina_Bool
598_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file, const char *key) 633_elm_thumb_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
599{ 634{
600 Eina_Bool file_replaced, key_replaced; 635 return sd->loaded;
636}
601 637
602 file_replaced = eina_stringshare_replace(&(sd->file), file); 638EOLIAN static Eina_Error
603 key_replaced = eina_stringshare_replace(&(sd->key), key); 639_elm_thumb_efl_file_load(Eo *obj, Elm_Thumb_Data *sd)
640{
641 int prefix_size;
642 const char **ext, *ptr;
643 static const char *extensions[] =
644 {