From d204d6d555ac8e79da330a93e96fb070c8ee8f8c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 26 Oct 2014 23:49:18 +0000 Subject: 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. --- desktop/gui_factory.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'desktop/gui_factory.c') 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; } -- cgit v1.2.3