edje: add event for inform about circular dependency

This commit add the event "circular,dependency" for edje object. Given
event is called when edje found the circular dependency between parts
in object. This event will be usefull and informative paired with
Edje_Edit API.
This commit is contained in:
Vyacheslav Reutskiy 2017-11-13 10:50:44 +02:00
parent 7764abe8f6
commit d498065cb4
3 changed files with 24 additions and 1 deletions

View File

@ -835,6 +835,27 @@ _edje_reload(void *data EINA_UNUSED, Evas_Object *obj, const char *emission EINA
_edje_load_or_show_error(obj, file, group);
}
static void
_edje_circul(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
char buf[1024] = "";
Eina_List *parts = event_info;
Eina_List *l;
char *part_name;
char *group = data;
part_name = eina_list_data_get(eina_list_last(parts));
strncat(buf, part_name, strlen(part_name));
EINA_LIST_FOREACH(parts, l, part_name)
{
strncat(buf, " -> ", strlen(" -> "));
strncat(buf, part_name, strlen(part_name));
}
fprintf(stderr, "Group '%s' have a circul dependency between parts: %s\n",
group, buf);
}
static Eina_Bool
_edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group)
{
@ -930,6 +951,7 @@ _create_edje(Evas *evas, const struct opts *opts)
edje_file_collection_list_free(groups);
}
}
evas_object_smart_callback_add(edje, "circular,dependency", _edje_circul, opts->group);
edje_object_size_max_get(edje, &maxw, &maxh);
edje_object_size_min_get(edje, &minw, &minh);

View File

@ -93,7 +93,6 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Rea
pd_##type->type.orientation.data[2], \
pd_##type->type.orientation.data[3]);
void
_edje_calc_params_clear(Edje_Calc_Params *p)
{
@ -3846,6 +3845,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
strncat(depends_path, part_name,
sizeof(depends_path) - strlen(depends_path) - 1);
}
efl_event_callback_legacy_call(ed->obj, EDJE_OBJECT_EVENT_CIRCULAR_DEPENDENCY, clist);
ERR("Circular dependency in the group '%s' : %s",
ed->group, depends_path);
eina_list_free(clist);

View File

@ -214,5 +214,6 @@ class Edje.Object (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part,
}
events {
recalc; [[Edje re-calculated the object.]]
circular,dependency; [[Edje found circular dependencies between parts of the object.]]
}
}