From d13bd5fa8e7e6ee844a931424c4db42fa2c9d2c6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:44 -0400 Subject: [PATCH] efl_ui/alert_popup: use normal C-based part aliasing and remove theme alias Summary: part aliasing should be done at the layout level, not using bespoke string comparisons. also this removes the "title" part of the alert_popup theme which was previously considered api Depends on D10091 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10092 --- data/elementary/themes/edc/efl/popup.edc | 1 - src/lib/elementary/efl_ui_alert_popup.c | 27 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index 176e7b8b20..22f1a94507 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -32,7 +32,6 @@ group { "efl/popup"; group { "efl/alert_popup"; data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { - alias: "title" "efl.text.title"; image { "bg"; desc { "default"; min: 100 100; diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c index 0edfff363d..9acc174c3a 100644 --- a/src/lib/elementary/efl_ui_alert_popup.c +++ b/src/lib/elementary/efl_ui_alert_popup.c @@ -25,15 +25,24 @@ static const char BUTTON_SWALLOW_NAME[EFL_UI_ALERT_POPUP_BUTTON_COUNT][20] = "efl.button2", "efl.button3"}; +static const Elm_Layout_Part_Alias_Description _text_aliases[] = +{ + {"title", "efl.text.title"}, + {NULL, NULL} +}; + static Eina_Bool _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *part, const char *label) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); + if (eina_streq(part, "efl.text.title")) { Eina_Bool changed = eina_stringshare_replace(&pd->title_text, label); if (changed) { - efl_text_set(efl_part(efl_super(obj, MY_CLASS), "title"), label); + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); if (label) elm_layout_signal_emit(obj, "efl,title,show", "efl"); else @@ -44,8 +53,6 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p efl_canvas_group_change(obj); } } - else - efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); return EINA_TRUE; } @@ -53,7 +60,9 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p const char * _efl_ui_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Alert_Popup_Data *pd, const char *part) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + if (eina_streq(part, "efl.text.title")) { if (pd->title_text) return pd->title_text; @@ -248,9 +257,10 @@ _efl_ui_alert_popup_efl_object_destructor(Eo *obj, Efl_Ui_Alert_Popup_Data *pd) } static Eina_Bool -_part_is_efl_ui_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part) +_part_is_efl_ui_alert_popup_part(const Eo *obj, const char *part) { - return (eina_streq(part, "title") || eina_streq(part, "efl.text.title")); + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) return EINA_FALSE; + return eina_streq(part, "efl.text.title"); } /* Efl.Part begin */ @@ -261,5 +271,8 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, Efl_Ui_Alert_ #include "efl_ui_alert_popup_part.eo.c" /* Efl.Part end */ +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_alert_popup) +#define EFL_UI_ALERT_POPUP_EXTRA_OPS \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(efl_ui_alert_popup) #include "efl_ui_alert_popup.eo.c"