From b3ee868f9443d4de4b26d159e49fbd2c512ee1e8 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Fri, 29 Sep 2000 23:13:02 +0000 Subject: [PATCH] Added function to keep symetry with g_node_insert_before. 2000-09-29 2000-09-29 Jonathan Blandford * gnode.c (g_node_insert_after): Added function to keep symetry with g_node_insert_before. 2000-09-29 Jonathan Blandford * glib/tmpl/trees-nary.sgml: Add g_node_insert_after(). --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ docs/reference/ChangeLog | 4 ++++ docs/reference/glib/glib-sections.txt | 1 + docs/reference/glib/tmpl/trees-nary.sgml | 12 +++++++++++ glib.h | 3 +++ glib/glib.h | 3 +++ glib/gnode.c | 36 ++++++++++++++++++++++++++++++++ gnode.c | 36 ++++++++++++++++++++++++++++++++ gobject/gobject.c | 4 ++-- 16 files changed, 137 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7acbb0..00b2e03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f7acbb0..00b2e03 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2000-09-29 Jonathan Blandford + + * gnode.c (g_node_insert_after): Added function to keep symetry + with g_node_insert_before. + 2000-09-30 Martin Baulig * configure.in (HAVE_THREADS): New automake conditional. diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 6e7c13e..a71589b 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2000-09-29 Jonathan Blandford + + * glib/tmpl/trees-nary.sgml: Add g_node_insert_after(). + Thu Sep 7 12:35:35 2000 Owen Taylor * Some further makefile improvement. diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index c644286..aeb80ca 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -1319,6 +1319,7 @@ g_node_copy g_node_insert g_node_insert_before +g_node_insert_after g_node_append g_node_prepend diff --git a/docs/reference/glib/tmpl/trees-nary.sgml b/docs/reference/glib/tmpl/trees-nary.sgml index 2019c86..8916fa6 100644 --- a/docs/reference/glib/tmpl/trees-nary.sgml +++ b/docs/reference/glib/tmpl/trees-nary.sgml @@ -113,6 +113,18 @@ the node is inserted as the last child of @parent. @Returns: the inserted #GNode. + + +Inserts a #GNode beneath the parent after the given sibling. + + +@parent: the #GNode to place @node under. +@sibling: the sibling #GNode to place @node after. If sibling is NULL, +the node is inserted as the first child of @parent. +@node: the #GNode to insert. +@Returns: the inserted #GNode. + + Inserts a #GNode as the last child of the given parent. diff --git a/glib.h b/glib.h index f485552..7ba589b 100644 --- a/glib.h +++ b/glib.h @@ -1267,6 +1267,9 @@ GNode* g_node_insert (GNode *parent, GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node); +GNode* g_node_insert_after (GNode *parent, + GNode *sibling, + GNode *node); GNode* g_node_prepend (GNode *parent, GNode *node); guint g_node_n_nodes (GNode *root, diff --git a/glib/glib.h b/glib/glib.h index f485552..7ba589b 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1267,6 +1267,9 @@ GNode* g_node_insert (GNode *parent, GNode* g_node_insert_before (GNode *parent, GNode *sibling, GNode *node); +GNode* g_node_insert_after (GNode *parent, + GNode *sibling, + GNode *node); GNode* g_node_prepend (GNode *parent, GNode *node); guint g_node_n_nodes (GNode *root, diff --git a/glib/gnode.c b/glib/gnode.c index d09c8ef..5b72300 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) { diff --git a/gnode.c b/gnode.c index d09c8ef..5b72300 100644 --- a/gnode.c +++ b/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) { diff --git a/gobject/gobject.c b/gobject/gobject.c index e772769..5a703ce 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -338,9 +338,9 @@ static void g_object_do_dispatch_param_changed (GObject *object, GParamSpec *pspec) { - g_message ("NOTIFICATION: parameter `%s' changed on object `%s'", +/* g_message ("NOTIFICATION: parameter `%s' changed on object `%s'", pspec->name, - G_OBJECT_TYPE_NAME (object)); + G_OBJECT_TYPE_NAME (object));*/ } static gboolean -- 2.7.4