diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-persist.cpp | 28 |
2 files changed, 20 insertions, 14 deletions
@@ -1,3 +1,9 @@ +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. + 2005-05-28 Christian Persch <chpe@cvs.gnome.org> * configure.ac: 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; |