diff options
author | Chris Lahey <clahey@src.gnome.org> | 2004-01-10 04:49:11 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2004-01-10 04:49:11 +0800 |
commit | 1743162eef31aab9bb28a2c8201240e7dc4bd1cd (patch) | |
tree | 46addc66c3d524ccd4adddac135385b44c390852 /lib/ephy-node.c | |
parent | fd4119bf05f970c82fda53fe0deff9dc440d8f5b (diff) | |
download | gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar.gz gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar.bz2 gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar.lz gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar.xz gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.tar.zst gsoc2013-epiphany-1743162eef31aab9bb28a2c8201240e7dc4bd1cd.zip |
Added disable_bookmark_editing key.
* data/epiphany-lockdown.schemas.in, lib/ephy-prefs.h: Added
disable_bookmark_editing key.
* lib/ephy-node-db.c, ephy-node-db.h, ephy-node.c: Added immutable
property.
* lib/egg/egg-editable-toolbar.c (drag_data_received_cb,
toolbar_drag_motion_cb), src/ephy-toolbars-model.c
(impl_get_item_id): Made these handle immutable models/node_dbs.
* src/ephy-automation.c, src/ephy-session.c: Don't show the
bookmark editor if disabled.
* src/ephy-window.c: Disable a bunch of menus if bookmark editing
is disabled.
* src/bookmarks/ephy-bookmarks-import.c,
src/bookmarks/ephy-bookmarks.c: Disable bookmark editing and
importing is key is set. Uses immutable property.
Diffstat (limited to 'lib/ephy-node.c')
-rw-r--r-- | lib/ephy-node.c | 26 |
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); |