summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-xml-extensions.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnautilus-private/nautilus-xml-extensions.c')
-rw-r--r--libnautilus-private/nautilus-xml-extensions.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-xml-extensions.c b/libnautilus-private/nautilus-xml-extensions.c
index b41ad96f6..652b99b23 100644
--- a/libnautilus-private/nautilus-xml-extensions.c
+++ b/libnautilus-private/nautilus-xml-extensions.c
@@ -184,3 +184,33 @@ nautilus_xml_get_property_translated (xmlNodePtr parent,
xmlFree (untranslated_property);
return xmlStrdup (translated_property);
}
+
+void
+nautilus_xml_remove_node (xmlNodePtr node)
+{
+ g_return_if_fail (node != NULL);
+ g_return_if_fail (node->doc != NULL);
+ g_return_if_fail (node->parent != NULL);
+ g_return_if_fail (node->doc->xmlRootNode != node);
+
+ if (node->prev == NULL) {
+ g_assert (node->parent->xmlChildrenNode == node);
+ node->parent->xmlChildrenNode = node->next;
+ } else {
+ g_assert (node->parent->xmlChildrenNode != node);
+ node->prev->next = node->next;
+ }
+
+ if (node->next == NULL) {
+ g_assert (node->parent->last == node);
+ node->parent->last = node->prev;
+ } else {
+ g_assert (node->parent->last != node);
+ node->next->prev = node->prev;
+ }
+
+ node->doc = NULL;
+ node->parent = NULL;
+ node->next = NULL;
+ node->prev = NULL;
+}