{
Edje *ed;
Evas *tev;
+ Edje_Real_Part *rp;
+ Eina_List *textblocks = NULL;
+ Eina_List *sources = NULL;
+ Eina_List *externals = NULL;
Eina_List *old_swallows;
unsigned int n;
Eina_List *parts = NULL;
else
{
unsigned int i;
- int errors = 0;
/* colorclass stuff */
for (i = 0; i < ed->collection->parts_count; ++i)
ep = ed->collection->parts[i];
- if (errors)
- break;
/* Register any color classes in this parts descriptions. */
if ((ep->default_desc) && (ep->default_desc->color_class))
_edje_color_class_member_add(ed, ep->default_desc->color_class);
for (n = 0; n < ed->collection->parts_count; n++)
{
Edje_Part *ep;
- Edje_Real_Part *rp;
ep = ed->collection->parts[n];
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
if (!rp)
{
+ /* FIXME: destroy all allocated ressource, need to have a common exit point */
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
evas_event_thaw(tev);
evas_event_thaw_eval(tev);
rp->object = evas_object_text_add(ed->base.evas);
evas_object_text_font_source_set(rp->object, ed->path);
break;
- case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
+ sources = eina_list_append(sources, rp);
+ case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_EXTERNAL:
+ if (ep->type == EDJE_PART_TYPE_EXTERNAL)
+ externals = eina_list_append(externals, rp);
rp->object = evas_object_rectangle_add(ed->base.evas);
evas_object_color_set(rp->object, 0, 0, 0, 0);
evas_object_pass_events_set(rp->object, 1);
_edje_callbacks_focus_add(rp->object, ed, rp);
break;
case EDJE_PART_TYPE_TEXTBLOCK:
+ textblocks = eina_list_append(textblocks, rp);
rp->object = evas_object_textblock_add(ed->base.evas);
break;
case EDJE_PART_TYPE_BOX:
+ sources = eina_list_append(sources, rp);
rp->object = evas_object_box_add(ed->base.evas);
rp->anim = _edje_box_layout_anim_new(rp->object);
break;
case EDJE_PART_TYPE_TABLE:
+ sources = eina_list_append(sources, rp);
rp->object = evas_object_table_add(ed->base.evas);
break;
case EDJE_PART_TYPE_GRADIENT:
}
if (n > 0)
{
- Edje_Real_Part *rp;
Eina_List *l;
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
_edje_var_init(ed);
for (i = 0; i < ed->table_parts_size; i++)
{
- Edje_Real_Part *rp;
-
rp = ed->table_parts[i];
evas_object_show(rp->object);
if (_edje_block_break(ed)) break;
if ((evas_object_clipees_get(ed->base.clipper)) &&
(evas_object_visible_get(obj)))
evas_object_show(ed->base.clipper);
-
+
/* instantiate 'internal swallows' */
- for (i = 0; i < ed->table_parts_size; i++)
+ EINA_LIST_FREE(externals, rp)
+ {
+ Edje_Part_Description_External *external;
+ Evas_Object *child_obj;
+
+ external = (Edje_Part_Description_External *) rp->part->default_desc;
+ child_obj = _edje_external_type_add(rp->part->source,
+ evas_object_evas_get(ed->obj), ed->obj,
+ external->external_params, rp->part->name);
+ if (child_obj)
+ {
+ _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
+ rp->param1.external_params = _edje_external_params_parse(child_obj,
+ external->external_params);
+ _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
+ }
+ }
+
+ EINA_LIST_FREE(sources, rp)
{
- Edje_Real_Part *rp;
/* XXX: curr_item and pack_it don't require to be NULL since
* XXX: they are just used when source != NULL and type == BOX,
* XXX: and they're always set in this case, but GCC fails to
unsigned int item_count = 0;
Edje_Pack_Element *pack_it = NULL;
const char *source = NULL;
-
- rp = ed->table_parts[i];
switch (rp->part->type)
{
}
}
break;
- case EDJE_PART_TYPE_EXTERNAL:
- {
- Edje_Part_Description_External *external;
- Evas_Object *child_obj;
-
- external = (Edje_Part_Description_External *) rp->part->default_desc;
- child_obj = _edje_external_type_add(rp->part->source,
- evas_object_evas_get(ed->obj), ed->obj,
- external->external_params, rp->part->name);
- if (child_obj)
- {
- _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
- rp->param1.external_params = _edje_external_params_parse(child_obj,
- external->external_params);
- _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
- }
- }
- continue;
default:
+ /* This list should only be filled by group, box or table, nothing else. */
+ abort();
continue;
}
{
if (data == group_path_entry)
{
+ textblocks = eina_list_free(textblocks);
+ externals = eina_list_free(externals);
+ sources = eina_list_free(sources);
_edje_thaw(ed);
_edje_unblock(ed);
_edje_unref(ed);
return 0;
}
}
-
+
child_obj = edje_object_add(ed->base.evas);
group_path = eina_list_append(group_path, group_path_entry);
if (rp->part->type == EDJE_PART_TYPE_GROUP)
if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path))
{
+ textblocks = eina_list_free(textblocks);
+ externals = eina_list_free(externals);
+ sources = eina_list_free(sources);
_edje_thaw(ed);
_edje_unblock(ed);
_edje_unref(ed);
_edje_file_del(ed);
-
+
if (group_path_started)
{
while (group_path)
{
const char *name;
Evas_Object *swallow;
-
+
name = eina_list_data_get(old_swallows);
old_swallows = eina_list_remove_list(old_swallows, old_swallows);
-
+
swallow = eina_list_data_get(old_swallows);
old_swallows = eina_list_remove_list(old_swallows, old_swallows);
-
+
edje_object_part_swallow(obj, name, swallow);
eina_stringshare_del(name);
}
}
-
+
_edje_recalc(ed);
_edje_thaw(ed);
_edje_unblock(ed);
_edje_unref(ed);
ed->load_error = EDJE_LOAD_ERROR_NONE;
_edje_emit(ed, "load", NULL);
- /* instantiate 'internal swallows' */
- for (i = 0; i < ed->table_parts_size; i++)
- {
- Edje_Real_Part *rp;
-
- rp = ed->table_parts[i];
- if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
- (rp->part->default_desc))
- {
- Edje_Part_Description_Text *text;
- Edje_Style *stl = NULL;
- const char *style;
-
- text = (Edje_Part_Description_Text *) rp->part->default_desc;
- style = edje_string_get(&text->text.style);
- if (style)
- {
- Eina_List *l;
-
- EINA_LIST_FOREACH(ed->file->styles, l, stl)
- {
- if ((stl->name) && (!strcmp(stl->name, style))) break;
- stl = NULL;
- }
- }
- if (stl)
- {
- if (evas_object_textblock_style_get(rp->object) != stl->style)
- evas_object_textblock_style_set(rp->object, stl->style);
- }
- }
- }
+
+ /* instantiate 'internal textblock style' */
+ EINA_LIST_FREE(textblocks, rp)
+ if (rp->part->default_desc)
+ {
+ Edje_Part_Description_Text *text;
+ Edje_Style *stl = NULL;
+ const char *style;
+
+ text = (Edje_Part_Description_Text *) rp->part->default_desc;
+ style = edje_string_get(&text->text.style);
+ if (style)
+ {
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(ed->file->styles, l, stl)
+ {
+ if ((stl->name) && (!strcmp(stl->name, style))) break;
+ stl = NULL;
+ }
+ }
+ if (stl)
+ {
+ if (evas_object_textblock_style_get(rp->object) != stl->style)
+ evas_object_textblock_style_set(rp->object, stl->style);
+ }
+ }
}
_edje_entry_init(ed);
evas_event_thaw(tev);