aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.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 /src/bookmarks/ephy-bookmarks.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 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 2c4fdd413..1a8a703d5 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -33,6 +33,9 @@
#include "ephy-toolbars-model.h"
#include "ephy-bookmarks-export.h"
#include "ephy-bookmarks-import.h"
+#include "ephy-prefs.h"
+
+#include "eel-gconf-extensions.h"
#include <string.h>
#include <glib/gi18n.h>
@@ -61,6 +64,8 @@ struct EphyBookmarksPrivate
EphyNode *smartbookmarks;
EphyNode *lower_fav;
double lower_score;
+
+ guint disable_bookmark_editing_notifier_id;
};
typedef struct
@@ -497,6 +502,23 @@ topics_removed_cb (EphyNode *node,
}
static void
+update_bookmark_editing (EphyBookmarks *eb)
+{
+ g_object_set (G_OBJECT (eb->priv->db),
+ "immutable", eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING),
+ NULL);
+}
+
+static void
+disable_bookmark_editing_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyBookmarks *eb)
+{
+ update_bookmark_editing (eb);
+}
+
+static void
ephy_bookmarks_init (EphyBookmarks *eb)
{
GValue value = { 0, };
@@ -599,6 +621,11 @@ ephy_bookmarks_init (EphyBookmarks *eb)
}
}
+ eb->priv->disable_bookmark_editing_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING,
+ (GConfClientNotifyFunc)disable_bookmark_editing_notifier, eb);
+ update_bookmark_editing (eb);
+
ephy_setup_history_notifiers (eb);
ephy_bookmarks_update_favorites (eb);
}
@@ -608,6 +635,8 @@ ephy_bookmarks_finalize (GObject *object)
{
EphyBookmarks *eb = EPHY_BOOKMARKS (object);
+ eel_gconf_notification_remove (eb->priv->disable_bookmark_editing_notifier_id);
+
if (eb->priv->save_timeout_id != 0)
{
g_source_remove (eb->priv->save_timeout_id);
@@ -685,6 +714,8 @@ ephy_bookmarks_add (EphyBookmarks *eb,
bm = ephy_node_new (eb->priv->db);
+ if (bm == NULL) return NULL;
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, title);
ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_TITLE,
@@ -938,6 +969,8 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb,
key = ephy_node_new (eb->priv->db);
+ if (key == NULL) return NULL;
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, name);
ephy_node_set_property (key, EPHY_NODE_KEYWORD_PROP_NAME,