aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--ChangeLog29
-rw-r--r--data/epiphany-lockdown.schemas.in33
-rw-r--r--lib/ephy-prefs.h3
-rw-r--r--src/ephy-automation.c6
-rw-r--r--src/ephy-notebook.c2
-rw-r--r--src/ephy-session.c13
-rw-r--r--src/ephy-tab.c5
-rw-r--r--src/ephy-window.c64
8 files changed, 138 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 08e51334c..667b03bf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+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.
+
2004-01-10 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/ContentHandler.cpp:
@@ -70,7 +93,7 @@
Add "Download Link As" to the link context menu.
-2004-01-09 <clahey@ximian.com>
+2004-01-09 Christopher James Lahey <clahey@ximian.com>
* src/toolbar.c (update_location_editable): Check if embed is valid
here.
@@ -117,11 +140,7 @@
* lib/ephy-state.c: Fixed a logic error in using & instead of &&
(bug #130919, Dave Jones).
-<<<<<<< ChangeLog
-2004-01-08 Chris Lahey <clahey@ximian.com>
-=======
2004-01-08 Christopher James Lahey <clahey@ximian.com>
->>>>>>> 1.1255
* 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 c904dc144..9125b7597 100644
--- a/data/epiphany-lockdown.schemas.in
+++ b/data/epiphany-lockdown.schemas.in
@@ -48,6 +48,17 @@
</locale>
</schema>
<schema>
+ <key>/schemas/apps/epiphany/lockdown/disable_arbitrary_url</key>
+ <applyto>/apps/epiphany/lockdown/disable_arbitrary_url</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Disable Arbitrary URLs</short>
+ <long>Disable users ability to type in a URL to epiphany.</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/epiphany/lockdown/disable_bookmark_editing</key>
<applyto>/apps/epiphany/lockdown/disable_bookmark_editing</applyto>
<owner>epiphany</owner>
@@ -58,5 +69,27 @@
<long>Disable users ability to edit their bookmarks.</long>
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/epiphany/lockdown/disable_toolbar_editing</key>
+ <applyto>/apps/epiphany/lockdown/disable_toolbar_editing</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Disable Toolbar Editing</short>
+ <long>Disable users ability to edit toolbars.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/lockdown/disable_history</key>
+ <applyto>/apps/epiphany/lockdown/disable_history</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Disable History</short>
+ <long>Disable all historical information by disabling the back button, not allowing the history dialog and hiding the favorite bookmarks.</long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 48845bd17..ba49df410 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -44,7 +44,10 @@ G_BEGIN_DECLS
#define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload"
/* Lockdown */
+#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
#define CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING "/apps/epiphany/lockdown/disable_bookmark_editing"
+#define CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING "/apps/epiphany/lockdown/disable_toolbar_editing"
+#define CONF_LOCKDOWN_DISABLE_HISTORY "/apps/epiphany/lockdown/disable_history"
#define CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK "/desktop/gnome/lockdown/disable_save_to_disk"
/* System prefs */
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);