summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2017-11-10 18:28:20 -0200
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>2017-11-15 17:06:45 +0900
commit201608c57bf4a7ca2a9d913ce0c960b75fc385ca (patch)
tree6849868db13575f559a4ae9973dc55ef04b96a83
parentc3eaf3ca36faffbb75a951251b3e2d7774636b7c (diff)
elm: model unrealize in model_set
-rw-r--r--src/lib/elementary/efl_ui_list.c6
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.c62
2 files changed, 18 insertions, 50 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index af0952c8bb..2455e8e6e8 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -1079,6 +1079,9 @@ _efl_ui_list_efl_ui_view_model_set(Eo *obj, Efl_Ui_List_Data *pd, Efl_Model *mod
1079 if (pd->model == model) 1079 if (pd->model == model)
1080 return; 1080 return;
1081 1081
1082 if (pd->relayout)
1083 efl_ui_list_relayout_model_set(pd->relayout, model);
1084
1082 if (pd->count_future) 1085 if (pd->count_future)
1083 { 1086 {
1084 efl_future_cancel(pd->count_future); 1087 efl_future_cancel(pd->count_future);
@@ -1109,9 +1112,6 @@ _efl_ui_list_efl_ui_view_model_set(Eo *obj, Efl_Ui_List_Data *pd, Efl_Model *mod
1109 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd); 1112 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd);
1110 } 1113 }
1111 1114
1112 if (pd->relayout)
1113 efl_ui_list_relayout_model_set(pd->relayout, model);
1114
1115 evas_object_smart_changed(pd->obj); 1115 evas_object_smart_changed(pd->obj);
1116} 1116}
1117 1117
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.c b/src/lib/elementary/efl_ui_list_precise_layouter.c
index e1df0f1b3d..f6a587c48a 100644
--- a/src/lib/elementary/efl_ui_list_precise_layouter.c
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.c
@@ -53,6 +53,8 @@ typedef struct _Efl_Ui_List_Precise_Layouter_Callback_Data
53static void _efl_ui_list_relayout_layout_do(Efl_Ui_List_Precise_Layouter_Data *); 53static void _efl_ui_list_relayout_layout_do(Efl_Ui_List_Precise_Layouter_Data *);
54static void _initilize(Eo *, Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_Model*, Efl_Ui_List_SegArray*); 54static void _initilize(Eo *, Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_Model*, Efl_Ui_List_SegArray*);
55static void _finalize(Eo *, Efl_Ui_List_Precise_Layouter_Data*); 55static void _finalize(Eo *, Efl_Ui_List_Precise_Layouter_Data*);
56static void _node_realize(Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_SegArray_Node*);
57static void _node_unrealize(Efl_Ui_List_Precise_Layouter_Data*, Efl_Ui_List_SegArray_Node*);
56 58
57static void 59static void
58_item_min_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_LayoutItem* item 60_item_min_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_LayoutItem* item
@@ -124,28 +126,6 @@ _count_error(void * data, Efl_Event const* event EINA_UNUSED)
124 EINA_SAFETY_ON_NULL_RETURN(pd); 126 EINA_SAFETY_ON_NULL_RETURN(pd);
125 pd->count_future = NULL; 127 pd->count_future = NULL;
126} 128}
127/*
128static void
129_slice_then(void * data, Efl_Event const* event)
130{
131 Efl_Ui_List_Precise_Layouter_Data *pd = data;
132
133 if (pd->slice_acc)
134 eina_accessor_free(pd->slice_acc);
135
136 pd->slice_acc = (Eina_Accessor*)((Efl_Future_Event_Success*)event->info)->value;
137
138 pd->slice_future = NULL;
139}
140
141static void
142_slice_error(void * data, Efl_Event const* event EINA_UNUSED)
143{
144 Efl_Ui_List_Precise_Layouter_Data *pd = data;
145 EINA_SAFETY_ON_NULL_RETURN(pd);
146 pd->slice_future = NULL;
147}
148*/
149 129
150static void 130static void
151_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED, 131_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED,
@@ -199,13 +179,7 @@ _initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_Li
199 179
200 evas_object_event_callback_add(modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); 180 evas_object_event_callback_add(modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd);
201 efl_ui_list_model_load_range_set(modeler, 0, 0); // load all 181 efl_ui_list_model_load_range_set(modeler, 0, 0); // load all
202/*
203 if (pd->slice_future)
204 efl_future_cancel(pd->slice_future);
205 182
206 pd->slice_future = efl_model_children_slice_get(pd->model, 0, 0);
207 efl_future_then(pd->slice_future, &_slice_then, &_slice_error, NULL, pd);
208*/
209 pd->min.w = 0; 183 pd->min.w = 0;
210 pd->min.h = 0; 184 pd->min.h = 0;
211} 185}
@@ -213,28 +187,24 @@ _initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_Li
213static void 187static void
214_finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd) 188_finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd)
215{ 189{
216 Efl_Ui_List_Precise_Layouter_Callback_Data *cb_data; 190 Efl_Ui_List_SegArray_Node* node;
217 Efl_Ui_List_LayoutItem *layout_item; 191 int i = 0;
218 Eina_Iterator *item_iterator;
219 void *data;
220 192
221 evas_object_event_callback_del_full(pd->modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); 193 evas_object_event_callback_del_full(pd->modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd);
222/* 194
223 item_iterator = eina_hash_iterator_key_new(pd->size_information); 195 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
224 while(eina_iterator_next(item_iterator, &data)) 196 EINA_ACCESSOR_FOREACH(nodes, i, node)
225 { 197 _node_unrealize(pd, node);
226 layout_item = *(Efl_Ui_List_LayoutItem **)data; 198 eina_accessor_free(nodes);
227 cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change); 199
228 efl_ui_list_model_unrealize(pd->modeler, layout_item);
229 free(cb_data);
230 }
231 eina_iterator_free(item_iterator);
232 eina_hash_free_buckets(pd->size_information);
233*/
234 pd->modeler = NULL;
235 pd->min.w = 0; 200 pd->min.w = 0;
236 pd->min.h = 0; 201 pd->min.h = 0;
237 202
203 efl_ui_list_model_min_size_set(pd->modeler, pd->min);
204
205 pd->segarray = NULL;
206 pd->modeler = NULL;
207
238 pd->initialized = EINA_FALSE; 208 pd->initialized = EINA_FALSE;
239} 209}
240 210
@@ -305,7 +275,6 @@ _calc_range(Efl_Ui_List_Precise_Layouter_Data *pd)
305 (pd->modeler, NULL, NULL, &ow, &oh); 275 (pd->modeler, NULL, NULL, &ow, &oh);
306 elm_interface_scrollable_content_pos_get(pd->modeler, &scr_x, &scr_y); 276 elm_interface_scrollable_content_pos_get(pd->modeler, &scr_x, &scr_y);
307 277
308// DBG("CALC RANGE %d %d", ow, oh);
309 ch = 0; 278 ch = 0;
310 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray); 279 Eina_Accessor *nodes = efl_ui_list_segarray_node_accessor_get(pd->segarray);
311 EINA_ACCESSOR_FOREACH(nodes, i, node) 280 EINA_ACCESSOR_FOREACH(nodes, i, node)
@@ -430,7 +399,6 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_model_set(Eo *obj EINA_UNUSED
430 efl_ref(pd->model); 399 efl_ref(pd->model);
431 pd->count_future = efl_model_children_count_get(pd->model); 400 pd->count_future = efl_model_children_count_get(pd->model);
432 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd); 401 efl_future_then(pd->count_future, &_count_then, &_count_error, NULL, pd);
433 //_initilize(obj, pd, pd->modeler);
434 } 402 }
435} 403}
436 404