diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-automation.c | 6 | ||||
-rw-r--r-- | src/ephy-notebook.c | 2 | ||||
-rw-r--r-- | src/ephy-session.c | 13 | ||||
-rw-r--r-- | src/ephy-tab.c | 5 | ||||
-rw-r--r-- | src/ephy-window.c | 64 |
5 files changed, 78 insertions, 12 deletions
diff --git a/src/ephy-automation.c b/src/ephy-automation.c index 586587adf..fd9e33257 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti * @@ -53,6 +54,11 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); g_return_if_fail (session != NULL); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) + { + url = ""; + } + if (ephy_session_autoresume (session) && *url == '\0') { /* no need to open the homepage, diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 799e27b74..54f3bfe5f 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -634,6 +634,8 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context, g_signal_stop_emission_by_name (widget, "drag_data_received"); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) return; + if (selection_data->length <= 0 || selection_data->data == NULL) return; if (selection_data->target == gdk_atom_intern (EPHY_DND_URL_TYPE, FALSE)) diff --git a/src/ephy-session.c b/src/ephy-session.c index 527c84f46..3439357e9 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -648,14 +648,17 @@ ephy_session_load (EphySession *session, if (id && xmlStrEqual (BOOKMARKS_EDITOR_ID, id)) { - if (!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) - { - 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)) { - widget = ephy_shell_get_history_window (ephy_shell); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY)) + { + widget = ephy_shell_get_history_window (ephy_shell); + } } } diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 0ca50ef4a..6bfb97f48 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -1037,8 +1037,9 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed, is_left_click = (type == EPHY_EMBED_EVENT_MOUSE_BUTTON1); is_middle_click = (type == EPHY_EMBED_EVENT_MOUSE_BUTTON2); - middle_click_opens = eel_gconf_get_boolean - (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL); + middle_click_opens = + eel_gconf_get_boolean (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL) && + !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL); is_link = (context & EMBED_CONTEXT_LINK) != 0; is_image = (context & EMBED_CONTEXT_IMAGE) != 0; diff --git a/src/ephy-window.c b/src/ephy-window.c index deb226d7c..8e3c0c91b 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -334,8 +334,11 @@ struct EphyWindowPrivate guint show_bookmarks_bar_notifier_id; guint show_statusbar_notifier_id; guint hide_menubar_notifier_id; - guint disable_save_to_disk_notifier_id; + guint disable_arbitrary_url_notifier_id; guint disable_bookmark_editing_notifier_id; + guint disable_toolbar_editing_notifier_id; + guint disable_history_notifier_id; + guint disable_save_to_disk_notifier_id; guint browse_with_caret_notifier_id; }; @@ -934,7 +937,6 @@ sync_tab_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) if (window->priv->closing) return; address = ephy_tab_get_location (tab); - if (address == NULL) { address = ""; @@ -1007,6 +1009,7 @@ sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) GtkActionGroup *action_group; GtkAction *action; gboolean up = FALSE, back = FALSE, forward = FALSE; + gboolean disable_arbitrary_url, disable_history; if (window->priv->closing) return; @@ -1025,6 +1028,14 @@ sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) forward = TRUE; } + disable_arbitrary_url = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL); + disable_history = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY); + + up = up && !disable_arbitrary_url; + + back = back && !disable_history; + forward = forward && !disable_history; + action_group = window->priv->action_group; action = gtk_action_group_get_action (action_group, "GoUp"); g_object_set (action, "sensitive", up, NULL); @@ -1715,6 +1726,12 @@ 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); + action = gtk_action_group_get_action (action_group, "GoLocation"); + g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL), NULL); + + action = gtk_action_group_get_action (action_group, "GoHistory"); + g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY), 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); @@ -1737,6 +1754,18 @@ update_actions (EphyWindow *window) action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground"); g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE), NULL); + + action = gtk_action_group_get_action (action_group, "EditToolbar"); + g_object_set (action, "sensitive", ! eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING), NULL); +} + +static void +update_navigation (EphyWindow *window) +{ + if (window->priv->active_tab) + { + sync_tab_navigation (window->priv->active_tab, NULL, window); + } } static void @@ -1751,10 +1780,20 @@ chrome_notifier (GConfClient *client, static void actions_notifier (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EphyWindow *window) + guint cnxn_id, + GConfEntry *entry, + EphyWindow *window) +{ + update_actions(window); +} + +static void +navigation_notifier (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + EphyWindow *window) { + update_navigation(window); update_actions(window); } @@ -1864,10 +1903,22 @@ ephy_window_init (EphyWindow *window) (CONF_LOCKDOWN_HIDE_MENUBAR, (GConfClientNotifyFunc)chrome_notifier, window); + window->priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add + (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL, + (GConfClientNotifyFunc)navigation_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_toolbar_editing_notifier_id = eel_gconf_notification_add + (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING, + (GConfClientNotifyFunc)actions_notifier, window); + + window->priv->disable_history_notifier_id = eel_gconf_notification_add + (CONF_LOCKDOWN_DISABLE_HISTORY, + (GConfClientNotifyFunc)navigation_notifier, window); + window->priv->disable_save_to_disk_notifier_id = eel_gconf_notification_add (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK, (GConfClientNotifyFunc)actions_notifier, window); @@ -1894,7 +1945,10 @@ 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_arbitrary_url_notifier_id); eel_gconf_notification_remove (window->priv->disable_bookmark_editing_notifier_id); + eel_gconf_notification_remove (window->priv->disable_toolbar_editing_notifier_id); + eel_gconf_notification_remove (window->priv->disable_history_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); |