aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-node-db.c
diff options
context:
space:
mode:
authorChris Lahey <clahey@src.gnome.org>2004-01-10 04:49:11 +0800
committerChris Lahey <clahey@src.gnome.org>2004-01-10 04:49:11 +0800
commit1743162eef31aab9bb28a2c8201240e7dc4bd1cd (patch)
tree46addc66c3d524ccd4adddac135385b44c390852 /lib/ephy-node-db.c
parentfd4119bf05f970c82fda53fe0deff9dc440d8f5b (diff)
downloadgsoc2013-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-db.c')
-rw-r--r--lib/ephy-node-db.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c
index 8c569485a..43b6db39f 100644
--- a/lib/ephy-node-db.c
+++ b/lib/ephy-node-db.c
@@ -40,7 +40,8 @@ static void ephy_node_db_finalize (GObject *object);
enum
{
PROP_0,
- PROP_NAME
+ PROP_NAME,
+ PROP_IMMUTABLE,
};
#define EPHY_NODE_DB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_DB, EphyNodeDbPrivate))
@@ -48,6 +49,7 @@ enum
struct EphyNodeDbPrivate
{
char *name;
+ gboolean immutable;
long id_factory;
@@ -97,6 +99,7 @@ ephy_node_db_set_name (EphyNodeDb *db, const char *name)
g_hash_table_insert (ephy_node_databases, db->priv->name, db);
}
+
static void
ephy_node_db_get_property (GObject *object,
guint prop_id,
@@ -112,6 +115,9 @@ ephy_node_db_get_property (GObject *object,
case PROP_NAME:
g_value_set_string (value, db->priv->name);
break;
+ case PROP_IMMUTABLE:
+ g_value_set_boolean (value, db->priv->immutable);
+ break;
}
}
@@ -131,6 +137,10 @@ ephy_node_db_set_property (GObject *object,
case PROP_NAME:
ephy_node_db_set_name (db, g_value_get_string (value));
break;
+ case PROP_IMMUTABLE:
+ db->priv->immutable = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (db), "immutable");
+ break;
}
}
@@ -153,6 +163,14 @@ ephy_node_db_class_init (EphyNodeDbClass *klass)
NULL,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMMUTABLE,
+ g_param_spec_boolean ("immutable",
+ "Immutable",
+ "Immutable",
+ FALSE,
+ G_PARAM_READWRITE));
+
g_type_class_add_private (object_class, sizeof (EphyNodeDbPrivate));
}
@@ -229,6 +247,12 @@ ephy_node_db_get_name (EphyNodeDb *db)
return db->priv->name;
}
+gboolean
+ephy_node_db_is_immutable (EphyNodeDb *db)
+{
+ return db->priv->immutable;
+}
+
EphyNode *
ephy_node_db_get_node_from_id (EphyNodeDb *db, long id)
{
@@ -284,6 +308,7 @@ ephy_node_db_load_from_file (EphyNodeDb *db,
{
xmlTextReaderPtr reader;
gboolean success = TRUE;
+ gboolean was_immutable;
int ret;
LOG ("ephy_node_db_load_from_file %s", xml_file)
@@ -301,6 +326,9 @@ ephy_node_db_load_from_file (EphyNodeDb *db,
return FALSE;
}
+ was_immutable = db->priv->immutable;
+ db->priv->immutable = FALSE;
+
ret = xmlTextReaderRead (reader);
while (ret == 1)
{
@@ -349,6 +377,8 @@ ephy_node_db_load_from_file (EphyNodeDb *db,
xmlFreeTextReader (reader);
+ db->priv->immutable = was_immutable;
+
STOP_PROFILER ("loading node db")
return (success && ret == 0);