summaryrefslogtreecommitdiff
path: root/desktop/gui_factory.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-10-26 23:49:18 +0000
committerVincent Sanders <vince@kyllikki.org>2014-10-26 23:53:14 +0000
commitd204d6d555ac8e79da330a93e96fb070c8ee8f8c (patch)
tree5422294976240b8f63d8255f5e47c8396ad88248 /desktop/gui_factory.c
parent29dfdd459dc4f835bc4dda5d67714b4aaa2c897a (diff)
downloadnetsurf-d204d6d555ac8e79da330a93e96fb070c8ee8f8c.tar.gz
netsurf-d204d6d555ac8e79da330a93e96fb070c8ee8f8c.tar.bz2
Clean up saving as PDF
This removes the global PDF_Password interface that had completely bitrotted and moves it into the standard misc operation table with a sensible defualt implementation. This also cleans up and fixes the gtk frontend implementation of the pdf password callback so it compiles. Finally this moves the implementation to a sensible place alongside the other exporters reducing target makefile complexity futher.
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r--desktop/gui_factory.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index e7770e770..b69700fca 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -20,6 +20,7 @@
#include "content/backing_store.h"
#include "utils/file.h"
+#include "desktop/save_pdf.h"
#include "desktop/download.h"
#include "desktop/searchweb.h"
#include "desktop/gui_download.h"
@@ -259,6 +260,12 @@ static void gui_default_download_done(struct gui_download_window *dw)
{
}
+static struct gui_download_table default_download_table = {
+ .create = gui_default_download_create,
+ .data = gui_default_download_data,
+ .error = gui_default_download_error,
+ .done = gui_default_download_done,
+};
/** verify download window table is valid */
static nserror verify_download_register(struct gui_download_table *gdt)
@@ -566,12 +573,12 @@ static void gui_default_401login_open(nsurl *url, const char *realm,
cb(false, cbpw);
}
-static struct gui_download_table default_download_table = {
- .create = gui_default_download_create,
- .data = gui_default_download_data,
- .error = gui_default_download_error,
- .done = gui_default_download_done,
-};
+static void
+gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
+{
+ *owner_pass = NULL;
+ save_pdf(path);
+}
/** verify browser table is valid */
static nserror verify_browser_register(struct gui_browser_table *gbt)
@@ -599,6 +606,9 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
if (gbt->login == NULL) {
gbt->login = gui_default_401login_open;
}
+ if (gbt->pdf_password == NULL) {
+ gbt->pdf_password = gui_default_pdf_password;
+ }
return NSERROR_OK;
}