summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-04-18 09:57:53 -0700
committerCedric BAIL <cedric.bail@free.fr>2019-04-26 11:32:52 -0700
commit13b230029df72120191bbd837b065e2610a3c3ed (patch)
tree50e3dc82e240afdb567f640edd59953118ac59dc /src/lib/ecore
parenteb8511ce7bc68615fcc837031e66336cbc18dcdd (diff)
ecore: use new infrastructure for Efl.CompositeModel to only have one Model object represent its data at any point in time.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D8660
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_composite_model.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c
index a0457729ac..7ef607edd2 100644
--- a/src/lib/ecore/efl_composite_model.c
+++ b/src/lib/ecore/efl_composite_model.c
@@ -252,6 +252,20 @@ struct _Efl_Composite_Model_Slice_Request
252 unsigned int dummy_need; 252 unsigned int dummy_need;
253}; 253};
254 254
255static Efl_Model *
256_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index)
257{
258 EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model");
259
260 remember = efl_add_ref(self, parent,
261 efl_ui_view_model_set(efl_added, view),
262 efl_composite_model_index_set(efl_added, index),
263 efl_loop_model_volatile_make(efl_added));
264 if (!remember) return NULL;
265
266 EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
267}
268
255static Eina_Value 269static Eina_Value
256_efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v) 270_efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
257{ 271{
@@ -266,13 +280,8 @@ _efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
266 { 280 {
267 Eo *composite; 281 Eo *composite;
268 282
269 // First set the Model to be used as a source so that we the newly object 283 // Fetch an existing composite model for this model or create a new one if none exist
270 // can know if it needs to retain the information regarding its index. 284 composite = _efl_composite_lookup(req->self, req->parent, target, req->start + i);
271 composite = efl_add_ref(req->self, req->parent,
272 efl_ui_view_model_set(efl_added, target),
273 efl_composite_model_index_set(efl_added, req->start + i),
274 efl_loop_model_volatile_make(efl_added));
275
276 eina_value_array_append(&r, composite); 285 eina_value_array_append(&r, composite);
277 // Dropping this scope reference 286 // Dropping this scope reference
278 efl_unref(composite); 287 efl_unref(composite);