diff options
author | Christopher James Lahey <clahey@ximian.com> | 2004-01-11 05:59:25 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-01-11 05:59:25 +0800 |
commit | 09136af43c1074fb979578be2987cd0ae3a8852d (patch) | |
tree | e4673d8a9ad46a80a97002004426fad58e99841f /embed/mozilla/PrintingPromptService.cpp | |
parent | d33c13d6d52a405ef9bec15b414904a9c2620380 (diff) | |
download | gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar.gz gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar.bz2 gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar.lz gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar.xz gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.tar.zst gsoc2013-epiphany-09136af43c1074fb979578be2987cd0ae3a8852d.zip |
Implement print and print setup disabling for lockdown mode.
2004-01-10 Christopher James Lahey <clahey@ximian.com>
* embed/mozilla/PrintingPromptService.cpp:
* lib/ephy-prefs.h:
* src/ephy-main.c: (main):
* src/ephy-window.c: (update_actions), (ephy_window_init),
(ephy_window_finalize), (ephy_window_print):
Implement print and print setup disabling for lockdown mode.
Diffstat (limited to 'embed/mozilla/PrintingPromptService.cpp')
-rw-r--r-- | embed/mozilla/PrintingPromptService.cpp | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/embed/mozilla/PrintingPromptService.cpp b/embed/mozilla/PrintingPromptService.cpp index 60eb3b1db..85c885592 100644 --- a/embed/mozilla/PrintingPromptService.cpp +++ b/embed/mozilla/PrintingPromptService.cpp @@ -30,6 +30,8 @@ #include "ephy-command-manager.h" #include "MozillaPrivate.h" #include "PrintingPromptService.h" +#include "eel-gconf-extensions.h" +#include "ephy-prefs.h" #include <nsIPrintSettings.h> #include <nsCOMPtr.h> @@ -51,41 +53,50 @@ GPrintingPromptService::~GPrintingPromptService() NS_IMETHODIMP GPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) { EphyDialog *dialog; - nsresult rv = NS_ERROR_ABORT; - GtkWidget *gtkParent = MozillaFindGtkParent(parent); - NS_ENSURE_TRUE (gtkParent, NS_ERROR_FAILURE); + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING)) + { + return NS_ERROR_ABORT; + } EphyEmbed *embed = EPHY_EMBED (MozillaFindEmbed (parent)); NS_ENSURE_TRUE (embed, NS_ERROR_FAILURE); - dialog = ephy_print_dialog_new (gtkParent, embed, TRUE); - ephy_dialog_set_modal (dialog, TRUE); - - int ret = ephy_dialog_run (dialog); - if (ret == GTK_RESPONSE_OK) + if (!(eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) || + eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE))) { - EmbedPrintInfo *info; + GtkWidget *gtkParent = MozillaFindGtkParent(parent); + NS_ENSURE_TRUE (gtkParent, NS_ERROR_FAILURE); + + dialog = ephy_print_dialog_new (gtkParent, embed, TRUE); + ephy_dialog_set_modal (dialog, TRUE); + + int ret = ephy_dialog_run (dialog); - info = ephy_print_get_print_info (); + g_object_unref (dialog); - /* work around mozilla bug which borks when printing selection without having one */ - if (info->pages == 2 && ephy_command_manager_can_do_command - (EPHY_COMMAND_MANAGER (embed), "cmd_copy") == FALSE) + if (ret != GTK_RESPONSE_OK) { - info->pages = 0; + return NS_ERROR_ABORT; } + } - MozillaCollatePrintSettings (info, printSettings); + EmbedPrintInfo *info; - ephy_print_info_free (info); + info = ephy_print_get_print_info (); - rv = NS_OK; + /* work around mozilla bug which borks when printing selection without having one */ + if (info->pages == 2 && ephy_command_manager_can_do_command + (EPHY_COMMAND_MANAGER (embed), "cmd_copy") == FALSE) + { + info->pages = 0; } - g_object_unref (dialog); + MozillaCollatePrintSettings (info, printSettings); - return rv; + ephy_print_info_free (info); + + return NS_OK; } /* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */ @@ -101,6 +112,13 @@ NS_IMETHODIMP GPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPri EphyDialog *dialog; nsresult rv = NS_ERROR_ABORT; + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING) || + eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) || + eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE)) + { + return rv; + } + dialog = ephy_print_setup_dialog_new (); ephy_dialog_set_modal (dialog, TRUE); |