aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-node.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ephy-node.c')
-rw-r--r--lib/ephy-node.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/ephy-node.c b/lib/ephy-node.c
index 6194cb60f..c99ea9a0a 100644
--- a/lib/ephy-node.c
+++ b/lib/ephy-node.c
@@ -277,6 +277,8 @@ ephy_node_new (EphyNodeDb *db)
g_return_val_if_fail (EPHY_IS_NODE_DB (db), NULL);
+ if (ephy_node_db_is_immutable (db)) return NULL;
+
id = _ephy_node_db_new_id (db);
return ephy_node_new_with_id (db, id);
@@ -289,6 +291,8 @@ ephy_node_new_with_id (EphyNodeDb *db, gulong reserved_id)
g_return_val_if_fail (EPHY_IS_NODE_DB (db), NULL);
+ if (ephy_node_db_is_immutable (db)) return NULL;
+
node = g_new0 (EphyNode, 1);
node->ref_count = 0;
@@ -397,6 +401,8 @@ ephy_node_set_property (EphyNode *node,
g_return_if_fail (property_id >= 0);
g_return_if_fail (value != NULL);
+ if (ephy_node_db_is_immutable (node->db)) return;
+
new = g_new0 (GValue, 1);
g_value_init (new, G_VALUE_TYPE (value));
g_value_copy (value, new);
@@ -759,11 +765,13 @@ ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node)
g_return_val_if_fail (EPHY_IS_NODE_DB (db), NULL);
g_return_val_if_fail (xml_node != NULL, NULL);
+ if (ephy_node_db_is_immutable (db)) return NULL;
+
xml = xmlGetProp (xml_node, "id");
if (xml == NULL)
return NULL;
id = atol (xml);
- g_free (xml);
+ xmlFree (xml);
node = ephy_node_new_with_id (db, id);
@@ -775,7 +783,7 @@ ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node)
xml = xmlGetProp (xml_child, "id");
g_assert (xml != NULL);
parent_id = atol (xml);
- g_free (xml);
+ xmlFree (xml);
parent = ephy_node_db_get_node_from_id (db, parent_id);
@@ -792,11 +800,11 @@ ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node)
xml = xmlGetProp (xml_child, "id");
property_id = atoi (xml);
- g_free (xml);
+ xmlFree (xml);
xml = xmlGetProp (xml_child, "value_type");
value_type = g_type_from_name (xml);
- g_free (xml);
+ xmlFree (xml);
xml = xmlNodeGetContent (xml_child);
value = g_new0 (GValue, 1);
@@ -838,7 +846,7 @@ ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node)
real_set_property (node, property_id, value);
- g_free (xml);
+ xmlFree (xml);
}
}
@@ -852,6 +860,8 @@ ephy_node_add_child (EphyNode *node,
EphyNode *child)
{
g_return_if_fail (EPHY_IS_NODE (node));
+
+ if (ephy_node_db_is_immutable (node->db)) return;
real_add_child (node, child);
@@ -864,6 +874,8 @@ ephy_node_remove_child (EphyNode *node,
{
g_return_if_fail (EPHY_IS_NODE (node));
+ if (ephy_node_db_is_immutable (node->db)) return;
+
real_remove_child (node, child, TRUE, TRUE);
}
@@ -906,6 +918,8 @@ ephy_node_sort_children (EphyNode *node,
GPtrArray *newkids;
int i, *new_order;
+ if (ephy_node_db_is_immutable (node->db)) return;
+
g_return_if_fail (EPHY_IS_NODE (node));
g_return_if_fail (compare_func != NULL);
@@ -953,6 +967,8 @@ ephy_node_reorder_children (EphyNode *node,
g_return_if_fail (EPHY_IS_NODE (node));
g_return_if_fail (new_order != NULL);
+ if (ephy_node_db_is_immutable (node->db)) return;
+
newkids = g_ptr_array_new ();
g_ptr_array_set_size (newkids, node->children->len);