aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author8 <clahey@ximian.com>2004-01-08 23:42:09 +0800
committerChris Lahey <clahey@src.gnome.org>2004-01-08 23:42:09 +0800
commit54ceff0ed9f6f9085d084903453e77950e41ace3 (patch)
treede76defb3f310ec00e613907543dd214f15ec03d
parentf4d976d3d8675948af9bf4ab28e900cc2dcc72e5 (diff)
downloadgsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar.gz
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar.bz2
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar.lz
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar.xz
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.tar.zst
gsoc2013-epiphany-54ceff0ed9f6f9085d084903453e77950e41ace3.zip
Don't save the file if disable_save_to_disk is on.
2004-01-08 <clahey@ximian.com> * embed/mozilla/ContentHandler.cpp (MIMEAskAction): Don't save the file if disable_save_to_disk is on. * lib/ephy-prefs.h (CONF_DISABLE_SAVE_TO_DISK): Added this key here. * src/ephy-window.c (update_actions): Obey disable_save_to_disk. Also, disable toggling view settings if their keys are locked.
-rw-r--r--ChangeLog10
-rw-r--r--embed/mozilla/ContentHandler.cpp3
-rw-r--r--lib/ephy-prefs.h3
-rw-r--r--src/ephy-window.c39
4 files changed, 51 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 20c39257b..5ebe2c80c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-08 <clahey@ximian.com>
+
+ * embed/mozilla/ContentHandler.cpp (MIMEAskAction): Don't save the
+ file if disable_save_to_disk is on.
+
+ * lib/ephy-prefs.h (CONF_DISABLE_SAVE_TO_DISK): Added this key here.
+
+ * src/ephy-window.c (update_actions): Obey disable_save_to_disk.
+ Also, disable toggling view settings if their keys are locked.
+
2004-01-06 Piers Cornwell <piers@myrealbox.com>
* help/C/epiphany-C.omf
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 32a18ca96..eee5bca71 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -316,8 +316,9 @@ NS_METHOD GContentHandler::MIMEAskAction (void)
if (!auto_open || !DefaultApp || permission != EPHY_MIME_PERMISSION_SAFE)
{
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK)) return NS_OK;
nsCOMPtr<nsIHelperAppLauncher> launcher;
-
+
rv = mContentHandler->GetLauncher (getter_AddRefs(launcher));
if (NS_FAILED (rv)) return rv;
launcher->SaveToDisk (nsnull,PR_FALSE);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 1814d63b2..965d0ed0c 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -43,6 +43,9 @@ G_BEGIN_DECLS
#define CONF_STATE_DOWNLOAD_DIR "/apps/epiphany/directories/download"
#define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload"
+/* Lockdown */
+#define CONF_DISABLE_SAVE_TO_DISK "/desktop/gnome/lockdown/disable_save_to_disk"
+
/* System prefs */
#define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command"
#define CONF_DESKTOP_TOOLBAR_STYLE "/desktop/gnome/interface/toolbar_style"
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 361de631b..b47152152 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -327,6 +327,7 @@ 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;
};
enum
@@ -1683,22 +1684,40 @@ ensure_default_icon (void)
}
static void
-update_layout_toggles (EphyWindow *window)
+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;
action = gtk_action_group_get_action (action_group, "ViewToolbar");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS));
+ g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS), NULL);
action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR));
+ g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_BOOKMARKS_BAR), NULL);
action = gtk_action_group_get_action (action_group, "ViewStatusbar");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR));
+ g_object_set (action, "sensitive", eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR), 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);
+ action = gtk_action_group_get_action (popups_action_group, "DownloadLink");
+ g_object_set (action, "sensitive", save_to_disk, NULL);
+ action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs");
+ g_object_set (action, "sensitive", save_to_disk, NULL);
+ action = gtk_action_group_get_action (popups_action_group, "SaveImageAs");
+ g_object_set (action, "sensitive", save_to_disk, NULL);
+
+ 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);
}
static void
@@ -1708,7 +1727,16 @@ chrome_notifier (GConfClient *client,
EphyWindow *window)
{
update_chrome (window);
- update_layout_toggles(window);
+ update_actions(window);
+}
+
+static void
+actions_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyWindow *window)
+{
+ update_actions(window);
}
static void
@@ -1803,6 +1831,10 @@ ephy_window_init (EphyWindow *window)
(CONF_LOCKDOWN_HIDE_MENUBAR,
(GConfClientNotifyFunc)chrome_notifier, window);
+ window->priv->disable_save_to_disk_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK,
+ (GConfClientNotifyFunc)actions_notifier, window);
+
/* ensure the UI is updated */
gtk_ui_manager_ensure_update (GTK_UI_MANAGER (window->ui_merge));
@@ -1819,6 +1851,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_save_to_disk_notifier_id);
if (window->priv->find_dialog)
{
@@ -2010,7 +2043,7 @@ ephy_window_show (GtkWidget *widget)
EphyWindow *window = EPHY_WINDOW(widget);
update_chrome (window);
- update_layout_toggles(window);
+ update_actions(window);
if (!window->priv->has_size)
{