summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2019-09-15 20:50:05 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-24 09:18:49 +0200
commit892c26f906d23595b709b834dde6b032bdd6d89d (patch)
treedd925c1a24c478f84094f19464c577191922052a
parent759ac54e7f779456e01c194861a6d29465766275 (diff)
efl: simplify logic for widget created by factory.
In an attempt to make things more complex than they should have been, I tried to change the inheritance tree on the fly and assume widget would rely on autodeleting its children. This is way more complex of a solution than to let the View actually release all the child manually and just set the window as the default parent.h Co-authored-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9953
-rw-r--r--src/examples/elementary/layout_property_bind.c2
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c7
-rw-r--r--src/lib/efl/interfaces/efl_ui_factory.eo1
-rw-r--r--src/lib/efl/interfaces/efl_ui_view_factory.eo1
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.c76
-rw-r--r--src/lib/elementary/efl_ui_caching_factory.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_factory.c6
-rw-r--r--src/lib/elementary/efl_ui_layout.c4
-rw-r--r--src/lib/elementary/efl_ui_list_view.c4
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c32
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.eo1
-rw-r--r--src/lib/elementary/elm_priv.h2
12 files changed, 74 insertions, 64 deletions
diff --git a/src/examples/elementary/layout_property_bind.c b/src/examples/elementary/layout_property_bind.c
index da4c5e6..f9c5cf9 100644
--- a/src/examples/elementary/layout_property_bind.c
+++ b/src/examples/elementary/layout_property_bind.c
@@ -169,7 +169,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
169 efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property 169 efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property
170 efl_ui_factory_bind(priv->bt, "icon", img_factory); 170 efl_ui_factory_bind(priv->bt, "icon", img_factory);
171 171
172 efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL, bxr), 172 efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL),
173 .success = _wait_for_image, 173 .success = _wait_for_image,
174 .data = priv); 174 .data = priv);
175 175
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 4f144be..91b7ff1 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -127,10 +127,11 @@ _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Ein
127 return v; 127 return v;
128} 128}
129 129
130static Eina_Future * 130EOLIAN static Eina_Future *
131_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) 131_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models)
132{ 132{
133 return efl_future_then(factory, efl_ui_factory_create(factory, models, parent), 133 EINA_SAFETY_ON_NULL_RETURN_VAL(factory, NULL);
134 return efl_future_then(factory, efl_ui_factory_create(factory, models),
134 .success_type = EINA_VALUE_TYPE_ARRAY, 135 .success_type = EINA_VALUE_TYPE_ARRAY,
135 .success = _efl_ui_view_factory_item_created); 136 .success = _efl_ui_view_factory_item_created);
136} 137}
diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo
index bd3d84f..7eda0c6 100644
--- a/src/lib/efl/interfaces/efl_ui_factory.eo
+++ b/src/lib/efl/interfaces/efl_ui_factory.eo
@@ -23,7 +23,6 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind
23 params { 23 params {
24 models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. 24 models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item.
25 It should remain valid until the end of the function call.]] 25 It should remain valid until the end of the function call.]]
26 parent: Efl.Gfx.Entity; [[Efl canvas.]]
27 } 26 }
28 return: future<Efl.Gfx.Entity>; [[Created UI object.]] 27 return: future<Efl.Gfx.Entity>; [[Created UI object.]]
29 } 28 }
diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo
index bb1e4a4..728c259 100644
--- a/src/lib/efl/interfaces/efl_ui_view_factory.eo
+++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo
@@ -12,7 +12,6 @@ class @beta Efl.Ui.View_Factory
12 event onto.]] 12 event onto.]]
13 models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should 13 models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should
14 remain valid until the end of the function call.]] 14 remain valid until the end of the function call.]]
15 parent: Efl.Gfx.Entity; [[Efl canvas]]
16 } 15 }
17 return: future<Efl.Gfx.Entity>; [[Created UI object]] 16 return: future<Efl.Gfx.Entity>; [[Created UI object]]
18 } 17 }
diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c
index 843871e..3035c30 100644
--- a/src/lib/elementary/efl_ui_caching_factory.c
+++ b/src/lib/elementary/efl_ui_caching_factory.c
@@ -125,7 +125,7 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v)
125 // This is not ideal, we would want to gather all the request in one swoop here, 125 // This is not ideal, we would want to gather all the request in one swoop here,
126 // left for later improvement. 126 // left for later improvement.
127 f = efl_ui_factory_create(efl_super(r->factory, EFL_UI_CACHING_FACTORY_CLASS), 127 f = efl_ui_factory_create(efl_super(r->factory, EFL_UI_CACHING_FACTORY_CLASS),
128 EINA_C_ARRAY_ITERATOR_NEW(models), r->parent); 128 EINA_C_ARRAY_ITERATOR_NEW(models));
129 f = efl_future_then(r->factory, f, 129 f = efl_future_then(r->factory, f,
130 .success = _efl_ui_caching_factory_uncap_then, 130 .success = _efl_ui_caching_factory_uncap_then,
131 .success_type = EINA_VALUE_TYPE_ARRAY); 131 .success_type = EINA_VALUE_TYPE_ARRAY);
@@ -135,7 +135,6 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v)
135 eina_hash_del(r->pd->lookup, style, w); 135 eina_hash_del(r->pd->lookup, style, w);
136 _efl_ui_caching_factory_remove(r->pd, eina_list_data_find(r->pd->cache, w), w); 136 _efl_ui_caching_factory_remove(r->pd, eina_list_data_find(r->pd->cache, w), w);
137 137
138 efl_parent_set(w, r->parent);
139 efl_ui_view_model_set(w, model); 138 efl_ui_view_model_set(w, model);
140 139
141 return eina_value_object_init(w); 140 return eina_value_object_init(w);
@@ -178,7 +177,7 @@ _efl_ui_caching_factory_group_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_
178static Eina_Future * 177static Eina_Future *
179_efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, 178_efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
180 Efl_Ui_Caching_Factory_Data *pd, 179 Efl_Ui_Caching_Factory_Data *pd,
181 Eina_Iterator *models, Efl_Gfx_Entity *parent) 180 Eina_Iterator *models)
182{ 181{
183 Efl_Ui_Caching_Factory_Request *r; 182 Efl_Ui_Caching_Factory_Request *r;
184 Efl_Ui_Caching_Factory_Group_Request *gr; 183 Efl_Ui_Caching_Factory_Group_Request *gr;
@@ -195,7 +194,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
195 if (!r) return efl_loop_future_rejected(obj, ENOMEM); 194 if (!r) return efl_loop_future_rejected(obj, ENOMEM);
196 195
197 r->pd = pd; 196 r->pd = pd;
198 r->parent = efl_ref(parent);
199 r->factory = efl_ref(obj); 197 r->factory = efl_ref(obj);
200 198
201 all = calloc(1, sizeof (Eina_Future *)); 199 all = calloc(1, sizeof (Eina_Future *));
@@ -231,7 +229,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
231 { 229 {
232 w = eina_list_data_get(pd->cache); 230 w = eina_list_data_get(pd->cache);
233 _efl_ui_caching_factory_remove(pd, pd->cache, w); 231 _efl_ui_caching_factory_remove(pd, pd->cache, w);
234 efl_parent_set(w, parent);
235 232
236 efl_ui_view_model_set(w, model); 233 efl_ui_view_model_set(w, model);
237 234
@@ -243,9 +240,11 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
243 // Now create object on the fly that are missing from the cache 240 // Now create object on the fly that are missing from the cache
244 if (pd->klass) 241 if (pd->klass)
245 { 242 {
243 Efl_Ui_Widget *widget = efl_ui_widget_factory_widget_get(obj);
244
246 EINA_ITERATOR_FOREACH(models, model) 245 EINA_ITERATOR_FOREACH(models, model)
247 { 246 {
248 w = efl_add(pd->klass, parent, 247 w = efl_add(pd->klass, widget,
249 efl_ui_view_model_set(efl_added, model), 248 efl_ui_view_model_set(efl_added, model),
250 efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); 249 efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added));
251 efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); 250 efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w);
@@ -260,8 +259,7 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj,
260 return f; 259 return f;
261 } 260 }
262 261
263 f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), 262 f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), models);
264 models, parent);
265 return efl_future_then(obj, f, 263 return efl_future_then(obj, f,
266 .success = _efl_ui_caching_factory_group_create_then, 264 .success = _efl_ui_caching_factory_group_create_then,
267 .success_type = EINA_VALUE_TYPE_ARRAY, 265 .success_type = EINA_VALUE_TYPE_ARRAY,
@@ -357,7 +355,6 @@ _efl_ui_caching_factory_efl_ui_factory_release(Eo *obj,
357 } 355 }
358 356
359 // Change parent, disconnect the object and make it invisible 357 // Change parent, disconnect the object and make it invisible
360 efl_parent_set(ui_view, obj);
361 efl_gfx_entity_visible_set(ui_view, EINA_FALSE); 358 efl_gfx_entity_visible_set(ui_view, EINA_FALSE);
362 efl_ui_view_model_set(ui_view, NULL); 359 efl_ui_view_model_set(ui_view, NULL);
363 360
@@ -380,29 +377,6 @@ _efl_ui_caching_factory_efl_ui_factory_release(Eo *obj,
380} 377}
381 378
382static void 379static void
383_efl_ui_caching_factory_efl_object_invalidate(Eo *obj EINA_UNUSED,
384 Efl_Ui_Caching_Factory_Data *pd)
385{
386 // As all the objects in the cache have the factory as parent, there's no need to unparent them
387 pd->cache = eina_list_free(pd->cache);
388 eina_hash_free(pd->lookup);
389 pd->lookup = NULL;
390 pd->invalidated = EINA_TRUE;
391}
392
393static Efl_App *
394_efl_ui_caching_factory_app_get(Eo *obj)
395{
396 Efl_Object *p;
397
398 p = efl_parent_get(obj);
399 if (!p) return NULL;
400
401 // It is acceptable to just have a loop as parent and not an app
402 return efl_provider_find(obj, EFL_APP_CLASS);
403}
404
405static void
406_efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED) 380_efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED)
407{ 381{
408 Efl_Ui_Caching_Factory_Data *pd = data; 382 Efl_Ui_Caching_Factory_Data *pd = data;
@@ -418,18 +392,42 @@ _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED)
418} 392}
419 393
420static void 394static void
421_efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, Efl_Object *parent) 395_invalidate(void *data, const Efl_Event *event EINA_UNUSED)
422{ 396{
423 Efl_App *a; 397 Efl_Ui_Caching_Factory_Data *pd = data;
424 398
425 a = _efl_ui_caching_factory_app_get(obj); 399 // As all the objects in the cache have the factory as parent, there's no need to unparent them
426 if (a) efl_event_callback_del(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); 400 pd->cache = eina_list_free(pd->cache);
401 eina_hash_free(pd->lookup);
402 pd->lookup = NULL;
403 pd->invalidated = EINA_TRUE;
404}
405
406static Efl_Object *
407_efl_ui_caching_factory_efl_object_finalize(Eo *obj, Efl_Ui_Caching_Factory_Data *pd)
408{
409 Efl_App *a;
427 410
428 efl_parent_set(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), parent); 411 obj = efl_finalize(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS));
412 if (!obj) return NULL;
429 413
430 // We are fetching the parent again, just in case the update was denied 414 a = efl_provider_find(obj, EFL_APP_CLASS);
431 a = _efl_ui_caching_factory_app_get(obj);
432 if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); 415 if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd);
416
417 // The order of the invalidate event is guaranteed to happen before any children is invalidated
418 // this is not the case for the children invalidate function, which can happen in random order.
419 efl_event_callback_add(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd);
420
421 return obj;
422}
423
424static void
425_efl_ui_caching_factory_efl_object_invalidate(Eo *obj,
426 Efl_Ui_Caching_Factory_Data *pd)
427{
428 efl_event_callback_del(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd);
429
430 efl_invalidate(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS));
433} 431}
434 432
435static Eina_Error 433static Eina_Error
diff --git a/src/lib/elementary/efl_ui_caching_factory.eo b/src/lib/elementary/efl_ui_caching_factory.eo
index f0a5aae..9907da7 100644
--- a/src/lib/elementary/efl_ui_caching_factory.eo
+++ b/src/lib/elementary/efl_ui_caching_factory.eo
@@ -41,6 +41,6 @@ class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory
41 Efl.Ui.Property_Bind.property_bind; 41 Efl.Ui.Property_Bind.property_bind;
42 Efl.Ui.Widget_Factory.item_class { get; set; } 42 Efl.Ui.Widget_Factory.item_class { get; set; }
43 Efl.Object.invalidate; 43 Efl.Object.invalidate;
44 Efl.Object.parent { set; } 44 Efl.Object.finalize;
45 } 45 }
46} 46}
diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c
index 615f202..f803404 100644
--- a/src/lib/elementary/efl_ui_image_factory.c
+++ b/src/lib/elementary/efl_ui_image_factory.c
@@ -47,13 +47,11 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
47} 47}
48 48
49EOLIAN static Eina_Future * 49EOLIAN static Eina_Future *
50_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, 50_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models)
51 Eina_Iterator *models, Efl_Gfx_Entity *parent)
52{ 51{
53 if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
54 if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); 52 if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
55 53
56 return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); 54 return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models);
57} 55}
58 56
59EOLIAN static Eina_Error 57EOLIAN static Eina_Error
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index bcc947b..e0b8250 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -2238,9 +2238,7 @@ _efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_F
2238 request->tracking = tracking; 2238 request->tracking = tracking;
2239 2239
2240 models[0] = efl_ui_view_model_get(pd->obj); 2240 models[0] = efl_ui_view_model_get(pd->obj);
2241 f = efl_ui_view_factory_create_with_event(tracking->factory, 2241 f = efl_ui_view_factory_create_with_event(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(models));
2242 EINA_C_ARRAY_ITERATOR_NEW(models),
2243 pd->obj);
2244 f = efl_future_then(pd->obj, f, 2242 f = efl_future_then(pd->obj, f,
2245 .success = _content_created, 2243 .success = _content_created,
2246 .success_type = EINA_VALUE_TYPE_ARRAY, 2244 .success_type = EINA_VALUE_TYPE_ARRAY,
diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c
index e74e15c..8329301 100644
--- a/src/lib/elementary/efl_ui_list_view.c
+++ b/src/lib/elementary/efl_ui_list_view.c
@@ -959,9 +959,7 @@ _efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data
959 tracking->pd = pd; 959 tracking->pd = pd;
960 childrens[0] = item->children; 960 childrens[0] = item->children;
961 961
962 item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, 962 item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(childrens));
963 EINA_C_ARRAY_ITERATOR_NEW(childrens),
964 obj);
965 item->layout_request = efl_future_then(obj, item->layout_request, 963 item->layout_request = efl_future_then(obj, item->layout_request,
966 .success = _content_created, 964 .success = _content_created,
967 .success_type = EINA_VALUE_TYPE_ARRAY, 965 .success_type = EINA_VALUE_TYPE_ARRAY,
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index 0d6f641..a485edf 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -32,6 +32,8 @@ struct _Efl_Ui_Widget_Factory_Data
32{ 32{
33 const Efl_Class *klass; 33 const Efl_Class *klass;
34 34
35 Efl_Ui_Widget *parenting_widget;
36
35 Eina_Hash *parts; 37 Eina_Hash *parts;
36 38
37 Eina_Stringshare *style; 39 Eina_Stringshare *style;
@@ -41,9 +43,25 @@ struct _Efl_Ui_Widget_Factory_Request
41{ 43{
42 Efl_Ui_Widget_Factory_Data *pd; 44 Efl_Ui_Widget_Factory_Data *pd;
43 Efl_Ui_Factory *factory; 45 Efl_Ui_Factory *factory;
44 Eo *parent;
45}; 46};
46 47
48static Efl_Object *
49_efl_ui_widget_factory_efl_object_finalize(Eo *obj, Efl_Ui_Widget_Factory_Data *pd)
50{
51 pd->parenting_widget = efl_provider_find(obj, EFL_UI_WIDGET_CLASS);
52 if (!pd->parenting_widget) return NULL;
53
54 return efl_finalize(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS));
55}
56
57Efl_Ui_Win *
58efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory)
59{
60 Efl_Ui_Widget_Factory_Data *pd = efl_data_scope_get(factory, EFL_UI_WIDGET_FACTORY_CLASS);
61
62 return pd->parenting_widget;
63}
64
47static void 65static void
48_efl_ui_widget_factory_item_class_set(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, 66_efl_ui_widget_factory_item_class_set(Eo *obj, Efl_Ui_Widget_Factory_Data *pd,
49 const Efl_Class *klass) 67 const Efl_Class *klass)
@@ -151,7 +169,8 @@ _efl_ui_widget_factory_efl_object_constructor(Efl_Ui_Widget_Factory *obj,
151 169
152static Efl_Ui_Widget * 170static Efl_Ui_Widget *
153_efl_ui_widget_create(const Efl_Ui_Factory *factory, 171_efl_ui_widget_create(const Efl_Ui_Factory *factory,
154 const Efl_Class *klass, Eo *parent, 172 const Efl_Class *klass,
173 Efl_Ui_Widget *parent,
155 Efl_Model *model) 174 Efl_Model *model)
156{ 175{
157 Efl_Ui_Widget *w; 176 Efl_Ui_Widget *w;
@@ -169,7 +188,7 @@ _efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v EIN
169 Efl_Ui_Widget_Factory_Request *r = data; 188 Efl_Ui_Widget_Factory_Request *r = data;
170 Efl_Ui_Widget *w; 189 Efl_Ui_Widget *w;
171 190
172 w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model); 191 w = _efl_ui_widget_create(r->factory, r->pd->klass, r->pd->parenting_widget, model);
173 if (!w) return eina_value_error_init(ENOMEM); 192 if (!w) return eina_value_error_init(ENOMEM);
174 return eina_value_object_init(w); 193 return eina_value_object_init(w);
175} 194}
@@ -186,13 +205,12 @@ _efl_ui_widget_factory_create_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_
186 Efl_Ui_Widget_Factory_Request *r = data; 205 Efl_Ui_Widget_Factory_Request *r = data;
187 206
188 efl_unref(r->factory); 207 efl_unref(r->factory);
189 efl_unref(r->parent);
190 free(r); 208 free(r);
191} 209}
192 210
193static Eina_Future * 211static Eina_Future *
194_efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, 212_efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data *pd,
195 Eina_Iterator *models, Efl_Gfx_Entity *parent) 213 Eina_Iterator *models)
196{ 214{
197 Efl_Ui_Widget_Factory_Request *r; 215 Efl_Ui_Widget_Factory_Request *r;
198 Eina_Future **f; 216 Eina_Future **f;
@@ -211,7 +229,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
211 229
212 EINA_ITERATOR_FOREACH(models, model) 230 EINA_ITERATOR_FOREACH(models, model)
213 { 231 {
214 w = _efl_ui_widget_create(obj, pd->klass, parent, model); 232 w = _efl_ui_widget_create(obj, pd->klass, pd->parenting_widget, model);
215 233
216 if (!w) return efl_loop_future_rejected(obj, ENOMEM); 234 if (!w) return efl_loop_future_rejected(obj, ENOMEM);
217 eina_value_array_append(&r, w); 235 eina_value_array_append(&r, w);
@@ -225,7 +243,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
225 if (!r) return efl_loop_future_rejected(obj, ENOMEM); 243 if (!r) return efl_loop_future_rejected(obj, ENOMEM);
226 244
227 r->pd = pd; 245 r->pd = pd;
228 r->parent = efl_ref(parent);
229 r->factory = efl_ref(obj); 246 r->factory = efl_ref(obj);
230 247
231 f = calloc(count + 1, sizeof (Eina_Future *)); 248 f = calloc(count + 1, sizeof (Eina_Future *));
@@ -249,7 +266,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data
249 .free = _efl_ui_widget_factory_create_cleanup); 266 .free = _efl_ui_widget_factory_create_cleanup);
250 267
251alloc_array_error: 268alloc_array_error:
252 efl_unref(r->parent);
253 efl_unref(r->factory); 269 efl_unref(r->factory);
254 free(r); 270 free(r);
255 eina_iterator_free(models); 271 eina_iterator_free(models);
diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo
index c00775a..82ce729 100644
--- a/src/lib/elementary/efl_ui_widget_factory.eo
+++ b/src/lib/elementary/efl_ui_widget_factory.eo
@@ -22,6 +22,7 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa
22 Efl.Ui.Factory.release; 22 Efl.Ui.Factory.release;
23 Efl.Ui.Property_Bind.property_bind; 23 Efl.Ui.Property_Bind.property_bind;
24 Efl.Part.part_get; 24 Efl.Part.part_get;
25 Efl.Object.finalize;
25 } 26 }
26 constructors { 27 constructors {
27 .item_class @optional; 28 .item_class @optional;
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index b94322c..f1b959b 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -892,6 +892,8 @@ extern const char SIG_LAYOUT_UNFOCUSED[];
892 892
893extern Eina_Stringshare *_property_style_ss; 893extern Eina_Stringshare *_property_style_ss;
894 894
895Efl_Ui_Win *efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory);
896
895extern Eina_Bool _config_profile_lock; 897extern Eina_Bool _config_profile_lock;
896 898
897extern Eina_FreeQ *postponed_fq; 899extern Eina_FreeQ *postponed_fq;