aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorJean-François Rameau <jframeau@cvs.gnome.org>2005-05-29 03:00:56 +0800
committerJean-François Rameau <jframeau@src.gnome.org>2005-05-29 03:00:56 +0800
commited4d0f2ebcedabd15ebeb73408b69cd314fd1e86 (patch)
tree69124c934640675040aa42ff3b9e69bd4ca0da6e /embed/mozilla
parenta29f71709ee09ddce6da8ddd80c45b5311dd38b2 (diff)
downloadgsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar.gz
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar.bz2
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar.lz
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar.xz
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.tar.zst
gsoc2013-epiphany-ed4d0f2ebcedabd15ebeb73408b69cd314fd1e86.zip
Get a temporary filename to save to only when needed.
2005-05-28 Jean-François Rameau <jframeau@cvs.gnome.org> * embed/mozilla/mozilla-embed-persist.cpp: (impl_save): Get a temporary filename to save to only when needed.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 06733ddbe..c10d677ae 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -177,19 +177,6 @@ impl_save (EphyEmbedPersist *persist)
/* we must have one of uri or browser */
g_assert (browser != NULL || uri != NULL);
- /* Get a temp filename to save to */
- char *tmp_filename, *base;
- base = g_build_filename (g_get_tmp_dir (), "sav-XXXXXX", NULL);
- tmp_filename = ephy_file_tmp_filename (base, "html");
- g_free (base);
- if (tmp_filename == NULL) return FALSE;
-
- nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
- NS_ENSURE_TRUE (tmpFile, FALSE);
-
- tmpFile->InitWithNativePath (nsEmbedCString (tmp_filename));
- g_free (tmp_filename);
-
/* Get the uri to save to */
nsCOMPtr<nsIURI> inURI;
if (uri)
@@ -254,6 +241,19 @@ impl_save (EphyEmbedPersist *persist)
if (filename == NULL || filename[0] == '\0')
{
+ /* Get a temp filename to save to */
+ char *tmp_filename, *base;
+ base = g_build_filename (g_get_tmp_dir (), "sav-XXXXXX", NULL);
+ tmp_filename = ephy_file_tmp_filename (base, "html");
+ g_free (base);
+ if (tmp_filename == NULL) return FALSE;
+
+ nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ NS_ENSURE_TRUE (tmpFile, FALSE);
+
+ tmpFile->InitWithNativePath (nsEmbedCString (tmp_filename));
+ g_free (tmp_filename);
+
/* Create an header sniffer and do the save */
nsCOMPtr<nsIWebBrowserPersist> webPersist =
MOZILLA_EMBED_PERSIST (persist)->priv->mPersist;
@@ -263,7 +263,7 @@ impl_save (EphyEmbedPersist *persist)
(webPersist, MOZILLA_EMBED_PERSIST (persist),
tmpFile, inURI, DOMDocument, postData, single);
if (!sniffer) return FALSE;
-
+
webPersist->SetProgressListener(sniffer);
rv = webPersist->SaveURI(inURI, pageDescriptor, nsnull, nsnull, nsnull, tmpFile);
if (NS_FAILED (rv)) return FALSE;