Edje text_class: Unified the _object_text_class_set code a bit more.

There were two code paths, with one missing a couple of calls. Now there's
less code duplication and less bugs.

SVN revision: 73604
This commit is contained in:
Tom Hacohen 2012-07-12 08:10:29 +00:00
parent ae1d0e3a9b
commit 9aaa7690f7
1 changed files with 14 additions and 19 deletions

View File

@ -907,7 +907,7 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
{ {
Edje *ed; Edje *ed;
Eina_List *l; Eina_List *l;
Edje_Text_Class *tc; Edje_Text_Class *tc = NULL;
unsigned int i; unsigned int i;
ed = _edje_fetch(obj); ed = _edje_fetch(obj);
@ -927,29 +927,24 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
/* Update new text class properties */ /* Update new text class properties */
eina_stringshare_replace(&tc->font, font); eina_stringshare_replace(&tc->font, font);
tc->size = size; tc->size = size;
break;
/* Update edje */
ed->dirty = 1;
ed->recalc_call = 1;
#ifdef EDJE_CALC_CACHE
ed->text_part_change = 1;
#endif
_edje_recalc(ed);
return EINA_TRUE;
} }
} }
/* No matches, create a new text class */ if (!tc)
tc = calloc(1, sizeof(Edje_Text_Class));
if (!tc) return EINA_FALSE;
tc->name = eina_stringshare_add(text_class);
if (!tc->name)
{ {
free(tc); /* No matches, create a new text class */
return EINA_FALSE; tc = calloc(1, sizeof(Edje_Text_Class));
if (!tc) return EINA_FALSE;
tc->name = eina_stringshare_add(text_class);
if (!tc->name)
{
free(tc);
return EINA_FALSE;
}
tc->font = eina_stringshare_add(font);
tc->size = size;
} }
tc->font = eina_stringshare_add(font);
tc->size = size;
for (i = 0; i < ed->table_parts_size; i++) for (i = 0; i < ed->table_parts_size; i++)
{ {