From 495edbd9958ff077e44a62bf83f1a9032875f423 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 55507d7252..9423e04fce 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -700,7 +700,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); } @@ -733,7 +733,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; @@ -744,7 +744,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; @@ -1572,7 +1572,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 */ @@ -1581,7 +1580,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 59108cd7aa..b935acc0c0 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 f91ba38a9d..a155d85474 100644 --- a/src/lib/elementary/elc_multibuttonentry.c +++ b/src/lib/elementary/elc_multibuttonentry.c @@ -1477,7 +1477,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); } @@ -1494,7 +1494,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 e38625d793..dde37d9b55 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c @@ -1234,7 +1234,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); @@ -1295,7 +1295,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); @@ -1363,7 +1363,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); @@ -1840,7 +1840,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 */ @@ -1849,8 +1848,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 103c74afbc..99ad393671 100644 --- a/src/lib/elementary/elm_notify.c +++ b/src/lib/elementary/elm_notify.c @@ -407,19 +407,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"); } static void diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 315725ad50..01002bedbf 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -739,7 +739,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); @@ -777,7 +777,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)); @@ -801,7 +801,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 94f743ad3b..80746e75b0 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -645,7 +645,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); } @@ -688,7 +688,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)); } @@ -700,7 +700,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)); } @@ -721,19 +721,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 @@ -1370,8 +1370,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 */ @@ -1379,7 +1377,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)