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
This commit is contained in:
Mike Blumenkrantz 2019-09-24 16:59:44 -04:00
parent 1511430c29
commit d13bd5fa8e
2 changed files with 20 additions and 8 deletions

View File

@ -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;

View File

@ -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"