aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/PrintingPromptService.cpp33
-rw-r--r--embed/mozilla/mozilla-embed.cpp9
2 files changed, 30 insertions, 12 deletions
diff --git a/embed/mozilla/PrintingPromptService.cpp b/embed/mozilla/PrintingPromptService.cpp
index cab6b9b22..3a2bd63ae 100644
--- a/embed/mozilla/PrintingPromptService.cpp
+++ b/embed/mozilla/PrintingPromptService.cpp
@@ -26,6 +26,7 @@
#include "print-dialog.h"
#include "ephy-embed.h"
+#include "ephy-command-manager.h"
#include "MozillaPrivate.h"
#include "PrintingPromptService.h"
@@ -49,27 +50,37 @@ GPrintingPromptService::~GPrintingPromptService()
NS_IMETHODIMP GPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
{
EphyDialog *dialog;
- EmbedPrintInfo *info;
- nsresult rv = NS_OK;
+ nsresult rv = NS_ERROR_ABORT;
GtkWidget *gtkParent = MozillaFindGtkParent(parent);
+ if (!gtkParent) return NS_ERROR_ABORT;
+
EphyEmbed *embed = EPHY_EMBED (MozillaFindEmbed (parent));
+ if (!embed) return NS_ERROR_ABORT;
- dialog = print_dialog_new_with_parent (gtkParent, embed, &info);
+ dialog = ephy_print_dialog_new (gtkParent, embed, TRUE);
ephy_dialog_set_modal (dialog, TRUE);
- gint ret = ephy_dialog_run (dialog);
- if(ret == GTK_RESPONSE_OK)
+ int ret = ephy_dialog_run (dialog);
+ if (ret == GTK_RESPONSE_OK)
{
- MozillaCollatePrintSettings(info, printSettings);
- print_free_info(info);
+ EmbedPrintInfo *info;
+
+ info = ephy_print_get_print_info ();
+
+ /* 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;
+ }
+
+ MozillaCollatePrintSettings (info, printSettings);
+
+ ephy_print_info_free (info);
rv = NS_OK;
}
- else
- {
- rv = NS_ERROR_ABORT;
- }
g_object_unref (dialog);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index c031664af..297b64747 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -703,7 +703,14 @@ impl_print (EphyEmbed *embed,
nsCOMPtr<nsIPrintSettings> options;
result = mpriv->browser->GetPrintSettings(getter_AddRefs(options));
- if (!NS_SUCCEEDED (result)) return;
+ if (NS_FAILED (result) || !options) return;
+
+ /* 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;
+ }
MozillaCollatePrintSettings(info, options);