From 1885536e41726d40825753019e37c793dc83a70d Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 2 Jan 2007 19:47:49 +0000 Subject: Disables "Add Bookmark" in the File menu when bookmarks are locked down. 2007-01-02 Diego Escalante Urrelo * src/ephy-history-window.c: (ephy_history_window_update_menu): Disables "Add Bookmark" in the File menu when bookmarks are locked down. * src/bookmarks/ephy-bookmark-properties.c: (ephy_bookmark_properties_constructor): Makes the topics pane insensitive and the rest of entries non-editables (but sensitive so we can select the text) when bookmarks are locked down. * src/bookmarks/ephy-bookmarks-ui.c: (ephy_bookmarks_ui_add_bookmark): Don't allow the add bookmark ui to appear if it's locked down. svn path=/trunk/; revision=6778 --- ChangeLog | 17 +++++++++++++++++ src/bookmarks/ephy-bookmark-properties.c | 11 +++++++++++ src/bookmarks/ephy-bookmarks-ui.c | 6 ++++++ src/ephy-history-window.c | 6 +++++- 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f836bf271..2bbf24a3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2007-01-02 Diego Escalante Urrelo + + * src/ephy-history-window.c: (ephy_history_window_update_menu): + + Disables "Add Bookmark" in the File menu when bookmarks are locked + down. + + * src/bookmarks/ephy-bookmark-properties.c: (ephy_bookmark_properties_constructor): + + Makes the topics pane insensitive and the rest of entries + non-editables (but sensitive so we can select the text) + when bookmarks are locked down. + + * src/bookmarks/ephy-bookmarks-ui.c: (ephy_bookmarks_ui_add_bookmark): + + Don't allow the add bookmark ui to appear if it's locked down. + 2006-12-31 Christian Persch * src/ephy-main.c: (main): diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c index acfe01425..bc83675d2 100644 --- a/src/bookmarks/ephy-bookmark-properties.c +++ b/src/bookmarks/ephy-bookmark-properties.c @@ -34,6 +34,10 @@ #include "ephy-state.h" #include "ephy-gui.h" #include "ephy-dnd.h" +#include "ephy-prefs.h" + +#include "eel-gconf-extensions.h" + #include #include @@ -497,6 +501,7 @@ ephy_bookmark_properties_constructor (GType type, GtkWidget *widget, *table, *label, *entry, *container; GtkWindow *window; GtkDialog *dialog; + gboolean lockdown; const char *tmp; char *text; @@ -526,6 +531,8 @@ ephy_bookmark_properties_constructor (GType type, EPHY_STATE_WINDOW_SAVE_POSITION | EPHY_STATE_WINDOW_SAVE_SIZE); } + /* Lockdown */ + lockdown = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING); update_window_title (properties); @@ -541,6 +548,7 @@ ephy_bookmark_properties_constructor (GType type, gtk_widget_show (table); entry = gtk_entry_new (); + gtk_entry_set_editable (GTK_ENTRY (entry), !lockdown); tmp = ephy_node_get_property_string (properties->priv->bookmark, EPHY_NODE_BMK_PROP_TITLE); gtk_entry_set_text (GTK_ENTRY (entry), tmp); @@ -557,6 +565,7 @@ ephy_bookmark_properties_constructor (GType type, gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); entry = gtk_entry_new (); + gtk_entry_set_editable (GTK_ENTRY (entry), !lockdown); tmp = ephy_node_get_property_string (properties->priv->bookmark, EPHY_NODE_BMK_PROP_LOCATION); gtk_entry_set_text (GTK_ENTRY (entry), tmp); @@ -572,6 +581,7 @@ ephy_bookmark_properties_constructor (GType type, gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); entry = ephy_topics_entry_new (priv->bookmarks, priv->bookmark); + gtk_entry_set_editable (GTK_ENTRY (entry), !lockdown); priv->entry = entry; gtk_widget_show (entry); label = gtk_label_new_with_mnemonic(_("T_opics:")); @@ -591,6 +601,7 @@ ephy_bookmark_properties_constructor (GType type, NULL); gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); + gtk_widget_set_sensitive (container, !lockdown); gtk_widget_show (container); g_signal_connect (container, "map", G_CALLBACK (list_mapped_cb), properties); g_signal_connect (container, "unmap", G_CALLBACK (list_unmapped_cb), properties); diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c index 4a8e8a4c4..bab58195f 100644 --- a/src/bookmarks/ephy-bookmarks-ui.c +++ b/src/bookmarks/ephy-bookmarks-ui.c @@ -21,6 +21,7 @@ #include "config.h" +#include "eel-gconf-extensions.h" #include "ephy-bookmarks.h" #include "ephy-bookmarks-ui.h" #include "ephy-bookmarks-menu.h" @@ -43,12 +44,14 @@ #include "ephy-file-helpers.h" #include "ephy-gui.h" #include "ephy-stock-icons.h" +#include "ephy-prefs.h" #include "egg-editable-toolbar.h" #include #include #include + #define BM_WINDOW_DATA_KEY "bookmarks-window-data" typedef struct @@ -429,6 +432,9 @@ ephy_bookmarks_ui_add_bookmark (GtkWindow *parent, const char *location, const char *title) { + + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return; + EphyBookmarks *bookmarks; EphyNode *bookmark; GtkWidget *dialog; diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 45f64fdcf..934d831df 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -67,6 +67,7 @@ #include "ephy-node-common.h" #include "ephy-node-view.h" #include "ephy-bookmarks-ui.h" +#include "ephy-prefs.h" #include "ephy-gui.h" static const GtkTargetEntry page_drag_types [] = @@ -668,6 +669,7 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor) gboolean cut, copy, paste, select_all; gboolean pages_focus, pages_selection, single_page_selected; gboolean delete, bookmark_page; + gboolean bookmarks_locked; int num_pages_selected; GtkActionGroup *action_group; GtkAction *action; @@ -722,7 +724,8 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor) open_in_window = (pages_focus && pages_selection); open_in_tab = (pages_focus && pages_selection); delete = (pages_focus && pages_selection); - bookmark_page = (pages_focus && single_page_selected); + bookmarks_locked = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING); + bookmark_page = (pages_focus && single_page_selected) && !bookmarks_locked; action_group = editor->priv->action_group; action = gtk_action_group_get_action (action_group, "OpenInWindow"); @@ -744,6 +747,7 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor) gtk_action_set_sensitive (action, delete); action = gtk_action_group_get_action (action_group, "BookmarkLink"); gtk_action_set_sensitive (action, bookmark_page); + } static void -- cgit v1.2.3