forked from enlightenment/efl
Canvas text: fix re-add of existing style to list
Styles were appended regardless their key already existing. Now it's fixed. Also, improved readability of 'style_set'.
This commit is contained in:
parent
a827f418d9
commit
36a2e29624
|
@ -7009,10 +7009,13 @@ _efl_canvas_text_style_set(Eo *eo_obj, Efl_Canvas_Text_Data *o, const char *key,
|
||||||
ts = _style_by_key_find(o, key);
|
ts = _style_by_key_find(o, key);
|
||||||
|
|
||||||
if (!ts && !style)
|
if (!ts && !style)
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ts && !style)
|
if (ts && !style)
|
||||||
{
|
{
|
||||||
|
// Delete the style
|
||||||
if (!key)
|
if (!key)
|
||||||
{
|
{
|
||||||
evas_textblock_style_set(ts, "");
|
evas_textblock_style_set(ts, "");
|
||||||
|
@ -7023,28 +7026,23 @@ _efl_canvas_text_style_set(Eo *eo_obj, Efl_Canvas_Text_Data *o, const char *key,
|
||||||
ts->objects = eina_list_remove(ts->objects, eo_obj);
|
ts->objects = eina_list_remove(ts->objects, eo_obj);
|
||||||
evas_textblock_style_free(ts);
|
evas_textblock_style_free(ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
else if (!ts)
|
else if (!ts && style)
|
||||||
{
|
{
|
||||||
Evas_Textblock_Style *tmp = NULL;
|
Evas_Textblock_Style *tmp = NULL;
|
||||||
|
|
||||||
|
// No entry for respective key, so create one.
|
||||||
ts = evas_textblock_style_new();
|
ts = evas_textblock_style_new();
|
||||||
_textblock_style_generic_set(eo_obj, ts, &tmp);
|
evas_textblock_style_set(ts, style);
|
||||||
}
|
|
||||||
|
|
||||||
evas_textblock_style_set(ts, style);
|
|
||||||
|
|
||||||
if (!key)
|
|
||||||
{
|
|
||||||
o->style = ts;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ts->key = eina_stringshare_add(key);
|
ts->key = eina_stringshare_add(key);
|
||||||
o->styles = eina_list_append(o->styles, ts);
|
o->styles = eina_list_append(o->styles, ts);
|
||||||
|
_textblock_style_generic_set(eo_obj, ts, &tmp);
|
||||||
}
|
}
|
||||||
end:
|
else if (ts && style)
|
||||||
|
{
|
||||||
|
evas_textblock_style_set(ts, style);
|
||||||
|
}
|
||||||
|
|
||||||
o->format_changed = EINA_TRUE;
|
o->format_changed = EINA_TRUE;
|
||||||
_evas_textblock_invalidate_all(o);
|
_evas_textblock_invalidate_all(o);
|
||||||
_evas_textblock_changed(o, eo_obj);
|
_evas_textblock_changed(o, eo_obj);
|
||||||
|
|
Loading…
Reference in New Issue