summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-12 19:33:31 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-25 20:42:39 +0200
commit2a970046bc6355af59e0b4c0f7d44e0b44d764bb (patch)
tree6490f174c52aef971c7223ddc5e0db1949986e03
parent6d0b0baf9bec36a364224eb6e6c5d53adc4f2adf (diff)
downloadefl-2a970046bc6355af59e0b4c0f7d44e0b44d764bb.tar.gz
efl_ui_spotlight_container: mirror the behavior of view_manager
setting the parent here is usefull, as we can forgot about this object then, and do not have to free the object by hand. Differential Revision: https://phab.enlightenment.org/D9305
-rw-r--r--src/bin/elementary/test_ui_spotlight.c2
-rw-r--r--src/lib/elementary/efl_ui_spotlight_container.c4
-rw-r--r--src/tests/elementary/efl_ui_test_spotlight.c2
3 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c
index bcb6fbbd3e..ff0cbdd6f5 100644
--- a/src/bin/elementary/test_ui_spotlight.c
+++ b/src/bin/elementary/test_ui_spotlight.c
@@ -347,7 +347,7 @@ indicator_icon_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Params *params = data;
- params->indicator = efl_add(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS, params->spotlight);
+ params->indicator = efl_new(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS);
efl_ui_spotlight_indicator_set(params->spotlight, params->indicator);
}
diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c
index 37ee165667..45afd99b1b 100644
--- a/src/lib/elementary/efl_ui_spotlight_container.c
+++ b/src/lib/elementary/efl_ui_spotlight_container.c
@@ -637,6 +637,10 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Da
pd->indicator = indicator;
if (pd->indicator)
{
+ EINA_SAFETY_ON_FALSE_RETURN(efl_ownable_get(pd->indicator));
+ efl_parent_set(pd->indicator, obj);
+ //the api indicates that the caller passes ownership to this function, so we need to unref here
+ efl_unref(pd->indicator);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
if (pd->position != -1)
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position);
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index 6b5a79291d..0bad5c362f 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -81,7 +81,7 @@ _create_indicator(void)
{
Eo *obj;
- obj = efl_add(efl_ui_spotlight_indicator_realized_class_get(), win);
+ obj = efl_new(efl_ui_spotlight_indicator_realized_class_get());
efl_object_override(obj, &indicator_tracker);
return obj;