efl.file: improve api a bit
authorMike Blumenkrantz <zmike@samsung.com>
Wed, 27 Feb 2019 18:17:09 +0000 (13:17 -0500)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 8 Mar 2019 11:49:36 +0000 (20:49 +0900)
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

120 files changed:
src/Makefile_Efl.am
src/bin/edje/edje_cc_out.c
src/bin/elementary/test_bg.c
src/bin/elementary/test_box.c
src/bin/elementary/test_efl_gfx_mapping.c
src/bin/elementary/test_evas_map.c
src/bin/elementary/test_evas_mask.c
src/bin/elementary/test_evas_snapshot.c
src/bin/elementary/test_gfx_filters.c
src/bin/elementary/test_part_bg.c
src/bin/elementary/test_part_shadow.c
src/bin/elementary/test_photocam.c
src/bin/elementary/test_ui_button.c
src/bin/elementary/test_ui_pager.c
src/bin/elementary/test_ui_pager_scroll.c
src/bin/elementary/test_ui_panel.c
src/bin/elementary/test_ui_popup.c
src/bin/elementary/test_ui_progressbar.c
src/bin/elementary/test_ui_tab_pager.c
src/examples/ecore/efl_io_copier_example.c
src/examples/ecore/efl_net_dialer_http_example.c
src/examples/elementary/bg_cxx_example_02.cc
src/examples/elementary/efl_canvas_layout_text.c
src/examples/elementary/efl_ui_list_example_1.c
src/examples/elementary/efl_ui_scroller_example.c
src/examples/elementary/icon_cxx_example_01.cc
src/examples/elementary/performance/graphical.c
src/examples/elementary/popup_cxx_example.cc
src/examples/elementary/toolbar_cxx_example_01.cc
src/examples/evas/evas-3d-aabb.c
src/examples/evas/evas-3d-colorpick.c
src/examples/evas/evas-3d-cube2.c
src/examples/evas/evas-3d-eet.c
src/examples/evas/evas-3d-frustum.c
src/examples/evas/evas-3d-hull.c
src/examples/evas/evas-3d-md2.c
src/examples/evas/evas-3d-mmap-set.c
src/examples/evas/evas-3d-obj.c
src/examples/evas/evas-3d-parallax-occlusion.c
src/examples/evas/evas-3d-pick.c
src/examples/evas/evas-3d-ply.c
src/examples/evas/evas-3d-shadows.c
src/examples/evas/evas-3d-static-lod.c
src/examples/evas/evas-object-manipulation-eo.c
src/examples/evas/evas-vg-json.c
src/examples/evas/shooter/evas-3d-shooter-macros.h
src/examples/evas/shooter/evas-3d-shooter.c
src/lib/ecore/efl_io_file.c
src/lib/ecore/efl_io_file.eo
src/lib/ecore_con/ecore_con_url.c
src/lib/ecore_file/ecore_file_download.c
src/lib/edje/edje_calc.c
src/lib/edje/edje_edit.c
src/lib/edje/edje_edit.eo
src/lib/edje/edje_legacy.c
src/lib/edje/edje_load.c
src/lib/edje/edje_private.h
src/lib/edje/edje_smart.c
src/lib/edje/efl_canvas_layout.eo
src/lib/efl/Efl.h
src/lib/efl/interfaces/efl_file.c
src/lib/efl/interfaces/efl_file.eo
src/lib/efl/interfaces/efl_file.h [new file with mode: 0644]
src/lib/efl/interfaces/efl_gfx_image.eo
src/lib/efl/interfaces/meson.build
src/lib/elementary/efl_ui_animation_view.c
src/lib/elementary/efl_ui_animation_view.eo
src/lib/elementary/efl_ui_bg.c
src/lib/elementary/efl_ui_bg.eo
src/lib/elementary/efl_ui_image.c
src/lib/elementary/efl_ui_image.eo
src/lib/elementary/efl_ui_image_zoomable.c
src/lib/elementary/efl_ui_image_zoomable.eo
src/lib/elementary/efl_ui_layout.c
src/lib/elementary/efl_ui_layout.eo
src/lib/elementary/efl_ui_popup.c
src/lib/elementary/efl_ui_popup_part_backwall.eo
src/lib/elementary/efl_ui_selection_manager.c
src/lib/elementary/efl_ui_text.c
src/lib/elementary/efl_ui_text.eo
src/lib/elementary/efl_ui_text_factory_images.c
src/lib/elementary/efl_ui_video.c
src/lib/elementary/efl_ui_video.eo
src/lib/elementary/efl_ui_widget.c
src/lib/elementary/efl_ui_widget_part_bg.eo
src/lib/elementary/efl_ui_win.c
src/lib/elementary/efl_ui_win_part.eo
src/lib/elementary/elm_entry.c
src/lib/elementary/elm_entry.eo
src/lib/elementary/elm_icon.c
src/lib/elementary/elm_icon.eo
src/lib/elementary/elm_photo.c
src/lib/elementary/elm_photo.eo
src/lib/elementary/elm_thumb.c
src/lib/elementary/elm_thumb.eo
src/lib/elementary/elm_widget_thumb.h
src/lib/emotion/efl_canvas_video.eo
src/lib/emotion/emotion_smart.c
src/lib/evas/canvas/efl_canvas_image.c
src/lib/evas/canvas/efl_canvas_image.eo
src/lib/evas/canvas/efl_canvas_image_internal.eo
src/lib/evas/canvas/efl_canvas_proxy.c
src/lib/evas/canvas/efl_canvas_vg_object.c
src/lib/evas/canvas/efl_canvas_vg_object.eo
src/lib/evas/canvas/evas_canvas3d_mesh.c
src/lib/evas/canvas/evas_canvas3d_mesh.eo
src/lib/evas/canvas/evas_canvas3d_texture.c
src/lib/evas/canvas/evas_canvas3d_texture.eo
src/lib/evas/canvas/evas_image.eo
src/lib/evas/canvas/evas_image_legacy.c
src/lib/evas/canvas/evas_image_private.h
src/lib/evas/canvas/evas_object_image.c
src/lib/evas/canvas/evas_vg_private.h
src/tests/edje/edje_test_edje.c
src/tests/edje/edje_test_signal.c
src/tests/edje/edje_test_text.c
src/tests/elementary/efl_ui_test_layout.c
src/tests/emotion/emotion_test_main-eo.c
src/tests/evas/evas_test_image.c
src/tests/evas/evas_test_mesh.c

index d254f6f..f565ed4 100644 (file)
@@ -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
index 857397a..dde5907 100644 (file)
@@ -1475,7 +1475,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);
index 338084b..c7c7f19 100644 (file)
@@ -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));
index 31ccc9c..c5c596c 100644 (file)
@@ -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));
index 71cfd82..cb780d7 100644 (file)
@@ -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);
index b598044..3b3e66a 100644 (file)
@@ -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);
index 497d4a2..39a91e1 100644 (file)
@@ -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
index c1b110e..70791e6 100644 (file)
@@ -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)));
 }
 
index 965720a..d8bd58e 100644 (file)
@@ -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))
index 37e39da..04e436a 100644 (file)
@@ -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);
index 70d9a6f..07aeb8d 100644 (file)
@@ -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;
 
index c1e055e..f006620 100644 (file)
@@ -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)
                      );
index f5aa340..f89a188 100644 (file)
@@ -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)
           );
 
index e8d602f..cebbbad 100644 (file)
@@ -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,
index 9941304..7a0bfb8 100644 (file)
@@ -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,
index 40ca680..e73a318 100644 (file)
@@ -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));
index 311ec1d..e4a7a89 100644 (file)
@@ -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);
 
index cbb2fdc..16848ef 100644 (file)
@@ -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)
           );
 
index 2c82a97..203294e 100644 (file)
@@ -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);
index 25a8114..13f26b8 100644 (file)
@@ -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 */
index 70861dc..02783dc 100644 (file)
@@ -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. */
index 71c3540..94c17e3 100644 (file)
@@ -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});
index a0d7f57..556c528 100644 (file)
@@ -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));
index be47aa0..c34aa0f 100644 (file)
@@ -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;
index 4de4d21..e300b65 100644 (file)
@@ -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);
 }
index 88f9f95..6252ce1 100644 (file)
@@ -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;
index d006c3e..13d7ea1 100644 (file)
@@ -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);
            }
index b6c7832..6c32327 100644 (file)
@@ -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<efl::File>(g_popup.part_get("backwall")).file_set("./sky_01.jpg", nullptr);
+           efl::eo::downcast<efl::File>(g_popup.part_get("backwall")).file_set("./sky_01.jpg");
            backwall_btn.text_set("Unset Backwall");
         }
         else {
-           efl::eo::downcast<efl::File>(g_popup.part_get("backwall")).file_set(nullptr, nullptr);
+           efl::eo::downcast<efl::File>(g_popup.part_get("backwall")).file_set(nullptr);
            backwall_btn.text_set("Set Backwall");
         }
      }));
index 5a884b9..f5c47cb 100644 (file)
@@ -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);
index dd4c1f0..fdb8a45 100644 (file)
@@ -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);
index 8c9ea3b..7b894cd 100644 (file)
@@ -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);
index c8558b6..b2d905e 100644 (file)
@@ -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);
index da94e06..becd0bc 100644 (file)
@@ -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));
index 02f5bba..6e765bd 100644 (file)
@@ -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);
 }
index 0e13705..e82f31b 100644 (file)
@@ -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);
index adfb696..f97c183 100644 (file)
@@ -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);
index 3605555..149217d 100644 (file)
@@ -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));          \
index 65f57ec..91126fb 100644 (file)
@@ -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, \
index 83188c0..1d2cc75 100644 (file)
@@ -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);
index 1e2f3d6..20230d0 100644 (file)
@@ -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);
index 821195b..7769a45 100644 (file)
@@ -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)]);
           }
index ae06a36..1673318 100644 (file)
@@ -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);
 
index d7672a4..92e3b1a 100644 (file)
@@ -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]);
index 551d287..081d063 100644 (file)
@@ -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)
      {
index bcce053..ce45513 100644 (file)
@@ -79,14 +79,14 @@ main(void)
    Eo *vg = gvg[0] = efl_add(EFL_CANVAS_VG_CLASS, evas);
 
    snprintf(buf, sizeof(buf), "%s/browser.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
-   efl_file_set(vg, buf, NULL);
+   efl_file_simple_load(vg, buf, NULL);
    efl_gfx_entity_size_set(vg, EINA_SIZE2D(200, 200));
    efl_gfx_entity_visible_set(vg, EINA_TRUE);
 
    //2
    Eo *vg2 = gvg[1] = efl_add(EFL_CANVAS_VG_CLASS, evas);
    snprintf(buf, sizeof(buf), "%s/jolly_walker.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
-   efl_file_set(vg2, buf, NULL);
+   efl_file_simple_load(vg2, buf, NULL);
    efl_gfx_entity_position_set(vg2, EINA_POSITION2D(200, 200));
    efl_gfx_entity_size_set(vg2, EINA_SIZE2D(200, 200));
    efl_gfx_entity_visible_set(vg2, EINA_TRUE);
@@ -94,7 +94,7 @@ main(void)
    //3
    Eo *vg3 = gvg[2] = efl_add(EFL_CANVAS_VG_CLASS, evas);
    snprintf(buf, sizeof(buf), "%s/windmill.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
-   efl_file_set(vg3, buf, NULL);
+   efl_file_simple_load(vg3, buf, NULL);
    efl_gfx_entity_position_set(vg3, EINA_POSITION2D(0, 200));
    efl_gfx_entity_size_set(vg3, EINA_SIZE2D(200, 200));
    efl_gfx_entity_visible_set(vg3, EINA_TRUE);
@@ -102,7 +102,7 @@ main(void)
    //4
    Eo* vg4 = gvg[3] = efl_add(EFL_CANVAS_VG_CLASS, evas);
    snprintf(buf, sizeof(buf), "%s/emoji_wink.json", PACKAGE_EXAMPLES_DIR EVAS_VG_FOLDER);
-   efl_file_set(vg4, buf, NULL);
+   efl_file_simple_load(vg4, buf, NULL);
    efl_gfx_entity_position_set(vg4, EINA_POSITION2D(200, 0));
    efl_gfx_entity_size_set(vg4, EINA_SIZE2D(200, 200));
    efl_gfx_entity_visible_set(vg4, EINA_TRUE);
index 9cb92a6..94980ec 100644 (file)
@@ -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);   \
index ae6bede..1c4deb4 100644 (file)
@@ -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);
index c8716d2..041db19 100644 (file)
@@ -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)
 {
index c663b72..269d46e 100644 (file)
@@ -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;
index 6f1c22c..acd0008 100644 (file)
@@ -1181,7 +1181,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));
index 5466669..4b65c51 100644 (file)
@@ -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);
index e3d3b1d..5cd49b7 100644 (file)
@@ -3306,7 +3306,7 @@ _edje_vector_load_json(Edje *ed, Edje_Real_Part *ep, const char *key)
         json_data = (char *)eet_read(ed->file->ef, key, &json_data_len);
         json_data[json_data_len] = '\0';
         file = eina_file_virtualize(NULL, json_data, json_data_len + 1, EINA_FALSE);
-        efl_file_mmap_set(ep->object, file, NULL);
+        efl_file_simple_mmap_load(ep->object, file, NULL);
 
         if (ep->typedata.vector->json_virtual_file)
           eina_file_close(ep->typedata.vector->json_virtual_file);
@@ -3367,17 +3367,17 @@ _edje_vector_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EIN
 
    if ((new_id < 0) || (new_type == EDJE_VECTOR_FILE_TYPE_JSON))
      {
-        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_id);
 
-        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);
 
@@ -5132,7 +5132,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);
                             }
index 3606f8d..f86c235 100644 (file)
@@ -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 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 EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
 
-   return EINA_TRUE;
+   return 0;
 }
 
 EAPI Evas_Object *
index a7bb40a..61ae265 100644 (file)
@@ -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;
    }
 }
index fead8b0..5906ff1 100644 (file)
@@ -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;
index 04a26b4..7c50de6 100644 (file)
@@ -161,19 +161,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 Efl_Gfx_Image_Load_Error
-_efl_canvas_layout_efl_file_load_error_get(const Eo *obj, Edje *ed)
+EOLIAN const char *
+_efl_canvas_layout_efl_file_group_get(Eo *obj EINA_UNUSED, Edje *ed)
 {
-   Efl_Gfx_Image_Load_Error p = efl_file_load_error_get(efl_super(obj, EFL_CANVAS_LAYOUT_CLASS));
+   return ed->group;
+}
 
-   if (p != EFL_GFX_IMAGE_LOAD_ERROR_NONE) return p;
+EOLIAN Efl_Gfx_Image_Load_Error
+_efl_canvas_layout_layout_load_error_get(const Eo *obj EINA_UNUSED, Edje *ed)
+{
    switch (ed->load_error)
      {
       case EDJE_LOAD_ERROR_NONE: return EFL_GFX_IMAGE_LOAD_ERROR_NONE;
@@ -186,8 +188,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 *
@@ -763,7 +766,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;
@@ -784,12 +787,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);
@@ -850,7 +853,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, EINA_TRUE);
-             return 0;
+             return EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE;
           }
         eina_array_step_set(&parts, sizeof (Eina_Array), 8);
 
@@ -1041,7 +1044,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);
@@ -1138,7 +1141,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
                             {
@@ -1515,6 +1518,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));
 
@@ -1524,7 +1528,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);
@@ -1779,11 +1784,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);
@@ -1803,7 +1808,7 @@ on_error:
      }
    evas_event_thaw(tev);
    evas_event_thaw_eval(tev);
-   return 0;
+   return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
 }
 
 void
index 5b54ddc..38d97b9 100644 (file)
@@ -2723,7 +2723,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, Eina_Bool reuse_ic);
index 520e681..681743c 100644 (file)
@@ -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);
 
@@ -424,50 +424,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
index 2ace16e..e93ee82 100644 (file)
@@ -74,6 +74,15 @@ 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.]]
+          }
+      }
+
       /***********************************************************************************
        * TIZEN_ONLY_FEATURE: API for handling text properties of Edje                    *
        ***********************************************************************************/
@@ -374,8 +383,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;
index 46fd921..a398c11 100644 (file)
@@ -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"
index d1c86ee..3acdc17 100644 (file)
 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;
 
-   tmp = (char*)(file);
-   if (tmp)
+   if (pd->loaded) return 0;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(pd->vpath, ENOENT);
+   errno = 0;
+   if (!pd->file)
      {
-        tmp = eina_vpath_resolve(tmp);
+        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;
+}
 
-   if (tmp)
+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)
      {
-        f = eina_file_open(tmp, EINA_FALSE);
-        if (!f) goto on_error;
+        /* avoid infinite recursion */
+        pd->setting = 1;
+        err = efl_file_set(obj, eina_file_filename_get(pd->file));
+        pd->setting = 0;
      }
+   return err;
+}
 
-   pd->error = EFL_GFX_IMAGE_LOAD_ERROR_NONE;
+EOLIAN static const Eina_File *
+_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
+{
+   return pd->file;
+}
 
-   r = efl_file_mmap_set(obj, f, key);
-   if (f) eina_file_close(f);
+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;
 
- on_error:
+   tmp = (char*)(file);
+   if (tmp)
+     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;
+   return pd->vpath;
+}
 
-   efl_file_mmap_get(obj, &f, key);
+EOLIAN static void
+_efl_file_key_set(Eo *obj EINA_UNUSED, Efl_File_Data *pd, const char *key)
+{
+   if (eina_stringshare_replace(&pd->key, key))
+     pd->loaded = 0;
+}
 
-   if (f && file) *file = eina_file_filename_get(f);
-   else if (file) *file = NULL;
+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);
 }
 
-static Efl_Gfx_Image_Load_Error
-_efl_file_load_error_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
+EAPI void
+efl_file_simple_mmap_get(const Eo *obj, const Eina_File **file, const char **key)
 {
-   return pd->error;
+   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"
index 8d98a00..985b3fd 100644 (file)
 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 {
+      @property mmap {
+         set {
+            [[Set the mmaped file from where an object will fetch the real
+              data (it must be an Eina_File).
+
+              If mmap is set during object construction, the object will automatically
+              call @.load during the finalize phase of construction.
+
+              ]]
+
+            return: Eina.Error; [[0 on success, error code otherwise]]
+         }
          get {
-            [[Gets the (last) file loading error for a given object.]]
+            [[Get the mmaped file from where an object will fetch the real
+              data (it must be an Eina_File).
+
+              ]]
          }
          values {
-            error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]]
+            f: ptr(const(Eina.File)); [[The handle to an Eina_File that will be used]]
          }
       }
-      @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).
-
-              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.
+      @property file {
+         set {
+            [[Set the file path from where an object will fetch the data.
 
-              @since 1.8]]
+              If file is set during object construction, the object will automatically
+              call @.load during the finalize phase of construction.
+            ]]
 
-            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).
-
-              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.
+         get {
+            [[Retrieve the file path from where an object is to fetch the data.
 
-              @since 1.10]]
+              You must not modify the strings on the returned pointers.]]
          }
          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.]]
+            file: string; [[The file path.]]
          }
       }
-      @property file {
+      @property key {
          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).
-
-              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.]]
-
-            /* 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]]
+            [[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 {
-            [[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).
+            [[Get the previously-set key which corresponds to the target data within a file.
 
-              You must not modify the strings on the returned pointers.
+              Some filetypes can contain multiple data streams which are indexed by
+              a key. Use this property for such cases.
 
-              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.]]
+            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 (file)
index 0000000..d045714
--- /dev/null
@@ -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
index 420bb81..eb23f3f 100644 (file)
@@ -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.]]
index 7483903..d91ea66 100644 (file)
@@ -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()]
index 4d6c939..b57a30e 100644 (file)
@@ -280,13 +280,15 @@ _ready_play(Efl_Ui_Animation_View_Data *pd)
    return EINA_FALSE;
 }
 
-EOLIAN static Eina_Bool
-_efl_ui_animation_view_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, const char *file, const char *key)
+EOLIAN static Eina_Error
+_efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
-   if (!evas_object_vg_file_set(pd->vg, file, key)) return EINA_FALSE;
+   const char *file = efl_file_get(obj);
+   const char *key = efl_file_key_get(obj);
 
-   if (pd->file) eina_stringshare_del(pd->file);
-   pd->file = eina_stringshare_add(file);
+   if (!evas_object_vg_file_set(pd->vg, file, key)) return ENOENT;
+
+   pd->file = file;
    pd->progress = 0;
 
    _sizing_eval(pd);
@@ -297,10 +299,10 @@ _efl_ui_animation_view_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_V
         pd->frame_cnt = 0;
         pd->frame_duration = 0;
         if (pd->transit) elm_transit_del(pd->transit);
-        return EINA_FALSE;
+        return ENOENT;
      }
 
-   if (!_ready_play(pd)) return EINA_TRUE;
+   if (!_ready_play(pd)) return 0;
 
    if (pd->auto_play)
      {
@@ -308,13 +310,13 @@ _efl_ui_animation_view_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_V
 
         if (!_visible_check(obj))
           {
-             elm_transit_paused_set(pd->transit, EINA_TRUE);
+             elm_transit_paused_set(pd->transit, 0);
              pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE;
              pd->auto_play_pause = EINA_TRUE;
              evas_object_smart_callback_call(pd->obj, SIG_PLAY_PAUSE, NULL);
           }
      }
-   return EINA_TRUE;
+   return 0;
 }
 
 EOLIAN static void
@@ -662,7 +664,7 @@ elm_animation_view_add(Evas_Object *parent)
 EAPI Eina_Bool
 elm_animation_view_file_set(Elm_Animation_View *obj, const char *file, const char *key)
 {
-   return efl_file_set(obj, file, key);
+   return efl_file_simple_load(obj, file, key);
 }
 
 EAPI Elm_Animation_View_State
index feb426c..ef9e812 100644 (file)
@@ -280,7 +280,7 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
    implements {
       Efl.Object.constructor;
       Efl.Object.destructor;
-      Efl.File.file { set; }
+      Efl.File.load;
       Efl.Gfx.Entity.visible { set; }
       Efl.Gfx.Entity.position { set; }
       Efl.Gfx.Entity.size { set; }
index 0145e9b..9874127 100644 (file)
@@ -212,48 +212,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;
 }
 
 // TIZEN_ONLY(20160218): Improve launching performance.
index b928549..6809b7f 100644 (file)
@@ -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; }
index 65f9268..a80ee34 100644 (file)
@@ -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},
@@ -399,7 +400,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;
@@ -417,19 +418,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);
@@ -440,18 +443,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;
@@ -470,22 +475,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)
@@ -503,32 +514,23 @@ _efl_ui_image_edje_file_set(Evas_Object *obj,
 
    if (!sd->async_enable)
      {
-        if (f)
-          {
-             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
+        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_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
@@ -550,7 +552,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),
@@ -881,12 +883,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)
+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_Bool ret = EINA_FALSE;
+   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 */
@@ -896,48 +919,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
@@ -945,7 +1020,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)
@@ -959,7 +1034,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
@@ -996,7 +1071,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;
@@ -1014,11 +1089,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 };
 
@@ -1074,11 +1149,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));
@@ -1113,72 +1189,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)
 {
@@ -1281,18 +1291,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
@@ -1742,7 +1740,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;
@@ -1810,7 +1808,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,
@@ -1892,13 +1890,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);
           }
      }
 
@@ -2027,7 +2025,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;
 }
@@ -2035,14 +2033,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
index 7a19d04..109ef76 100644 (file)
@@ -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; }
index 5147114..016c019 100644 (file)
@@ -2036,14 +2036,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));
@@ -2055,23 +2058,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;
           }
      }
 
@@ -2113,41 +2106,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);
@@ -2158,7 +2152,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);
 
@@ -2174,7 +2168,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);
@@ -2202,6 +2196,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
@@ -2252,11 +2247,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 };
 
@@ -2365,11 +2360,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);
 
@@ -2395,21 +2389,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 :
@@ -2419,14 +2416,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
@@ -2829,7 +2826,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);
@@ -2845,10 +2842,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);
@@ -2856,7 +2853,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
@@ -2864,7 +2861,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;
@@ -2915,7 +2912,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;
@@ -2983,7 +2980,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,
@@ -3376,7 +3373,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 ?
@@ -3395,9 +3392,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
index 1c458e1..e8781a9 100644 (file)
@@ -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; }
index 681143a..a42ee77 100644 (file)
@@ -1026,67 +1026,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
@@ -2174,7 +2177,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);
 
@@ -2609,9 +2612,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;
 }
@@ -2655,7 +2660,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));
                     }
@@ -2897,25 +2902,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
index b6f09a2..4fb5d0d 100644 (file)
@@ -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;
index 43150df..f48e304 100644 (file)
@@ -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"
index 759e0f4..4a6a914 100644 (file)
@@ -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;
    }
 }
index b65afd5..f63cffc 100644 (file)
@@ -1218,7 +1218,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);
 
@@ -2512,7 +2512,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);
 
index f70bb65..57c2978 100644 (file)
@@ -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
index afb6094..7394a61 100644 (file)
@@ -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;
    }
index 54c5c43..38529e4 100644 (file)
@@ -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
index 3d7bf74..ec9bce6 100644 (file)
@@ -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
index 61cef8f..d418cb4 100644 (file)
@@ -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;
index 80ca677..77077ac 100644 (file)
@@ -6544,20 +6544,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_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_set(bg_obj, file, key);
+   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_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);
 
-   efl_file_get(bg_obj, file, key);
+   return efl_file_mmap_set(bg_obj, file);
 }
 
 EOLIAN static void
index cbe42fd..94f87b8 100644 (file)
@@ -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; }
    }
index ff6825a..f4e9bbb 100644 (file)
@@ -6709,6 +6709,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;
 }
 
@@ -8664,9 +8670,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"))
      {
@@ -8677,7 +8688,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);
           }
@@ -8693,22 +8704,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 */
@@ -8733,22 +8763,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);
+   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);
-   _efl_ui_win_part_file_get(pd->obj, sd, pd->part, file, key);
+   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)
index 55919f7..ea9d09f 100644 (file)
@@ -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; }
    }
 }
index 22ec12d..200cb69 100644 (file)
@@ -221,16 +221,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)
      {
@@ -258,11 +256,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;
@@ -275,47 +273,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
@@ -6638,24 +6643,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);
@@ -6665,13 +6680,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)
 {
    ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
index 5d9119d..103e21c 100644 (file)
@@ -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 ]]
@@ -916,7 +916,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.Access.Object.access_children { get; }
       Efl.Part.part_get;
 
index 4a0165d..2d3c76f 100644 (file)
@@ -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
@@ -699,7 +705,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
index 35ce8a9..a933381 100644 (file)
@@ -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]]
index 53300f9..0130385 100644 (file)
@@ -315,6 +315,17 @@ elm_photo_add(Evas_Object *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)
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
@@ -325,50 +336,61 @@ _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
    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 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)
+EOLIAN static const Eina_File *
+_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
 {
-   efl_file_mmap_get(sd->icon, file, key);
+   return efl_file_mmap_get(sd->icon);
 }
 
-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 Eina_Error
+_elm_photo_efl_file_mmap_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File *file)
 {
-   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;
-     }
+   return efl_file_mmap_set(sd->icon, file);
+}
 
-   _sizing_eval(obj);
+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);
+}
 
-   return EINA_TRUE;
+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_key_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *key)
+{
+   return efl_file_key_set(sd->icon, key);
+}
+
+EOLIAN static const char *
+_elm_photo_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
+{
+   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 */
index 3ceb6d7..7263119 100644 (file)
@@ -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; }
    }
index 2671772..a36abe7 100644 (file)
@@ -582,6 +582,14 @@ elm_thumb_add(Evas_Object *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)
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
@@ -594,53 +602,71 @@ _elm_thumb_efl_object_constructor(Eo *obj, Elm_Thumb_Data *sd)
    return obj;
 }
 
+EOLIAN static Eina_Error
+_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file)
+{
+   if (eina_stringshare_replace(&(sd->file), file))
+     sd->loaded = EINA_FALSE;
+   return 0;
+}
+
+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;
+}
+
+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_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file, const char *key)
+_elm_thumb_efl_file_loaded_get(const Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
 {
-   Eina_Bool file_replaced, key_replaced;
+   return sd->loaded;
+}
 
-   file_replaced = eina_stringshare_replace(&(sd->file), file);
-   key_replaced = eina_stringshare_replace(&(sd->key), key);
+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 (file_replaced)
+   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 */
index 94e911e..22fd890 100644 (file)
@@ -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; }
    }
index 927d798..dd03411 100644 (file)
@@ -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;
 };
 
 /**
index 0adbf3e..38a9894 100644 (file)
@@ -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; }
index ed5eb36..06c95bf 100644 (file)
@@ -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
index d00ee65..0d95f2f 100644 (file)
@@ -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;
 }
 
-void
-_evas_image_mmap_get(const Eo *eo_obj, const Eina_File **f, const char **key)
+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);
 
-   if (f)
-     *f = o->cur->f;
-   if (key)
-     *key = o->cur->key;
+   return o->cur->f;
 }
 
-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)
+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);
-   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;
+   return o->cur->key;
 }
 
-EOLIAN static Efl_Gfx_Image_Load_Error
-_efl_canvas_image_efl_file_load_error_get(const Eo *eo_obj, void *_pd EINA_UNUSED)
+void
+_efl_canvas_image_load_error_set(Eo *eo_obj EINA_UNUSED, Eina_Error err)
 {
-   return _evas_image_load_error_get(eo_obj);
+   Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
+   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));
      }
index f92da8c..2dbad42 100644 (file)
@@ -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; }
index 5d9ff95..c0b9093 100644 (file)
@@ -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; }
index b057400..734b8bc 100644 (file)
@@ -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;
index 2e148a0..e4c9387 100644 (file)
@@ -244,143 +244,71 @@ _efl_canvas_vg_object_viewbox_align_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vg
    if (align_y) *align_y = pd->align_y;
 }
 
-static Eina_Bool
-_vg_file_mmap_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, const Eina_File *file, const char *key, Eina_Bool mmap)
+EOLIAN static Eina_Bool
+_efl_canvas_vg_object_efl_file_loaded_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Vg_Object_Data *pd)
 {
-   Vg_Cache_Entry *old_entry;
-   Evas_Object_Protected_Data *obj;
-
-   obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
-
-   old_entry = pd->vg_entry;
-
-   if (file)
-     pd->vg_entry = evas_cache_vg_entry_create(file, key,
-                                               obj->cur->geometry.w,
-                                               obj->cur->geometry.h,
-                                               mmap);
-   else
-     pd->vg_entry = NULL;
-
-   evas_object_change(eo_obj, obj);
-   evas_cache_vg_entry_del(old_entry);
-
-   return EINA_TRUE;
+   return !!pd->vg_entry;
 }
 
-EOLIAN static void
-_efl_canvas_vg_object_efl_file_mmap_get(const Eo *eo_obj EINA_UNUSED,
-                                        Efl_Canvas_Vg_Object_Data *pd,
-                                        const Eina_File **file, const char **key)
+EOLIAN static Eina_Error
+_efl_canvas_vg_object_efl_file_load(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd)
 {
-   if (file) *file = NULL;
-   if (key) *key = NULL;
+   Eina_Bool is_mmap;
 
-   if (pd->vg_entry)
-     {
-        if (file) *file = pd->vg_entry->file;
-        if (key) *key = pd->vg_entry->key;
-     }
-}
+   const Eina_File *file = efl_file_mmap_get(eo_obj);
+   const char *filepath = efl_file_get(eo_obj);
+   const char *key = efl_file_key_get(eo_obj);
 
-EOLIAN static Eina_Bool
-_efl_canvas_vg_object_efl_file_mmap_set(Eo *eo_obj, Efl_Canvas_Vg_Object_Data *pd, const Eina_File *file, const char *key)
-{
-   Eina_File *pf = pd->file;
-   Eina_Bool ret;
+   is_mmap = !!file;
+
+   Vg_Cache_Entry *old_entry;
+   Evas_Object_Protected_Data *obj;
 
    if (!file)
      {
-        Evas_Object_Protected_Data *obj;
-        obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
-        evas_cache_vg_entry_del(pd->vg_entry);
-        evas_object_change(eo_obj, obj);
-        eina_stringshare_del(pd->key);
-        pd->vg_entry = NULL;
-        pd->file = NULL;
-        pd->key = NULL;
-        return EINA_TRUE;
-     }
-   if (pd->file == file)
-     {
-        if (!pd->key && !key) return EINA_FALSE;
-        else if (pd->key && key)
+        if (!filepath)
           {
-             if (!strcmp(pd->key, key)) return EINA_FALSE;
+             Evas_Object_Protected_Data *obj;
+             obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
+             evas_cache_vg_entry_del(pd->vg_entry);
+             evas_object_change(eo_obj, obj);
+             pd->vg_entry = NULL;
+             return ENOENT;
           }
-        pf = NULL;
-     }
-   if (pd->file != file)
-     pd->file = eina_file_dup(file);
-   ret = _vg_file_mmap_set(eo_obj, pd, file, key, EINA_TRUE);
-
-   //Close previous file after deleting ex-cache entry.
-   if (pf) eina_file_close(pf);
-
-   return ret;
-}
-
-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)
-{
-   Eina_File *pf = pd->file;
-   Eina_Bool ret;
-
-   if (!file)
-     {
-        Evas_Object_Protected_Data *obj;
-        obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
-        evas_cache_vg_entry_del(pd->vg_entry);
-        evas_object_change(eo_obj, obj);
-        eina_stringshare_del(pd->key);
-        pd->vg_entry = NULL;
-        pd->file = NULL;
-        pd->key = NULL;
-        return EINA_TRUE;
-     }
-   if (!pd->file)
-     {
-        pd->file = eina_file_open(file, EINA_FALSE);
-        if (!pd->file) return EINA_FALSE;
-     }
-   else
-     {
-        const char *filename = eina_file_filename_get(pd->file);
-        if (filename)
+        else
           {
-             if (strcmp(filename, file))
-               pd->file = eina_file_open(file, EINA_FALSE);
-             else
-               {
-                  if (!pd->key && !key) return EINA_FALSE;
-                  else if (pd->key && key)
-                    {
-                       if (!strcmp(pd->key, key)) return EINA_FALSE;
-                    }
-                  pf = NULL;
-               }
+             file = eina_file_open(filepath, EINA_FALSE);
+             if (!file) return ENOENT;
           }
      }
 
-   ret = _vg_file_mmap_set(eo_obj, pd, pd->file, key, EINA_FALSE);
+   obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
+   old_entry = pd->vg_entry;
+   pd->vg_entry = evas_cache_vg_entry_create(file, key,
+                                             obj->cur->geometry.w,
+                                             obj->cur->geometry.h,
+                                             is_mmap);
 
-   //Close previous file after deleting ex-cache entry.
-   if (pf) eina_file_close(pf);
+   evas_object_change(eo_obj, obj);
+   evas_cache_vg_entry_del(old_entry);
 
-   return ret;
+   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 (!efl_file_loaded_get(eo_obj)) return;
+   old_entry = pd->vg_entry;
 
-   if (pd->vg_entry)
-     {
-        if (file) *file = eina_file_filename_get(pd->vg_entry->file);
-        if (key) *key = pd->vg_entry->key;
-     }
+   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
@@ -420,18 +348,6 @@ _efl_canvas_vg_object_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Vg_Object_Dat
    pd->user_entry = NULL;
    evas_cache_vg_entry_del(pd->vg_entry);
 
-   //Close files after deleting entry.
-   if (pd->file)
-     {
-        eina_file_close(pd->file);
-        pd->file = NULL;
-     }
-   if (pd->key)
-     {
-        eina_stringshare_del(pd->key);
-        pd->key = NULL;
-     }
-
    efl_destructor(efl_super(eo_obj, MY_CLASS));
 }
 
@@ -1029,13 +945,13 @@ evas_object_vg_animated_frame_set(Evas_Object *obj, int frame_index)
 EAPI Eina_Bool
 evas_object_vg_mmap_set(Evas_Object *obj, const Eina_File *f, const char *key)
 {
-   return efl_file_mmap_set(obj, f, key);
+   return efl_file_simple_mmap_load(obj, f, key);
 }
 
 EAPI Eina_Bool
 evas_object_vg_file_set(Evas_Object *obj, const char *file, const char *key)
 {
-   return efl_file_set(obj, file, key);
+   return efl_file_simple_load(obj, file, key);
 }
 
 #include "efl_canvas_vg_object.eo.c"
index c02034c..19793ed 100644 (file)
@@ -85,8 +85,9 @@ class @beta Efl.Canvas.Vg.Object extends Efl.Canvas.Object implements Efl.File,
       Efl.Object.constructor;
       Efl.Object.finalize;
       Efl.Object.destructor;
-      Efl.File.mmap { get; set; }
-      Efl.File.file { get; set; }
+      Efl.File.load;
+      Efl.File.unload;
+      Efl.File.loaded { get; }
       Efl.File_Save.save;
       Efl.Gfx.Frame_Controller.animated { get; }
       Efl.Gfx.Frame_Controller.frame { get; set; }
index d91feaf..ccac776 100644 (file)
@@ -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)
 {
-   _mesh_fini(pd);
-   _mesh_init(pd);
-
-   if (f == NULL) return EINA_FALSE;
-
-   evas_common_load_model_from_eina_file(obj, f);
-
-   return EINA_TRUE;
-}
+   const Eina_File *f;
+   Eina_Error err;
 
-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;
-}
+   if (efl_file_loaded_get(obj)) return 0;
 
-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;
-}
+   err = efl_file_load(efl_super(obj, MY_CLASS));
+   if (err) return err;
 
-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;
+   f = efl_file_mmap_get(obj);
+   if (f == NULL) return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
 
-   evas_common_load_model_from_file(obj, file);
-   return EINA_TRUE;
+   evas_common_load_model_from_eina_file(obj, f);
+
+   return 0;
 }
 
 EOLIAN static Eina_Bool
index 0284654..64441db 100644 (file)
@@ -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;
    }
 
index 540f6c6..5533e18 100644 (file)
@@ -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)
-{
-   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)
+EOLIAN static Eina_Error
+_evas_canvas3d_texture_efl_file_load(Eo *obj, Evas_Canvas3D_Texture_Data *pd)
 {
-
    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);
 
index 0b22e86..dd5156e 100644 (file)
@@ -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;
    }
 }
index f7163b7..254580b 100644 (file)
@@ -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;
    }
 }
index 64757d6..a7b6e48 100755 (executable)
@@ -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
@@ -367,8 +367,7 @@ evas_object_image_load_error_get(const Evas_Object *obj)
    //TIZEN_ONLY(20180515): keep compatibility
    //EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_GENERIC);
    EVAS_IMAGE_API(obj, EVAS_LOAD_ERROR_NONE);
-   //
-   return _evas_image_load_error_get(obj);
+   return efl_gfx_image_load_error_get(obj);
 }
 
 EAPI void
@@ -1336,20 +1335,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"
index fa2cb75..fbada80 100755 (executable)
@@ -169,11 +169,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);
index dcb5a38..f63b7b0 100755 (executable)
@@ -867,6 +867,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)
 {
index 5476a21..1d8e48b 100644 (file)
@@ -50,9 +50,8 @@ struct _Efl_Canvas_Vg_Object_Data
    Eina_Array                 cleanup;
    double                     align_x, align_y;
    Efl_Canvas_Vg_Fill_Mode    fill_mode;
+
    int                        frame_idx;
-   Eina_File                 *file;
-   Eina_Stringshare          *key;
    int                        cached_frame_idx;
 
    Eina_Bool                  changed : 1;
index efe17e5..fb1e8e2 100644 (file)
@@ -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)
index 2dc42b0..20240a4 100644 (file)
@@ -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));
 
index 96b33b5..86e1aaf 100644 (file)
@@ -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);
index 660010b..f64c713 100644 (file)
@@ -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);
index 65508a0..8304979 100644 (file)
@@ -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);
index 9e7da26..da6ad42 100644 (file)
@@ -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;
index 424b57b..aba0373 100644 (file)
        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);                              \