diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-06-25 19:31:22 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-06-25 19:31:22 +0800 |
commit | 36ad80414746a470d3f64849266817c58fef2344 (patch) | |
tree | f7360d1212f4dbc10e0606b4e78852ebbb3463a2 /embed/mozilla/EphyBrowser.cpp | |
parent | b6b7539092921b12790435b10e6bfb68ec9339f5 (diff) | |
download | gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar.gz gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar.bz2 gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar.lz gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar.xz gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.tar.zst gsoc2013-epiphany-36ad80414746a470d3f64849266817c58fef2344.zip |
Simplify print code. Now there is only one case to deal with, the mozilla
2004-06-25 Marco Pesenti Gritti <marco@gnome.org>
* embed/ephy-embed.c: (ephy_embed_print),
(ephy_embed_set_print_preview_mode):
* embed/ephy-embed.h:
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/PrintingPromptService.cpp:
* embed/mozilla/mozilla-embed.cpp:
* embed/print-dialog.c: (ephy_print_dialog_response_cb),
(ephy_print_dialog_new):
* embed/print-dialog.h:
* src/ephy-window.c: (ephy_window_delete_event_cb),
(ephy_window_finalize), (update_embed_dialogs), (ephy_window_find):
* src/ppview-toolbar.c: (toolbar_cmd_ppv_close):
* src/window-commands.c: (window_cmd_file_print_preview),
(window_cmd_file_print):
Simplify print code. Now there is only one case to deal with,
the mozilla prompt dialog.
This should help with xprint.
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 8481cee56..b9db2c2a0 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -24,9 +24,11 @@ #include "EphyBrowser.h" #include "EphyUtils.h" +#include "MozillaPrivate.h" #include "ephy-embed.h" #include "ephy-string.h" #include "ephy-debug.h" +#include "print-dialog.h" #include <gtkmozembed_internal.h> #include <unistd.h> @@ -311,43 +313,49 @@ EphyBrowser::DetachListeners(void) return NS_OK; } -nsresult EphyBrowser::Print (nsIPrintSettings *options, PRBool preview) +nsresult EphyBrowser::Print () { - nsresult result; - NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser)); NS_ENSURE_TRUE (print, NS_ERROR_FAILURE); - if (!preview) - { - result = print->Print (options, nsnull); - } - else - { - result = print->PrintPreview(options, nsnull, nsnull); - } - - return result; + return print->Print (nsnull, nsnull); } -nsresult EphyBrowser::PrintPreviewClose (void) +nsresult EphyBrowser::SetPrintPreviewMode (PRBool previewMode) { nsresult rv; - PRBool isPreview = PR_FALSE; NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser)); NS_ENSURE_TRUE (print, NS_ERROR_FAILURE); - rv = print->GetDoingPrintPreview(&isPreview); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + if (previewMode) + { + EmbedPrintInfo *info; - if (isPreview == PR_TRUE) + nsCOMPtr<nsIPrintSettings> settings; + print->GetGlobalPrintSettings (getter_AddRefs(settings)); + + info = ephy_print_get_print_info (); + MozillaCollatePrintSettings (info, settings); + ephy_print_info_free (info); + + rv = print->PrintPreview (nsnull, mDOMWindow, nsnull); + } + else { - rv = print->ExitPrintPreview(); + PRBool isPreview = PR_FALSE; + + rv = print->GetDoingPrintPreview(&isPreview); + NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + + if (isPreview == PR_TRUE) + { + rv = print->ExitPrintPreview(); + } } return rv; @@ -373,16 +381,6 @@ nsresult EphyBrowser::PrintPreviewNavigate(PRInt16 navType, PRInt32 pageNum) return print->PrintPreviewNavigate(navType, pageNum); } -nsresult EphyBrowser::GetPrintSettings (nsIPrintSettings **options) -{ - NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); - - nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser)); - NS_ENSURE_TRUE (print, NS_ERROR_FAILURE); - - return print->GetGlobalPrintSettings(options); -} - nsresult EphyBrowser::GetSHistory (nsISHistory **aSHistory) { nsresult result; |