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)
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
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);
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);
}
}
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);
}
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),
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),
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));
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));
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);
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);
// 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
_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)));
}
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))
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
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);
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);
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;
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");
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)
);
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)
);
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)
);
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;
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;
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,
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;
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;
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,
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));
{
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;
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);
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);
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);
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);
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);
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);
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);
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)
);
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));
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);
{
/* 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 */
* 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 */
{
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));
{
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. */
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});
{
// 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"))
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));
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;
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);
}
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;
}
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);
}
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);
}
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);
}
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");
}
}));
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);
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);
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);
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);
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);
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);
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);
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);
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));
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);
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);
}
#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);
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);
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)); \
#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)); \
#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, \
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);
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);
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);
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);
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)]);
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)]);
}
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);
_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);
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);
_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);
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]);
* 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)
{
/* 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)
{
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);
//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);
//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);
#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); \
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); \
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); \
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);
}
}
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);
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);
}
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);
typedef struct _Efl_Io_File_Data
{
- const char *path;
uint32_t flags;
uint32_t mode;
uint64_t last_position;
}
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)))
}
efl_destructor(efl_super(o, MY_CLASS));
-
- eina_stringshare_del(pd->path);
}
EOLIAN static Efl_Object *
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;
}
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)
{
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;
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));
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),
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),
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);
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),
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);
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);
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);
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);
}
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
* 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 *
implements {
Efl.Object.constructor;
Efl.Object.destructor;
- Efl.File.file { set; }
- Efl.File.mmap { set; }
+ Efl.File.load;
}
}
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;
/************************** 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;
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 *
_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;
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);
{
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);
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);
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
{
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));
_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);
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);
}
evas_event_thaw(tev);
evas_event_thaw_eval(tev);
- return 0;
+ return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
}
void
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);
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);
_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
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 *
***********************************************************************************/
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;
#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"
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"
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;
}
}
--- /dev/null
+#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
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.]]
# '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()]
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);
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)
{
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
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
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; }
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.
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; }
};
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},
_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;
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);
_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;
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)
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
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),
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 */
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
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)
_efl_ui_image_sizing_eval(obj);
- return EINA_TRUE;
+ return 0;
}
static void
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;
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 };
{ 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));
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)
{
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
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;
{
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,
{
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);
}
}
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;
}
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
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.
}
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; }
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));
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;
}
}
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);
{
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);
{
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);
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
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 };
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);
{
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 :
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
}
}
-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);
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);
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
{
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;
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;
{
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,
{
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 ?
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
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; }
/* 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
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);
_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;
}
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));
}
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
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;
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)
{
}
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"
}
}
implements {
- Efl.File.file { set; }
+ Efl.File.load;
}
}
}
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);
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);
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;
}
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:
{
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
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
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;
}
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
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))
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*
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
}
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;
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
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; }
}
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;
}
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"))
{
{
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);
}
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 */
_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)
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; }
}
}
}
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)
{
}
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;
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
{
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);
}
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);
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 ]]
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;
}
}
-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) */
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
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
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]]
}
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));
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
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 */
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; }
}
}
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));
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 *
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 */
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; }
}
Eina_Bool on_hold : 1;
Eina_Bool is_video : 1;
Eina_Bool was_video : 1;
+ Eina_Bool loaded : 1;
};
/**
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; }
Eina_Bool remember_play : 1;
Eina_Bool seek : 1;
Eina_Bool seeking : 1;
+ Eina_Bool loaded : 1;
};
struct _Emotion_Xattr_Data
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;
{
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);
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);
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
#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);
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
{
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));
}
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; }
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; }
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;
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
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));
}
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"
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; }
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
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;
}
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);
Efl.Object.destructor;
Evas.Canvas3D.Object.update_notify;
Evas.Canvas3D.Object.change_notify;
- Efl.File.mmap { set; get; }
+ Efl.File.load;
}
}
[[Internal class for legacy support of Evas Image.]]
data: null;
implements {
- Efl.File.mmap { get; set; }
+ Efl.File.load;
}
}
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);
}
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
//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
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"
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);
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)
{
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;
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)
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);
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));
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));
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);
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);
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);
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);
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);
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);
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);
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);
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);
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;
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); \
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); \