summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2012-11-03 23:19:28 +0000
committerJohn-Mark Bell <jmb@netsurf-browser.org>2012-11-03 23:19:45 +0000
commitf824ab8af4d3d2e34bd59b860b9c6d5568c3bb44 (patch)
tree70f5f8d5a3ec2f952b18f59a6ed632f207f8a50f /gtk
parent3f1b68384562fe294a1a263214a3fd26ea869bc9 (diff)
downloadnetsurf-f824ab8af4d3d2e34bd59b860b9c6d5568c3bb44.tar.gz
netsurf-f824ab8af4d3d2e34bd59b860b9c6d5568c3bb44.tar.bz2
Port save complete to libdom.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.target2
-rw-r--r--gtk/gui.c3
-rw-r--r--gtk/save.c81
-rw-r--r--gtk/scaffolding.c3
4 files changed, 5 insertions, 84 deletions
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index c60247392..0018a67d5 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -107,7 +107,7 @@ $(eval $(foreach V,$(filter GTK_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(
S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \
treeview.c scaffolding.c gdk.c completion.c login.c throbber.c \
selection.c history.c window.c filetype.c download.c menu.c \
- print.c save.c search.c tabs.c theme.c toolbar.c \
+ print.c search.c tabs.c theme.c toolbar.c \
compat.c cookies.c hotlist.c system_colour.c \
$(addprefix dialogs/,options.c about.c source.c)
diff --git a/gtk/gui.c b/gtk/gui.c
index 891910407..1d15ef743 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -51,6 +51,7 @@
#include "desktop/history_global_core.h"
#include "desktop/netsurf.h"
#include "desktop/options.h"
+#include "desktop/save_complete.h"
#include "desktop/save_pdf/pdf_plotters.h"
#include "desktop/searchweb.h"
#include "desktop/sslcert.h"
@@ -417,6 +418,8 @@ static void gui_init(int argc, char** argv, char **respath)
filepath_sfinddef(respath, buf, "mime.types", "/etc/");
gtk_fetch_filetype_init(buf);
+ save_complete_init();
+
urldb_load(nsoption_charp(url_file));
urldb_load_cookies(nsoption_charp(cookie_file));
diff --git a/gtk/save.c b/gtk/save.c
deleted file mode 100644
index fb8f3e0b9..000000000
--- a/gtk/save.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "content/content.h"
-#include "desktop/save_complete.h"
-#include "utils/utils.h"
-
-/**
-* conducts the filesystem save appropriate to the gui
-* \param path save path
-* \param filename name of file to save
-* \param len data length
-* \param sourcedata pointer to data to save
-* \param type content type
-* \return true for success
-*/
-
-bool save_complete_gui_save(const char *path, const char *filename,
- size_t len, const char *sourcedata, lwc_string *mime_type)
-{
- int res;
- int namelen;
- namelen = strlen(path) + strlen(filename) + 2; /* '/', '\0' */
- char *fullpath = malloc(namelen);
- if (!fullpath) {
- warn_user("NoMemory", 0);
- return false;
- }
- snprintf(fullpath, namelen, "%s/%s", path, filename);
- FILE *f;
- f = fopen(fullpath, "wb");
- free(fullpath);
- if (f == NULL)
- return false;
- res = fwrite(sourcedata, len, 1, f);
- fclose(f);
- if (res != 1)
- return false;
- return true;
-}
-
-/**
-* wrapper for lib function htmlSaveFileFormat; front sets path from path
-* + filename in a filesystem-specific way
-*/
-
-int save_complete_htmlSaveFileFormat(const char *path, const char *filename,
- xmlDocPtr cur, const char *encoding, int format)
-{
- int ret;
- int len = strlen(path) + strlen(filename) + 2;
- char *fullpath = malloc(len);
- if (fullpath == NULL) {
- warn_user("NoMemory", 0);
- return -1;
- }
- snprintf(fullpath, len, "%s/%s", path, filename);
- ret = htmlSaveFileFormat(fullpath, cur, encoding, format);
- free(fullpath);
- return ret;
-}
-
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 22816cf89..91288a22e 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -668,9 +668,8 @@ MULTIHANDLER(savepage)
return TRUE;
}
closedir(d);
- save_complete_init();
save_complete(nsgtk_get_browser_window(
- g->top_level)->current_content, path);
+ g->top_level)->current_content, path, NULL);
g_free(path);
gtk_widget_destroy(fc);