From 6326e18b3fb2a4757f8ffa22be5d55a75da23049 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 27 Feb 2019 13:17:09 -0500 Subject: [PATCH] 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 --- src/Makefile_Efl.am | 2 + src/bin/edje/edje_cc_out.c | 4 +- src/bin/elementary/test_bg.c | 19 +- src/bin/elementary/test_box.c | 3 +- src/bin/elementary/test_efl_gfx_mapping.c | 2 +- src/bin/elementary/test_evas_map.c | 3 +- src/bin/elementary/test_evas_mask.c | 5 +- src/bin/elementary/test_evas_snapshot.c | 3 +- src/bin/elementary/test_gfx_filters.c | 2 +- src/bin/elementary/test_part_bg.c | 6 +- src/bin/elementary/test_part_shadow.c | 2 +- src/bin/elementary/test_photocam.c | 5 +- src/bin/elementary/test_ui_button.c | 4 +- src/bin/elementary/test_ui_pager.c | 12 +- src/bin/elementary/test_ui_pager_scroll.c | 12 +- src/bin/elementary/test_ui_panel.c | 2 +- src/bin/elementary/test_ui_popup.c | 18 +- src/bin/elementary/test_ui_progressbar.c | 3 +- src/bin/elementary/test_ui_tab_pager.c | 6 +- src/examples/ecore/efl_io_copier_example.c | 4 +- .../ecore/efl_net_dialer_http_example.c | 4 +- src/examples/elementary/bg_cxx_example_02.cc | 3 +- .../elementary/efl_canvas_layout_text.c | 4 +- .../elementary/efl_ui_list_example_1.c | 4 +- .../elementary/efl_ui_scroller_example.c | 2 +- .../elementary/icon_cxx_example_01.cc | 4 +- .../elementary/performance/graphical.c | 6 +- src/examples/elementary/popup_cxx_example.cc | 4 +- .../elementary/toolbar_cxx_example_01.cc | 14 +- src/examples/evas/evas-3d-aabb.c | 4 +- src/examples/evas/evas-3d-colorpick.c | 2 +- src/examples/evas/evas-3d-cube2.c | 2 +- src/examples/evas/evas-3d-eet.c | 4 +- src/examples/evas/evas-3d-frustum.c | 4 +- src/examples/evas/evas-3d-hull.c | 2 +- src/examples/evas/evas-3d-md2.c | 4 +- src/examples/evas/evas-3d-mmap-set.c | 2 +- src/examples/evas/evas-3d-obj.c | 4 +- .../evas/evas-3d-parallax-occlusion.c | 8 +- src/examples/evas/evas-3d-pick.c | 2 +- src/examples/evas/evas-3d-ply.c | 6 +- src/examples/evas/evas-3d-shadows.c | 10 +- src/examples/evas/evas-3d-static-lod.c | 4 +- .../evas/evas-object-manipulation-eo.c | 9 +- .../evas/shooter/evas-3d-shooter-macros.h | 8 +- src/examples/evas/shooter/evas-3d-shooter.c | 10 +- src/lib/ecore/efl_io_file.c | 30 +- src/lib/ecore/efl_io_file.eo | 1 - src/lib/ecore_con/ecore_con_url.c | 2 +- src/lib/ecore_file/ecore_file_download.c | 10 +- src/lib/edje/edje_calc.c | 8 +- src/lib/edje/edje_edit.c | 38 +-- src/lib/edje/edje_edit.eo | 3 +- src/lib/edje/edje_legacy.c | 3 - src/lib/edje/edje_load.c | 43 +-- src/lib/edje/edje_private.h | 2 +- src/lib/edje/edje_smart.c | 45 +-- src/lib/edje/efl_canvas_layout.eo | 11 +- src/lib/efl/Efl.h | 1 + src/lib/efl/interfaces/efl_file.c | 224 +++++++++++-- src/lib/efl/interfaces/efl_file.eo | 145 +++++---- src/lib/efl/interfaces/efl_file.h | 10 + src/lib/efl/interfaces/efl_gfx_image.eo | 8 + src/lib/efl/interfaces/meson.build | 4 + src/lib/elementary/efl_ui_bg.c | 68 ++-- src/lib/elementary/efl_ui_bg.eo | 3 + src/lib/elementary/efl_ui_image.c | 304 +++++++++--------- src/lib/elementary/efl_ui_image.eo | 8 +- src/lib/elementary/efl_ui_image_zoomable.c | 131 ++++---- src/lib/elementary/efl_ui_image_zoomable.eo | 3 +- src/lib/elementary/efl_ui_layout.c | 87 ++--- src/lib/elementary/efl_ui_layout.eo | 2 + src/lib/elementary/efl_ui_popup.c | 24 +- .../elementary/efl_ui_popup_part_backwall.eo | 2 +- src/lib/elementary/efl_ui_selection_manager.c | 4 +- src/lib/elementary/efl_ui_text.c | 53 +-- src/lib/elementary/efl_ui_text.eo | 3 +- .../elementary/efl_ui_text_factory_images.c | 16 +- src/lib/elementary/efl_ui_video.c | 26 +- src/lib/elementary/efl_ui_video.eo | 2 +- src/lib/elementary/efl_ui_widget.c | 50 ++- src/lib/elementary/efl_ui_widget_part_bg.eo | 4 +- src/lib/elementary/efl_ui_win.c | 71 +++- src/lib/elementary/efl_ui_win_part.eo | 4 +- src/lib/elementary/elm_entry.c | 66 ++-- src/lib/elementary/elm_entry.eo | 7 +- src/lib/elementary/elm_icon.c | 30 +- src/lib/elementary/elm_icon.eo | 2 +- src/lib/elementary/elm_photo.c | 76 +++-- src/lib/elementary/elm_photo.eo | 7 +- src/lib/elementary/elm_thumb.c | 102 +++--- src/lib/elementary/elm_thumb.eo | 4 + src/lib/elementary/elm_widget_thumb.h | 1 + src/lib/emotion/efl_canvas_video.eo | 4 +- src/lib/emotion/emotion_smart.c | 41 +-- src/lib/evas/canvas/efl_canvas_image.c | 73 ++--- src/lib/evas/canvas/efl_canvas_image.eo | 3 +- .../evas/canvas/efl_canvas_image_internal.eo | 1 + src/lib/evas/canvas/efl_canvas_proxy.c | 2 +- src/lib/evas/canvas/efl_canvas_vg_object.c | 43 ++- src/lib/evas/canvas/efl_canvas_vg_object.eo | 5 +- src/lib/evas/canvas/evas_canvas3d_mesh.c | 49 +-- src/lib/evas/canvas/evas_canvas3d_mesh.eo | 3 +- src/lib/evas/canvas/evas_canvas3d_texture.c | 22 +- src/lib/evas/canvas/evas_canvas3d_texture.eo | 2 +- src/lib/evas/canvas/evas_image.eo | 2 +- src/lib/evas/canvas/evas_image_legacy.c | 43 +-- src/lib/evas/canvas/evas_image_private.h | 7 +- src/lib/evas/canvas/evas_object_image.c | 6 + src/tests/edje/edje_test_edje.c | 3 +- src/tests/edje/edje_test_signal.c | 9 +- src/tests/edje/edje_test_text.c | 30 +- src/tests/elementary/efl_ui_test_layout.c | 2 +- src/tests/emotion/emotion_test_main-eo.c | 4 +- src/tests/evas/evas_test_image.c | 4 +- src/tests/evas/evas_test_mesh.c | 16 +- 116 files changed, 1392 insertions(+), 977 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_file.h diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index d254f6f8a1..f565ed45a6 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -108,6 +108,7 @@ EXTRA_DIST2 += \ lib/efl/Efl_Config.h \ lib/efl/Efl_Config.h.in \ lib/efl/Efl.h \ + lib/efl/interfaces/efl_file.h \ lib/efl/interfaces/efl_common_internal.h \ $(efl_eolian_files) \ $(efl_eolian_type_files) @@ -152,6 +153,7 @@ dist_installed_eflheaders_DATA = \ installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces nodist_installed_eflinterfaces_DATA = \ $(efl_eolian_files_h) \ + lib/efl/interfaces/efl_file.h \ $(efl_eolian_legacy_files_h) if HAVE_LUA_BINDINGS diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 90c7d8f46c..096631d5ec 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -1432,7 +1432,9 @@ data_write_vectors(Eet_File *ef, int *vector_num) if (!f) continue; eina_file_close(f); - if (!efl_file_set(vg, eina_strbuf_string_get(buf), NULL)) + if (efl_file_set(vg, eina_strbuf_string_get(buf))) + error_and_abort(ef, "Failed to parse svg : %s", vector->entry); + if (efl_file_load(vg)) error_and_abort(ef, "Failed to parse svg : %s", vector->entry); eina_strbuf_reset(buf); diff --git a/src/bin/elementary/test_bg.c b/src/bin/elementary/test_bg.c index 338084b31a..c7c7f1902a 100644 --- a/src/bin/elementary/test_bg.c +++ b/src/bin/elementary/test_bg.c @@ -292,15 +292,15 @@ _file_cb(void *data, const Efl_Event *ev) const char *f, *k; // File API - efl_file_get(efl_part(win, "background"), &f, &k); + efl_file_simple_get(efl_part(win, "background"), &f, &k); if (f) { - efl_file_set(efl_part(win, "background"), NULL, NULL); + efl_file_simple_load(efl_part(win, "background"), NULL, NULL); } else { - efl_file_get(ev->object, &f, &k); - efl_file_set(efl_part(win, "background"), f, k); + efl_file_simple_get(ev->object, &f, &k); + efl_file_simple_load(efl_part(win, "background"), f, k); } } @@ -315,10 +315,11 @@ _image_cb(void *data, const Efl_Event *ev) efl_content_set(efl_part(win, "background"), NULL); else { - efl_file_get(ev->object, &f, &k); + efl_file_simple_get(ev->object, &f, &k); o = efl_add(EFL_UI_IMAGE_CLASS, win, efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE), - efl_file_set(efl_added, f, k) + efl_file_set(efl_added, f), + efl_file_key_set(efl_added, k) ); efl_content_set(efl_part(win, "background"), o); } @@ -353,7 +354,7 @@ test_bg_window(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); efl_add(EFL_UI_IMAGE_CLASS, win, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)), efl_gfx_hint_align_set(efl_added, 0.5, 0.5), efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _file_cb, win), @@ -361,7 +362,7 @@ test_bg_window(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event snprintf(buf, sizeof(buf), "%s/images/sky_04.jpg", elm_app_data_dir_get()); efl_add(EFL_UI_IMAGE_CLASS, win, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)), efl_gfx_hint_align_set(efl_added, 0.5, 0.5), efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _image_cb, win), @@ -420,7 +421,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); o_bg = efl_add(EFL_UI_BG_CLASS, box, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND), efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE), efl_pack(box, efl_added)); diff --git a/src/bin/elementary/test_box.c b/src/bin/elementary/test_box.c index 31ccc9cbb0..c5c596cc00 100644 --- a/src/bin/elementary/test_box.c +++ b/src/bin/elementary/test_box.c @@ -916,7 +916,8 @@ test_box_stack(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); o = efl_add(EFL_UI_IMAGE_CLASS, win, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)), - efl_file_set(efl_added, buf, NULL)); + efl_file_set(efl_added, buf), + efl_file_load(efl_added)); efl_pack(bx, o); efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300)); diff --git a/src/bin/elementary/test_efl_gfx_mapping.c b/src/bin/elementary/test_efl_gfx_mapping.c index 71cfd82257..cb780d7ba8 100644 --- a/src/bin/elementary/test_efl_gfx_mapping.c +++ b/src/bin/elementary/test_efl_gfx_mapping.c @@ -53,7 +53,7 @@ test_efl_gfx_mapping(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get()); img = efl_add(EFL_UI_IMAGE_CLASS, win, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)), - efl_file_set(efl_added, buf, NULL)); + efl_file_set(efl_added, buf)); efl_gfx_image_scale_type_set(img, EFL_GFX_IMAGE_SCALE_TYPE_FILL); evas_object_event_callback_add(img, EVAS_CALLBACK_RESIZE, _image_resize_cb, NULL); diff --git a/src/bin/elementary/test_evas_map.c b/src/bin/elementary/test_evas_map.c index b598044c7d..3b3e66a56f 100644 --- a/src/bin/elementary/test_evas_map.c +++ b/src/bin/elementary/test_evas_map.c @@ -61,7 +61,8 @@ test_evas_map(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", elm_app_data_dir_get()); img = efl_add(EFL_UI_IMAGE_CLASS, win, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(64, 64)), - efl_file_set(efl_added, buf, NULL)); + efl_file_set(efl_added, buf), + efl_file_load(efl_added)); efl_gfx_image_scale_type_set(img, EFL_GFX_IMAGE_SCALE_TYPE_FILL); evas_object_event_callback_add(img, EVAS_CALLBACK_RESIZE, _image_resize_cb, NULL); diff --git a/src/bin/elementary/test_evas_mask.c b/src/bin/elementary/test_evas_mask.c index 497d4a2a97..39a91e155b 100644 --- a/src/bin/elementary/test_evas_mask.c +++ b/src/bin/elementary/test_evas_mask.c @@ -118,12 +118,13 @@ test_evas_mask(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event // FIXME: No API to set background as "tile" :( snprintf(buf, sizeof(buf), "%s/images/pm_fill.png", elm_app_data_dir_get()); - efl_file_set(efl_part(win, "background"), buf, NULL); + efl_file_simple_load(efl_part(win, "background"), buf, NULL); // FIXME: layout EO API snprintf(buf, sizeof(buf), "%s/objects/test_masking.edj", elm_app_data_dir_get()); ly = efl_add(EFL_UI_LAYOUT_CLASS, win, - efl_file_set(efl_added, buf, "masking")); + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "masking")); efl_pack(box, ly); // FIXME: No genlist in EO API diff --git a/src/bin/elementary/test_evas_snapshot.c b/src/bin/elementary/test_evas_snapshot.c index c1b110ead6..70791e6705 100644 --- a/src/bin/elementary/test_evas_snapshot.c +++ b/src/bin/elementary/test_evas_snapshot.c @@ -29,7 +29,8 @@ static inline Eo * _image_create(Eo *win, const char *path) { return efl_add(EFL_UI_IMAGE_CLASS, win, - efl_file_set(efl_added, path, NULL), + efl_file_set(efl_added, path), + efl_file_load(efl_added), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(20, 20))); } diff --git a/src/bin/elementary/test_gfx_filters.c b/src/bin/elementary/test_gfx_filters.c index 965720a604..d8bd58e2c4 100644 --- a/src/bin/elementary/test_gfx_filters.c +++ b/src/bin/elementary/test_gfx_filters.c @@ -403,7 +403,7 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve efl_gfx_hint_align_set(efl_added, 0.5, 0.5), efl_gfx_hint_size_max_set(efl_added, size), efl_gfx_hint_size_min_set(efl_added, size), - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_name_set(efl_added, images[k].src_name), elm_object_tooltip_text_set(efl_added, images[k].src_name)); if (efl_player_playable_get(o)) diff --git a/src/bin/elementary/test_part_bg.c b/src/bin/elementary/test_part_bg.c index 37e39da2c6..04e436a061 100644 --- a/src/bin/elementary/test_part_bg.c +++ b/src/bin/elementary/test_part_bg.c @@ -18,7 +18,7 @@ _reset_cb(void *data, const Efl_Event *ev EINA_UNUSED) target = evas_object_data_get(radio, "data"); efl_gfx_color_set(efl_part(target, "background"), 0, 0, 0, 0); - efl_file_set(efl_part(target, "background"), NULL, NULL); + efl_file_simple_load(efl_part(target, "background"), NULL, NULL); } static void @@ -46,7 +46,7 @@ _scale_type_cb(void *data, const Efl_Event *ev EINA_UNUSED) target = evas_object_data_get(radio, "data"); snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); - efl_file_set(efl_part(target, "background"), buf, NULL); + efl_file_simple_load(efl_part(target, "background"), buf, NULL); type = efl_gfx_image_scale_type_get(efl_part(target, "background")); type = (type + 1) % 5; efl_gfx_image_scale_type_set(efl_part(target, "background"), type); @@ -103,7 +103,7 @@ _create_box_contents(Evas_Object *box) if (efl_isa(content, EFL_UI_IMAGE_CLASS)) { snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); - efl_file_set(content, buf, NULL); + efl_file_simple_load(content, buf, NULL); } evas_object_data_set(radio, "data", content); diff --git a/src/bin/elementary/test_part_shadow.c b/src/bin/elementary/test_part_shadow.c index 70d9a6f6d2..07aeb8d3b1 100644 --- a/src/bin/elementary/test_part_shadow.c +++ b/src/bin/elementary/test_part_shadow.c @@ -109,7 +109,7 @@ test_part_shadow(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve ic = efl_add(EFL_UI_IMAGE_CLASS, win); snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); - efl_file_set(ic, buf, NULL); + efl_file_simple_load(ic, buf, NULL); efl_pack(bx, ic); td->ico = ic; diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index c1e055e997..f00662069f 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -142,7 +142,7 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) if (eina_list_count(grps) > 0) { const char *grp = eina_list_nth(grps, 0); - efl_file_set(ph, file, grp); + efl_file_simple_load(ph, file, grp); printf("Successfully set the edje file: %s, group: %s\n", file, grp); } else printf("Failed to set edje file\n"); @@ -823,7 +823,8 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE snprintf(buf, sizeof(buf), "%s/images/animated_logo.gif", elm_app_data_dir_get()); zoomable = efl_add(EFL_UI_IMAGE_ZOOMABLE_CLASS, win, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), + efl_file_load(efl_added), efl_pack(bx, efl_added), efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _zoomable_clicked_cb, NULL) ); diff --git a/src/bin/elementary/test_ui_button.c b/src/bin/elementary/test_ui_button.c index f5aa340ad6..f89a188407 100644 --- a/src/bin/elementary/test_ui_button.c +++ b/src/bin/elementary/test_ui_button.c @@ -55,7 +55,7 @@ test_ui_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event efl_event_callback_add(efl_added, EFL_UI_EVENT_UNPRESSED, _unpressed, NULL) ); efl_add(EFL_UI_IMAGE_CLASS, btn, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_content_set(btn, efl_added) ); @@ -69,7 +69,7 @@ test_ui_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event efl_event_callback_add(efl_added, EFL_UI_EVENT_UNPRESSED, _unpressed, NULL) ); efl_add(EFL_UI_IMAGE_CLASS, btn, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_content_set(btn, efl_added) ); diff --git a/src/bin/elementary/test_ui_pager.c b/src/bin/elementary/test_ui_pager.c index e8d602f8d5..cebbbad641 100644 --- a/src/bin/elementary/test_ui_pager.c +++ b/src/bin/elementary/test_ui_pager.c @@ -78,7 +78,9 @@ static Eo *page_add(Page_Type p, Eo *parent) snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, - efl_file_set(efl_added, buf, "page"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "page"), + efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; @@ -104,7 +106,9 @@ static Eo *page_add(Page_Type p, Eo *parent) snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, - efl_file_set(efl_added, buf, "page"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "page"), + efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; @@ -696,7 +700,9 @@ void test_ui_pager(void *data EINA_UNUSED, snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); layout = efl_add(EFL_UI_LAYOUT_CLASS, panes, - efl_file_set(efl_added, buf, "pager"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "pager"), + efl_file_load(efl_added), efl_content_set(efl_part(panes, "second"), efl_added)); pager = efl_add(EFL_UI_PAGER_CLASS, layout, diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c index 9941304491..7a0bfb83eb 100644 --- a/src/bin/elementary/test_ui_pager_scroll.c +++ b/src/bin/elementary/test_ui_pager_scroll.c @@ -83,7 +83,9 @@ static Eo *page_add(Page_Type p, Eo *parent) snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, - efl_file_set(efl_added, buf, "page"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "page"), + efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; @@ -109,7 +111,9 @@ static Eo *page_add(Page_Type p, Eo *parent) snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, - efl_file_set(efl_added, buf, "page"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "page"), + efl_file_load(efl_added), efl_text_set(efl_part(efl_added, "text"), "Layout Page")); efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE); break; @@ -877,7 +881,9 @@ void test_ui_pager_scroll(void *data EINA_UNUSED, snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj", elm_app_data_dir_get()); layout = efl_add(EFL_UI_LAYOUT_CLASS, panes, - efl_file_set(efl_added, buf, "pager"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "pager"), + efl_file_load(efl_added), efl_content_set(efl_part(panes, "second"), efl_added)); pager = efl_add(EFL_UI_PAGER_CLASS, layout, diff --git a/src/bin/elementary/test_ui_panel.c b/src/bin/elementary/test_ui_panel.c index 40ca680c0f..e73a3186d6 100644 --- a/src/bin/elementary/test_ui_panel.c +++ b/src/bin/elementary/test_ui_panel.c @@ -19,7 +19,7 @@ test_ui_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); efl_add(EFL_UI_IMAGE_CLASS, table, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL), efl_pack_table(table, efl_added, 0, 0, 4, 5)); diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c index 311ec1d715..e4a7a89479 100644 --- a/src/bin/elementary/test_ui_popup.c +++ b/src/bin/elementary/test_ui_popup.c @@ -85,12 +85,12 @@ _backwall_cb(void *data EINA_UNUSED, const Efl_Event *ev) { char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); - efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), buf, NULL); + efl_file_simple_load(efl_part(p_data->efl_ui_popup, "backwall"), buf, NULL); efl_text_set(ev->object, "Backwall UnSet"); } else { - efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), NULL, NULL); + efl_file_simple_load(efl_part(p_data->efl_ui_popup, "backwall"), NULL, NULL); efl_text_set(ev->object, "Backwall Set"); } k = !k; @@ -365,7 +365,7 @@ test_ui_alert_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void * Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL); @@ -386,7 +386,7 @@ _alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); @@ -410,7 +410,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); @@ -436,7 +436,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); @@ -462,7 +462,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); @@ -488,7 +488,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED) Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_popup_scroll_content"); + efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content"); efl_content_set(efl_ui_popup, layout); @@ -1008,7 +1008,7 @@ test_ui_anchor_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win); snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); - efl_file_set(layout, buf, "efl_ui_anchor_popup_layout"); + efl_file_simple_load(layout, buf, "efl_ui_anchor_popup_layout"); efl_gfx_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); efl_content_set(win, layout); diff --git a/src/bin/elementary/test_ui_progressbar.c b/src/bin/elementary/test_ui_progressbar.c index cbb2fdc95a..16848ef5b1 100644 --- a/src/bin/elementary/test_ui_progressbar.c +++ b/src/bin/elementary/test_ui_progressbar.c @@ -138,7 +138,8 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); efl_add(EFL_UI_IMAGE_CLASS, pd->pb1, - efl_file_set(efl_added, buf, NULL), + efl_file_set(efl_added, buf), + efl_file_load(efl_added), efl_content_set(pd->pb1, efl_added) ); diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c index 318e019e42..af0b900fcf 100644 --- a/src/bin/elementary/test_ui_tab_pager.c +++ b/src/bin/elementary/test_ui_tab_pager.c @@ -86,7 +86,8 @@ content_add(Eo *parent, char *text) snprintf(buf, sizeof(buf), "%s/objects/test_tab_pager.edj", elm_app_data_dir_get()); page = efl_add(EFL_UI_LAYOUT_CLASS, parent, - efl_file_set(efl_added, buf, "page_layout"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "page_layout"), efl_text_set(efl_part(efl_added, "text"), text), efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE)); @@ -129,7 +130,8 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev snprintf(buf, sizeof(buf), "%s/objects/test_tab_pager.edj", elm_app_data_dir_get()); layout = efl_add(EFL_UI_LAYOUT_CLASS, win, - efl_file_set(efl_added, buf, "tab_page_layout"), + efl_file_set(efl_added, buf), + efl_file_key_set(efl_added, "tab_page_layout"), efl_content_set(win, efl_added)); navi = elm_naviframe_add(layout); diff --git a/src/examples/ecore/efl_io_copier_example.c b/src/examples/ecore/efl_io_copier_example.c index 25a81140bd..13f26b8577 100644 --- a/src/examples/ecore/efl_io_copier_example.c +++ b/src/examples/ecore/efl_io_copier_example.c @@ -664,7 +664,7 @@ efl_main(void *data EINA_UNUSED, { /* regular file, open with flags: read-only and close-on-exec */ input = efl_add_ref(EFL_IO_FILE_CLASS, NULL, - efl_file_set(efl_added, input_fname, NULL), /* mandatory */ + efl_file_set(efl_added, input_fname), /* mandatory */ efl_io_file_flags_set(efl_added, O_RDONLY), /* default */ efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */ efl_event_callback_array_add(efl_added, input_cbs(), NULL) /* optional */ @@ -940,7 +940,7 @@ efl_main(void *data EINA_UNUSED, * create if did not exist and truncate if exist. */ output = efl_add_ref(EFL_IO_FILE_CLASS, NULL, - efl_file_set(efl_added, output_fname, NULL), /* mandatory */ + efl_file_set(efl_added, output_fname), /* mandatory */ efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT | O_TRUNC), /* mandatory for write */ efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */ efl_io_file_mode_set(efl_added, 0644), /* mandatory for write */ diff --git a/src/examples/ecore/efl_net_dialer_http_example.c b/src/examples/ecore/efl_net_dialer_http_example.c index 70861dc438..02783dc165 100644 --- a/src/examples/ecore/efl_net_dialer_http_example.c +++ b/src/examples/ecore/efl_net_dialer_http_example.c @@ -321,7 +321,7 @@ efl_main(void *data EINA_UNUSED, { input = efl_add(EFL_IO_FILE_CLASS, loop, efl_name_set(efl_added, "input"), - efl_file_set(efl_added, input_fname, NULL), + efl_file_set(efl_added, input_fname), efl_io_file_flags_set(efl_added, O_RDONLY), efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */ efl_event_callback_add(efl_added, EFL_IO_READER_EVENT_EOS, _eos, NULL)); @@ -336,7 +336,7 @@ efl_main(void *data EINA_UNUSED, { output = efl_add(EFL_IO_FILE_CLASS, loop, efl_name_set(efl_added, "output"), - efl_file_set(efl_added, output_fname, NULL), + efl_file_set(efl_added, output_fname), efl_io_file_mode_set(efl_added, 0644), efl_io_file_flags_set(efl_added, O_WRONLY | O_TRUNC | O_CREAT), efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE)); /* recommended, set *after* flags, or include O_CLOEXEC in flags -- be careful with _WIN32 that doesn't support it. */ diff --git a/src/examples/elementary/bg_cxx_example_02.cc b/src/examples/elementary/bg_cxx_example_02.cc index 71c3540d98..94c17e3dcf 100644 --- a/src/examples/elementary/bg_cxx_example_02.cc +++ b/src/examples/elementary/bg_cxx_example_02.cc @@ -31,7 +31,8 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev) efl::ui::Bg bg(instantiate, win); bg.scale_type_set(EFL_GFX_IMAGE_SCALE_TYPE_FILL); - bg.file_set(path, nullptr); + bg.file_set(path); + bg.load(); win.content_set(bg); win.size_set({640, 400}); diff --git a/src/examples/elementary/efl_canvas_layout_text.c b/src/examples/elementary/efl_canvas_layout_text.c index a0d7f57e6b..556c528ca0 100644 --- a/src/examples/elementary/efl_canvas_layout_text.c +++ b/src/examples/elementary/efl_canvas_layout_text.c @@ -88,7 +88,7 @@ _on_key_down(void *data, const Efl_Event *event) { // edje group group_itr = (group_itr + 1) % 2; - efl_file_set(layout, edjefile, groups[group_itr]); + efl_file_simple_load(layout, edjefile, groups[group_itr]); printf("Changed layout group to: %s\n", groups[group_itr]); } else if (!strcmp(key, "w")) @@ -139,7 +139,7 @@ efl_main(void *data EINA_UNUSED, layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, win); - efl_file_set(layout, edjefile, groups[group_itr]); + efl_file_simple_load(layout, edjefile, groups[group_itr]); efl_content_set(win, layout); efl_gfx_entity_size_set(win, EINA_SIZE2D(110, 100)); diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c index be47aa0fc9..c34aa0ff53 100644 --- a/src/examples/elementary/efl_ui_list_example_1.c +++ b/src/examples/elementary/efl_ui_list_example_1.c @@ -197,13 +197,13 @@ elm_main(int argc EINA_UNUSED, char **argv) break; case 40: - efl_file_set(efl_part(item, "background"), "./sky_01.jpg", NULL); + efl_file_simple_load(efl_part(item, "background"), "./sky_01.jpg", NULL); efl_gfx_image_scale_type_set(efl_part(item, "background"), EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE); efl_pack_at(list, item, 39); break; case 50: - efl_file_set(efl_part(item, "background"), "./sky_01.jpg", NULL); + efl_file_simple_load(efl_part(item, "background"), "./sky_01.jpg", NULL); efl_gfx_image_scale_type_set(efl_part(item, "background"), EFL_GFX_IMAGE_SCALE_TYPE_TILE); efl_pack(list, item); break; diff --git a/src/examples/elementary/efl_ui_scroller_example.c b/src/examples/elementary/efl_ui_scroller_example.c index 4de4d216a3..e300b659b1 100644 --- a/src/examples/elementary/efl_ui_scroller_example.c +++ b/src/examples/elementary/efl_ui_scroller_example.c @@ -24,7 +24,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev) content = efl_add(EFL_UI_IMAGE_CLASS, scroller); snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); - efl_file_set(content, buf, NULL); + efl_file_simple_load(content, buf, NULL); efl_gfx_entity_size_set(content, EINA_SIZE2D(5000, 5000)); efl_content_set(scroller, content); } diff --git a/src/examples/elementary/icon_cxx_example_01.cc b/src/examples/elementary/icon_cxx_example_01.cc index 88f9f95502..6252ce1cc0 100644 --- a/src/examples/elementary/icon_cxx_example_01.cc +++ b/src/examples/elementary/icon_cxx_example_01.cc @@ -14,8 +14,8 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) efl::ui::Image icon(instantiate, win); icon.icon_set("home"); - efl::eina::string_view path, group; - icon.file_get(path, group); + efl::eina::string_view path = icon.file_get(); + efl::eina::string_view group = icon.key_get(); std::cout << "path = " << path << ", group = "<< group; std::cout << ", name = " << icon.icon_get() << std::endl; diff --git a/src/examples/elementary/performance/graphical.c b/src/examples/elementary/performance/graphical.c index d006c3ec5b..13d7ea1a0c 100644 --- a/src/examples/elementary/performance/graphical.c +++ b/src/examples/elementary/performance/graphical.c @@ -323,7 +323,7 @@ _change_scene_setup() } else { - efl_file_set(globalGraphical.mesh, globalGraphical.model_path, NULL); + efl_file_simple_load(globalGraphical.mesh, globalGraphical.model_path, NULL); evas_canvas3d_mesh_frame_material_set(globalGraphical.mesh, 0, globalGraphical.material); evas_canvas3d_mesh_shader_mode_set(globalGraphical.mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); } @@ -427,7 +427,7 @@ _init_scene(Evas_Object *img) globalGraphical.material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, globalGraphical.evas); globalGraphical.texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, globalGraphical.evas); - efl_file_set(globalGraphical.texture, "target_texture.png", NULL); + efl_file_simple_load(globalGraphical.texture, "target_texture.png", NULL); evas_canvas3d_texture_filter_set(globalGraphical.texture, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR); evas_canvas3d_texture_wrap_set(globalGraphical.texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(globalGraphical.material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, globalGraphical.texture); @@ -460,7 +460,7 @@ _init_scene(Evas_Object *img) } else { - efl_file_set(globalGraphical.mesh, globalGraphical.model_path, NULL); + efl_file_simple_load(globalGraphical.mesh, globalGraphical.model_path, NULL); evas_canvas3d_mesh_frame_material_set(globalGraphical.mesh, 0, globalGraphical.material); evas_canvas3d_mesh_shader_mode_set(globalGraphical.mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); } diff --git a/src/examples/elementary/popup_cxx_example.cc b/src/examples/elementary/popup_cxx_example.cc index b6c78322f9..6c323275f0 100644 --- a/src/examples/elementary/popup_cxx_example.cc +++ b/src/examples/elementary/popup_cxx_example.cc @@ -207,11 +207,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) backwall_visible = !backwall_visible; if (backwall_visible) { - efl::eo::downcast(g_popup.part_get("backwall")).file_set("./sky_01.jpg", nullptr); + efl::eo::downcast(g_popup.part_get("backwall")).file_set("./sky_01.jpg"); backwall_btn.text_set("Unset Backwall"); } else { - efl::eo::downcast(g_popup.part_get("backwall")).file_set(nullptr, nullptr); + efl::eo::downcast(g_popup.part_get("backwall")).file_set(nullptr); backwall_btn.text_set("Set Backwall"); } })); diff --git a/src/examples/elementary/toolbar_cxx_example_01.cc b/src/examples/elementary/toolbar_cxx_example_01.cc index 5a884b96f7..f5c47cb0eb 100644 --- a/src/examples/elementary/toolbar_cxx_example_01.cc +++ b/src/examples/elementary/toolbar_cxx_example_01.cc @@ -77,7 +77,7 @@ elm_main(int argc, char* argv[]) elm::Widget photo_1(elm_photo_add(win_1._eo_ptr())); elm_photo_size_set(photo_1._eo_ptr(), 40); - efl_file_set(photo_1._eo_ptr(), "/opt/e/share/elementary/images/plant_01.jpg", nullptr); + efl_file_simple_load(photo_1._eo_ptr(), "/opt/e/share/elementary/images/plant_01.jpg", nullptr); photo_1.hint_weight_set(1, 1); photo_1.hint_align_set(0.5, 0.5); photo_1.visible_set(true); @@ -92,7 +92,7 @@ elm_main(int argc, char* argv[]) elm_table_pack(table_1._eo_ptr(), photo_2._eo_ptr(), 1, 0, 1, 1); elm::Widget photo_3(elm_photo_add(win_1._eo_ptr())); elm_photo_size_set(photo_3._eo_ptr(), 20); - efl_file_set(photo_3._eo_ptr(), "/opt/e/share/elementary/images/sky_01.jpg", nullptr); + efl_file_simple_load(photo_3._eo_ptr(), "/opt/e/share/elementary/images/sky_01.jpg", nullptr); photo_3.hint_weight_set(1, 1); photo_3.hint_align_set(0.5, 0.5); photo_3.visible_set(true); @@ -100,7 +100,7 @@ elm_main(int argc, char* argv[]) elm_table_pack(table_1._eo_ptr(), photo_3._eo_ptr(), 0, 1, 1, 1); elm::Widget photo_4(elm_photo_add(win_1._eo_ptr())); elm_photo_size_set(photo_4._eo_ptr(), 60); - efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_02.jpg", nullptr); + efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_02.jpg", nullptr); photo_4.hint_weight_set(1, 1); photo_4.hint_align_set(0.5, 0.5); photo_4.visible_set(true); @@ -111,22 +111,22 @@ elm_main(int argc, char* argv[]) win_1.content_set(box_1); auto _item_2_selected_cb = std::bind([&] () { - efl_file_set(photo_1._eo_ptr(), "/opt/e/share/elementary/images/rock_01.jpg", nullptr); + efl_file_simple_load(photo_1._eo_ptr(), "/opt/e/share/elementary/images/rock_01.jpg", nullptr); }); efl::eolian::event_add(efl::ui::Selectable::selected_event, item_2, _item_2_selected_cb); auto _item_3_selected_cb = std::bind([&] () { - efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/wood_01.jpg", nullptr); + efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/wood_01.jpg", nullptr); }); efl::eolian::event_add(efl::ui::Selectable::selected_event, item_3, _item_3_selected_cb); auto _item_4_selected_cb = std::bind([&] () { - efl_file_set(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_03.jpg", nullptr); + efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_03.jpg", nullptr); }); efl::eolian::event_add(efl::ui::Selectable::selected_event, item_4, _item_4_selected_cb); auto _item_5_selected_cb = std::bind([&] () { - efl_file_set(photo_4._eo_ptr(), nullptr, nullptr); + efl_file_simple_load(photo_4._eo_ptr(), nullptr, nullptr); }); efl::eolian::event_add(efl::ui::Selectable::selected_event, item_5, _item_5_selected_cb); diff --git a/src/examples/evas/evas-3d-aabb.c b/src/examples/evas/evas-3d-aabb.c index dd4c1f0f27..fdb8a45278 100644 --- a/src/examples/evas/evas-3d-aabb.c +++ b/src/examples/evas/evas-3d-aabb.c @@ -170,12 +170,12 @@ main(void) mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); - efl_file_set(mesh, model_path, NULL); + efl_file_simple_load(mesh, model_path, NULL); evas_canvas3d_mesh_frame_material_set(mesh, 0, material); evas_canvas3d_mesh_shader_mode_set(mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(texture, image_path, NULL); + efl_file_simple_load(texture, image_path, NULL); evas_canvas3d_texture_filter_set(texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture); diff --git a/src/examples/evas/evas-3d-colorpick.c b/src/examples/evas/evas-3d-colorpick.c index 8c9ea3b54f..7b894cd23e 100644 --- a/src/examples/evas/evas-3d-colorpick.c +++ b/src/examples/evas/evas-3d-colorpick.c @@ -256,7 +256,7 @@ _init_sphere(void *this, const char *texture) evas_canvas3d_mesh_color_pick_enable_set(sphere->mesh, EINA_TRUE); sphere->texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(sphere->texture, texture, NULL); + efl_file_simple_load(sphere->texture, texture, NULL); evas_canvas3d_texture_filter_set(sphere->texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(sphere->texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(sphere->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, sphere->texture); diff --git a/src/examples/evas/evas-3d-cube2.c b/src/examples/evas/evas-3d-cube2.c index c8558b622b..b2d905e873 100644 --- a/src/examples/evas/evas-3d-cube2.c +++ b/src/examples/evas/evas-3d-cube2.c @@ -168,7 +168,7 @@ _mesh_setup(Scene_Data *data) evas_canvas3d_texture_data_set(data->texture0, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels0[0]); evas_canvas3d_texture_data_set(data->texture1, EVAS_COLORSPACE_ARGB8888, 4, 4, &pixels1[0]); - efl_file_set(data->texture_normal, normal_map_path, NULL); + efl_file_simple_load(data->texture_normal, normal_map_path, NULL); evas_canvas3d_material_texture_set(data->material0, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, data->texture0); evas_canvas3d_material_texture_set(data->material1, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, data->texture1); diff --git a/src/examples/evas/evas-3d-eet.c b/src/examples/evas/evas-3d-eet.c index da94e06d7e..becd0bcadc 100644 --- a/src/examples/evas/evas-3d-eet.c +++ b/src/examples/evas/evas-3d-eet.c @@ -146,7 +146,7 @@ main(void) mesh2 = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); - efl_file_set(mesh, input_model_path, NULL); + efl_file_simple_load(mesh, input_model_path, NULL); evas_canvas3d_mesh_frame_material_set(mesh, 0, material); evas_canvas3d_mesh_shader_mode_set(mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); @@ -165,7 +165,7 @@ main(void) efl_file_save(mesh, output_model_path, NULL, NULL); - efl_file_set(mesh2, output_model_path, NULL); + efl_file_simple_load(mesh2, output_model_path, NULL); evas_canvas3d_mesh_shader_mode_set(mesh2, EVAS_CANVAS3D_SHADER_MODE_PHONG); mesh_node = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_MESH)); diff --git a/src/examples/evas/evas-3d-frustum.c b/src/examples/evas/evas-3d-frustum.c index 02f5bba05e..6e765bd399 100644 --- a/src/examples/evas/evas-3d-frustum.c +++ b/src/examples/evas/evas-3d-frustum.c @@ -352,7 +352,7 @@ _mesh_setup_model(Scene_Data *data) data->material_model = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); data->texture_model = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(data->texture_model, texture_path, NULL); + efl_file_simple_load(data->texture_model, texture_path, NULL); evas_canvas3d_texture_filter_set(data->texture_model, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(data->texture_model, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); @@ -367,7 +367,7 @@ _mesh_setup_model(Scene_Data *data) evas_canvas3d_material_texture_set(data->material_model, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, data->texture_model); evas_canvas3d_material_shininess_set(data->material_model, 100.0); - efl_file_set(data->mesh_model, mesh_path, NULL); + efl_file_simple_load(data->mesh_model, mesh_path, NULL); evas_canvas3d_mesh_frame_material_set(data->mesh_model, 0, data->material_model); evas_canvas3d_mesh_shader_mode_set(data->mesh_model, EVAS_CANVAS3D_SHADER_MODE_DIFFUSE); } diff --git a/src/examples/evas/evas-3d-hull.c b/src/examples/evas/evas-3d-hull.c index 0e13705c36..e82f31bca7 100644 --- a/src/examples/evas/evas-3d-hull.c +++ b/src/examples/evas/evas-3d-hull.c @@ -87,7 +87,7 @@ int rr; #define MODEL_MESH_INIT(name, model, shade) \ data->mesh_##name = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); \ - efl_file_set(data->mesh_##name, model, NULL); \ + efl_file_simple_load(data->mesh_##name, model, NULL); \ evas_canvas3d_mesh_vertex_assembly_set(data->mesh_##name, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES); \ evas_canvas3d_mesh_shader_mode_set(data->mesh_##name, EVAS_CANVAS3D_SHADER_MODE_##shade); \ evas_canvas3d_mesh_frame_material_set(data->mesh_##name, 0, data->material); diff --git a/src/examples/evas/evas-3d-md2.c b/src/examples/evas/evas-3d-md2.c index adfb6962a0..f97c183bd0 100644 --- a/src/examples/evas/evas-3d-md2.c +++ b/src/examples/evas/evas-3d-md2.c @@ -124,12 +124,12 @@ main(void) mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); - efl_file_set(mesh, model_path, NULL); + efl_file_simple_load(mesh, model_path, NULL); evas_canvas3d_mesh_frame_material_set(mesh, 0, material); evas_canvas3d_mesh_shader_mode_set(mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(texture, image_path, NULL); + efl_file_simple_load(texture, image_path, NULL); evas_canvas3d_texture_filter_set(texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture); diff --git a/src/examples/evas/evas-3d-mmap-set.c b/src/examples/evas/evas-3d-mmap-set.c index 360555501e..149217d95a 100644 --- a/src/examples/evas/evas-3d-mmap-set.c +++ b/src/examples/evas/evas-3d-mmap-set.c @@ -33,7 +33,7 @@ snprintf(buffer, PATH_MAX, "%s%s", template_path, #extention); \ extention##_file = eina_file_open(buffer , 0); \ mesh_##extention = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); \ - efl_file_mmap_set(mesh_##extention, extention##_file, NULL); \ + efl_file_simple_mmap_load(mesh_##extention, extention##_file, NULL); \ evas_canvas3d_mesh_frame_material_set(mesh_##extention, 0, material); \ evas_canvas3d_mesh_shader_mode_set(mesh_##extention, EVAS_CANVAS3D_SHADER_MODE_PHONG); \ node_##extention = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_MESH)); \ diff --git a/src/examples/evas/evas-3d-obj.c b/src/examples/evas/evas-3d-obj.c index 65f57ecffd..91126fbfa0 100644 --- a/src/examples/evas/evas-3d-obj.c +++ b/src/examples/evas/evas-3d-obj.c @@ -47,7 +47,7 @@ #define ADD_OBJ_MESH(path, Y, Z, num, shade_mode, name_of_material) \ mesh[num] = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); \ snprintf(full_file_path, sizeof(full_file_path), "%s.obj", path); \ - efl_file_set(mesh[num], full_file_path, NULL); \ + efl_file_simple_load(mesh[num], full_file_path, NULL); \ evas_canvas3d_mesh_frame_material_set(mesh[num], 0, name_of_material); \ evas_canvas3d_mesh_shader_mode_set(mesh[num], shade_mode); \ mesh_node[num] = efl_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_type_set(efl_added, EVAS_CANVAS3D_NODE_TYPE_MESH)); \ @@ -65,7 +65,7 @@ #define ADD_TEXTURE(name, path) \ name = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ - efl_file_set(name, path, NULL); \ + efl_file_simple_load(name, path, NULL); \ evas_canvas3d_texture_filter_set(name, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \ evas_canvas3d_texture_wrap_set(name, EVAS_CANVAS3D_WRAP_MODE_REPEAT, \ diff --git a/src/examples/evas/evas-3d-parallax-occlusion.c b/src/examples/evas/evas-3d-parallax-occlusion.c index 83188c0538..1d2cc75263 100644 --- a/src/examples/evas/evas-3d-parallax-occlusion.c +++ b/src/examples/evas/evas-3d-parallax-occlusion.c @@ -138,9 +138,9 @@ _mesh_setup(Scene_Data *data) data->texture_rocks = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); data->texture_rocks_n = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(data->texture_rocks, rock_diffuse, NULL); + efl_file_simple_load(data->texture_rocks, rock_diffuse, NULL); evas_canvas3d_texture_wrap_set(data->texture_rocks, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); - efl_file_set(data->texture_rocks_n, rock_n_and_height_map, NULL); + efl_file_simple_load(data->texture_rocks_n, rock_n_and_height_map, NULL); evas_canvas3d_texture_wrap_set(data->texture_rocks_n, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(data->material_rocks, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, data->texture_rocks_n); @@ -160,9 +160,9 @@ _mesh_setup(Scene_Data *data) data->texture_wood = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); data->texture_four_n = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(data->texture_wood, wood_diffuse, NULL); + efl_file_simple_load(data->texture_wood, wood_diffuse, NULL); evas_canvas3d_texture_wrap_set(data->texture_wood, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); - efl_file_set(data->texture_four_n, wood_n_and_height_map, NULL); + efl_file_simple_load(data->texture_four_n, wood_n_and_height_map, NULL); evas_canvas3d_texture_wrap_set(data->texture_four_n, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(data->material_wood, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, data->texture_four_n); diff --git a/src/examples/evas/evas-3d-pick.c b/src/examples/evas/evas-3d-pick.c index 1e2f3d6ead..20230d0112 100644 --- a/src/examples/evas/evas-3d-pick.c +++ b/src/examples/evas/evas-3d-pick.c @@ -143,7 +143,7 @@ main(void) material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); texture_diffuse = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(texture_diffuse, image_path, NULL); + efl_file_simple_load(texture_diffuse, image_path, NULL); evas_canvas3d_texture_filter_set(texture_diffuse, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR, EVAS_CANVAS3D_TEXTURE_FILTER_LINEAR); evas_canvas3d_material_texture_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture_diffuse); evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE); diff --git a/src/examples/evas/evas-3d-ply.c b/src/examples/evas/evas-3d-ply.c index 821195b30e..7769a45442 100644 --- a/src/examples/evas/evas-3d-ply.c +++ b/src/examples/evas/evas-3d-ply.c @@ -159,7 +159,7 @@ main(void) material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(texture, image_path, NULL); + efl_file_simple_load(texture, image_path, NULL); evas_canvas3d_texture_filter_set(texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); evas_canvas3d_material_texture_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture); @@ -182,7 +182,7 @@ main(void) mesh[i] = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); snprintf(buffer, PATH_MAX, "%s%s", input_template, file_name[i % 8]); - efl_file_set(mesh[i], buffer, NULL); + efl_file_simple_load(mesh[i], buffer, NULL); evas_canvas3d_mesh_frame_material_set(mesh[i], 0, material); evas_canvas3d_mesh_shader_mode_set(mesh[i], draw_mode[(i % 8)]); @@ -191,7 +191,7 @@ main(void) if (i > 15) { - efl_file_set(mesh[i], buffer, NULL); + efl_file_simple_load(mesh[i], buffer, NULL); evas_canvas3d_mesh_frame_material_set(mesh[i], 0, material); evas_canvas3d_mesh_shader_mode_set(mesh[i], draw_mode[(i % 8)]); } diff --git a/src/examples/evas/evas-3d-shadows.c b/src/examples/evas/evas-3d-shadows.c index ae06a3631a..16733183f4 100644 --- a/src/examples/evas/evas-3d-shadows.c +++ b/src/examples/evas/evas-3d-shadows.c @@ -262,12 +262,12 @@ _fence_setup(Body_3D *fence) Eo *texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); evas_canvas3d_texture_atlas_enable_set(texture, EINA_FALSE); - efl_file_set(texture, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid.png", NULL); + efl_file_simple_load(texture, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid.png", NULL); evas_canvas3d_texture_filter_set(texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); Eo *texture1 = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); evas_canvas3d_texture_atlas_enable_set(texture1, EINA_FALSE); - efl_file_set(texture1, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid_n.png", NULL); + efl_file_simple_load(texture1, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid_n.png", NULL); evas_canvas3d_texture_filter_set(texture1, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(texture1, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); fence->material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); @@ -344,7 +344,7 @@ static void _model_setup(Body_3D *model) { model->texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(model->texture, image_path, NULL); + efl_file_simple_load(model->texture, image_path, NULL); evas_canvas3d_texture_filter_set(model->texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(model->texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); model->material = efl_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); @@ -358,7 +358,7 @@ _model_setup(Body_3D *model) model->mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); - efl_file_set(model->mesh, model_path, NULL); + efl_file_simple_load(model->mesh, model_path, NULL); evas_canvas3d_mesh_frame_material_set(model->mesh, 0, model->material); evas_canvas3d_mesh_shader_mode_set(model->mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); @@ -373,7 +373,7 @@ static void _billboard_setup(Scene_Data *data) { data->billboard.texture = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(data->billboard.texture, b_image_path, NULL); + efl_file_simple_load(data->billboard.texture, b_image_path, NULL); evas_canvas3d_texture_filter_set(data->billboard.texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(data->billboard.texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); diff --git a/src/examples/evas/evas-3d-static-lod.c b/src/examples/evas/evas-3d-static-lod.c index d7672a48b5..92e3b1a1a9 100644 --- a/src/examples/evas/evas-3d-static-lod.c +++ b/src/examples/evas/evas-3d-static-lod.c @@ -179,14 +179,14 @@ _mesh_setup(Scene_Data *data) Eo *mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); Eina_Stringshare *str = eina_stringshare_printf("%s%d%s", model_path, i, ".obj"); - efl_file_set(mesh, str, NULL); + efl_file_simple_load(mesh, str, NULL); evas_canvas3d_mesh_frame_material_set(mesh, 0, data->material); evas_canvas3d_mesh_shader_mode_set(mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); evas_canvas3d_mesh_lod_boundary_set(mesh, distances[i], distances[i + 1]); evas_canvas3d_node_mesh_add(data->lod_mesh_node1, mesh); mesh = efl_add(EVAS_CANVAS3D_MESH_CLASS, evas); - efl_file_set(mesh, str, NULL); + efl_file_simple_load(mesh, str, NULL); evas_canvas3d_mesh_frame_material_set(mesh, 0, data->material); evas_canvas3d_mesh_shader_mode_set(mesh, EVAS_CANVAS3D_SHADER_MODE_PHONG); evas_canvas3d_mesh_lod_boundary_set(mesh, m_distances[i], m_distances[i + 1]); diff --git a/src/examples/evas/evas-object-manipulation-eo.c b/src/examples/evas/evas-object-manipulation-eo.c index 551d2873f7..081d063641 100644 --- a/src/examples/evas/evas-object-manipulation-eo.c +++ b/src/examples/evas/evas-object-manipulation-eo.c @@ -193,8 +193,9 @@ main(void) * So it's possible to decrement refcount, and 'image' object * will be deleted automatically by parent.*/ - efl_file_set(d.img, img_path, NULL); - err = efl_file_load_error_get(d.img); + if (efl_file_set(d.img, img_path)) goto panic; + + err = efl_file_load(d.img); if (err != EVAS_LOAD_ERROR_NONE) { @@ -211,8 +212,8 @@ main(void) /* border on the image's clipper, here just to emphasize its position */ d.clipper_border = efl_add(EFL_CANVAS_IMAGE_CLASS, d.canvas); - efl_file_set(d.clipper_border, border_img_path, NULL); - err = efl_file_load_error_get(d.clipper_border); + if (efl_file_set(d.clipper_border, border_img_path)) goto panic; + err = efl_file_load(d.clipper_border); if (err != EVAS_LOAD_ERROR_NONE) { diff --git a/src/examples/evas/shooter/evas-3d-shooter-macros.h b/src/examples/evas/shooter/evas-3d-shooter-macros.h index 9cb92a6cf8..94980ec2e3 100644 --- a/src/examples/evas/shooter/evas-3d-shooter-macros.h +++ b/src/examples/evas/shooter/evas-3d-shooter-macros.h @@ -150,13 +150,13 @@ typedef struct _vec2 #define MATERIAL_TEXTURE_SET(Object, Name, file, image) \ - efl_file_set(data->mesh_##Name, file, NULL); \ + efl_file_simple_load(data->mesh_##Name, file, NULL); \ \ SETUP_DEFAULT_MESH(Object, Name, PHONG) \ data->texture_diffuse_##Object = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ \ evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_##Object, EINA_FALSE); \ - efl_file_set(data->texture_diffuse_##Object, image, NULL); \ + efl_file_simple_load(data->texture_diffuse_##Object, image, NULL); \ evas_canvas3d_texture_filter_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \ evas_canvas3d_texture_wrap_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \ @@ -175,7 +175,7 @@ typedef struct _vec2 data->texture_diffuse_##Object = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ \ evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_##Object, EINA_FALSE); \ - efl_file_set(data->texture_diffuse_##Object, image, NULL); \ + efl_file_simple_load(data->texture_diffuse_##Object, image, NULL); \ evas_canvas3d_texture_filter_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \ evas_canvas3d_texture_wrap_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \ @@ -190,7 +190,7 @@ typedef struct _vec2 data->texture_normal_##Object = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ \ evas_canvas3d_texture_atlas_enable_set(data->texture_normal_##Object, EINA_FALSE); \ - efl_file_set(data->texture_normal_##Object, normal, NULL); \ + efl_file_simple_load(data->texture_normal_##Object, normal, NULL); \ evas_canvas3d_texture_filter_set(data->texture_normal_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \ evas_canvas3d_texture_wrap_set(data->texture_normal_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \ diff --git a/src/examples/evas/shooter/evas-3d-shooter.c b/src/examples/evas/shooter/evas-3d-shooter.c index ae6bedee7f..1c4deb4d7e 100644 --- a/src/examples/evas/shooter/evas-3d-shooter.c +++ b/src/examples/evas/shooter/evas-3d-shooter.c @@ -133,14 +133,14 @@ _key_down(void *data, if (!scene->blending) { scene->blending = EINA_TRUE; - efl_file_set(scene->texture_diffuse_carpet, gazebo_t_trans_path, NULL); + efl_file_simple_load(scene->texture_diffuse_carpet, gazebo_t_trans_path, NULL); evas_canvas3d_mesh_blending_enable_set(scene->mesh_carpet, EINA_TRUE); evas_canvas3d_mesh_blending_func_set(scene->mesh_carpet, EVAS_CANVAS3D_BLEND_FUNC_SRC_ALPHA, EVAS_CANVAS3D_BLEND_FUNC_ONE_MINUS_SRC_ALPHA); } else { scene->blending = EINA_FALSE; - efl_file_set(scene->texture_diffuse_carpet, gazebo_t_path, NULL); + efl_file_simple_load(scene->texture_diffuse_carpet, gazebo_t_path, NULL); evas_canvas3d_mesh_blending_enable_set(scene->mesh_carpet, EINA_FALSE); } } @@ -733,7 +733,7 @@ _mesh_setup_gun_planet(Scene_Data *data) ADD_MESH(tommy, tommy, 0.0, 0.3, 1.0) SETUP_MESH_NODE(tommy) - efl_file_set(data->mesh_tommy, gun_path, NULL); + efl_file_simple_load(data->mesh_tommy, gun_path, NULL); efl_file_save(data->mesh_tommy, "try.obj", NULL, NULL); evas_canvas3d_mesh_shader_mode_set(data->mesh_tommy, EVAS_CANVAS3D_SHADER_MODE_PHONG); evas_canvas3d_mesh_frame_material_set(data->mesh_tommy, 0, data->material_tommy); @@ -763,7 +763,7 @@ _mesh_setup_gun_planet(Scene_Data *data) if (data->blending) { evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_carpet, EINA_FALSE); - efl_file_set(data->texture_diffuse_carpet, gazebo_t_trans_path, NULL); + efl_file_simple_load(data->texture_diffuse_carpet, gazebo_t_trans_path, NULL); evas_canvas3d_mesh_blending_enable_set(data->mesh_carpet, EINA_TRUE); evas_canvas3d_mesh_blending_func_set(data->mesh_carpet, EVAS_CANVAS3D_BLEND_FUNC_SRC_ALPHA, EVAS_CANVAS3D_BLEND_FUNC_ONE_MINUS_SRC_ALPHA); } @@ -888,7 +888,7 @@ _mesh_setup_column(Scene_Data *data, int index) data->texture_diffuse_column = efl_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); - efl_file_set(data->texture_diffuse_column, red_brick_path, NULL); + efl_file_simple_load(data->texture_diffuse_column, red_brick_path, NULL); evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_column, EINA_FALSE); evas_canvas3d_texture_filter_set(data->texture_diffuse_column, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); evas_canvas3d_texture_wrap_set(data->texture_diffuse_column, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); diff --git a/src/lib/ecore/efl_io_file.c b/src/lib/ecore/efl_io_file.c index c8716d2935..041db19e95 100644 --- a/src/lib/ecore/efl_io_file.c +++ b/src/lib/ecore/efl_io_file.c @@ -29,7 +29,6 @@ typedef struct _Efl_Io_File_Data { - const char *path; uint32_t flags; uint32_t mode; uint64_t last_position; @@ -123,7 +122,7 @@ _efl_io_file_efl_object_constructor(Eo *o, Efl_Io_File_Data *pd) } EOLIAN static void -_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd) +_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd EINA_UNUSED) { if (efl_io_closer_close_on_invalidate_get(o) && (!efl_io_closer_closed_get(o))) @@ -134,8 +133,6 @@ _efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd) } efl_destructor(efl_super(o, MY_CLASS)); - - eina_stringshare_del(pd->path); } EOLIAN static Efl_Object * @@ -144,17 +141,18 @@ _efl_io_file_efl_object_finalize(Eo *o, Efl_Io_File_Data *pd) int fd = efl_loop_fd_file_get(o); if (fd < 0) { - EINA_SAFETY_ON_NULL_RETURN_VAL(pd->path, NULL); + const char *path = efl_file_get(o); + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); if (pd->mode) - fd = open(pd->path, pd->flags, pd->mode); + fd = open(path, pd->flags, pd->mode); else - fd = open(pd->path, pd->flags); + fd = open(path, pd->flags); if (fd < 0) { eina_error_set(errno); - ERR("Could not open file '%s': %s", pd->path, strerror(errno)); + ERR("Could not open file '%s': %s", path, strerror(errno)); return NULL; } @@ -164,22 +162,6 @@ _efl_io_file_efl_object_finalize(Eo *o, Efl_Io_File_Data *pd) return efl_finalize(efl_super(o, MY_CLASS)); } -EOLIAN static Eina_Bool -_efl_io_file_efl_file_file_set(Eo *o, Efl_Io_File_Data *pd, const char *file, const char *key EINA_UNUSED) -{ - EINA_SAFETY_ON_TRUE_RETURN_VAL(efl_finalized_get(o), EINA_FALSE); - - eina_stringshare_replace(&pd->path, file); - return EINA_TRUE; -} - -EOLIAN static void -_efl_io_file_efl_file_file_get(const Eo *o EINA_UNUSED, Efl_Io_File_Data *pd, const char **file, const char **key) -{ - if (file) *file = pd->path; - if (key) *key = NULL; -} - EOLIAN static Eina_Error _efl_io_file_efl_io_reader_read(Eo *o, Efl_Io_File_Data *pd, Eina_Rw_Slice *rw_slice) { diff --git a/src/lib/ecore/efl_io_file.eo b/src/lib/ecore/efl_io_file.eo index c663b723c5..269d46ec37 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 Efl.Object.destructor; Efl.Object.finalize; Efl.Loop_Fd.fd_file { set; } - Efl.File.file { get; set; } Efl.Io.Reader.read; Efl.Io.Writer.write; 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 5f94ebf2d1..b78498aa0e 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, file = efl_add(EFL_IO_FILE_CLASS, efl_loop_get(url_con->dialer), efl_name_set(efl_added, "upload-file"), - efl_file_set(efl_added, filename, NULL), + efl_file_set(efl_added, filename), efl_io_file_flags_set(efl_added, O_RDONLY), efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE), 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 54666693d2..4b65c51ee6 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) Efl_Net_Http_Status status = efl_net_dialer_http_response_status_get(job->input); const char *file; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); DBG("Finished downloading %s (status=%d) -> %s", efl_net_dialer_address_dial_get(job->input), @@ -92,7 +92,7 @@ _ecore_file_download_copier_error(void *data, const Efl_Event *event) Eina_Error *perr = event->info; const char *file; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); WRN("Failed downloading %s (status=%d) -> %s: %s", 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 if (!job->progress_cb) return; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); efl_net_dialer_http_progress_download_get(job->input, &dn, &dt); efl_net_dialer_http_progress_upload_get(job->input, &un, &ut); ret = job->progress_cb((void *)job->data, file, dt, dn, ut, un); @@ -227,7 +227,7 @@ ecore_file_download_full(const char *url, EINA_SAFETY_ON_NULL_GOTO(job->input, error_input); job->output = efl_add(EFL_IO_FILE_CLASS, loop, - efl_file_set(efl_added, dst, NULL), + efl_file_set(efl_added, dst), efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT), efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE), @@ -309,7 +309,7 @@ ecore_file_download_abort(Ecore_File_Download_Job *job) return; } - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); DBG("Aborting download %s -> %s", efl_net_dialer_address_dial_get(job->input), file); diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 1857990f42..18dd82d0cb 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 if (new_svg < 0) { - efl_file_set(ep->object, ed->file->path, src_key); + efl_file_simple_load(ep->object, ed->file->path, src_key); } else { snprintf(dest_key, sizeof(dest_key), "edje/vectors/%i", new_svg); - efl_file_set(ep->object, ed->file->path, src_key); + efl_file_simple_load(ep->object, ed->file->path, src_key); src_root = efl_canvas_vg_object_root_node_get(ep->object); efl_ref(src_root); - efl_file_set(ep->object, ed->file->path, dest_key); + efl_file_simple_load(ep->object, ed->file->path, dest_key); dest_root = efl_canvas_vg_object_root_node_get(ep->object); efl_ref(dest_root); @@ -4927,7 +4927,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry; if (proxy) { - efl_file_mmap_set(texture, ed->file->f, proxy); + efl_file_simple_mmap_load(texture, ed->file->f, proxy); evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2); evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2); } diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 010b1aff6b..37133e3731 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) return EINA_TRUE; } -EOLIAN static Eina_Bool -_edje_edit_efl_file_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group) +EOLIAN static Eina_Error +_edje_edit_efl_file_load(Eo *obj, Edje_Edit *eed) { + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + _edje_edit_data_clean(eed); + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; /* TODO and maybes: * * The whole point of this thing is keep track of stuff such as * 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 * groups). * P.S. don't forget about mmap version below */ - file = eina_vpath_resolve(file); - - Eina_Bool int_ret; - int_ret = efl_file_set(efl_super(obj, MY_CLASS), file, group); - - if (!int_ret) - return EINA_FALSE; - if (!_load_scripts(obj, eed)) - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_edje_edit_efl_file_mmap_set(Eo *obj, Edje_Edit *eed, const Eina_File *mmap, const char *group) -{ - _edje_edit_data_clean(eed); - - Eina_Bool int_ret; - int_ret = efl_file_mmap_set(efl_super(obj, MY_CLASS), mmap, group); - if (!int_ret) - return EINA_FALSE; - - if (!_load_scripts(obj, eed)) - return EINA_FALSE; - - return EINA_TRUE; + return 0; } EAPI Evas_Object * diff --git a/src/lib/edje/edje_edit.eo b/src/lib/edje/edje_edit.eo index a7bb40a550..61ae265498 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 implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.File.file { set; } - Efl.File.mmap { set; } + Efl.File.load; } } diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c index fead8b04be..5906ff1969 100644 --- a/src/lib/edje/edje_legacy.c +++ b/src/lib/edje/edje_legacy.c @@ -5,11 +5,8 @@ EAPI Edje_Load_Error edje_object_load_error_get(const Eo *obj) { - Efl_Gfx_Image_Load_Error p = efl_file_load_error_get(obj); Edje *ed; - if (p != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return EDJE_LOAD_ERROR_DOES_NOT_EXIST; - ed = _edje_fetch(obj); if (!ed) return EDJE_LOAD_ERROR_GENERIC; return ed->load_error; diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 360365ce91..9256d43acf 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); /************************** API Routines **************************/ -EOLIAN void -_efl_canvas_layout_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed, const char **file, const char **group) +EOLIAN const char * +_efl_canvas_layout_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed) { - if (file) *file = ed->path; - if (group) *group = ed->group; + return ed->path; +} + +EOLIAN const char * +_efl_canvas_layout_efl_file_group_get(Eo *obj EINA_UNUSED, Edje *ed) +{ + return ed->group; } EOLIAN Efl_Gfx_Image_Load_Error -_efl_canvas_layout_efl_file_load_error_get(const Eo *obj, Edje *ed) +_efl_canvas_layout_layout_load_error_get(const Eo *obj EINA_UNUSED, Edje *ed) { - Efl_Gfx_Image_Load_Error p = efl_file_load_error_get(efl_super(obj, EFL_CANVAS_LAYOUT_CLASS)); - - if (p != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return p; switch (ed->load_error) { 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) case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: return EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE; case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION; case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: return EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE; - default: return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; + default: break; } + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } EAPI const char * @@ -761,7 +764,7 @@ _edje_devices_add(Edje *ed, Evas *tev) _edje_device_changed_cb, ed); } -int +Eina_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) { Edje *ed; @@ -782,12 +785,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch Edje_Nested_Support *st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL; ed = _edje_fetch(obj); - if (!ed) return 0; + if (!ed) return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; if (!group) group = ""; if ((ed->file) && (ed->file->f == file) && (ed->group) && (!strcmp(group, ed->group))) { - return 1; + return 0; } tev = evas_object_evas_get(obj); @@ -840,7 +843,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch { ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE; _edje_file_del(ed); - return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE; } eina_array_step_set(&parts, sizeof (Eina_Array), 8); @@ -1009,7 +1012,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch eina_mempool_free(_edje_real_part_mp, rp); evas_event_thaw(tev); evas_event_thaw_eval(tev); - return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; } _edje_ref(ed); @@ -1106,7 +1109,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch if (pd_mesh_node->mesh_node.mesh.primitive == EVAS_CANVAS3D_MESH_PRIMITIVE_NONE) { - efl_file_set(mesh, ed->file->model_dir->entries[pd_mesh_node->mesh_node.mesh.id].entry, NULL); + efl_file_simple_load(mesh, ed->file->model_dir->entries[pd_mesh_node->mesh_node.mesh.id].entry, NULL); } else { @@ -1460,6 +1463,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch do { + Eina_Error load_error; child_obj = edje_object_add(ed->base.evas); edje_object_mirrored_set(child_obj, edje_object_mirrored_get(ed->obj)); @@ -1469,7 +1473,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); } - if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested)) + load_error = _edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested); + if (load_error) { ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'", 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 eina_array_flush(&parts); evas_event_thaw(tev); evas_event_thaw_eval(tev); - return 1; + return 0; } evas_event_thaw(tev); evas_event_thaw_eval(tev); - return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; on_error: eina_list_free(textblocks); @@ -1748,7 +1753,7 @@ on_error: } evas_event_thaw(tev); evas_event_thaw_eval(tev); - return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } void diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 25a00022b4..a92e5b1273 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, EAPI void _edje_edd_init(void); EAPI void _edje_edd_shutdown(void); -int _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); +Eina_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); void _edje_file_callbacks_del(Edje *ed, Evas *e); void _edje_file_del(Edje *ed); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index b7ca9c02d2..14f3d50c3c 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 Edje_Load_Error error; const char *file, *edje_group; - efl_file_get(eo_obj, &file, &edje_group); + efl_file_simple_get(eo_obj, &file, &edje_group); EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); @@ -402,50 +402,55 @@ _efl_canvas_layout_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Edje *e _edje_recalc_do(ed); } -EOLIAN static Eina_Bool -_efl_canvas_layout_efl_file_mmap_set(Eo *obj, Edje *pd EINA_UNUSED, - const Eina_File *f, const char *key) +EOLIAN static Eina_Error +_efl_canvas_layout_efl_file_load(Eo *obj, Edje *ed) { - Eina_Bool ret; + Eina_Error err; Eina_Array *nested; - ret = EINA_FALSE; + if (efl_file_loaded_get(obj)) return 0; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) + { + if (err == ENOENT) + ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST; + else if (err == ENOMEM) + ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + else if ((err == EPERM) || (err == EACCES)) + ed->load_error = EDJE_LOAD_ERROR_PERMISSION_DENIED; + else + ed->load_error = EDJE_LOAD_ERROR_GENERIC; + return err; + } nested = eina_array_new(8); - if (_edje_object_file_set_internal(obj, f, key, NULL, NULL, nested)) - ret = EINA_TRUE; + err = _edje_object_file_set_internal(obj, efl_file_mmap_get(obj), efl_file_key_get(obj), NULL, NULL, nested); eina_array_free(nested); _edje_object_orientation_inform(obj); - return ret; -} - -EOLIAN static void -_efl_canvas_layout_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Edje *pd, - const Eina_File **f, const char **key) -{ - if (f) *f = pd->file ? pd->file->f : NULL; - if (key) *key = pd->group; + return err; } EAPI Eina_Bool edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group) { - return efl_file_mmap_set(obj, file, group); + return efl_file_simple_mmap_load(obj, file, group); } EAPI Eina_Bool edje_object_file_set(Edje_Object *obj, const char *file, const char *group) { - return efl_file_set(obj, file, group); + return efl_file_simple_load(obj, file, group); } EAPI void edje_object_file_get(const Edje_Object *obj, const char **file, const char **group) { - efl_file_get((Edje_Object *)obj, file, group); + if (file) *file = efl_file_get(obj); + if (group) *group = efl_file_key_get(obj); } EOLIAN static void diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index d61ef892f2..5acf87fcd1 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. device: Efl.Input.Device; [[The seat device]] } } + @property layout_load_error { + get { + [[Gets the (last) file loading error for a given object.]] + } + values { + error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]] + } + } } events { 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. Efl.Ui.I18n.mirrored { set; get; } Efl.Ui.I18n.language { set; get; } Efl.Gfx.Entity.scale { set; get; } - Efl.File.load_error { get; } - Efl.File.mmap { get; set; } + Efl.File.load; Efl.Container.content_remove; Efl.Container.content_iterate; Efl.Container.content_count; diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 46fd921d3d..a398c1109d 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; #include "interfaces/efl_config.eo.h" #include "interfaces/efl_control.eo.h" #include "interfaces/efl_duplicate.eo.h" +#include "interfaces/efl_file.h" #include "interfaces/efl_file.eo.h" #include "interfaces/efl_file_save.eo.h" #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 d1c86ee7c2..3acdc17ce8 100644 --- a/src/lib/efl/interfaces/efl_file.c +++ b/src/lib/efl/interfaces/efl_file.c @@ -7,56 +7,210 @@ typedef struct _Efl_File_Data Efl_File_Data; struct _Efl_File_Data { - Efl_Gfx_Image_Load_Error error; + Eina_Stringshare *vpath; /* efl_file_set */ + Eina_Stringshare *key; /* efl_file_key_set */ + Eina_File *file; /* efl_file_mmap_set */ + Eina_Bool file_opened : 1; /* if `file` was opened implicitly during load */ + Eina_Bool setting : 1; /* set when this file is internally calling methods to avoid infinite recursion */ + Eina_Bool loaded : 1; /* whether the currently set file properties have been loaded */ }; -static Eina_Bool -_efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file, const char *key) +EOLIAN static void +_efl_file_unload(Eo *obj, Efl_File_Data *pd) { - char *tmp = NULL; - Eina_File *f = NULL; - Eina_Bool r = EINA_FALSE; + if (!pd->loaded) return; + if (!pd->file) return; + if (!pd->file_opened) return; + pd->setting = 1; + eina_file_close(pd->file); + efl_file_mmap_set(obj, NULL); + pd->setting = 0; + pd->loaded = pd->file_opened = EINA_FALSE; +} - pd->error = EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; +EOLIAN static Eina_Error +_efl_file_load(Eo *obj, Efl_File_Data *pd) +{ + Eina_Error ret = 0; + + if (pd->loaded) return 0; + EINA_SAFETY_ON_NULL_RETURN_VAL(pd->vpath, ENOENT); + errno = 0; + if (!pd->file) + { + Eina_File *f; + f = eina_file_open(pd->vpath, EINA_FALSE); + if (!f) return errno; + pd->file_opened = EINA_TRUE; + pd->setting = 1; + ret = efl_file_mmap_set(obj, f); + pd->setting = 0; + if (ret) pd->file_opened = EINA_FALSE; + eina_file_close(f); + } + pd->loaded = !ret; + return ret; +} + +EOLIAN static Eina_Error +_efl_file_mmap_set(Eo *obj, Efl_File_Data *pd, const Eina_File *f) +{ + Eina_Error err = 0; + Eina_File *file = NULL; + + if (f == pd->file) return 0; + if (f) + { + file = eina_file_dup(f); + if (!file) return errno; + } + if (pd->file) eina_file_close(pd->file); + pd->file = file; + pd->loaded = EINA_FALSE; + + if (!pd->setting) + { + /* avoid infinite recursion */ + pd->setting = 1; + err = efl_file_set(obj, eina_file_filename_get(pd->file)); + pd->setting = 0; + } + return err; +} + +EOLIAN static const Eina_File * +_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) +{ + return pd->file; +} + +EOLIAN static Eina_Error +_efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file) +{ + char *tmp; + Eina_Error err = 0; + Eina_Bool same; tmp = (char*)(file); if (tmp) - { - tmp = eina_vpath_resolve(tmp); - } - - if (tmp) - { - f = eina_file_open(tmp, EINA_FALSE); - if (!f) goto on_error; - } - - pd->error = EFL_GFX_IMAGE_LOAD_ERROR_NONE; - - r = efl_file_mmap_set(obj, f, key); - if (f) eina_file_close(f); - - on_error: + tmp = eina_vpath_resolve(tmp); + same = !eina_stringshare_replace(&pd->vpath, tmp ?: file); free(tmp); - return r; + if (same) return err; + pd->loaded = EINA_FALSE; + if (!pd->setting) + { + pd->setting = 1; + err = efl_file_mmap_set(obj, NULL); + pd->setting = 0; + } + return err; } -static void -_efl_file_file_get(const Eo *obj, Efl_File_Data *pd EINA_UNUSED, const char **file, const char **key) +EOLIAN static Eina_Stringshare * +_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) { - const Eina_File *f = NULL; - - efl_file_mmap_get(obj, &f, key); - - if (f && file) *file = eina_file_filename_get(f); - else if (file) *file = NULL; + return pd->vpath; } -static Efl_Gfx_Image_Load_Error -_efl_file_load_error_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) +EOLIAN static void +_efl_file_key_set(Eo *obj EINA_UNUSED, Efl_File_Data *pd, const char *key) { - return pd->error; + if (eina_stringshare_replace(&pd->key, key)) + pd->loaded = 0; +} + +EOLIAN static Eina_Stringshare * +_efl_file_key_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) +{ + return pd->key; +} + +EOLIAN static Eina_Bool +_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd) +{ + return pd->loaded; +} + +EOLIAN static void +_efl_file_efl_object_destructor(Eo *obj, Efl_File_Data *pd) +{ + eina_stringshare_del(pd->vpath); + eina_stringshare_del(pd->key); + eina_file_close(pd->file); + efl_destructor(efl_super(obj, EFL_FILE_MIXIN)); +} + +EOLIAN static Eo * +_efl_file_efl_object_finalize(Eo *obj, Efl_File_Data *pd) +{ + obj = efl_finalize(efl_super(obj, EFL_FILE_MIXIN)); + if (!obj) return NULL; + if (pd->file || pd->vpath) efl_file_load(obj); + return obj; +} + +//////////////////////////////////////////////////////////////////////////// + +EAPI Eina_Bool +efl_file_simple_load(Eo *obj, const char *file, const char *key) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + efl_ref(obj); + EINA_SAFETY_ON_TRUE_GOTO(efl_file_set(obj, file), fail); + efl_file_key_set(obj, key); + if (file) + { + if (efl_file_load(obj)) goto fail; + efl_unref(obj); + return EINA_TRUE; + } + efl_file_unload(obj); + efl_unref(obj); + return EINA_TRUE; +fail: + efl_unref(obj); + return EINA_FALSE; +} + +EAPI Eina_Bool +efl_file_simple_mmap_load(Eo *obj, const Eina_File *file, const char *key) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + efl_ref(obj); + EINA_SAFETY_ON_TRUE_GOTO(efl_file_mmap_set(obj, file), fail); + efl_file_key_set(obj, key); + if (file) + { + if (efl_file_load(obj)) goto fail; + efl_unref(obj); + return EINA_TRUE; + } + efl_file_unload(obj); + efl_unref(obj); + return EINA_TRUE; +fail: + efl_unref(obj); + return EINA_FALSE; +} + +EAPI void +efl_file_simple_get(const Eo *obj, const char **file, const char **key) +{ + efl_ref((Eo*)obj); + if (file) *file = efl_file_get(obj); + if (key) *key = efl_file_key_get(obj); + efl_unref((Eo*)obj); +} + +EAPI void +efl_file_simple_mmap_get(const Eo *obj, const Eina_File **file, const char **key) +{ + efl_ref((Eo*)obj); + if (file) *file = efl_file_mmap_get(obj); + if (key) *key = efl_file_key_get(obj); + efl_unref((Eo*)obj); } #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 8d98a004a4..985b3fd687 100644 --- a/src/lib/efl/interfaces/efl_file.eo +++ b/src/lib/efl/interfaces/efl_file.eo @@ -1,93 +1,108 @@ import eina_types; import efl_gfx_types; -mixin @beta Efl.File { +mixin @beta Efl.File requires Efl.Object { [[Efl file interface]] methods { - @property load_error { - get { - [[Gets the (last) file loading error for a given object.]] - } - values { - error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]] - } - } @property mmap { - set @pure_virtual { - [[Set the source mmaped file from where an image object must fetch the real - image data (it must be an Eina_File). + set { + [[Set the mmaped file from where an object will fetch the real + data (it must be an Eina_File). - If the file supports multiple data stored in it (as Eet files do), - you can specify the key to be used as the index of the image in - this file. + If mmap is set during object construction, the object will automatically + call @.load during the finalize phase of construction. - @since 1.8]] + ]] - return: bool; [[$true on success, $false otherwise]] + return: Eina.Error; [[0 on success, error code otherwise]] } - get @pure_virtual { - [[Get the source mmaped file from where an image object must fetch the real - image data (it must be an Eina_File). + get { + [[Get the mmaped file from where an object will fetch the real + data (it must be an Eina_File). - If the file supports multiple data stored in it (as Eet files do), - you can get the key to be used as the index of the image in - this file. - - @since 1.10]] + ]] } values { - f: ptr(const(Eina.File)); [[The handler to an Eina_File that will be used as image source]] - key: string @optional; [[The group that the image belongs to, in case - it's an EET(including Edje case) file. This can be used - as a key inside evas image cache if this is a normal image - file not eet file.]] + f: ptr(const(Eina.File)); [[The handle to an Eina_File that will be used]] } } @property file { set { - [[Set the source file from where an image object must fetch the real - image data (it may be an Eet file, besides pure image ones). + [[Set the file path from where an object will fetch the data. - If the file supports multiple data stored in it (as Eet files do), - you can specify the key to be used as the index of the image in - this file.]] + If file is set during object construction, the object will automatically + call @.load during the finalize phase of construction. + ]] - /* FIXME-doc - * Example: - * @code - * img = evas_object_image_add(canvas); - * evas_object_image_file_set(img, "/path/to/img", NULL); - * err = evas_object_image_load_error_get(img); - * if (err != EVAS_LOAD_ERROR_NONE) - * { - * fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n", - * valid_path, evas_load_error_str(err)); - * } - * else - * { - * evas_object_image_fill_set(img, 0, 0, w, h); - * evas_object_resize(img, w, h); - * evas_object_show(img); - * } - * @endcode - */ - - return: bool; [[$true on success, $false otherwise]] + return: Eina.Error; [[0 on success, error code otherwise]] } get { - [[Retrieve the source file from where an image object is to fetch the - real image data (it may be an Eet file, besides pure image ones). + [[Retrieve the file path from where an object is to fetch the data. - You must not modify the strings on the returned pointers. - - Note: Use $null pointers on the file components you're not - interested in: they'll be ignored by the function.]] + You must not modify the strings on the returned pointers.]] } values { - file: string; [[The image file path.]] - key: string; [[The image key in $file (if its an Eet one), or - $null, otherwise.]] + file: string; [[The file path.]] } } + @property key { + set { + [[Set the key which corresponds to the target data within a file. + + Some filetypes can contain multiple data streams which are indexed by + a key. Use this property for such cases. + ]] + } + get { + [[Get the previously-set key which corresponds to the target data within a file. + + Some filetypes can contain multiple data streams which are indexed by + a key. Use this property for such cases. + + You must not modify the strings on the returned pointers.]] + } + values { + key: string; [[The group that the image belongs to, in case + it's an EET(including Edje case) file. This can be used + as a key inside evas image cache if this is a normal image + file not eet file.]] + } + } + @property loaded { + get { + [[Get the load state of the object. + ]] + } + values { + loaded: bool; [[True if the object is loaded, otherwise false.]] + } + } + + load { + [[Perform all necessary operations to open and load file data into the object + using the @.file (or @.mmap) and @.key properties. + + In the case where @.file.set has been called on an object, this will internally + open the file and call @.mmap.set on the object using the opened file handle. + + Calling @.load on an object which has already performed file operations based on + the currently set properties will have no effect.]] + + return: Eina.Error; [[0 on success, error code otherwise]] + } + + unload { + [[Perform all necessary operations to unload file data from the object. + + In the case where @.mmap.set has been externally called on an object, the file handle + stored in the object will be preserved. + + Calling @.unload on an object which is not currently loaded will have no effect. + ]] + } + } + implements { + Efl.Object.destructor; + Efl.Object.finalize; } } diff --git a/src/lib/efl/interfaces/efl_file.h b/src/lib/efl/interfaces/efl_file.h new file mode 100644 index 0000000000..d0457148e4 --- /dev/null +++ b/src/lib/efl/interfaces/efl_file.h @@ -0,0 +1,10 @@ +#ifndef _EFL_FILE_H +# define _EFL_FILE_H + +/* add doc note about needing ref/unref when passing efl_part to these functions */ +EAPI Eina_Bool efl_file_simple_load(Eo *obj, const char *file, const char *key); +EAPI Eina_Bool efl_file_simple_mmap_load(Eo *obj, const Eina_File *file, const char *key); +EAPI void efl_file_simple_get(const Eo *obj, const char **file, const char **key); +EAPI void efl_file_simple_mmap_get(const Eo *obj, const Eina_File **file, const char **key); + +#endif diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo b/src/lib/efl/interfaces/efl_gfx_image.eo index 420bb8199d..eb23f3fe30 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 see @Efl.Gfx.Image_Scale_Hint]] } } + @property image_load_error { + get { + [[Gets the (last) file loading error for a given object.]] + } + values { + error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]] + } + } } events { preload: void; [[Image data has been preloaded.]] diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index 74839038f2..d91ea663c6 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -183,4 +183,8 @@ efl_src += files([ # 'efl_common_internal.h' #]) +install_headers('efl_file.h', + install_dir : join_paths(dir_package_include, 'interfaces'), +) + eolian_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 90bb5061eb..54b29d91b2 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 EAPI Eina_Bool elm_bg_file_set(Eo *obj, const char *file, const char *group) { - return efl_file_set((Eo *) obj, file, group); + return efl_file_simple_load((Eo *) obj, file, group); } -EOLIAN static Eina_Bool -_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file, const char *key) +EOLIAN static Eina_Error +_efl_ui_bg_efl_file_load(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd) +{ + return efl_file_load(sd->img); +} + +EOLIAN static Eina_Error +_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file) { eina_stringshare_replace(&sd->file, file); + + return efl_file_set(sd->img, file); +} + +EOLIAN static void +_efl_ui_bg_efl_file_key_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *key) +{ eina_stringshare_replace(&sd->key, key); - return efl_file_set(sd->img, file, key); + efl_file_key_set(sd->img, key); } + EAPI void elm_bg_file_get(const Eo *obj, const char **file, const char **group) { - efl_file_get((Eo *) obj, file, group); + efl_file_simple_get((Eo *) obj, file, group); } -EOLIAN static void -_efl_ui_bg_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Data *sd, const char **file, const char **key) +EOLIAN static const char * +_efl_ui_bg_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Data *sd) { if (elm_widget_is_legacy(obj)) - { - if (file) *file = sd->file; - if (key) *key = sd->key; - return; - } + return sd->file; - efl_file_get(sd->img, file, key); + return efl_file_get(sd->img); } -EOLIAN static Eina_Bool +EOLIAN static const char * +_efl_ui_bg_efl_file_key_get(const Eo *obj, Efl_Ui_Bg_Data *sd) +{ + if (elm_widget_is_legacy(obj)) + return sd->key; + + return efl_file_key_get(sd->img); +} + +EOLIAN static Eina_Error _efl_ui_bg_efl_file_mmap_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, - const Eina_File *file, const char *key) + const Eina_File *file) { - return efl_file_mmap_set(sd->img, file, key); + return efl_file_mmap_set(sd->img, file); } -EOLIAN static void -_efl_ui_bg_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, - const Eina_File **file, const char **key) +EOLIAN static const Eina_File * +_efl_ui_bg_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd) { - efl_file_mmap_get(sd->img, file, key); + return efl_file_mmap_get(sd->img); +} + + +EOLIAN static Eo * +_efl_ui_bg_efl_object_finalize(Eo *obj, Efl_Ui_Bg_Data *sd) +{ + obj = efl_finalize(efl_super(obj, MY_CLASS)); + if (!obj) return NULL; + if (efl_file_get(sd->img) || efl_file_mmap_get(sd->img)) efl_file_load(sd->img); + return obj; } /* 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 b928549fef..6809b7f418 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 implements { Efl.Object.constructor; Efl.Object.destructor; + Efl.Object.finalize; + Efl.File.load; Efl.File.file { get; set; } + Efl.File.key { get; set; } Efl.File.mmap { get; set; } Efl.Gfx.Color.color { get; set; } 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 90ec82003f..d4089edd1f 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[] = { }; static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params); -static 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); +static Eina_Error _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd); static void _efl_ui_image_remote_copier_cancel(Eo *obj, Efl_Ui_Image_Data *sd); void _efl_ui_image_sizing_eval(Evas_Object *obj); static void _efl_ui_image_model_properties_changed_cb(void *data, const Efl_Event *event); static void _on_size_hints_changed(void *data, const Efl_Event *e); +static Eina_Bool _efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url); static const Elm_Action key_actions[] = { {"activate", _key_action_activate}, @@ -396,7 +397,7 @@ static void _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread) { Async_Open_Data *todo = data; - Eina_Stringshare *file, *key; + const char *key; Eina_Bool ok; Eina_File *f; void *map; @@ -414,19 +415,21 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread) map = todo->map; f = todo->f_open; ok = f && map; - if (todo->file) file = todo->file; - else file = f ? eina_file_filename_get(f) : NULL; if (ok) { - if (sd->edje) + efl_file_key_set(sd->self, key); + ok = !efl_file_mmap_set(sd->self, f); + if (ok) { - _prev_img_del(sd); - ok = edje_object_mmap_set(sd->img, f, key); + if (sd->edje) + { + _prev_img_del(sd); + ok = edje_object_mmap_set(sd->img, f, key); + } + else + ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd); } - else - ok = _efl_ui_image_smart_internal_file_set - (sd->self, sd, file, f, key); } if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL); 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) _async_open_data_free(todo); } -static Eina_Bool -_efl_ui_image_async_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file, - const Eina_File *f, const char *key) +static Eina_Error +_efl_ui_image_async_file_set(Eo *obj, Efl_Ui_Image_Data *sd) { Async_Open_Data *todo; + const char *file = efl_file_get(obj); + const char *key = efl_file_key_get(obj); + const Eina_File *f = efl_file_mmap_get(obj); if (sd->async.th && ((file == sd->async.file) || (file && sd->async.file && !strcmp(file, sd->async.file))) && ((key == sd->async.key) || (key && sd->async.key && !strcmp(key, sd->async.key)))) - return EINA_TRUE; + return 0; todo = calloc(1, sizeof(Async_Open_Data)); 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, sd->async.th = ecore_thread_run(_efl_ui_image_async_open_do, _efl_ui_image_async_open_done, _efl_ui_image_async_open_cancel, todo); - if (sd->async.th) return EINA_TRUE; + if (sd->async.th) return 0; _async_open_data_free(todo); _async_clear(sd); DBG("Could not spawn an async thread!"); - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } -static Eina_Bool -_efl_ui_image_edje_file_set(Evas_Object *obj, - const char *file, - const Eina_File *f, - const char *group) +static Eina_Error +_efl_ui_image_edje_file_set(Evas_Object *obj) { + Eina_Error err; + const Eina_File *f; + const char *key; + EFL_UI_IMAGE_DATA_GET(obj, sd); + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + f = efl_file_mmap_get(obj); + key = efl_file_key_get(obj); _prev_img_del(sd); if (!sd->edje) @@ -500,32 +511,23 @@ _efl_ui_image_edje_file_set(Evas_Object *obj, if (!sd->async_enable) { - if (f) + efl_file_key_set(sd->img, key); + err = efl_file_mmap_set(sd->img, f); + if (!err) err = efl_file_load(sd->img); + if (err) { - if (!edje_object_mmap_set(sd->img, f, group)) - { - ERR("failed to set edje file '%s', group '%s': %s", file, group, - edje_load_error_str(edje_object_load_error_get(sd->img))); - return EINA_FALSE; - } - } - else - { - if (!edje_object_file_set(sd->img, file, group)) - { - ERR("failed to set edje file '%s', group '%s': %s", file, group, - edje_load_error_str(edje_object_load_error_get(sd->img))); - return EINA_FALSE; - } + ERR("failed to set edje file '%s', group '%s': %s", eina_file_filename_get(f), key, + edje_load_error_str(edje_object_load_error_get(sd->img))); + return err; } } else - return _efl_ui_image_async_file_set(obj, sd, file, f, group); + return _efl_ui_image_async_file_set(obj, sd); /* FIXME: do i want to update icon on file change ? */ _efl_ui_image_sizing_eval(obj); - return EINA_TRUE; + return 0; } EOLIAN static void @@ -547,7 +549,7 @@ _efl_ui_image_drag_n_drop_cb(void *elm_obj, Elm_Selection_Data *drop) { Eina_Bool ret = EINA_FALSE; - ret = efl_file_set(obj, drop->data, NULL); + ret = efl_file_simple_load(obj, drop->data, NULL); if (ret) { 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) return obj; } -EOLIAN Eina_Bool -_efl_ui_image_efl_file_mmap_set(Eo *obj, Efl_Ui_Image_Data *sd, - const Eina_File *file, const char *key) -{ - Eina_Bool ret = EINA_FALSE; +static const Eina_Slice remote_uri[] = { + EINA_SLICE_STR_LITERAL("http://"), + EINA_SLICE_STR_LITERAL("https://"), + EINA_SLICE_STR_LITERAL("ftp://"), + { } +}; +static inline Eina_Bool +_efl_ui_image_is_remote(const char *file) +{ + Eina_Slice s = EINA_SLICE_STR(file); + const Eina_Slice *itr; + + for (itr = remote_uri; itr->mem; itr++) + if (eina_slice_startswith(s, *itr)) + return EINA_TRUE; + + return EINA_FALSE; +} + +EOLIAN Eina_Error +_efl_ui_image_efl_file_load(Eo *obj, Efl_Ui_Image_Data *sd) +{ + Eina_Error ret; + const char *file = efl_file_get(obj); + + if (efl_file_loaded_get(obj)) return 0; _async_cancel(sd); /* 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, if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd); if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free); + if (sd->anim) + { + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); + sd->play = EINA_FALSE; + sd->anim = EINA_FALSE; + } + + if (file && _efl_ui_image_is_remote(file)) + { + evas_object_hide(sd->img); + if (_efl_ui_image_download(obj, sd, file)) + { + evas_object_smart_callback_call(obj, SIG_DOWNLOAD_START, NULL); + return 0; + } + } + if (!sd->async_enable) - ret = _efl_ui_image_smart_internal_file_set(obj, sd, eina_file_filename_get(file), file, key); + ret = _efl_ui_image_smart_internal_file_set(obj, sd); else - ret = _efl_ui_image_async_file_set(obj, sd, eina_file_filename_get(file), file, key); + ret = _efl_ui_image_async_file_set(obj, sd); return ret; } EOLIAN void -_efl_ui_image_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const Eina_File **file, const char **group) +_efl_ui_image_efl_file_unload(Eo *obj, Efl_Ui_Image_Data *sd) { - if (sd->img) efl_file_mmap_get(sd->img, file, group); + _async_cancel(sd); + + /* stop preloading as it may hit to-be-freed memory */ + if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING) + evas_object_image_preload(sd->img, EINA_TRUE); + + if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd); + if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free); + + if (sd->anim) + { + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); + sd->play = EINA_FALSE; + sd->anim = EINA_FALSE; + } + + if (sd->prev_img) + _prev_img_del(sd); + _efl_ui_image_file_set_do(obj); + efl_file_unload(sd->img); + efl_file_unload(efl_super(obj, MY_CLASS)); + if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) + _prev_img_del(sd); + else + { + evas_object_hide(sd->img); + sd->preload_status = EFL_UI_IMAGE_PRELOADING; + evas_object_image_preload(sd->img, EINA_FALSE); + } + + _efl_ui_image_sizing_eval(obj); } -static 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) +static Eina_Error +_efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd) { - Evas_Load_Error err; + Eina_Error err; + const Eina_File *f; + const char *key; + const char *file = efl_file_get(obj); if (eina_str_has_extension(file, ".edj")) - return _efl_ui_image_edje_file_set(obj, file, f, key); + return _efl_ui_image_edje_file_set(obj); + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + f = efl_file_mmap_get(obj); + key = efl_file_key_get(obj); _efl_ui_image_file_set_do(obj); - if (f) - evas_object_image_mmap_set(sd->img, f, key); - else - evas_object_image_file_set(sd->img, file, key); + evas_object_image_mmap_set(sd->img, f, key); err = evas_object_image_load_error_get(sd->img); - if (err != EVAS_LOAD_ERROR_NONE) + if (err) { if (file || f) { if (key) ERR("Failed to load image '%s' '%s': %s. (%p)", - file ? file : eina_file_filename_get(f), key, + eina_file_filename_get(f), key, evas_load_error_str(err), obj); else ERR("Failed to load image '%s': %s. (%p)", - file ? file : eina_file_filename_get(f), + eina_file_filename_get(f), evas_load_error_str(err), obj); } else @@ -928,7 +1003,7 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd, ERR("NULL image file passed! (%p)", obj); } _prev_img_del(sd); - return EINA_FALSE; + return err; } 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, _efl_ui_image_sizing_eval(obj); - return EINA_TRUE; + return 0; } static void @@ -979,7 +1054,7 @@ _efl_ui_image_remote_copier_done(void *data, const Efl_Event *event EINA_UNUSED) Eina_File *f; Eo *dialer; const char *url; - Eina_Bool ret = EINA_FALSE; + Eina_Error ret; /* we're called from _efl_ui_image_remote_copier_cancel() */ if (!sd->remote.copier) return; @@ -997,11 +1072,11 @@ _efl_ui_image_remote_copier_done(void *data, const Efl_Event *event EINA_UNUSED) eina_binbuf_string_get(sd->remote.binbuf), eina_binbuf_length_get(sd->remote.binbuf), EINA_FALSE); - - ret = _efl_ui_image_smart_internal_file_set(obj, sd, url, f, sd->remote.key); + efl_file_mmap_set(obj, f); + ret = _efl_ui_image_smart_internal_file_set(obj, sd); eina_file_close(f); - if (!ret) + if (ret) { Efl_Ui_Image_Error err = { 0, EINA_TRUE }; @@ -1057,11 +1132,12 @@ EFL_CALLBACKS_ARRAY_DEFINE(_efl_ui_image_remote_copier_cbs, { EFL_IO_COPIER_EVENT_PROGRESS, _efl_ui_image_remote_copier_progress }); static Eina_Bool -_efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url, const char *key) +_efl_ui_image_download(Eo *obj, Efl_Ui_Image_Data *sd, const char *url) { Eo *dialer; Efl_Ui_Image_Error img_err = { ENOSYS, EINA_FALSE }; Eina_Error err; + const char *key = efl_file_key_get(obj); dialer = efl_add(EFL_NET_DIALER_HTTP_CLASS, obj, 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 return EINA_FALSE; } -static const Eina_Slice remote_uri[] = { - EINA_SLICE_STR_LITERAL("http://"), - EINA_SLICE_STR_LITERAL("https://"), - EINA_SLICE_STR_LITERAL("ftp://"), - { } -}; - -static inline Eina_Bool -_efl_ui_image_is_remote(const char *file) -{ - Eina_Slice s = EINA_SLICE_STR(file); - const Eina_Slice *itr; - - for (itr = remote_uri; itr->mem; itr++) - if (eina_slice_startswith(s, *itr)) - return EINA_TRUE; - - return EINA_FALSE; -} - -EOLIAN static Eina_Bool -_efl_ui_image_efl_file_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file, const char *key) -{ - Eina_Bool ret = EINA_FALSE; - - _async_cancel(sd); - - /* stop preloading as it may hit to-be-freed memory */ - if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING) - evas_object_image_preload(sd->img, EINA_TRUE); - - if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd); - if (sd->remote.binbuf) ELM_SAFE_FREE(sd->remote.binbuf, eina_binbuf_free); - - if (sd->anim) - { - ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); - sd->play = EINA_FALSE; - sd->anim = EINA_FALSE; - } - - if (!file) - { - if (sd->prev_img) - _prev_img_del(sd); - return _efl_ui_image_smart_internal_file_set(obj, sd, file, NULL, key);; - } - - if (_efl_ui_image_is_remote(file)) - { - evas_object_hide(sd->img); - if (_efl_ui_image_download(obj, sd, file, key)) - { - evas_object_smart_callback_call(obj, SIG_DOWNLOAD_START, NULL); - return EINA_TRUE; - } - } - - if (!sd->async_enable) - ret = _efl_ui_image_smart_internal_file_set(obj, sd, file, NULL, key); - else - ret = _efl_ui_image_async_file_set(obj, sd, file, NULL, key); - - return ret; -} - EOLIAN static const char* _efl_ui_image_efl_layout_group_group_data_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *key) { @@ -1264,18 +1274,6 @@ _efl_ui_image_efl_layout_calc_calc_auto_update_hints_get(const Eo *obj EINA_UNUS return EINA_TRUE; } -EOLIAN static void -_efl_ui_image_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char **file, const char **key) -{ - if (sd->async.th) - { - if (file) *file = sd->async.file; - if (key) *key = sd->async.key; - return; - } - efl_file_get(sd->img, file, key); -} - #if 0 // Kept for reference: wait for async open to complete - probably unused. static Eina_Bool @@ -1725,7 +1723,7 @@ _icon_freedesktop_set(Evas_Object *obj, const char *name, int size) if (sd->freedesktop.use) { sd->freedesktop.requested_size = size; - efl_file_set(obj, path, NULL); + efl_file_simple_load(obj, path, NULL); return EINA_TRUE; } return EINA_FALSE; @@ -1793,7 +1791,7 @@ _internal_efl_ui_image_icon_set(Evas_Object *obj, const char *name, Eina_Bool *f { if (fdo) *fdo = EINA_FALSE; - return efl_file_set(obj, name, NULL); + return efl_file_simple_load(obj, name, NULL); } /* 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) { eina_value_get(vfile, &f); - efl_file_mmap_set(obj, f, key); + efl_file_simple_mmap_load(obj, f, key); } else { file = eina_value_to_string(vfile); - efl_file_set(obj, file, key); + efl_file_simple_load(obj, file, key); } } @@ -2010,7 +2008,7 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group) Eina_Bool ret = EINA_FALSE; EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; - ret = efl_file_set(obj, file, group); + ret = efl_file_simple_load(obj, file, group); _efl_ui_image_sizing_eval(obj); return ret; } @@ -2018,14 +2016,14 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group) EAPI void elm_image_file_get(const Eo *obj, const char **file, const char **group) { - efl_file_get((Eo *) obj, file, group); + efl_file_simple_get((Eo *) obj, file, group); } EAPI Eina_Bool elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group) { EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; - return efl_file_mmap_set(obj, file, group); + return efl_file_simple_mmap_load(obj, file, group); } EAPI Eina_Bool diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 7a19d04b8f..109ef76d57 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. the absolute path of an image file, this image will be used. Lookup order used by @.icon.set can be set using "icon_theme" in config. - Note: The image set by this function can be changed by - @Efl.File.file.set. + Note: The image set by this function is changed when + @Efl.File.load is called. Note: This function does not accept relative icon path. @@ -89,8 +89,8 @@ class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Ui.Clickable, Efl. } implements { Efl.Object.constructor; - Efl.File.file { get; set; } - Efl.File.mmap { get; set; } + Efl.File.load; + Efl.File.unload; Efl.Gfx.Color.color { set; } Efl.Gfx.Entity.visible { set; } 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 dc17dce226..21d3d6fc31 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 return ok; } -static Eina_Bool +static Eina_Error _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, - const char *file, const Eina_File *f, const char *group, Eina_Bool resize) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); double tz; int w, h; + Eina_Error err; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; sd->zoom = 1.0; 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, sd->edje = edje_object_add(evas_object_evas_get(obj)); if (!resize) { - if (f) + efl_file_key_set(sd->edje, efl_file_key_get(obj)); + err = efl_file_mmap_set(sd->edje, efl_file_mmap_get(obj)); + if (err) { - if (!edje_object_mmap_set(sd->edje, f, group)) - { - ERR("failed to set edje file '%s', group '%s': %s", sd->file, group, - edje_load_error_str(edje_object_load_error_get(sd->edje))); - return EINA_FALSE; - } - } - else if (file) - { - if (!edje_object_file_set(sd->edje, file, group)) - { - ERR("failed to set edje file '%s', group '%s': %s", file, group, - edje_load_error_str(edje_object_load_error_get(sd->edje))); - return EINA_FALSE; - } + ERR("failed to set edje file '%s', group '%s': %s", efl_file_get(obj), efl_file_key_get(obj), + edje_load_error_str(edje_object_load_error_get(sd->edje))); + return err; } } @@ -2100,41 +2093,42 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, sd->flip = EFL_FLIP_NONE; sd->orientation_changed = EINA_FALSE; - return EINA_TRUE; + return 0; } -static Eina_Bool -_image_zoomable_edje_file_set(Evas_Object *obj, - const char *file, - const char *group) +static Eina_Error +_image_zoomable_edje_file_set(Evas_Object *obj) { EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC); - if (file) eina_stringshare_replace(&sd->file, file); - return _img_proxy_set(obj, sd, file, NULL, group, EINA_FALSE); + return _img_proxy_set(obj, sd, EINA_FALSE); } -static void -_internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Eina_File *f, const char *key, Evas_Load_Error *ret) +static Eina_Error +_internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret) { - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - Evas_Load_Error err; + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC); int w, h; double tz; + Eina_Error err; + const char *file; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + file = efl_file_get(obj); if (eina_str_has_extension(file, ".edj")) { - _image_zoomable_edje_file_set(obj, file, key); - return; + return _image_zoomable_edje_file_set(obj); } // It is actually to late, we have lost the reference to the previous // file descriptor already, so we can't know if the file changed. To // be safe we do for now just force a full reload on file_set and hope // on evas to catch it, if there is no change. - eina_stringshare_replace(&sd->file, file); - sd->f = eina_file_dup(f); + sd->f = eina_file_dup(efl_file_mmap_get(obj)); evas_object_image_smooth_scale_set(sd->img, (sd->no_smooth == 0)); 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 { ERR("Things are going bad for '%s' (%p) : %i", file, sd->img, err); if (ret) *ret = err; - return; + return err; } evas_object_image_size_get(sd->img, &w, &h); @@ -2161,7 +2155,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, Ei { ERR("Things are going bad for '%s' (%p)", file, sd->img); if (ret) *ret = err; - return; + return err; } 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 sd->orientation_changed = EINA_FALSE; if (ret) *ret = evas_object_image_load_error_get(sd->img); + return efl_gfx_image_load_error_get(sd->img); } static void @@ -2239,11 +2234,11 @@ _efl_ui_image_zoomable_remote_copier_done(void *data, const Efl_Event *event EIN eina_binbuf_string_get(sd->remote.binbuf), eina_binbuf_length_get(sd->remote.binbuf), EINA_FALSE); - - _internal_file_set(obj, sd, url, f, NULL, &ret); + efl_file_mmap_set(obj, f); eina_file_close(f); + ret = _internal_file_set(obj, sd, &ret); - if (ret != EVAS_LOAD_ERROR_NONE) + if (ret) { Elm_Photocam_Error err = { 0, EINA_TRUE }; @@ -2352,11 +2347,10 @@ _efl_ui_image_zoomable_is_remote(const char *file) return EINA_FALSE; } -static Evas_Load_Error -_efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, const char *key) +static Eina_Error +_efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret) { - Evas_Load_Error ret = EVAS_LOAD_ERROR_NONE; - + const char *file = efl_file_get(obj); ELM_SAFE_FREE(sd->edje, evas_object_del); eina_stringshare_replace(&sd->stdicon, NULL); @@ -2382,21 +2376,24 @@ _efl_ui_image_zoomable_file_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd { efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_DOWNLOAD_START, NULL); - return ret; + *ret = EVAS_LOAD_ERROR_NONE; + return 0; } } - _internal_file_set(obj, sd, file, NULL, key, &ret); - - return ret; + return _internal_file_set(obj, sd, ret); } -EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file, const char *key) +EOLIAN static Eina_Error +_efl_ui_image_zoomable_efl_file_load(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd) { - Evas_Load_Error ret = _efl_ui_image_zoomable_file_set_internal(obj, sd, file, key); + Evas_Load_Error ret; + Eina_Error err; - if (ret == EVAS_LOAD_ERROR_NONE) return EINA_TRUE; + if (efl_file_loaded_get(obj)) return 0; + err = _efl_ui_image_zoomable_file_set_internal(obj, sd, &ret); + + if ((!ret) && (!err)) return 0; eina_error_set( 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 ret == EVAS_LOAD_ERROR_UNKNOWN_FORMAT ? PHOTO_FILE_LOAD_ERROR_UNKNOWN_FORMAT : PHOTO_FILE_LOAD_ERROR_GENERIC ); - return EINA_FALSE; + return err; } -EOLIAN static void -_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) +EOLIAN static Eina_Error +_efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file) { - if (file) *file = sd->file; - if (key) *key = NULL; + eina_stringshare_replace(&sd->file, file); + return efl_file_set(efl_super(obj, MY_CLASS), file); } EOLIAN static void @@ -2816,7 +2813,7 @@ _min_obj_size_get(Evas_Object *o, int *w, int *h) } } -static Eina_Bool +static Eina_Error _image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style, Eina_Bool resize) { 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, if (f) { if (sd->f) eina_file_close(sd->f); - eina_stringshare_replace(&sd->file, eina_file_filename_get(f)); - sd->f = eina_file_dup(f); + efl_file_key_set(o, buf); + efl_file_mmap_set(o, f); - return _img_proxy_set(o, sd, NULL, f, buf, resize); + return _img_proxy_set(o, sd, resize); } 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, WRN("Failed to set icon '%s'. Icon theme '%s' not found", group, buf); ELM_SAFE_FREE(sd->f, eina_file_close); - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION; } static Eina_Bool @@ -2851,7 +2848,7 @@ _icon_standard_set(Evas_Object *obj, const char *name, Eina_Bool resize) { EFL_UI_IMAGE_ZOOMABLE_DATA_GET(obj, sd); - if (_image_zoomable_object_icon_set(obj, name, "default", resize)) + if (!_image_zoomable_object_icon_set(obj, name, "default", resize)) { /* TODO: elm_unneed_efreet() */ sd->freedesktop.use = EINA_FALSE; @@ -2902,7 +2899,7 @@ _icon_freedesktop_set(Evas_Object *obj, const char *name, int size) if (sd->freedesktop.use) { sd->freedesktop.requested_size = size; - efl_file_set(obj, path, NULL); + efl_file_simple_load(obj, path, NULL); return EINA_TRUE; } return EINA_FALSE; @@ -2970,7 +2967,7 @@ _internal_efl_ui_image_zoomable_icon_set(Evas_Object *obj, const char *name, Ein { if (fdo) *fdo = EINA_FALSE; - return efl_file_set(obj, name, NULL); + return efl_file_simple_load(obj, name, NULL); } /* 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) { ELM_PHOTOCAM_CHECK(obj) EVAS_LOAD_ERROR_NONE; EINA_SAFETY_ON_NULL_RETURN_VAL(file, EVAS_LOAD_ERROR_NONE); - if (efl_file_set(obj, file, NULL)) return EVAS_LOAD_ERROR_NONE; + if (efl_file_simple_load(obj, file, NULL)) return EVAS_LOAD_ERROR_NONE; Eina_Error err = eina_error_get(); return err == PHOTO_FILE_LOAD_ERROR_DOES_NOT_EXIST ? @@ -3381,9 +3378,7 @@ elm_photocam_file_set(Evas_Object *obj, const char *file) EAPI const char* elm_photocam_file_get(const Evas_Object *obj) { - const char *ret = NULL; - efl_file_get(obj, &ret, NULL); - return ret; + return efl_file_get(obj); } EAPI void diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 1c458e1cd6..e8781a9898 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, Efl.Ui.Widget.widget_event; Efl.Ui.Scrollable_Interactive.scroll; Efl.Access.Widget.Action.elm_actions { get; } - Efl.File.file { get; set; } + Efl.File.load; + Efl.File.file { set; } Efl.Orientation.orientation { get; set; } Efl.Orientation.flip { get; set; } 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 13bdf53f4d..14520e53ff 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, /* The public functions down here are meant to operate on whichever * widget inheriting from elm_layout */ -EOLIAN static Eina_Bool -_efl_ui_layout_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *file, const char *group) +EOLIAN static Eina_Error +_efl_ui_layout_efl_file_load(Eo *obj, Efl_Ui_Layout_Data *sd) { - Eina_Bool int_ret = EINA_FALSE; + Eina_Error err; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - int_ret = - edje_object_file_set(wd->resize_obj, file, group); + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(wd->resize_obj); - if (int_ret) + if (!err) { sd->file_set = EINA_TRUE; _visuals_refresh(obj, sd); } else ERR("failed to set edje file '%s', group '%s': %s", - file, group, + efl_file_get(wd->resize_obj), efl_file_key_get(wd->resize_obj), edje_load_error_str (edje_object_load_error_get(wd->resize_obj))); - return int_ret; + return err; +} + +EOLIAN static Eina_Error +_efl_ui_layout_efl_file_file_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *file) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC); + return efl_file_set(wd->resize_obj, file); +} + +EOLIAN static const char * +_efl_ui_layout_efl_file_file_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + return efl_file_get(wd->resize_obj); } EOLIAN static void -_efl_ui_layout_efl_file_file_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char **file, const char **group) +_efl_ui_layout_efl_file_key_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const char *key) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - edje_object_file_get(wd->resize_obj, file, group); + return efl_file_key_set(wd->resize_obj, key); } - -EOLIAN static Eina_Bool -_efl_ui_layout_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Data *sd, const Eina_File *file, const char *group) +EOLIAN static const char * +_efl_ui_layout_efl_file_key_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED) { - Eina_Bool int_ret = EINA_FALSE; + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + return efl_file_key_get(wd->resize_obj); +} +EOLIAN static Eina_Error +_efl_ui_layout_efl_file_mmap_set(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const Eina_File *file) +{ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - int_ret = - edje_object_mmap_set(wd->resize_obj, file, group); - - if (int_ret) - { - sd->file_set = EINA_TRUE; - _visuals_refresh(obj, sd); - } - else - ERR("failed to set edje mmap file %p, group '%s': %s", - file, group, - edje_load_error_str - (edje_object_load_error_get(wd->resize_obj))); - - return int_ret; + return efl_file_mmap_set(wd->resize_obj, file); } -EOLIAN static void -_efl_ui_layout_efl_file_mmap_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, const Eina_File **file, const char **group) +EOLIAN static const Eina_File * +_efl_ui_layout_efl_file_mmap_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED) { - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - efl_file_mmap_get(wd->resize_obj, file, group); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + return efl_file_mmap_get(wd->resize_obj); } EOLIAN 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_ Evas_Object *edje_obj = wd->resize_obj; Edje_Load_Error error; - efl_file_get(edje_obj, &file, &edje_group); + efl_file_simple_get(edje_obj, &file, &edje_group); EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); @@ -2391,9 +2394,11 @@ EOLIAN static Efl_Object* _efl_ui_layout_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED) { Eo *eo; - + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); eo = efl_finalize(efl_super(obj, MY_CLASS)); efl_ui_widget_theme_apply(eo); + if (efl_file_get(wd->resize_obj) || efl_file_mmap_get(wd->resize_obj)) + efl_file_load(wd->resize_obj); return eo; } @@ -2437,7 +2442,7 @@ _efl_ui_layout_efl_part_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUS type > EFL_CANVAS_LAYOUT_PART_TYPE_NONE) { const char *file = NULL, *key = NULL; - efl_file_get(wd->resize_obj, &file, &key); + efl_file_simple_get(wd->resize_obj, &file, &key); WRN("Layout has a background but it's not a swallow: '%s'", elm_widget_theme_element_get(obj)); } @@ -2627,25 +2632,25 @@ elm_layout_add(Evas_Object *parent) EAPI Eina_Bool elm_layout_file_set(Eo *obj, const char *file, const char *group) { - return efl_file_set((Eo *) obj, file, group); + return efl_file_simple_load((Eo *) obj, file, group); } EAPI void elm_layout_file_get(Eo *obj, const char **file, const char **group) { - efl_file_get((Eo *) obj, file, group); + efl_file_simple_get((Eo *) obj, file, group); } EAPI Eina_Bool elm_layout_mmap_set(Eo *obj, const Eina_File *file, const char *group) { - return efl_file_mmap_set((Eo *) obj, file, group); + return efl_file_simple_mmap_load((Eo *) obj, file, group); } EAPI void elm_layout_mmap_get(Eo *obj, const Eina_File **file, const char **group) { - efl_file_mmap_get((Eo *) obj, file, group); + efl_file_simple_mmap_get((Eo *) obj, file, group); } EAPI Eina_Bool diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index 350fac560c..b46af45a01 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 Efl.Object.constructor; Efl.Object.finalize; Efl.File.file { get; set; } + Efl.File.key { get; set; } Efl.File.mmap { get; set; } + Efl.File.load; Efl.Canvas.Group.group_calculate; Efl.Layout.Calc.calc_freeze; Efl.Layout.Calc.calc_thaw; diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c index 43150df460..f48e3040cc 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 return efl_canvas_object_repeat_events_get(sd->backwall); } -EOLIAN static Eina_Bool -_efl_ui_popup_part_backwall_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *group) +EOLIAN static Eina_Error +_efl_ui_popup_part_backwall_efl_file_load(Eo *obj, void *_pd EINA_UNUSED) { Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS); + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + Eo *prev_obj = edje_object_part_swallow_get(sd->backwall, "efl.content"); if (prev_obj) { @@ -366,16 +373,23 @@ _efl_ui_popup_part_backwall_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, co } Eo *image = elm_image_add(pd->obj); - Eina_Bool ret = elm_image_file_set(image, file, group); + Eina_Bool ret; + const Eina_File *f; + + f = efl_file_mmap_get(obj); + if (f) + ret = elm_image_mmap_set(image, f, efl_file_key_get(obj)); + else + ret = elm_image_file_set(image, efl_file_get(obj), efl_file_key_get(obj)); if (!ret) { efl_del(image); - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } edje_object_part_swallow(sd->backwall, "efl.content", image); edje_object_signal_emit(sd->backwall, "efl,state,content,set", "efl"); - return EINA_TRUE; + return 0; } #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 759e0f4697..4a6a914a45 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 } } implements { - Efl.File.file { set; } + Efl.File.load; } } diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c index d8064a4953..aa48ba72a1 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_ } else if (sel->format & EFL_UI_SELECTION_FORMAT_IMAGE) { - efl_file_get(sel->request_obj, (const char **)data_ret, NULL); + efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL); if (!*data_ret) *data_ret = strdup("No file"); else *data_ret = strdup(*data_ret); @@ -2487,7 +2487,7 @@ _wl_text_converter(char *target, Sel_Manager_Selection *sel, void *data, int siz else if (format & EFL_UI_SELECTION_FORMAT_IMAGE) { sel_debug("Image %s\n", evas_object_type_get(sel->request_obj)); - efl_file_get(sel->request_obj, (const char **)data_ret, NULL); + efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL); if (!*data_ret) *data_ret = strdup("No file"); else *data_ret = strdup(*data_ret); diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index f70bb65280..57c29784a8 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); static Eina_Position2D _decoration_calc_offset(Efl_Ui_Text_Data *sd); static char * -_file_load(const char *file) +_file_load(Eo *obj) { Eina_File *f; char *text = NULL; void *tmp = NULL; - f = eina_file_open(file, EINA_FALSE); - if (!f) return NULL; + f = eina_file_dup(efl_file_mmap_get(obj)); tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); if (!tmp) goto on_error; @@ -282,29 +281,35 @@ _file_load(const char *file) } static char * -_plain_load(const char *file) +_plain_load(Eo *obj) { - return _file_load(file); + return _file_load(obj); } -static Eina_Bool +static Eina_Error _load_do(Evas_Object *obj) { char *text; + Eina_Error err = 0; EFL_UI_TEXT_DATA_GET(obj, sd); if (!sd->file) { elm_object_text_set(obj, ""); - return EINA_TRUE; + return 0; } switch (sd->format) { /* Only available format */ case ELM_TEXT_FORMAT_PLAIN_UTF8: - text = _plain_load(sd->file); + text = _plain_load(obj); + if (!text) + { + err = errno; + if (!err) err = ENOENT; + } break; default: @@ -316,13 +321,10 @@ _load_do(Evas_Object *obj) { efl_text_set(obj, text); free(text); - return EINA_TRUE; - } - else - { - efl_text_set(obj, ""); - return EINA_FALSE; + return 0; } + efl_text_set(obj, ""); + return err; } static void @@ -2528,21 +2530,24 @@ _efl_ui_text_context_menu_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Da return !sd->context_menu; } -EOLIAN static Eina_Bool -_efl_ui_text_efl_file_file_set(Eo *obj, Efl_Ui_Text_Data *sd, const char *file, const char *group EINA_UNUSED) +EOLIAN static Eina_Error +_efl_ui_text_efl_file_file_set(Eo *obj, Efl_Ui_Text_Data *sd, const char *file) { - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - if (sd->auto_save) _save_do(obj); eina_stringshare_replace(&sd->file, file); - Eina_Bool int_ret = _load_do(obj); - return int_ret; + return efl_file_set(efl_super(obj, MY_CLASS), file); } -EOLIAN static void -_efl_ui_text_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char **file, const char **group) +EOLIAN static Eina_Error +_efl_ui_text_efl_file_load(Eo *obj, Efl_Ui_Text_Data *sd) { - if (file) *file = sd->file; - if (group) *group = NULL; + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); + if (sd->auto_save) _save_do(obj); + return _load_do(obj); } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo index afb6094e69..7394a61929 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, Efl.Access.Editable.Text.cut; Efl.Access.Editable.Text.delete; Efl.Access.Editable.Text.paste; - Efl.File.file { get; set; } + Efl.File.file { set; } + Efl.File.load; Efl.Text_Interactive.editable { set; } Efl.Part.part_get; } diff --git a/src/lib/elementary/efl_ui_text_factory_images.c b/src/lib/elementary/efl_ui_text_factory_images.c index 54c5c43aa9..38529e43a9 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, e = eina_hash_find(pd->hash, key); if (e) { - efl_file_mmap_set(o, e->file, e->key); + efl_file_key_set(o, e->key); + if (efl_file_mmap_set(o, e->file)) goto error; } else { - efl_file_set(o, key, NULL); - } - - if (efl_file_load_error_get(o) != EFL_GFX_IMAGE_LOAD_ERROR_NONE) - { - efl_del(o); - o = NULL; + if (efl_file_set(o, key)) goto error; } + if (efl_file_load(o)) goto error; return o; + +error: + efl_del(o); + return NULL; } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index 3d7bf74e5a..ec9bce6a2c 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 return obj; } -EOLIAN static Eina_Bool -_efl_ui_video_efl_file_file_set(Eo *obj, Efl_Ui_Video_Data *sd, const char *filename, const char *key EINA_UNUSED) +EOLIAN static Eina_Error +_efl_ui_video_efl_file_load(Eo *obj, Efl_Ui_Video_Data *sd) { + const char *file = efl_file_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(file, EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST); + + if (eina_streq(file, emotion_object_file_get(sd->emotion)) && efl_file_loaded_get(sd->emotion)) return 0; + if (sd->remember) emotion_object_last_position_save(sd->emotion); sd->stop = EINA_FALSE; - if (!emotion_object_file_set(sd->emotion, filename)) return EINA_FALSE; + if (!emotion_object_file_set(sd->emotion, file)) return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; - if (filename && ((!strncmp(filename, "file://", 7)) || (!strstr(filename, "://")))) + if (file && ((!strncmp(file, "file://", 7)) || (!strstr(file, "://")))) emotion_object_last_position_load(sd->emotion); 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 else elm_layout_signal_emit(obj, "efl,video,load", "efl"); - return EINA_TRUE; -} - -EOLIAN static void -_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) -{ - if (filename) - *filename = emotion_object_file_get(sd->emotion); + return 0; } EOLIAN static Evas_Object* @@ -454,13 +452,13 @@ elm_video_add(Evas_Object *parent) EAPI Eina_Bool elm_video_file_set(Eo *obj, const char *filename) { - return efl_file_set((Eo *) obj, filename, NULL); + return efl_file_simple_load((Eo *) obj, filename, NULL); } EAPI void elm_video_file_get(Eo *obj, const char **filename) { - efl_file_get((Eo *) obj, filename, NULL); + efl_file_simple_get((Eo *) obj, filename, NULL); } EAPI void diff --git a/src/lib/elementary/efl_ui_video.eo b/src/lib/elementary/efl_ui_video.eo index 61cef8fc7a..d418cb4511 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 } implements { Efl.Object.constructor; - Efl.File.file { get; set; } + Efl.File.load; Efl.Ui.Widget.widget_event; Efl.Access.Widget.Action.elm_actions { get; } Efl.Player.start; diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 63797dfe8c..2f51767e37 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) return _efl_ui_widget_bg_get(pd->obj); } -EOLIAN static Eina_Bool -_efl_ui_widget_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file, const char *key) +EOLIAN static Eina_Error +_efl_ui_widget_part_bg_efl_file_load(Eo *obj, void *pd EINA_UNUSED) { Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); - return efl_file_set(bg_obj, file, key); + return efl_file_load(bg_obj); +} + +EOLIAN static const char * +_efl_ui_widget_part_bg_efl_file_file_get(const Eo *obj, void *pd EINA_UNUSED) +{ + Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); + + return efl_file_get(bg_obj); +} + +EOLIAN static Eina_Error +_efl_ui_widget_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file) +{ + Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); + + return efl_file_set(bg_obj, file); +} + +EOLIAN static const char * +_efl_ui_widget_part_bg_efl_file_key_get(const Eo *obj, void *pd EINA_UNUSED) +{ + Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); + + return efl_file_key_get(bg_obj); } EOLIAN static void -_efl_ui_widget_part_bg_efl_file_file_get(const Eo *obj, void *pd EINA_UNUSED, const char **file, const char **key) +_efl_ui_widget_part_bg_efl_file_key_set(Eo *obj, void *pd EINA_UNUSED, const char *key) { Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); - efl_file_get(bg_obj, file, key); + efl_file_key_set(bg_obj, key); +} + +EOLIAN static const Eina_File * +_efl_ui_widget_part_bg_efl_file_mmap_get(const Eo *obj, void *pd EINA_UNUSED) +{ + Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); + + return efl_file_mmap_get(bg_obj); +} + +EOLIAN static Eina_Error +_efl_ui_widget_part_bg_efl_file_mmap_set(Eo *obj, void *pd EINA_UNUSED, const Eina_File *file) +{ + Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj); + + return efl_file_mmap_set(bg_obj, file); } EOLIAN 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 cbe42fd341..94f87b8ec8 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 data: null; implements { Efl.File.file { get; set; } - //Efl.File.mmap { get; set; } + Efl.File.key { get; set; } + Efl.File.mmap { get; set; } + Efl.File.load; Efl.Gfx.Color.color { set; get; } Efl.Gfx.Image.scale_type { get; set; } } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index fca343f9df..472e1bf6ef 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) if (!obj) return NULL; obj = efl_finalize(efl_super(obj, MY_CLASS)); if (obj && resume) efl_event_callback_call(efl_loop_get(obj), EFL_APP_EVENT_RESUME, NULL); + if (obj && (!elm_widget_is_legacy(obj))) + { + /* FIXME: if parts other than background are supported then this should change */ + if (efl_file_get(efl_part(obj, "background")) || efl_file_mmap_get(efl_part(obj, "background"))) + efl_file_load(efl_part(obj, "background")); + } return obj; } @@ -7617,9 +7623,14 @@ _efl_ui_win_part_color_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const char return EINA_FALSE; } -static Eina_Bool -_efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const char *file, const char *key) +static Eina_Error +_efl_ui_win_part_file_load(Eo *obj, Efl_Ui_Win_Data *sd, Eo *part_obj, const char *part) { + const char *file, *key; + + if (efl_file_loaded_get(part_obj)) return 0; + file = efl_file_get(part_obj); + key = efl_file_key_get(part_obj); sd->legacy.forbidden = EINA_TRUE; if (eina_streq(part, "background")) { @@ -7630,7 +7641,7 @@ _efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const { bg = efl_add(EFL_UI_IMAGE_CLASS, obj); efl_gfx_image_scale_type_set(bg, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE); - ok = efl_file_set(bg, file, key); + ok = efl_file_simple_load(bg, file, key); if (!ok) ELM_SAFE_DEL(bg); _elm_win_bg_set(sd, bg); } @@ -7646,22 +7657,41 @@ _efl_ui_win_part_file_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const return EINA_FALSE; } -static Eina_Bool -_efl_ui_win_part_file_get(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, const char **file, const char **key) +static const char * +_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) { sd->legacy.forbidden = EINA_TRUE; - if (file) *file = NULL; - if (key) *key = NULL; + return efl_file_get(efl_super(part_obj, EFL_UI_WIN_PART_CLASS)); +#if 0 if (eina_streq(part, "background")) { const Eo *bg = _efl_ui_win_content_get(obj, sd, "background"); - efl_file_get(bg, file, key); - return EINA_TRUE; + return efl_file_get(bg); } WIN_PART_ERR(part); - return EINA_FALSE; + return NULL; +#endif +} + +static const char * +_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) +{ + sd->legacy.forbidden = EINA_TRUE; + return efl_file_key_get(efl_super(part_obj, EFL_UI_WIN_PART_CLASS)); +/* NOTE; if more than one part is ever supported here then this section is needed */ +#if 0 + + if (eina_streq(part, "background")) + { + const Eo *bg = _efl_ui_win_content_get(obj, sd, "background"); + return efl_file_get(bg); + } + + WIN_PART_ERR(part); + return NULL; +#endif } /* Efl.Part begin */ @@ -7686,22 +7716,31 @@ _efl_ui_win_part_efl_gfx_color_color_get(const Eo *obj, void *_pd EINA_UNUSED, i _efl_ui_win_part_color_get(pd->obj, sd, pd->part, r, g, b, a); } -static Eina_Bool -_efl_ui_win_part_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *key) +EOLIAN static const char * +_efl_ui_win_part_efl_file_file_get(const Eo *obj, void *_pd EINA_UNUSED) { Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS); - return _efl_ui_win_part_file_set(pd->obj, sd, pd->part, file, key); + return _efl_ui_win_part_file_get(pd->obj, sd, obj, pd->part); } -static void -_efl_ui_win_part_efl_file_file_get(const Eo *obj, void *_pd EINA_UNUSED, const char **file, const char **key) +EOLIAN static const char * +_efl_ui_win_part_efl_file_key_get(const Eo *obj, void *_pd EINA_UNUSED) { Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS); - _efl_ui_win_part_file_get(pd->obj, sd, pd->part, file, key); + return _efl_ui_win_part_file_key_get(pd->obj, sd, obj, pd->part); } +EOLIAN static Eina_Error +_efl_ui_win_part_efl_file_load(Eo *obj, void *_pd EINA_UNUSED) +{ + Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); + Efl_Ui_Win_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS); + return _efl_ui_win_part_file_load(pd->obj, sd, obj, pd->part); +} + + ELM_PART_OVERRIDE(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data) ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_win, EFL_UI_WIN, Efl_Ui_Win_Data) ELM_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 55919f7f1d..ea9d09f518 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 Efl.Content.content { get; set; } Efl.Content.content_unset; Efl.Gfx.Color.color { get; set; } - Efl.File.file { get; set; } + Efl.File.load; + Efl.File.file { get; } + Efl.File.key { get; } } } diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 336b0f7ae8..4c42535571 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -138,16 +138,14 @@ ok: // ok - return api } static char * -_file_load(const char *file) +_file_load(Eo *obj) { Eina_File *f; char *text = NULL; void *tmp = NULL; size_t size; - f = eina_file_open(file, EINA_FALSE); - if (!f) return NULL; - + f = eina_file_dup(efl_file_mmap_get(obj)); size = eina_file_size_get(f); if (size) { @@ -175,11 +173,11 @@ _file_load(const char *file) } static char * -_plain_load(const char *file) +_plain_load(Eo *obj) { char *text; - text = _file_load(file); + text = _file_load(obj); if (text) { char *text2; @@ -192,47 +190,54 @@ _plain_load(const char *file) return NULL; } -static Eina_Bool +static Eina_Error _load_do(Evas_Object *obj) { char *text; + Eina_Bool fail = EINA_FALSE; + Eina_Error err = 0; ELM_ENTRY_DATA_GET(obj, sd); if (!sd->file) { elm_object_text_set(obj, ""); - return EINA_TRUE; + return 0; } switch (sd->format) { case ELM_TEXT_FORMAT_PLAIN_UTF8: - text = _plain_load(sd->file); + text = _plain_load(obj); + fail = !text; break; case ELM_TEXT_FORMAT_MARKUP_UTF8: - text = _file_load(sd->file); + text = _file_load(obj); + fail = !text; break; default: text = NULL; break; } + if (fail) + { + err = errno; + /* FIXME: this is more like a hint but not totally accurate... */ + if (!err) err = ENOENT; + } if (text) { elm_object_text_set(obj, text); free(text); - return EINA_TRUE; + return 0; } - else - { - elm_object_text_set(obj, ""); + elm_object_text_set(obj, ""); - return EINA_FALSE; - } + return err; } static void @@ -4969,24 +4974,34 @@ elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format) { Eina_Bool ret; elm_obj_entry_file_text_format_set(obj, format); - ret = efl_file_set(obj, file, NULL); + ret = efl_file_simple_load(obj, file, NULL); return ret; } -EOLIAN static Eina_Bool -_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file, const char *group EINA_UNUSED) +EOLIAN static Eina_Error +_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd) { + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); if (sd->auto_save) _save_do(obj); + return _load_do(obj); +} + +EOLIAN static Eina_Error +_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file) +{ eina_stringshare_replace(&sd->file, file); - Eina_Bool int_ret = _load_do(obj); - return int_ret; + return efl_file_set(efl_super(obj, MY_CLASS), file); } EAPI void elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format) { - efl_file_get(obj, file, NULL); + if (file) *file = efl_file_get(obj); if (format) { ELM_ENTRY_DATA_GET(obj, sd); @@ -4995,13 +5010,6 @@ elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *f } } -EOLIAN static void -_elm_entry_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char **file, const char **group) -{ - if (file) *file = sd->file; - if (group) *group = NULL; -} - EOLIAN static void _elm_entry_file_save(Eo *obj, Elm_Entry_Data *sd) { diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo index f2e5e3b59a..d5cbe8202b 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 Default is $ELM_TEXT_FORMAT_PLAIN_UTF8, if you want to use $ELM_TEXT_FORMAT_MARKUP_UTF8 then you need to set the text format - before calling @Efl.File.file.set. + before calling @Efl.File.load. You could also set it before a call to @.file_save in order to save with the given format. ]] set { - [[Use it before calling @Efl.File.file.set or @.file_save.]] + [[Use it before calling @Efl.File.load or @.file_save.]] } values { 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 Efl.Access.Editable.Text.delete; Efl.Access.Editable.Text.paste; Efl.Access.Widget.Action.elm_actions { get; } - Efl.File.file { get; set; } + Efl.File.file { set; } + Efl.File.load; Efl.Part.part_get; } events { diff --git a/src/lib/elementary/elm_icon.c b/src/lib/elementary/elm_icon.c index 2d612afafa..6b00dcc633 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) } } -EOLIAN static Eina_Bool -_elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const char *key) +EOLIAN static Eina_Error +_elm_icon_efl_file_load(Eo *obj, Elm_Icon_Data *sd) { Evas_Object *pclip; + const char *key; + Eina_Error err; + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + Efl_Ui_Image_Data *id = efl_data_scope_get(obj, EFL_UI_IMAGE_CLASS); - EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); - _edje_signals_free(sd); if (!sd->freedesktop.use) ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del); - if (!sd->is_video) - return efl_file_set(efl_super(obj, MY_CLASS), file, key); + if (!sd->is_video) return 0; /* parent's edje file setting path replicated here (we got .eet * extension, so bypassing it) */ @@ -346,18 +349,21 @@ _elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const evas_object_clip_set(id->img, pclip); id->edje = EINA_TRUE; } - - if (!edje_object_file_set(id->img, file, key)) + key = efl_file_key_get(obj); + efl_file_key_set(id->img, key); + err = efl_file_mmap_set(id->img, efl_file_mmap_get(obj)); + if (!err) err = efl_file_load(id->img); + if (err) { - ERR("failed to set edje file '%s', group '%s': %s", file, key, + ERR("failed to set edje file '%s', group '%s': %s", efl_file_get(id->img), key, edje_load_error_str (edje_object_load_error_get(id->img))); - return EINA_FALSE; + return err; } evas_object_geometry_set(id->img, id->img_x, id->img_y, id->img_w, id->img_h); - return EINA_TRUE; + return 0; } EOLIAN static Efl_Ui_Theme_Apply_Result @@ -652,7 +658,7 @@ elm_icon_file_set(Evas_Object *obj, ELM_ICON_CHECK(obj) EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); - return efl_file_set(obj, file, group); + return efl_file_simple_load(obj, file, group); } EAPI void diff --git a/src/lib/elementary/elm_icon.eo b/src/lib/elementary/elm_icon.eo index 35ce8a9e59..a933381459 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 class.constructor; Efl.Object.constructor; Efl.Ui.Widget.theme_apply; - Efl.File.file { set; } + Efl.File.load; } events { 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 53300f9d0e..0130385185 100644 --- a/src/lib/elementary/elm_photo.c +++ b/src/lib/elementary/elm_photo.c @@ -314,6 +314,17 @@ elm_photo_add(Evas_Object *parent) return elm_legacy_add(MY_CLASS, parent); } +EOLIAN static Eo * +_elm_photo_efl_object_finalize(Eo *obj, Elm_Photo_Data *sd) +{ + obj = efl_finalize(efl_super(obj, MY_CLASS)); + if (!obj) return NULL; + if (efl_file_get(sd->icon) || efl_file_mmap_get(sd->icon)) + efl_file_load(sd->icon); + + return obj; +} + EOLIAN static Eo * _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED) { @@ -325,50 +336,61 @@ _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED) return obj; } -EOLIAN static void -_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char **file, const char **key EINA_UNUSED) -{ - efl_file_get(sd->icon, file, NULL); -} - -EOLIAN static Eina_Bool -_elm_photo_efl_file_file_set(Eo *obj, Elm_Photo_Data *sd, const char *file, const char *key EINA_UNUSED) +EOLIAN static Eina_Error +_elm_photo_efl_file_load(Eo *obj, Elm_Photo_Data *sd) { + const char *file = efl_file_get(sd->icon); + Eina_Error err = 0; if (!file) { if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE; } else { - if (!elm_image_file_set(sd->icon, file, NULL)) return EINA_FALSE; + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(sd->icon); + if (err) return err; } _sizing_eval(obj); - return EINA_TRUE; + return 0; +} + +EOLIAN static const Eina_File * +_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) +{ + return efl_file_mmap_get(sd->icon); +} + +EOLIAN static Eina_Error +_elm_photo_efl_file_mmap_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File *file) +{ + return efl_file_mmap_set(sd->icon, file); +} + +EOLIAN static Eina_Error +_elm_photo_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file) +{ + return efl_file_set(sd->icon, file); +} + +EOLIAN static const char * +_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) +{ + return efl_file_get(sd->icon); } EOLIAN static void -_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File **file, const char **key EINA_UNUSED) +_elm_photo_efl_file_key_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *key) { - efl_file_mmap_get(sd->icon, file, key); + return efl_file_key_set(sd->icon, key); } -EOLIAN static Eina_Bool -_elm_photo_efl_file_mmap_set(Eo *obj, Elm_Photo_Data *sd, const Eina_File *file, const char *key EINA_UNUSED) +EOLIAN static const char * +_elm_photo_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) { - if (!file) - { - if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE; - } - else - { - if (!efl_file_mmap_set(sd->icon, file, NULL)) return EINA_FALSE; - } - - _sizing_eval(obj); - - return EINA_TRUE; + return efl_file_key_get(sd->icon); } static void @@ -380,7 +402,7 @@ _elm_photo_class_constructor(Efl_Class *klass) EAPI Eina_Bool elm_photo_file_set(Eo *obj, const char *file) { - return efl_file_set((Eo *) obj, file, NULL); + return efl_file_simple_load((Eo *) obj, file, NULL); } /* Legacy deprecated functions */ diff --git a/src/lib/elementary/elm_photo.eo b/src/lib/elementary/elm_photo.eo index 3ceb6d7653..7263119fbb 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 implements { class.constructor; Efl.Object.constructor; - Efl.File.file { set; get; } - Efl.File.mmap { set; get; } + Efl.Object.finalize; + Efl.File.file { get; set; } + Efl.File.key { get; set; } + Efl.File.mmap { get; set; } + Efl.File.load; Efl.Ui.Widget.theme_apply; Efl.Ui.Draggable.drag_target { get; set; } } diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c index 2671772726..a36abe7e38 100644 --- a/src/lib/elementary/elm_thumb.c +++ b/src/lib/elementary/elm_thumb.c @@ -581,6 +581,14 @@ elm_thumb_add(Evas_Object *parent) return elm_legacy_add(MY_CLASS, parent); } +EOLIAN static Eo * +_elm_thumb_efl_object_finalize(Eo *obj, Elm_Thumb_Data *sd) +{ + obj = efl_finalize(efl_super(obj, MY_CLASS)); + if (sd->file) efl_file_load(obj); + return obj; +} + EOLIAN static Eo * _elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd) { @@ -594,53 +602,71 @@ _elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd) return obj; } -EOLIAN static Eina_Bool -_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file, const char *key) +EOLIAN static Eina_Error +_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file) { - Eina_Bool file_replaced, key_replaced; + if (eina_stringshare_replace(&(sd->file), file)) + sd->loaded = EINA_FALSE; + return 0; +} - file_replaced = eina_stringshare_replace(&(sd->file), file); - key_replaced = eina_stringshare_replace(&(sd->key), key); +EOLIAN static void +_elm_thumb_efl_file_key_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *key) +{ + if (eina_stringshare_replace(&(sd->key), key)) + sd->loaded = EINA_FALSE; +} - if (file_replaced) +EOLIAN static const char * +_elm_thumb_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd) +{ + return sd->file; +} + +EOLIAN static const char * +_elm_thumb_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd) +{ + return sd->key; +} + +EOLIAN static Eina_Bool +_elm_thumb_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd) +{ + return sd->loaded; +} + +EOLIAN static Eina_Error +_elm_thumb_efl_file_load(Eo *obj, Elm_Thumb_Data *sd) +{ + int prefix_size; + const char **ext, *ptr; + static const char *extensions[] = + { + ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL + }; + + if (efl_file_loaded_get(obj)) return 0; + prefix_size = eina_stringshare_strlen(sd->file) - 4; + if (prefix_size >= 0) { - int prefix_size; - const char **ext, *ptr; - static const char *extensions[] = - { - ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL - }; - - prefix_size = eina_stringshare_strlen(sd->file) - 4; - if (prefix_size >= 0) - { - ptr = sd->file + prefix_size; - sd->is_video = EINA_FALSE; - for (ext = extensions; *ext; ext++) - if (!strcasecmp(ptr, *ext)) - { - sd->is_video = EINA_TRUE; - break; - } - } + ptr = sd->file + prefix_size; + sd->is_video = EINA_FALSE; + for (ext = extensions; *ext; ext++) + if (!strcasecmp(ptr, *ext)) + { + sd->is_video = EINA_TRUE; + break; + } } eina_stringshare_replace(&(sd->thumb.file), NULL); eina_stringshare_replace(&(sd->thumb.key), NULL); + sd->loaded = EINA_TRUE; - if (((file_replaced) || (key_replaced)) && (evas_object_visible_get(obj))) + if (evas_object_visible_get(obj)) _thumb_show(sd); - return EINA_TRUE; -} - -EOLIAN static void -_elm_thumb_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char **file, const char **key) -{ - if (file) - *file = sd->file; - if (key) - *key = sd->key; + return 0; } EAPI void * @@ -693,13 +719,13 @@ _elm_thumb_class_constructor(Efl_Class *klass) EAPI void elm_thumb_file_set(Eo *obj, const char *file, const char *key) { - efl_file_set((Eo *) obj, file, key); + efl_file_simple_load((Eo *) obj, file, key); } EAPI void elm_thumb_file_get(const Eo *obj, const char **file, const char **key) { - efl_file_get((Eo *) obj, file, key); + efl_file_simple_get((Eo *) obj, file, key); } /* Legacy deprecated functions */ diff --git a/src/lib/elementary/elm_thumb.eo b/src/lib/elementary/elm_thumb.eo index 94e911e736..22fd890377 100644 --- a/src/lib/elementary/elm_thumb.eo +++ b/src/lib/elementary/elm_thumb.eo @@ -8,7 +8,11 @@ class Elm.Thumb extends Efl.Ui.Layout implements Efl.File, Efl.Ui.Clickable, implements { class.constructor; Efl.Object.constructor; + Efl.Object.finalize; + Efl.File.load; + Efl.File.loaded { get; } Efl.File.file { get; set; } + Efl.File.key { get; set; } Efl.Gfx.Entity.visible { set; } Efl.Ui.Draggable.drag_target { get; set; } } diff --git a/src/lib/elementary/elm_widget_thumb.h b/src/lib/elementary/elm_widget_thumb.h index 927d79860b..dd034112d0 100644 --- a/src/lib/elementary/elm_widget_thumb.h +++ b/src/lib/elementary/elm_widget_thumb.h @@ -65,6 +65,7 @@ struct _Elm_Thumb_Data Eina_Bool on_hold : 1; Eina_Bool is_video : 1; Eina_Bool was_video : 1; + Eina_Bool loaded : 1; }; /** diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 0adbf3e3d0..38a9894631 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -53,7 +53,9 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group implements Efl.File, Efl.P Efl.Object.constructor; Efl.Gfx.Entity.position { set; } Efl.Gfx.Entity.size { set; } - Efl.File.file { get; set; } + Efl.File.load; + Efl.File.file { set; } + Efl.File.loaded { get; } Efl.Player.play { get; set; } Efl.Player.pos { get; set; } Efl.Player.progress { get; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index ed5eb36f34..06c95bf15b 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -119,6 +119,7 @@ struct _Efl_Canvas_Video_Data Eina_Bool remember_play : 1; Eina_Bool seek : 1; Eina_Bool seeking : 1; + Eina_Bool loaded : 1; }; struct _Emotion_Xattr_Data @@ -344,21 +345,34 @@ _efl_canvas_video_engine_set(Eo *obj, Efl_Canvas_Video_Data *pd, const char *eng EAPI Eina_Bool emotion_object_file_set(Evas_Object *obj, const char *file) { - return efl_file_set(obj, file, NULL); + return efl_file_simple_load(obj, file, NULL); } -EOLIAN static Eina_Bool -_efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, const char *file, const char *key EINA_UNUSED) +EOLIAN static Eina_Error +_efl_canvas_video_efl_file_file_set(Eo *obj, Efl_Canvas_Video_Data *sd, const char *file) { DBG("file=%s", file); - if (!eina_stringshare_replace(&sd->file, file)) return EINA_TRUE; + eina_stringshare_replace(&sd->file, file); + sd->loaded = 0; + return efl_file_set(efl_super(obj, MY_CLASS), file); +} +EOLIAN static Eina_Bool +_efl_canvas_video_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +{ + return sd->open && sd->loaded; +} + +EOLIAN static Eina_Error +_efl_canvas_video_efl_file_load(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +{ + const char *file = sd->file; if (!sd->engine_instance) _engine_init(obj, sd); if (!sd->engine_instance) { WRN("No engine chosen. Please set an engine."); - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } sd->video.w = 0; @@ -367,7 +381,6 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data * { char *file2 = NULL; - eina_stringshare_replace(&sd->file, file); emotion_engine_instance_file_close(sd->engine_instance); evas_object_image_data_set(sd->obj, NULL); evas_object_image_size_set(sd->obj, 1, 1); @@ -382,7 +395,7 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data * if (!emotion_engine_instance_file_open(sd->engine_instance, file2)) { WRN("Couldn't open file=%s", sd->file); - return EINA_FALSE; + return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; } free(file2); DBG("successfully opened file=%s", sd->file); @@ -402,23 +415,15 @@ _efl_canvas_video_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data * sd->anim = NULL; _xattr_data_cancel(sd->xattr); + sd->loaded = 1; - return EINA_TRUE; + return 0; } EAPI const char * emotion_object_file_get(const Evas_Object *obj) { - const char *file = NULL; - efl_file_get(obj, &file, NULL); - return file; -} - -EOLIAN static void -_efl_canvas_video_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, const char **file, const char **key) -{ - if (file) *file = sd->file; - if (key) *key = NULL; + return efl_file_get(obj); } static void diff --git a/src/lib/evas/canvas/efl_canvas_image.c b/src/lib/evas/canvas/efl_canvas_image.c index d00ee659d4..0d95f2f17e 100644 --- a/src/lib/evas/canvas/efl_canvas_image.c +++ b/src/lib/evas/canvas/efl_canvas_image.c @@ -5,18 +5,22 @@ #define MY_CLASS_NAME efl_class_name_get(MY_CLASS) Eina_Bool -_evas_image_mmap_set(Eo *eo_obj, const Eina_File *f, const char *key) +_evas_image_file_load(Eo *eo_obj) { Evas_Object_Protected_Data *obj; Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS); Evas_Image_Load_Opts lo; + const Eina_File *f = efl_file_mmap_get(eo_obj); + const char *key = efl_file_key_get(eo_obj); + + EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE); if (o->cur->f == f) { if ((!o->cur->key) && (!key)) - return EINA_FALSE; + return EINA_TRUE; if ((o->cur->key) && (key) && (!strcmp(o->cur->key, key))) - return EINA_FALSE; + return EINA_TRUE; } obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); @@ -31,45 +35,38 @@ _evas_image_mmap_set(Eo *eo_obj, const Eina_File *f, const char *key) return EINA_TRUE; } -EOLIAN static Eina_Bool -_efl_canvas_image_efl_file_mmap_set(Eo *eo_obj, void *_pd EINA_UNUSED, - const Eina_File *f, const char *key) +EOLIAN static Eina_Error +_efl_canvas_image_efl_file_load(Eo *eo_obj, void *_pd EINA_UNUSED) { - return _evas_image_mmap_set(eo_obj, f, key); + if (efl_file_loaded_get(eo_obj)) return 0; + Eina_Error err = efl_file_load(efl_super(eo_obj, MY_CLASS)); + if (err) return err; + if (_evas_image_file_load(eo_obj)) + return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; +} + +const Eina_File * +_evas_image_mmap_get(const Eo *eo_obj) +{ + Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS); + + return o->cur->f; +} + +const char * +_evas_image_key_get(const Eo *eo_obj) +{ + Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS); + + return o->cur->key; } void -_evas_image_mmap_get(const Eo *eo_obj, const Eina_File **f, const char **key) +_efl_canvas_image_load_error_set(Eo *eo_obj EINA_UNUSED, Eina_Error err) { Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS); - - if (f) - *f = o->cur->f; - if (key) - *key = o->cur->key; -} - -EOLIAN static void -_efl_canvas_image_efl_file_mmap_get(const Eo *eo_obj, void *_pd EINA_UNUSED, - const Eina_File **f, const char **key) -{ - _evas_image_mmap_get(eo_obj, f, key); -} - -Efl_Gfx_Image_Load_Error -_evas_image_load_error_get(const Eo *eo_obj) -{ - Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS); - Efl_Gfx_Image_Load_Error r = efl_file_load_error_get(efl_cast(eo_obj, EFL_FILE_MIXIN)); - - if (r != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return r; - return o->load_error; -} - -EOLIAN static Efl_Gfx_Image_Load_Error -_efl_canvas_image_efl_file_load_error_get(const Eo *eo_obj, void *_pd EINA_UNUSED) -{ - return _evas_image_load_error_get(eo_obj); + o->load_error = err; } static void @@ -786,13 +783,13 @@ _efl_canvas_image_efl_object_dbg_info_get(Eo *obj, void *pd EINA_UNUSED, Efl_Dbg { efl_dbg_info_get(efl_super(obj, MY_CLASS), root); - if ((efl_file_load_error_get(obj) != EFL_GFX_IMAGE_LOAD_ERROR_NONE) && + if ((efl_gfx_image_load_error_get(obj) != EFL_GFX_IMAGE_LOAD_ERROR_NONE) && (root)) { Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC; - error = (Evas_Load_Error) _evas_image_load_error_get(obj); + error = (Evas_Load_Error) efl_gfx_image_load_error_get(obj); EFL_DBG_INFO_APPEND(group, "Load Error", EINA_VALUE_TYPE_STRING, evas_load_error_str(error)); } diff --git a/src/lib/evas/canvas/efl_canvas_image.eo b/src/lib/evas/canvas/efl_canvas_image.eo index f92da8c171..2dbad42f60 100644 --- a/src/lib/evas/canvas/efl_canvas_image.eo +++ b/src/lib/evas/canvas/efl_canvas_image.eo @@ -16,8 +16,7 @@ class @beta Efl.Canvas.Image extends Efl.Canvas.Image_Internal implements Efl.Gfx.Buffer.buffer_size { get; } Efl.Gfx.Buffer.buffer_map; Efl.Gfx.Buffer.buffer_unmap; - Efl.File.mmap { get; set; } - Efl.File.load_error { get; } + Efl.File.load; Efl.Gfx.Frame_Controller.animated { get; } Efl.Gfx.Frame_Controller.frame { get; set; } Efl.Gfx.Frame_Controller.frame_count { get; } diff --git a/src/lib/evas/canvas/efl_canvas_image_internal.eo b/src/lib/evas/canvas/efl_canvas_image_internal.eo index 5d9ff95f9a..c0b9093557 100644 --- a/src/lib/evas/canvas/efl_canvas_image_internal.eo +++ b/src/lib/evas/canvas/efl_canvas_image_internal.eo @@ -21,6 +21,7 @@ abstract @beta Efl.Canvas.Image_Internal extends Efl.Canvas.Object implements Ef Efl.Gfx.Image.scale_hint { get; set; } Efl.Gfx.Image.content_hint { get; set; } Efl.Gfx.Image.image_size { get; } + Efl.Gfx.Image.image_load_error { get; } Efl.Gfx.Buffer.alpha { get; set; } Efl.Gfx.Buffer.buffer_update_add; Efl.Gfx.Buffer.colorspace { get; } diff --git a/src/lib/evas/canvas/efl_canvas_proxy.c b/src/lib/evas/canvas/efl_canvas_proxy.c index b057400808..734b8bc689 100644 --- a/src/lib/evas/canvas/efl_canvas_proxy.c +++ b/src/lib/evas/canvas/efl_canvas_proxy.c @@ -220,7 +220,7 @@ _evas_image_proxy_set(Evas_Object *eo_proxy, Evas_Object *eo_src) Evas_Image_Data *o = efl_data_scope_get(eo_proxy, EFL_CANVAS_IMAGE_INTERNAL_CLASS); if (o->legacy_type) - efl_file_set(eo_proxy, NULL, NULL); + efl_file_simple_load(eo_proxy, NULL, NULL); EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, proxy->proxy, Evas_Object_Proxy_Data, proxy_write) proxy_write->is_proxy = EINA_TRUE; diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index cbcc65d166..db224fdaab 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -245,41 +245,50 @@ _efl_canvas_vg_object_viewbox_align_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg } EOLIAN static Eina_Bool -_efl_canvas_vg_object_efl_file_file_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, const char *file, const char *key) +_efl_canvas_vg_object_efl_file_loaded_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Vg_Object_Data *pd) +{ + return !!pd->vg_entry; +} + +EOLIAN static Eina_Error +_efl_canvas_vg_object_efl_file_load(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd) { Vg_Cache_Entry *old_entry; + const char *file; - if (!file) return EINA_FALSE; + file = efl_file_get(eo_obj); + if (!file) return ENOENT; old_entry = pd->vg_entry; Evas_Object_Protected_Data *obj; obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); - if (file) - pd->vg_entry = evas_cache_vg_entry_create(file, key, - obj->cur->geometry.w, - obj->cur->geometry.h); - else - pd->vg_entry = NULL; + pd->vg_entry = evas_cache_vg_entry_create(file, efl_file_key_get(eo_obj), + obj->cur->geometry.w, + obj->cur->geometry.h); evas_object_change(eo_obj, obj); evas_cache_vg_entry_del(old_entry); - return EINA_TRUE; + return 0; } EOLIAN static void -_efl_canvas_vg_object_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Object_Data *pd, const char **file, const char **key) +_efl_canvas_vg_object_efl_file_unload(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd) { - if (file) *file = NULL; - if (key) *key = NULL; + Vg_Cache_Entry *old_entry; - if (pd->vg_entry) - { - if (file) *file = pd->vg_entry->file; - if (key) *key = pd->vg_entry->key; - } + if (!efl_file_loaded_get(eo_obj)) return; + old_entry = pd->vg_entry; + + Evas_Object_Protected_Data *obj; + obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); + + pd->vg_entry = NULL; + + evas_object_change(eo_obj, obj); + evas_cache_vg_entry_del(old_entry); } EOLIAN static Eina_Bool diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.eo b/src/lib/evas/canvas/efl_canvas_vg_object.eo index 44c9ce0f2e..eb5dbd04db 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.eo +++ b/src/lib/evas/canvas/efl_canvas_vg_object.eo @@ -73,8 +73,9 @@ class @beta Efl.Canvas.Vg.Object extends Efl.Canvas.Object implements Efl.File, Efl.Object.constructor; Efl.Object.finalize; Efl.Object.destructor; - // FIXME: Implement mmap only (also fix cache keys) - Efl.File.file { get; set; } + Efl.File.load; + Efl.File.unload; + Efl.File.loaded { get; } Efl.File_Save.save; } } diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.c b/src/lib/evas/canvas/evas_canvas3d_mesh.c index d91feafb99..ccac776dd5 100644 --- a/src/lib/evas/canvas/evas_canvas3d_mesh.c +++ b/src/lib/evas/canvas/evas_canvas3d_mesh.c @@ -861,49 +861,26 @@ _evas_canvas3d_mesh_alpha_test_enable_get(const Eo *obj EINA_UNUSED, Evas_Canvas return pd->alpha_test_enabled; } -EOLIAN static Eina_Bool -_evas_canvas3d_mesh_efl_file_mmap_set(Eo *obj, - Evas_Canvas3D_Mesh_Data *pd, - const Eina_File *f, const char *key EINA_UNUSED) +EOLIAN static Eina_Error +_evas_canvas3d_mesh_efl_file_load(Eo *obj, Evas_Canvas3D_Mesh_Data *pd) { + const Eina_File *f; + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + _mesh_fini(pd); _mesh_init(pd); - if (f == NULL) return EINA_FALSE; + f = efl_file_mmap_get(obj); + if (f == NULL) return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; evas_common_load_model_from_eina_file(obj, f); - return EINA_TRUE; -} - -EOLIAN void -_evas_canvas3d_mesh_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *sd EINA_UNUSED, const Eina_File **file, const char **group) -{ - ERR("this function is not available for this object"); - if (file) *file = NULL; - if (group) *group = NULL; -} - -EOLIAN void -_evas_canvas3d_mesh_efl_file_file_get(const Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *sd EINA_UNUSED, const char **file, const char **key) -{ - ERR("this function is not available for this object"); - if (file) *file = NULL; - if (key) *key = NULL; -} - -EOLIAN static Eina_Bool -_evas_canvas3d_mesh_efl_file_file_set(Eo *obj, Evas_Canvas3D_Mesh_Data *pd, - const char *file, - const char *key EINA_UNUSED) -{ - _mesh_fini(pd); - _mesh_init(pd); - - if (file == NULL) return EINA_FALSE; - - evas_common_load_model_from_file(obj, file); - return EINA_TRUE; + return 0; } EOLIAN static Eina_Bool diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.eo b/src/lib/evas/canvas/evas_canvas3d_mesh.eo index 028465423e..64441dbb92 100644 --- a/src/lib/evas/canvas/evas_canvas3d_mesh.eo +++ b/src/lib/evas/canvas/evas_canvas3d_mesh.eo @@ -426,8 +426,7 @@ class Evas.Canvas3D.Mesh extends Evas.Canvas3D.Object implements Efl.File, Efl.F Efl.Object.destructor; Evas.Canvas3D.Object.update_notify; Evas.Canvas3D.Object.change_notify; - Efl.File.file { get; set; } - Efl.File.mmap { get; set; } + Efl.File.load; Efl.File_Save.save; } diff --git a/src/lib/evas/canvas/evas_canvas3d_texture.c b/src/lib/evas/canvas/evas_canvas3d_texture.c index 540f6c6b39..5533e18373 100644 --- a/src/lib/evas/canvas/evas_canvas3d_texture.c +++ b/src/lib/evas/canvas/evas_canvas3d_texture.c @@ -372,25 +372,27 @@ _evas_canvas3d_texture_data_set(Eo *obj, Evas_Canvas3D_Texture_Data *pd, evas_canvas3d_object_change(obj, EVAS_CANVAS3D_STATE_TEXTURE_DATA, NULL); } -EOLIAN static void -_evas_canvas3d_texture_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Evas_Canvas3D_Texture_Data *pd, const Eina_File **f, const char **key) +EOLIAN static Eina_Error +_evas_canvas3d_texture_efl_file_load(Eo *obj, Evas_Canvas3D_Texture_Data *pd) { - if (f) *f = pd->f; - if (key) *key = pd->key; -} - -EOLIAN static Eina_Bool -_evas_canvas3d_texture_efl_file_mmap_set(Eo *obj, Evas_Canvas3D_Texture_Data *pd, const Eina_File *f, const char *key) -{ - Evas_Image_Load_Opts lo; int load_error; Eo *evas = NULL; void *image; + const Eina_File *f; + const char *key; + + if (efl_file_loaded_get(obj)) return 0; evas = evas_object_evas_get(obj); Evas_Public_Data *e = efl_data_scope_get(evas, EVAS_CANVAS_CLASS); + Eina_Error err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + f = efl_file_mmap_get(obj); + key = efl_file_key_get(obj); + if (!pd->engine_data && e->engine.func->texture_new) pd->engine_data = e->engine.func->texture_new(_evas_engine_context(e), pd->atlas_enable); diff --git a/src/lib/evas/canvas/evas_canvas3d_texture.eo b/src/lib/evas/canvas/evas_canvas3d_texture.eo index 0b22e86d1e..dd5156e377 100644 --- a/src/lib/evas/canvas/evas_canvas3d_texture.eo +++ b/src/lib/evas/canvas/evas_canvas3d_texture.eo @@ -155,6 +155,6 @@ class Evas.Canvas3D.Texture extends Evas.Canvas3D.Object implements Efl.File Efl.Object.destructor; Evas.Canvas3D.Object.update_notify; Evas.Canvas3D.Object.change_notify; - Efl.File.mmap { set; get; } + Efl.File.load; } } diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index f7163b7e50..254580b12c 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -3,6 +3,6 @@ class Evas.Image extends Efl.Canvas.Image_Internal implements Efl.File [[Internal class for legacy support of Evas Image.]] data: null; implements { - Efl.File.mmap { get; set; } + Efl.File.load; } } diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c index 75f4c2cfc0..886a37feba 100644 --- a/src/lib/evas/canvas/evas_image_legacy.c +++ b/src/lib/evas/canvas/evas_image_legacy.c @@ -49,7 +49,7 @@ evas_object_image_memfile_set(Evas_Object *eo_obj, void *data, int size, char *f f = eina_file_virtualize(NULL, data, size, EINA_TRUE); if (!f) return ; - efl_file_mmap_set(eo_obj, f, key); + efl_file_simple_mmap_load(eo_obj, f, key); eina_file_close(f); } @@ -194,28 +194,28 @@ EAPI void evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key) { EVAS_IMAGE_API(obj); - efl_file_set(obj, file, key); + efl_file_simple_load(obj, file, key); } EAPI void evas_object_image_file_get(const Evas_Object *obj, const char **file, const char **key) { EVAS_IMAGE_API(obj); - efl_file_get(obj, file, key); + efl_file_simple_get(obj, file, key); } EAPI void evas_object_image_mmap_set(Evas_Object *obj, const Eina_File *f, const char *key) { EVAS_IMAGE_API(obj); - _evas_image_mmap_set(obj, f, key); + efl_file_simple_mmap_load(obj, f, key); } EAPI void evas_object_image_mmap_get(const Evas_Object *obj, const Eina_File **f, const char **key) { EVAS_IMAGE_API(obj); - _evas_image_mmap_get(obj, f, key); + efl_file_simple_mmap_get(obj, f, key); } EAPI Eina_Bool @@ -362,7 +362,7 @@ EAPI Evas_Load_Error evas_object_image_load_error_get(const Evas_Object *obj) { EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_GENERIC); - return _evas_image_load_error_get(obj); + return efl_gfx_image_load_error_get(obj); } EAPI void @@ -1243,20 +1243,27 @@ evas_object_image_alpha_mask_set(Evas_Object *eo_obj EINA_UNUSED, Eina_Bool isma EVAS_IMAGE_LEGACY_API(eo_obj); } -EOLIAN static Eina_Bool -_evas_image_efl_file_mmap_set(Eo *obj, void *pd EINA_UNUSED, const Eina_File *f, const char *key) +EOLIAN static Eina_Error +_evas_image_efl_file_load(Eo *obj, void *pd EINA_UNUSED) { EVAS_IMAGE_API(obj, EINA_FALSE); - return _evas_image_mmap_set(obj, f, key); -} - -EOLIAN static void -_evas_image_efl_file_mmap_get(const Eo *obj, void *pd EINA_UNUSED, const Eina_File **f, const char **key) -{ - if (f) *f = NULL; - if (key) *key = NULL; - EVAS_IMAGE_API(obj); - _evas_image_mmap_get(obj, f, key); + if (efl_file_loaded_get(obj)) return 0; + Eina_Error err = efl_file_load(efl_super(obj, EVAS_IMAGE_CLASS)); + if (err) + { + if (err == ENOENT) + _efl_canvas_image_load_error_set(obj, EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST); + else if (err == ENOMEM) + _efl_canvas_image_load_error_set(obj, EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED); + else if ((err == EPERM) || (err == EACCES)) + _efl_canvas_image_load_error_set(obj, EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED); + else + _efl_canvas_image_load_error_set(obj, EFL_GFX_IMAGE_LOAD_ERROR_GENERIC); + return err; + } + if (_evas_image_file_load(obj)) + return 0; + return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; } #include "canvas/evas_image.eo.c" diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h index ac16b87f5f..7c197717a5 100644 --- a/src/lib/evas/canvas/evas_image_private.h +++ b/src/lib/evas/canvas/evas_image_private.h @@ -161,11 +161,12 @@ void *_evas_image_pixels_get(Eo *eo_obj, Evas_Object_Protected_Data *obj, void * void _evas_image_fill_set(Eo *eo_obj, Evas_Image_Data *o, int x, int y, int w, int h); /* Efl.File */ -Eina_Bool _evas_image_mmap_set(Eo *eo_obj, const Eina_File *f, const char *key); -void _evas_image_mmap_get(const Eo *eo_obj, const Eina_File **f, const char **key); +Eina_Bool _evas_image_file_load(Eo *eo_obj); +const Eina_File *_evas_image_mmap_get(const Eo *eo_obj); +const char *_evas_image_key_get(const Eo *eo_obj); +void _efl_canvas_image_load_error_set(Eo *eo_obj EINA_UNUSED, Eina_Error err); /* Efl.Image.Load */ -Efl_Gfx_Image_Load_Error _evas_image_load_error_get(const Eo *eo_obj); void _evas_image_load_post_update(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj); void _evas_image_load_async_start(Eo *eo_obj); void _evas_image_load_async_cancel(Eo *eo_obj); diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 03d37df5a4..a47934ea3b 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -854,6 +854,12 @@ _efl_canvas_image_internal_efl_gfx_image_ratio_get(const Eo *eo_obj EINA_UNUSED, return (double)o->cur->image.w / (double)o->cur->image.h; } +EOLIAN static Efl_Gfx_Image_Load_Error +_efl_canvas_image_internal_efl_gfx_image_image_load_error_get(const Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o) +{ + return o->load_error; +} + EOLIAN static Eina_Bool _efl_canvas_image_internal_efl_file_save_save(const Eo *eo_obj, Evas_Image_Data *o, const char *file, const char *key, const char *flags) { diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c index efe17e522f..fb1e8e224d 100644 --- a/src/tests/edje/edje_test_edje.c +++ b/src/tests/edje/edje_test_edje.c @@ -211,7 +211,8 @@ EFL_START_TEST(edje_test_part_caching) Evas_Object *ly, *o1, *global_p = NULL; ly = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, - efl_file_set(efl_added, test_layout_get("test_swallows.edj"), "test_group") + efl_file_set(efl_added, test_layout_get("test_swallows.edj")), + efl_file_key_set(efl_added, "test_group") ); for (int i = 0; i < 10; ++i) diff --git a/src/tests/edje/edje_test_signal.c b/src/tests/edje/edje_test_signal.c index 2dc42b0ae7..20240a421f 100644 --- a/src/tests/edje/edje_test_signal.c +++ b/src/tests/edje/edje_test_signal.c @@ -106,7 +106,8 @@ EFL_START_TEST(edje_test_message_send_eo) evas = _setup_evas(); obj = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, - efl_file_set(efl_added, test_layout_get("test_messages.edj"), "test_group")); + efl_file_set(efl_added, test_layout_get("test_messages.edj")), + efl_file_key_set(efl_added, "test_group")); // FIXME: EO API HERE edje_object_signal_callback_add(obj, "*", "edc", _message_signal_reply_cb, &id); @@ -163,7 +164,8 @@ EFL_START_TEST(edje_test_signals) evas = _setup_evas(); obj = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, - efl_file_set(efl_added, test_layout_get("test_signals.edj"), "level1"), + efl_file_set(efl_added, test_layout_get("test_signals.edj")), + efl_file_key_set(efl_added, "level1"), efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(320, 240)), efl_gfx_entity_visible_set(efl_added, 1)); @@ -207,7 +209,8 @@ EFL_START_TEST(edje_test_signal_callback_del_full) obj = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_file_set(efl_added, - test_layout_get("test_signal_callback_del_full.edj"), "test"), + test_layout_get("test_signal_callback_del_full.edj")), + efl_file_key_set(efl_added, "test"), efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(320, 240)), efl_gfx_entity_visible_set(efl_added, 1)); diff --git a/src/tests/edje/edje_test_text.c b/src/tests/edje/edje_test_text.c index 96b33b5605..86e1aaf06d 100644 --- a/src/tests/edje/edje_test_text.c +++ b/src/tests/edje/edje_test_text.c @@ -123,8 +123,9 @@ START_TEST(edje_test_text_ellipsis) layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 40))); - efl_file_set(layout, test_layout_get("test_text.edj"), "test"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test"); + ck_assert(!efl_file_load(layout)); efl_text_ellipsis_set(efl_part(layout, "text"), 1.0); @@ -141,8 +142,9 @@ START_TEST(edje_test_text_wrap) layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 40))); - efl_file_set(layout, test_layout_get("test_text.edj"), "test"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test"); + ck_assert(!efl_file_load(layout)); efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD); @@ -159,8 +161,9 @@ START_TEST(edje_test_text_font) layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 40))); - efl_file_set(layout, test_layout_get("test_text.edj"), "test"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test"); + ck_assert(!efl_file_load(layout)); efl_text_font_set(efl_part(layout, "text"), "Sans", 14); @@ -177,8 +180,9 @@ START_TEST(edje_test_text_color) layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 40))); - efl_file_set(layout, test_layout_get("test_text.edj"), "test"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test"); + ck_assert(!efl_file_load(layout)); efl_text_normal_color_set(efl_part(layout, "text"), 255, 255, 255, 255); @@ -315,13 +319,15 @@ START_TEST(edje_test_text_part) layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas, efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 40))); - efl_file_set(layout, test_layout_get("test_text.edj"), "test"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test"); + ck_assert(!efl_file_load(layout)); _basic_check(layout, EINA_TRUE); // Load again and check persistance - efl_file_set(layout, test_layout_get("test_text.edj"), "test2"); - fail_if(efl_file_load_error_get(layout)); + ck_assert(!efl_file_set(layout, test_layout_get("test_text.edj"))); + efl_file_key_set(layout, "test2"); + ck_assert(!efl_file_load(layout)); _basic_check(layout, EINA_FALSE); evas_free(evas); diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c index 660010bd54..f64c7131ce 100644 --- a/src/tests/elementary/efl_ui_test_layout.c +++ b/src/tests/elementary/efl_ui_test_layout.c @@ -32,7 +32,7 @@ EFL_START_TEST(efl_ui_layout_test_property_bind) ly = efl_add(EFL_UI_LAYOUT_CLASS, win); snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR); - efl_file_set(ly, buf, "layout"); + efl_file_simple_load(ly, buf, "layout"); efl_gfx_entity_visible_set(ly, EINA_TRUE); model = efl_add(EFL_GENERIC_MODEL_CLASS, win); diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c index 65508a0cc5..8304979cf2 100644 --- a/src/tests/emotion/emotion_test_main-eo.c +++ b/src/tests/emotion/emotion_test_main-eo.c @@ -112,7 +112,7 @@ static void bg_setup(void) { o_bg = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas); - efl_file_set(o_bg, theme_file, "background"); + efl_file_simple_load(o_bg, theme_file, "background"); efl_gfx_entity_position_set(o_bg, EINA_POSITION2D(0, 0)); efl_gfx_entity_size_set(o_bg, EINA_SIZE2D(startw, starth)); efl_gfx_stack_layer_set(o_bg, -999); @@ -624,7 +624,7 @@ init_video_object(const char *module_filename, const char *filename) oe = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas); efl_event_callback_add(oe, EFL_EVENT_DEL, _oe_free_cb, fd); efl_key_data_set(oe, "frame_data", fd); - efl_file_set(oe, theme_file, reflex ? "video_controller/reflex" : "video_controller"); + efl_file_simple_load(oe, theme_file, reflex ? "video_controller/reflex" : "video_controller"); edje_object_part_swallow(oe, "video_swallow", o); offset = 20 * (eina_list_count(video_objs) - 1); diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c index 9e7da26b16..da6ad42365 100644 --- a/src/tests/evas/evas_test_image.c +++ b/src/tests/evas/evas_test_image.c @@ -773,7 +773,7 @@ EFL_START_TEST(evas_object_image_map_unmap) const char *imgpath = TESTS_IMG_DIR "/Pic4.png"; o = efl_add(EFL_CANVAS_IMAGE_CLASS, e); - efl_file_set(o, imgpath, NULL); + efl_file_simple_load(o, imgpath, NULL); sz = efl_gfx_view_size_get(o); cs = efl_gfx_buffer_colorspace_get(o); @@ -852,7 +852,7 @@ EFL_START_TEST(evas_object_image_map_unmap) uint32_t *dest, *orig; o2 = efl_add(EFL_CANVAS_IMAGE_CLASS, e); - efl_file_set(o2, tmp, NULL); + efl_file_simple_load(o2, tmp, NULL); sz = efl_gfx_view_size_get(o); w2 = sz.w; h2 = sz.h; diff --git a/src/tests/evas/evas_test_mesh.c b/src/tests/evas/evas_test_mesh.c index 424b57b724..aba03730b5 100644 --- a/src/tests/evas/evas_test_mesh.c +++ b/src/tests/evas/evas_test_mesh.c @@ -52,22 +52,22 @@ fail_if(mesh == NULL); \ fail_if(mesh2 == NULL); \ snprintf(buffer, PATH_MAX, "%s%s", tmp, ext); \ - set_ok = efl_file_set(mesh, file->path, NULL); \ + set_ok = efl_file_simple_load(mesh, file->path, NULL); \ save_ok = efl_file_save(mesh, buffer, NULL, NULL); \ fail_if(!set_ok); \ fail_if(!save_ok); \ - set_ok = efl_file_set(mesh2, buffer, NULL); \ + set_ok = efl_file_simple_load(mesh2, buffer, NULL); \ fail_if(!set_ok); \ - efl_file_get(mesh2, &filename, &key); \ - fail_if(!!filename); \ + efl_file_simple_get(mesh2, &filename, &key); \ + fail_if(!filename); \ fail_if(!!key); \ res = _compare_meshes(mesh, mesh2); \ fail_if(res == 1); \ f = eina_file_open(file->path, 0); \ fail_if(!f); \ - set_ok = efl_file_mmap_set(mesh, f, NULL); \ - efl_file_mmap_get(mesh, &f_get, &key); \ - fail_if(!!f_get); \ + set_ok = efl_file_simple_mmap_load(mesh, f, NULL); \ + efl_file_simple_mmap_get(mesh, &f_get, &key); \ + fail_if(!f_get); \ fail_if(!!key); \ eina_file_close(f); \ save_ok = efl_file_save(mesh, buffer, NULL, NULL); \ @@ -75,7 +75,7 @@ fail_if(!save_ok); \ f = eina_file_open(buffer, 0); \ fail_if(!f); \ - set_ok = efl_file_mmap_set(mesh2, f, NULL); \ + set_ok = efl_file_simple_mmap_load(mesh2, f, NULL); \ eina_file_close(f); \ fail_if(!set_ok); \ res = _compare_meshes(mesh, mesh2); \