edje: Edje_Edit - fix edje_edit_part_source_set

Summary:
Fixed edje_edit_part_source_set so that it does not destroy TEXTBLOCK.
Changed type check to switch-case to stress allowed types.

@fix

Reviewers: cedric, raster, seoz, Hermet

Reviewed By: cedric

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D931

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Andrii Kroitor 2014-06-04 19:15:19 +02:00 committed by Cedric BAIL
parent 2010de6810
commit aec9cf0a3e
1 changed files with 30 additions and 19 deletions

View File

@ -2858,27 +2858,38 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source
Evas_Object *child_obj;
//printf("Set source for part: %s [source: %s]\n", part, source);
if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
return EINA_FALSE;
_edje_if_string_free(ed, rp->part->source);
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
switch(rp->part->type)
{
_edje_real_part_swallow_clear(ed, rp);
evas_object_del(rp->typedata.swallow->swallowed_object);
rp->typedata.swallow->swallowed_object = NULL;
case EDJE_PART_TYPE_GROUP:
{
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
{
_edje_real_part_swallow_clear(ed, rp);
evas_object_del(rp->typedata.swallow->swallowed_object);
rp->typedata.swallow->swallowed_object = NULL;
}
if (source)
{
child_obj = edje_object_add(ed->base->evas);
edje_object_file_set(child_obj, ed->file->path, source);
_edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE);
}
}
case EDJE_PART_TYPE_TEXTBLOCK:
{
_edje_if_string_free(ed, rp->part->source);
if (source)
rp->part->source = eina_stringshare_add(source);
else
rp->part->source = NULL;
return EINA_TRUE;
}
case EDJE_PART_TYPE_EXTERNAL: //EXTERNAL part has source property but it cannot be changed
default:
{
return EINA_FALSE;
}
}
if (source)
{
rp->part->source = eina_stringshare_add(source);
child_obj = edje_object_add(ed->base->evas);
edje_object_file_set(child_obj, ed->file->path, source);
_edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE);
}
else
rp->part->source = NULL;
return EINA_TRUE;
}
EAPI int