mirror of https://github.com/djcb/mu.git
mu: Make mu_container_splice_grandchildren() do only one thing
Don't kill the resultant childless container when promoting its children. This unifies the behavior of mu_container_splice_*() functions.
This commit is contained in:
parent
bb0cc542b8
commit
c9cb27be11
|
@ -290,8 +290,6 @@ mu_container_splice_grandchildren (MuContainer *parent, MuContainer *child)
|
|||
newchild = child->child;
|
||||
child->child=NULL;
|
||||
|
||||
mu_container_remove_child (parent, child);
|
||||
|
||||
return mu_container_append_children (parent, newchild);
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ MuContainer* mu_container_splice_children (MuContainer *c,
|
|||
MuContainer *sibling);
|
||||
|
||||
/**
|
||||
* promote child's children to be parent's children and remove child
|
||||
* promote child's children to be parent's children
|
||||
*
|
||||
* @param parent a container instance
|
||||
* @param child a child of this container
|
||||
|
|
|
@ -385,10 +385,12 @@ prune_maybe (MuContainer *c)
|
|||
MuContainer *cur;
|
||||
|
||||
for (cur = c->child; cur; cur = cur->next) {
|
||||
if (cur->flags & MU_CONTAINER_FLAG_DELETE)
|
||||
if (cur->flags & MU_CONTAINER_FLAG_DELETE) {
|
||||
c = mu_container_remove_child (c, cur);
|
||||
else if (cur->flags & MU_CONTAINER_FLAG_SPLICE)
|
||||
} else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) {
|
||||
c = mu_container_splice_grandchildren (c, cur);
|
||||
c = mu_container_remove_child (c, cur);
|
||||
}
|
||||
}
|
||||
|
||||
g_return_val_if_fail (c, FALSE);
|
||||
|
|
Loading…
Reference in New Issue