aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-import.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-import.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-import.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index 53849cc1c..d38c1f5d0 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2003 Marco Pesenti Gritti
*
@@ -32,6 +33,9 @@
#include "ephy-bookmarks-import.h"
#include "ephy-debug.h"
+#include "ephy-prefs.h"
+
+#include "eel-gconf-extensions.h"
/**
* NSItemType: netscape bookmark item type
@@ -59,6 +63,8 @@ bookmark_add (EphyBookmarks *bookmarks,
bmk = ephy_bookmarks_add (bookmarks, title, address);
+ if (bmk == NULL) return NULL;
+
if (topic_name)
{
topic = ephy_bookmarks_find_keyword (bookmarks, topic_name, FALSE);
@@ -67,7 +73,10 @@ bookmark_add (EphyBookmarks *bookmarks,
topic = ephy_bookmarks_add_keyword (bookmarks, topic_name);
}
- ephy_bookmarks_set_keyword (bookmarks, topic, bmk);
+ if (topic != NULL)
+ {
+ ephy_bookmarks_set_keyword (bookmarks, topic, bmk);
+ }
}
return bmk;
@@ -79,6 +88,8 @@ ephy_bookmarks_import (EphyBookmarks *bookmarks,
{
char *type;
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+
type = gnome_vfs_get_mime_type (filename);
LOG ("Importing bookmarks of type %s", type)
@@ -371,7 +382,7 @@ xbel_parse_folder (EphyBookmarks *eb, xmlTextReaderPtr reader)
xmlFree (title);
- g_return_val_if_fail (EPHY_IS_NODE (keyword), list);
+ if (keyword == NULL) return list;
for (l = list; l != NULL; l = l->next)
{
@@ -565,11 +576,17 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
const char *filename)
{
FILE *bf; /* bookmark file */
- GString *name = g_string_new (NULL);
+ GString *name;
gchar *parsedname;
GString *url = g_string_new (NULL);
GList *folders = NULL, *l;
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+
+ name = g_string_new (NULL);
+ url = g_string_new (NULL);
+
+
if (!(bf = fopen (filename, "r"))) {
g_warning ("Failed to open file: %s\n", filename);
return FALSE;
@@ -638,6 +655,8 @@ ephy_bookmarks_import_xbel (EphyBookmarks *bookmarks,
xmlTextReaderPtr reader;
GList *list;
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
{
return FALSE;
@@ -758,7 +777,10 @@ parse_rdf_item (EphyBookmarks *bookmarks,
topic = ephy_bookmarks_add_keyword (bookmarks, topic_name);
}
- ephy_bookmarks_set_keyword (bookmarks, topic, bmk);
+ if (topic != NULL)
+ {
+ ephy_bookmarks_set_keyword (bookmarks, topic, bmk);
+ }
}
xmlFree (title);
@@ -776,6 +798,8 @@ ephy_bookmarks_import_rdf (EphyBookmarks *bookmarks,
xmlNodePtr child;
xmlNodePtr root;
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
return FALSE;