genlist: Fix insert after with a tree
This fixes a case where inserting item "C" after item "B" in this tree would go wrong: A B - 1 - 2 Before this patch, 1 and 2 lose their parent: A B C - 1 - 2 After this patch, 1 and 2 retain their parent: A B - 1 - 2 C Insert before worked by luck, no need to fix it. Note that this patch may require the next one to actually work (ensuring expanded state flag). NOTE: This is a behaviour break!
This commit is contained in:
parent
fe6bdf30cd
commit
aa5414f95d
|
@ -6356,6 +6356,12 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
|
||||||
it->parent->item->items =
|
it->parent->item->items =
|
||||||
eina_list_append_relative(it->parent->item->items, EO_OBJ(it), eo_after);
|
eina_list_append_relative(it->parent->item->items, EO_OBJ(it), eo_after);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (after->item->items && after->item->expanded)
|
||||||
|
{
|
||||||
|
eo_after = eina_list_last_data_get(after->item->items);
|
||||||
|
after = efl_data_scope_get(eo_after, ELM_GENLIST_ITEM_CLASS);
|
||||||
|
}
|
||||||
sd->items = eina_inlist_append_relative
|
sd->items = eina_inlist_append_relative
|
||||||
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
|
(sd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue