From: Jee-Yong Um Date: Tue, 9 Aug 2016 08:29:49 +0000 (+0900) Subject: edje: resolve user defined string with type X-Git-Tag: upstream/1.20.0~4750 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fc6d3cf900b904533820f3c375499b5240b1a61;p=platform%2Fupstream%2Fefl.git edje: resolve user defined string with type Summary: Resolve Edje_User_Defined string with type (normal/escaped/unescaped) Reviewers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4219 --- diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index b671d86..6aca9e7 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -1369,7 +1369,18 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch break; case EDJE_USER_STRING: - edje_object_part_text_set(obj, eud->part, eud->u.string.text); + switch (eud->u.string.type) + { + case EDJE_TEXT_TYPE_NORMAL: + edje_object_part_text_set(obj, eud->part, eud->u.string.text); + break; + case EDJE_TEXT_TYPE_ESCAPED: + edje_object_part_text_escaped_set(obj, eud->part, eud->u.string.text); + break; + case EDJE_TEXT_TYPE_UNESCAPED: + edje_object_part_text_unescaped_set(obj, eud->part, eud->u.string.text); + break; + } eina_stringshare_del(eud->u.string.text); break; } diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index b97c7e5..afc6f79 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2022,6 +2022,13 @@ struct _Edje_Signal_Callback Eina_Bool propagate : 1; }; +typedef enum +{ + EDJE_TEXT_TYPE_NORMAL, + EDJE_TEXT_TYPE_ESCAPED, + EDJE_TEXT_TYPE_UNESCAPED +} Edje_Text_Type; + struct _Edje_Text_Insert_Filter_Callback { const char *part; @@ -2211,6 +2218,7 @@ struct _Edje_User_Defined union { struct { const char *text; + Edje_Text_Type type; } string; struct { Evas_Object *child; diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 885ed31..2144c02 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -2256,7 +2256,7 @@ _edje_object_part_text_style_user_peek(Eo *obj EINA_UNUSED, Edje *ed, const char } static void -_edje_user_define_string(Edje *ed, const char *part, const char *raw_text) +_edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_Text_Type type) { /* NOTE: This one is tricky, text is referenced in rp->typedata.text->text for the life of the rp. So on edje_object_file_set, we should first ref it, before destroying the old @@ -2273,12 +2273,14 @@ _edje_user_define_string(Edje *ed, const char *part, const char *raw_text) return; } eud->u.string.text = raw_text; + eud->u.string.type = type; return; } eud = _edje_user_definition_new(EDJE_USER_STRING, part, ed); if (!eud) return; eud->u.string.text = raw_text; + eud->u.string.type = type; } EOLIAN Eina_Bool @@ -2298,7 +2300,7 @@ _edje_object_part_text_set(Eo *obj, Edje *ed, const char *part, const char *text return EINA_TRUE; } int_ret = _edje_object_part_text_raw_set(ed, obj, rp, part, text); - _edje_user_define_string(ed, part, rp->typedata.text->text); + _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_NORMAL); return int_ret; } @@ -2410,12 +2412,12 @@ _edje_object_part_text_escaped_set(Eo *obj, Edje *ed, const char *part, const ch p++; } int_ret = _edje_object_part_text_raw_set(ed, obj, rp, part, eina_strbuf_string_get(sbuf)); - _edje_user_define_string(ed, part, rp->typedata.text->text); + _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_ESCAPED); eina_strbuf_free(sbuf); return int_ret; } int_ret = _edje_object_part_text_raw_set(ed, obj, rp, part, text); - _edje_user_define_string(ed, part, rp->typedata.text->text); + _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_ESCAPED); return int_ret; } @@ -2548,7 +2550,7 @@ _edje_object_part_text_unescaped_set(Eo *obj, Edje *ed, const char *part, const int_ret = _edje_object_part_text_raw_set(ed, obj, rp, part, text); free(text); } - _edje_user_define_string(ed, part, rp->typedata.text->text); + _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_UNESCAPED); return int_ret; }