From 57fd7d8dfa8a65e5dfb695976714ae798953a0b6 Mon Sep 17 00:00:00 2001 From: YeongJong Lee Date: Wed, 23 May 2018 19:35:18 +0900 Subject: [PATCH] elm: fix backward compatibility for "default" name part Summary: If you use legacy content/text set/get/unset with "default" part name, _elm_layout_part_aliasing_eval change the part name to "elm.swallow.content". Because internal _content_set/get/unset checked only "default" string, legacy content/test set/get/unset with "default" part name was not working. This patch fixes that bug. Test Plan: elm_object_part_content/text_set(obj, "default", content) Reviewers: Jaehyun_Cho, woohyun Reviewed By: Jaehyun_Cho Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6185 --- src/lib/elementary/elc_ctxpopup.c | 8 +++----- src/lib/elementary/elc_fileselector_entry.c | 4 ++-- src/lib/elementary/elc_multibuttonentry.c | 4 ++-- src/lib/elementary/elc_popup.c | 10 ++++------ src/lib/elementary/elm_notify.c | 6 +++--- src/lib/elementary/elm_panel.c | 6 +++--- src/lib/elementary/elm_scroller.c | 15 ++++++--------- 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index 5b82bd2..a1ba767 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -707,7 +707,7 @@ _elm_ctxpopup_efl_ui_widget_theme_apply(Eo *obj, Elm_Ctxpopup_Data *sd) static Eina_Bool _elm_ctxpopup_content_set(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part, Evas_Object *content) { - if ((part) && (strcmp(part, "default"))) + if ((part) && (strcmp(part, "elm.swallow.content"))) { return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content); } @@ -740,7 +740,7 @@ _elm_ctxpopup_content_set(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part, Evas static Evas_Object* _elm_ctxpopup_content_get(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part) { - if ((part) && (strcmp(part, "default"))) + if ((part) && (strcmp(part, "elm.swallow.content"))) return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part)); return sd->content; @@ -751,7 +751,7 @@ _elm_ctxpopup_content_unset(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part) { Evas_Object *content = NULL; - if ((part) && (strcmp(part, "default"))) + if ((part) && (strcmp(part, "elm.swallow.content"))) return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part)); content = sd->content; @@ -1820,7 +1820,6 @@ ELM_PART_OVERRIDE(elm_ctxpopup, ELM_CTXPOPUP, Elm_Ctxpopup_Data) ELM_PART_OVERRIDE_CONTENT_SET(elm_ctxpopup, ELM_CTXPOPUP, Elm_Ctxpopup_Data) ELM_PART_OVERRIDE_CONTENT_GET(elm_ctxpopup, ELM_CTXPOPUP, Elm_Ctxpopup_Data) ELM_PART_OVERRIDE_CONTENT_UNSET(elm_ctxpopup, ELM_CTXPOPUP, Elm_Ctxpopup_Data) -ELM_PART_CONTENT_DEFAULT_GET(elm_ctxpopup, "default") #include "elm_ctxpopup_part.eo.c" /* Efl.Part end */ @@ -1829,7 +1828,6 @@ ELM_PART_CONTENT_DEFAULT_GET(elm_ctxpopup, "default") #define ELM_CTXPOPUP_EXTRA_OPS \ ELM_LAYOUT_SIZING_EVAL_OPS(elm_ctxpopup), \ - ELM_PART_CONTENT_DEFAULT_OPS(elm_ctxpopup), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_ctxpopup) #include "elm_ctxpopup_item.eo.c" diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 59108cd..b935acc 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -173,7 +173,7 @@ _elm_fileselector_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Fileselect static Eina_Bool _elm_fileselector_entry_text_set(Eo *obj, Elm_Fileselector_Entry_Data *sd, const char *part, const char *label) { - if (part && strcmp(part, "default")) + if (part && strcmp(part, "elm.text")) { efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); } @@ -185,7 +185,7 @@ _elm_fileselector_entry_text_set(Eo *obj, Elm_Fileselector_Entry_Data *sd, const static const char * _elm_fileselector_entry_text_get(Eo *obj, Elm_Fileselector_Entry_Data *sd, const char *part) { - if (part && strcmp(part, "default")) + if (part && strcmp(part, "elm.text")) { const char *text = NULL; text = efl_text_get(efl_part(efl_super(obj, MY_CLASS), part)); diff --git a/src/lib/elementary/elc_multibuttonentry.c b/src/lib/elementary/elc_multibuttonentry.c index 5d6b1c6..2a3e54c 100644 --- a/src/lib/elementary/elc_multibuttonentry.c +++ b/src/lib/elementary/elc_multibuttonentry.c @@ -1624,7 +1624,7 @@ _view_init(Evas_Object *obj, Elm_Multibuttonentry_Data *sd) static void _elm_multibuttonentry_text_set(Eo *obj, Elm_Multibuttonentry_Data *sd EINA_UNUSED, const char *part, const char *label) { - if (!part || !strcmp(part, "default") || !strcmp(part, "elm.text")) + if (!part || !strcmp(part, "elm.text")) { if (label) _label_set(obj, label); } @@ -1641,7 +1641,7 @@ _elm_multibuttonentry_text_get(Eo *obj, Elm_Multibuttonentry_Data *sd, const cha { const char *text = NULL; - if (!part || !strcmp(part, "default")) + if (!part || !strcmp(part, "elm.text")) { text = sd->label_str; } diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c index e2ed7ed..0ab6355 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c @@ -1720,7 +1720,7 @@ _elm_popup_content_set(Eo *obj, Elm_Popup_Data *_pd EINA_UNUSED, const char *par unsigned int i; Eina_Bool ret = EINA_TRUE; - if (!part || !strcmp(part, "default")) + if (!part || !strcmp(part, "elm.swallow.content")) ret = _content_set(obj, content); else if (!strcmp(part, "title,icon")) ret = _title_icon_set(obj, content); @@ -1801,7 +1801,7 @@ _elm_popup_content_get(Eo *obj, Elm_Popup_Data *_pd, const char *part) Evas_Object *content = NULL; unsigned int i; - if (!part || !strcmp(part, "default")) + if (!part || !strcmp(part, "elm.swallow.content")) content = _content_get(_pd); else if (!strcmp(part, "title,text")) content = _title_icon_get(_pd); @@ -1874,7 +1874,7 @@ _elm_popup_content_unset(Eo *obj, Elm_Popup_Data *_pd EINA_UNUSED, const char *p Evas_Object *content = NULL; unsigned int i; - if (!part || !strcmp(part, "default")) + if (!part || !strcmp(part, "elm.swallow.content")) content = _content_unset(obj); else if (!strcmp(part, "title,icon")) content = _title_icon_unset(obj); @@ -2557,7 +2557,6 @@ ELM_PART_OVERRIDE_CONTENT_GET(elm_popup, ELM_POPUP, Elm_Popup_Data) ELM_PART_OVERRIDE_CONTENT_UNSET(elm_popup, ELM_POPUP, Elm_Popup_Data) ELM_PART_OVERRIDE_TEXT_SET(elm_popup, ELM_POPUP, Elm_Popup_Data) ELM_PART_OVERRIDE_TEXT_GET(elm_popup, ELM_POPUP, Elm_Popup_Data) -ELM_PART_CONTENT_DEFAULT_GET(elm_popup, "default") #include "elm_popup_part.eo.c" /* Efl.Part end */ @@ -2566,8 +2565,7 @@ ELM_PART_CONTENT_DEFAULT_GET(elm_popup, "default") #define ELM_POPUP_EXTRA_OPS \ ELM_LAYOUT_SIZING_EVAL_OPS(elm_popup), \ - EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_popup), \ - ELM_PART_CONTENT_DEFAULT_OPS(elm_popup) + EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_popup) #include "elm_popup.eo.c" #include "elm_popup_item.eo.c" diff --git a/src/lib/elementary/elm_notify.c b/src/lib/elementary/elm_notify.c index a3923c9..91297e1 100644 --- a/src/lib/elementary/elm_notify.c +++ b/src/lib/elementary/elm_notify.c @@ -467,19 +467,19 @@ _elm_notify_content_unset(Eo *obj, Elm_Notify_Data *sd, const char *part) EOLIAN static Eina_Bool _elm_notify_efl_content_content_set(Eo *obj, Elm_Notify_Data *sd, Evas_Object *content) { - return _elm_notify_content_set(obj, sd, NULL, content); + return _elm_notify_content_set(obj, sd, "default", content); } EOLIAN static Evas_Object* _elm_notify_efl_content_content_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd) { - return _elm_notify_content_get(obj, sd, NULL); + return _elm_notify_content_get(obj, sd, "default"); } EOLIAN static Evas_Object* _elm_notify_efl_content_content_unset(Eo *obj, Elm_Notify_Data *sd) { - return _elm_notify_content_unset(obj, sd, NULL); + return _elm_notify_content_unset(obj, sd, "default"); } /* TIZEN_ONLY(20160629) : add "show,finished" internal callback */ diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 429e49c..3f9f9b0 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -789,7 +789,7 @@ _elm_panel_content_set(Eo *obj, Elm_Panel_Data *sd, const char *part, Evas_Objec ERR("elm.swallow.event is being used for panel internally. Don't touch this part!"); return EINA_FALSE; } - if (strcmp(part, "default")) + if (strcmp(part, "elm.swallow.content") || (content == sd->bx)) { Eina_Bool int_ret = EINA_TRUE; int_ret = efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content); @@ -827,7 +827,7 @@ _elm_panel_content_get(Eo *obj, Elm_Panel_Data *sd, const char *part) ERR("elm.swallow.event is being used for panel internally. Don't touch this part!"); return NULL; } - if (strcmp(part, "default")) + if (strcmp(part, "elm.swallow.content")) { Evas_Object *ret = NULL; ret = efl_content_get(efl_part(efl_super(obj, MY_CLASS), part)); @@ -851,7 +851,7 @@ _elm_panel_content_unset(Eo *obj, Elm_Panel_Data *sd, const char *part) ERR("elm.swallow.event is being used for panel internally. Don't touch this part!"); return NULL; } - if (strcmp(part, "default")) + if (strcmp(part, "elm.swallow.content")) { ret = efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part)); return ret; diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index fb0ce4e..bc9b1fd 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -657,7 +657,7 @@ _loop_content_set(Evas_Object *obj, Elm_Scroller_Data *sd, Evas_Object *content) static Eina_Bool _elm_scroller_content_set(Eo *obj, Elm_Scroller_Data *sd, const char *part, Evas_Object *content) { - if (part && strcmp(part, "default")) + if (part && strcmp(part, "elm.swallow.content")) { return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content); } @@ -700,7 +700,7 @@ _elm_scroller_content_set(Eo *obj, Elm_Scroller_Data *sd, const char *part, Evas static Evas_Object* _elm_scroller_content_get(const Eo *obj, Elm_Scroller_Data *sd, const char *part) { - if (part && strcmp(part, "default")) + if (part && strcmp(part, "elm.swallow.content")) { return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part)); } @@ -712,7 +712,7 @@ static Evas_Object* _elm_scroller_content_unset(Eo *obj, Elm_Scroller_Data *sd, const char *part) { Evas_Object *ret = NULL; - if (part && strcmp(part, "default")) + if (part && strcmp(part, "elm.swallow.content")) { return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part)); } @@ -733,19 +733,19 @@ _elm_scroller_content_unset(Eo *obj, Elm_Scroller_Data *sd, const char *part) EOLIAN static Eina_Bool _elm_scroller_efl_content_content_set(Eo *obj, Elm_Scroller_Data *sd, Eo *content) { - return _elm_scroller_content_set(obj, sd, "default", content); + return _elm_scroller_content_set(obj, sd, "elm.swallow.content", content); } EOLIAN static Eo * _elm_scroller_efl_content_content_get(const Eo *obj, Elm_Scroller_Data *sd) { - return _elm_scroller_content_get(obj, sd, "default"); + return _elm_scroller_content_get(obj, sd, "elm.swallow.content"); } EOLIAN static Eo * _elm_scroller_efl_content_content_unset(Eo *obj, Elm_Scroller_Data *sd) { - return _elm_scroller_content_unset(obj, sd, "default"); + return _elm_scroller_content_unset(obj, sd, "elm.swallow.content"); } static void @@ -1382,8 +1382,6 @@ ELM_PART_OVERRIDE(elm_scroller, ELM_SCROLLER, Elm_Scroller_Data) ELM_PART_OVERRIDE_CONTENT_SET(elm_scroller, ELM_SCROLLER, Elm_Scroller_Data) ELM_PART_OVERRIDE_CONTENT_GET(elm_scroller, ELM_SCROLLER, Elm_Scroller_Data) ELM_PART_OVERRIDE_CONTENT_UNSET(elm_scroller, ELM_SCROLLER, Elm_Scroller_Data) -// FIXME: should be "content" but "default" was legacy API -ELM_PART_CONTENT_DEFAULT_GET(elm_scroller, "default") #include "elm_scroller_part.eo.c" /* Efl.Part end */ @@ -1391,7 +1389,6 @@ ELM_PART_CONTENT_DEFAULT_GET(elm_scroller, "default") /* Internal EO APIs and hidden overrides */ #define ELM_SCROLLER_EXTRA_OPS \ - ELM_PART_CONTENT_DEFAULT_OPS(elm_scroller), \ ELM_LAYOUT_SIZING_EVAL_OPS(elm_scroller), \ EFL_CANVAS_GROUP_ADD_OPS(elm_scroller) -- 2.7.4