diff options
author | Jonathan Blandford <jrb@redhat.com> | 2000-09-29 23:13:02 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2000-09-29 23:13:02 +0000 |
commit | b3ee868f9443d4de4b26d159e49fbd2c512ee1e8 (patch) | |
tree | 56c5fea5a86f03d50f5ff8b14410cf32d80267e0 /glib/gnode.c | |
parent | 79b416d0233f0f293274aa688d464fc27eaaa412 (diff) | |
download | glib-b3ee868f9443d4de4b26d159e49fbd2c512ee1e8.tar.gz |
Added function to keep symetry with g_node_insert_before. 2000-09-29
2000-09-29 Jonathan Blandford <jrb@redhat.com>
* gnode.c (g_node_insert_after): Added function to keep symetry
with g_node_insert_before.
2000-09-29 Jonathan Blandford <jrb@redhat.com>
* glib/tmpl/trees-nary.sgml: Add g_node_insert_after().
Diffstat (limited to 'glib/gnode.c')
-rw-r--r-- | glib/gnode.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/glib/gnode.c b/glib/gnode.c index d09c8ef79..5b72300c5 100644 --- a/glib/gnode.c +++ b/glib/gnode.c @@ -281,6 +281,42 @@ g_node_insert_before (GNode *parent, } GNode* +g_node_insert_after (GNode *parent, + GNode *sibling, + GNode *node) +{ + g_return_val_if_fail (parent != NULL, node); + g_return_val_if_fail (node != NULL, node); + g_return_val_if_fail (G_NODE_IS_ROOT (node), node); + if (sibling) + g_return_val_if_fail (sibling->parent == parent, node); + + node->parent = parent; + + if (sibling) + { + if (sibling->next) + { + sibling->next->prev = node; + } + node->next = sibling->next; + node->prev = sibling; + sibling->next = node; + } + else + { + if (parent->children) + { + node->next = parent->children; + parent->children->prev = node; + } + parent->children = node; + } + + return node; +} + +GNode* g_node_prepend (GNode *parent, GNode *node) { |