aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2004-01-10 23:35:19 +0800
committerChris Lahey <clahey@src.gnome.org>2004-01-10 23:35:19 +0800
commit818cf0139401620a5a04f0f0e12a5cbd001cdd8e (patch)
treeefe24bae1a4e96a973c8a9f2e45b9d261ef327ff /src/ephy-window.c
parentb0b62cbe423aa7c223baa81000cf66ec421ed2a2 (diff)
downloadgsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar.gz
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar.bz2
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar.lz
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar.xz
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.tar.zst
gsoc2013-epiphany-818cf0139401620a5a04f0f0e12a5cbd001cdd8e.zip
Added disable_arbitrary_url, disable_toolbar_editing, and disable_history
2004-01-09 Christopher James Lahey <clahey@ximian.com> * data/epiphany-lockdown.schemas.in, lib/ephy-prefs.h: Added disable_arbitrary_url, disable_toolbar_editing, and disable_history keys. * src/ephy-automation.c (impl_ephy_automation_loadurl): Make this ignore a url given on the command line if disable_arbitrary_url is on. * src/ephy-notebook.c (notebook_drag_data_received_cb): Made this ignore drags if disable_arbitrary_url is on. * src/ephy-session.c (ephy_session_load): Don't show history window if disable_history is on. * src/ephy-tab.c (ephy_tab_dom_mouse_click_cb): Disable middle click to paste url if disable_arbitrary_url is on. * src/ephy-window.c: Disable menu actions based on disable_arbitrary_url, disable_toolbar_editing, and disable_history keys.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c64
1 files changed, 59 insertions, 5 deletions
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);