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 | |
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.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | data/epiphany-lockdown.schemas.in | 11 | ||||
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 20 | ||||
-rw-r--r-- | lib/ephy-node-db.c | 32 | ||||
-rw-r--r-- | lib/ephy-node-db.h | 2 | ||||
-rw-r--r-- | lib/ephy-node.c | 26 | ||||
-rw-r--r-- | lib/ephy-prefs.h | 1 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-import.c | 32 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 33 | ||||
-rw-r--r-- | src/ephy-automation.c | 3 | ||||
-rw-r--r-- | src/ephy-session.c | 7 | ||||
-rwxr-xr-x | src/ephy-toolbars-model.c | 16 | ||||
-rw-r--r-- | src/ephy-window.c | 18 |
13 files changed, 197 insertions, 28 deletions
@@ -1,3 +1,25 @@ +2004-01-09 Christopher James Lahey <clahey@ximian.com> + + * 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. + 2004-01-09 Christian Persch <chpe@cvs.gnome.org> * data/epiphany.schemas.in: @@ -18,7 +40,7 @@ * lib/ephy-state.c: Fixed a logic error in using & instead of && (bug #130919, Dave Jones). -2004-01-08 <clahey@ximian.com> +2004-01-08 Christopher James Lahey <clahey@ximian.com> * embed/mozilla/ContentHandler.cpp (MIMEAskAction): Don't save the file if disable_save_to_disk is on. diff --git a/data/epiphany-lockdown.schemas.in b/data/epiphany-lockdown.schemas.in index 9e44d7a89..c904dc144 100644 --- a/data/epiphany-lockdown.schemas.in +++ b/data/epiphany-lockdown.schemas.in @@ -47,5 +47,16 @@ default, when disable_unsafe_protocols is enabled.</long> </locale> </schema> + <schema> + <key>/schemas/apps/epiphany/lockdown/disable_bookmark_editing</key> + <applyto>/apps/epiphany/lockdown/disable_bookmark_editing</applyto> + <owner>epiphany</owner> + <type>bool</type> + <default>0</default> + <locale name="C"> + <short>Disable Bookmark Editing</short> + <long>Disable users ability to edit their bookmarks.</long> + </locale> + </schema> </schemalist> </gconfschemafile> diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index 746affc42..7d1fe1f8a 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -419,8 +419,7 @@ drag_data_received_cb (GtkWidget *widget, target = gtk_drag_dest_find_target (widget, context, NULL); type = egg_toolbars_model_get_item_type (etoolbar->priv->model, target); - id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, - selection_data->data); + id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, selection_data->data); /* This function can be called for two reasons * @@ -433,6 +432,13 @@ drag_data_received_cb (GtkWidget *widget, * actually add a new item to the toolbar. */ + if (id == NULL) + { + etoolbar->priv->pending = FALSE; + g_free (type); + return; + } + if (etoolbar->priv->pending) { etoolbar->priv->pending = FALSE; @@ -453,11 +459,6 @@ drag_data_received_cb (GtkWidget *widget, } else { - type = egg_toolbars_model_get_item_type (etoolbar->priv->model, - target); - id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, - selection_data->data); - egg_toolbars_model_add_item (etoolbar->priv->model, toolbar_pos, pos, id, type); } @@ -591,9 +592,12 @@ toolbar_drag_motion_cb (GtkWidget *widget, /* The handler will make sure the item is created */ gtk_drag_get_data (widget, context, target, time); - g_assert (etoolbar->priv->dragged_item); g_assert (!etoolbar->priv->pending); + if (etoolbar->priv->dragged_item == NULL) { + return TRUE; + } + g_object_ref (etoolbar->priv->dragged_item); gtk_object_sink (GTK_OBJECT (etoolbar->priv->dragged_item)); } 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); diff --git a/lib/ephy-node-db.h b/lib/ephy-node-db.h index ba597f528..21206f2ff 100644 --- a/lib/ephy-node-db.h +++ b/lib/ephy-node-db.h @@ -73,6 +73,8 @@ int ephy_node_db_write_to_xml_safe (EphyNodeDb *db, const char *ephy_node_db_get_name (EphyNodeDb *db); +gboolean ephy_node_db_is_immutable (EphyNodeDb *db); + EphyNode *ephy_node_db_get_node_from_id (EphyNodeDb *db, long id); 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); diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index 4a0d94809..48845bd17 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -44,6 +44,7 @@ G_BEGIN_DECLS #define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload" /* Lockdown */ +#define CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING "/apps/epiphany/lockdown/disable_bookmark_editing" #define CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK "/desktop/gnome/lockdown/disable_save_to_disk" /* System prefs */ 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; 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, diff --git a/src/ephy-automation.c b/src/ephy-automation.c index 33f5dc822..586587adf 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -27,6 +27,8 @@ #include "ephy-session.h" #include "ephy-bookmarks.h" #include "ephy-bookmarks-import.h" +#include "eel-gconf-extensions.h" +#include "ephy-prefs.h" #include <string.h> #include <bonobo/bonobo-main.h> @@ -128,6 +130,7 @@ impl_ephy_automation_open_bookmarks_editor (PortableServer_Servant _servant, { GtkWidget *editor; + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return; editor = ephy_shell_get_bookmarks_editor (ephy_shell); gtk_window_present (GTK_WINDOW (editor)); diff --git a/src/ephy-session.c b/src/ephy-session.c index b1225a45a..527c84f46 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -33,6 +33,8 @@ #include "ephy-bookmarks-editor.h" #include "ephy-string.h" #include "ephy-file-helpers.h" +#include "eel-gconf-extensions.h" +#include "ephy-prefs.h" #include "ephy-debug.h" #include <glib/gi18n.h> @@ -646,7 +648,10 @@ ephy_session_load (EphySession *session, if (id && xmlStrEqual (BOOKMARKS_EDITOR_ID, id)) { - widget = ephy_shell_get_bookmarks_editor (ephy_shell); + if (!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) + { + widget = ephy_shell_get_bookmarks_editor (ephy_shell); + } } else if (id && xmlStrEqual (HISTORY_WINDOW_ID, id)) { diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index 8e0c578b4..132172f91 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -202,20 +202,22 @@ impl_get_item_id (EggToolbarsModel *t, } node = ephy_bookmarks_add (bookmarks, title, netscape_url[URL]); - g_return_val_if_fail (node != NULL, NULL); - gh = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); - icon = ephy_history_get_icon (gh, netscape_url[URL]); - - if (icon) + if (node != NULL) { - ephy_bookmarks_set_icon (bookmarks, netscape_url[URL], icon); + gh = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); + icon = ephy_history_get_icon (gh, netscape_url[URL]); + + if (icon) + { + ephy_bookmarks_set_icon (bookmarks, netscape_url[URL], icon); + } } } g_strfreev (netscape_url); - g_return_val_if_fail (node != NULL, NULL); + if (node == NULL) return NULL; return ephy_toolbars_model_get_action_name (model, ephy_node_get_id (node)); diff --git a/src/ephy-window.c b/src/ephy-window.c index 48513c880..f66d4119d 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -333,6 +333,7 @@ struct EphyWindowPrivate guint show_statusbar_notifier_id; guint hide_menubar_notifier_id; guint disable_save_to_disk_notifier_id; + guint disable_bookmark_editing_notifier_id; guint browse_with_caret_notifier_id; }; @@ -1695,7 +1696,7 @@ update_actions (EphyWindow *window) GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group); GtkActionGroup *popups_action_group = GTK_ACTION_GROUP (window->priv->popups_action_group); GtkAction *action; - gboolean save_to_disk; + gboolean bookmarks_editable, save_to_disk; action = gtk_action_group_get_action (action_group, "ViewToolbar"); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), @@ -1712,6 +1713,16 @@ update_actions (EphyWindow *window) eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR)); g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR), NULL); + bookmarks_editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING); + action = gtk_action_group_get_action (action_group, "GoBookmarks"); + g_object_set (action, "sensitive", bookmarks_editable, NULL); + action = gtk_action_group_get_action (action_group, "FileBookmarkPage"); + g_object_set (action, "sensitive", bookmarks_editable, NULL); + action = gtk_action_group_get_action (popups_action_group, "ContextBookmarkPage"); + g_object_set (action, "sensitive", bookmarks_editable, NULL); + action = gtk_action_group_get_action (popups_action_group, "BookmarkLink"); + g_object_set (action, "sensitive", bookmarks_editable, NULL); + save_to_disk = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK); action = gtk_action_group_get_action (action_group, "FileSaveAs"); g_object_set (action, "sensitive", save_to_disk, NULL); @@ -1851,6 +1862,10 @@ ephy_window_init (EphyWindow *window) (CONF_LOCKDOWN_HIDE_MENUBAR, (GConfClientNotifyFunc)chrome_notifier, window); + window->priv->disable_bookmark_editing_notifier_id = eel_gconf_notification_add + (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING, + (GConfClientNotifyFunc)actions_notifier, window); + window->priv->disable_save_to_disk_notifier_id = eel_gconf_notification_add (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK, (GConfClientNotifyFunc)actions_notifier, window); @@ -1877,6 +1892,7 @@ ephy_window_finalize (GObject *object) eel_gconf_notification_remove (window->priv->show_bookmarks_bar_notifier_id); eel_gconf_notification_remove (window->priv->show_statusbar_notifier_id); eel_gconf_notification_remove (window->priv->hide_menubar_notifier_id); + eel_gconf_notification_remove (window->priv->disable_bookmark_editing_notifier_id); eel_gconf_notification_remove (window->priv->disable_save_to_disk_notifier_id); eel_gconf_notification_remove (window->priv->browse_with_caret_notifier_id); |