summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-02-24 22:37:24 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-24 22:37:24 +0100
commita08c59eacf8b61dd4897e1aabab0130eb17b48b0 (patch)
treed8a2751da06b78be15ae14ca9b8ae243913ddf11 /src/lib/edje
parent78ddad3dafea60c13c00c8565acc896f913e0a70 (diff)
edje: refactor styles add logic.
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_textblock_styles.c79
1 files changed, 37 insertions, 42 deletions
diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c
index 0819b5e550..9e65253abd 100644
--- a/src/lib/edje/edje_textblock_styles.c
+++ b/src/lib/edje/edje_textblock_styles.c
@@ -267,6 +267,39 @@ _edje_textblock_style_all_update(Edje *ed)
267 eina_strbuf_free(txt); 267 eina_strbuf_free(txt);
268} 268}
269 269
270static inline Edje_Style *
271_edje_textblock_style_search(Edje *ed, const char *style)
272{
273 Edje_Style *stl = NULL;
274 Eina_List *l;
275
276 if (!style) return NULL;
277
278 EINA_LIST_FOREACH(ed->file->styles, l, stl)
279 {
280 if ((stl->name) &&
281 (!strcmp(stl->name, style))) break;
282 stl = NULL;
283 }
284
285 return stl;
286}
287
288static inline void
289_edje_textblock_style_member_add(Edje *ed, Edje_Style *stl)
290{
291 Edje_Style_Tag *tag;
292 Eina_List *l;
293
294 if (!stl) return ;
295
296 EINA_LIST_FOREACH(stl->tags, l, tag)
297 {
298 if (tag->text_class)
299 _edje_text_class_member_add(ed, tag->text_class);
300 }
301}
302
270void 303void
271_edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep) 304_edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep)
272{ 305{
@@ -282,54 +315,16 @@ _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep)
282 add the edje to the tc member list */ 315 add the edje to the tc member list */
283 desc = (Edje_Part_Description_Text *)pt->default_desc; 316 desc = (Edje_Part_Description_Text *)pt->default_desc;
284 style = edje_string_get(&desc->text.style); 317 style = edje_string_get(&desc->text.style);
285 if (style) 318 stl = _edje_textblock_style_search(ed, style);
286 { 319 _edje_textblock_style_member_add(ed, stl);
287 Eina_List *l;
288
289 EINA_LIST_FOREACH(ed->file->styles, l, stl)
290 {
291 if ((stl->name) && (!strcmp(stl->name, style))) break;
292 stl = NULL;
293 }
294 }
295 if (stl)
296 {
297 Edje_Style_Tag *tag;
298 Eina_List *l;
299
300 EINA_LIST_FOREACH(stl->tags, l, tag)
301 {
302 if (tag->text_class)
303 _edje_text_class_member_add(ed, tag->text_class);
304 }
305 }
306 320
307 /* If any other classes exist add them */ 321 /* If any other classes exist add them */
308 for (i = 0; i < pt->other.desc_count; ++i) 322 for (i = 0; i < pt->other.desc_count; ++i)
309 { 323 {
310 desc = (Edje_Part_Description_Text *)pt->other.desc[i]; 324 desc = (Edje_Part_Description_Text *)pt->other.desc[i];
311 style = edje_string_get(&desc->text.style); 325 style = edje_string_get(&desc->text.style);
312 if (style) 326 stl = _edje_textblock_style_search(ed, style);
313 { 327 _edje_textblock_style_member_add(ed, stl);
314 Eina_List *l;
315
316 EINA_LIST_FOREACH(ed->file->styles, l, stl)
317 {
318 if ((stl->name) && (!strcmp(stl->name, style))) break;
319 stl = NULL;
320 }
321 }
322 if (stl)
323 {
324 Edje_Style_Tag *tag;
325 Eina_List *l;
326
327 EINA_LIST_FOREACH(stl->tags, l, tag)
328 {
329 if (tag->text_class)
330 _edje_text_class_member_add(ed, tag->text_class);
331 }
332 }
333 } 328 }
334} 329}
335 330