summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_smart.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:09 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-02-27 13:17:10 -0500
commit6326e18b3fb2a4757f8ffa22be5d55a75da23049 (patch)
tree31d586b52638aa0d0b1c759869a8e3368c9daf5d /src/lib/edje/edje_smart.c
parent7924660d54500285d3844bfa384394c683825cd9 (diff)
efl.file: improve api a bit
Summary: the previous implementation/api had a number of issues: * "file" property contained both "file" and "key" values - also performed file loading operation * "load_error" property which was specific to image objects * no methods for controlling file loading/unloading this patch attempts the following changes: * split "file" property into "file" and "key" properties - also remove "key" from existing "mmap" property * remove "load_error" * directly return error codes from operations * add "load" and "unload" methods for directly controlling load state * add implicit file loading if file/mmap is set during construction * rewrite all efl.file implementations to move file loading into load() method * rewrite all usage of efl.file api based on these changes * add C extension functions to mimic previous behavior ref T7577 Reviewers: segfaultxavi, bu5hm4n, cedric Reviewed By: segfaultxavi Subscribers: vitor.sousa, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7577 Differential Revision: https://phab.enlightenment.org/D8018
Diffstat (limited to 'src/lib/edje/edje_smart.c')
-rw-r--r--src/lib/edje/edje_smart.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index b7ca9c0..14f3d50 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -95,7 +95,7 @@ _efl_canvas_layout_efl_object_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Ef
95 Edje_Load_Error error; 95 Edje_Load_Error error;
96 96
97 const char *file, *edje_group; 97 const char *file, *edje_group;
98 efl_file_get(eo_obj, &file, &edje_group); 98 efl_file_simple_get(eo_obj, &file, &edje_group);
99 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file); 99 EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
100 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group); 100 EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
101 101
@@ -402,50 +402,55 @@ _efl_canvas_layout_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Edje *e
402 _edje_recalc_do(ed); 402 _edje_recalc_do(ed);
403} 403}
404 404
405EOLIAN static Eina_Bool 405EOLIAN static Eina_Error
406_efl_canvas_layout_efl_file_mmap_set(Eo *obj, Edje *pd EINA_UNUSED, 406_efl_canvas_layout_efl_file_load(Eo *obj, Edje *ed)
407 const Eina_File *f, const char *key)
408{ 407{
409 Eina_Bool ret; 408 Eina_Error err;
410 Eina_Array *nested; 409 Eina_Array *nested;
411 410
412 ret = EINA_FALSE; 411 if (efl_file_loaded_get(obj)) return 0;
412
413 err = efl_file_load(efl_super(obj, MY_CLASS));
414 if (err)
415 {
416 if (err == ENOENT)
417 ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
418 else if (err == ENOMEM)
419 ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
420 else if ((err == EPERM) || (err == EACCES))
421 ed->load_error = EDJE_LOAD_ERROR_PERMISSION_DENIED;
422 else
423 ed->load_error = EDJE_LOAD_ERROR_GENERIC;
424 return err;
425 }
413 426
414 nested = eina_array_new(8); 427 nested = eina_array_new(8);
415 428
416 if (_edje_object_file_set_internal(obj, f, key, NULL, NULL, nested)) 429 err = _edje_object_file_set_internal(obj, efl_file_mmap_get(obj), efl_file_key_get(obj), NULL, NULL, nested);
417 ret = EINA_TRUE;
418 430
419 eina_array_free(nested); 431 eina_array_free(nested);
420 _edje_object_orientation_inform(obj); 432 _edje_object_orientation_inform(obj);
421 433
422 return ret; 434 return err;
423}
424
425EOLIAN static void
426_efl_canvas_layout_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Edje *pd,
427 const Eina_File **f, const char **key)
428{
429 if (f) *f = pd->file ? pd->file->f : NULL;
430 if (key) *key = pd->group;
431} 435}
432 436
433EAPI Eina_Bool 437EAPI Eina_Bool
434edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group) 438edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group)
435{ 439{
436 return efl_file_mmap_set(obj, file, group); 440 return efl_file_simple_mmap_load(obj, file, group);
437} 441}
438 442
439EAPI Eina_Bool 443EAPI Eina_Bool
440edje_object_file_set(Edje_Object *obj, const char *file, const char *group) 444edje_object_file_set(Edje_Object *obj, const char *file, const char *group)
441{ 445{
442 return efl_file_set(obj, file, group); 446 return efl_file_simple_load(obj, file, group);
443} 447}
444 448
445EAPI void 449EAPI void
446edje_object_file_get(const Edje_Object *obj, const char **file, const char **group) 450edje_object_file_get(const Edje_Object *obj, const char **file, const char **group)
447{ 451{
448 efl_file_get((Edje_Object *)obj, file, group); 452 if (file) *file = efl_file_get(obj);
453 if (group) *group = efl_file_key_get(obj);
449} 454}
450 455
451EOLIAN static void 456EOLIAN static void