aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--data/epiphany.applications2
-rw-r--r--embed/mozilla/ContentHandler.cpp52
3 files changed, 37 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ad7f5d39..ecd393cb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-29 James Willcox <jwillcox@gnome.org>
+
+ * embed/mozilla/ContentHandler.cpp:
+
+ Remember the directory when saving files. Fixes #115603.
+
2003-06-29 Marco Pesenti Gritti <marco@it.gnome.org>
* NEWS:
diff --git a/data/epiphany.applications b/data/epiphany.applications
index 42283d8db..bb283421d 100644
--- a/data/epiphany.applications
+++ b/data/epiphany.applications
@@ -1,6 +1,6 @@
epiphany
requires_terminal=false
- expects_uris=false
+ expects_uris=true
command=epiphany
can_open_multiple_files=false
name=Web Browser
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 0c7465174..6206b9d9a 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -281,8 +281,11 @@ NS_IMETHODIMP GContentHandler::
nsCOMPtr<nsILocalFile> saveDir;
char *dirName;
- /* FIXME persist download dir */
- dirName = g_strdup (g_get_home_dir());
+ dirName = eel_gconf_get_string (CONF_STATE_DOWNLOADING_DIR);
+ if (dirName == NULL)
+ {
+ dirName = g_strdup (g_get_home_dir());
+ }
saveDir = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
saveDir->InitWithPath (NS_ConvertUTF8toUCS2(dirName));
@@ -292,37 +295,42 @@ NS_IMETHODIMP GContentHandler::
PRInt16 okToSave = nsIFilePicker::returnCancel;
- if (okToSave == nsIFilePicker::returnCancel)
- {
- nsCOMPtr<nsIFilePicker> filePicker =
- do_CreateInstance (G_FILEPICKER_CONTRACTID);
+ nsCOMPtr<nsIFilePicker> filePicker =
+ do_CreateInstance (G_FILEPICKER_CONTRACTID);
- const nsAString &title = NS_ConvertUTF8toUCS2(_("Select the destination filename"));
+ const nsAString &title = NS_ConvertUTF8toUCS2(_("Select the destination filename"));
- filePicker->Init (windowInternal,
- PromiseFlatString(title).get(),
- nsIFilePicker::modeSave);
- filePicker->SetDefaultString (aDefaultFile);
- filePicker->SetDisplayDirectory (saveDir);
+ filePicker->Init (windowInternal,
+ PromiseFlatString(title).get(),
+ nsIFilePicker::modeSave);
+ filePicker->SetDefaultString (aDefaultFile);
+ filePicker->SetDisplayDirectory (saveDir);
- filePicker->Show (&okToSave);
-
- if (okToSave == nsIFilePicker::returnOK)
- {
- filePicker->GetFile (getter_AddRefs(saveFile));
- }
- }
+ filePicker->Show (&okToSave);
- if (okToSave == nsIFilePicker::returnCancel)
- return NS_ERROR_FAILURE;
- else
+ if (okToSave == nsIFilePicker::returnOK)
{
+ filePicker->GetFile (getter_AddRefs(saveFile));
+
+ nsString uFileName;
+ saveFile->GetPath(uFileName);
+ const nsCString &aFileName = NS_ConvertUCS2toUTF8(uFileName);
+
+ char *dir = g_path_get_dirname (aFileName.get());
+
+ eel_gconf_set_string (CONF_STATE_DOWNLOADING_DIR, dir);
+ g_free (dir);
+
nsCOMPtr<nsIFile> directory;
rv = saveFile->GetParent (getter_AddRefs(directory));
NS_IF_ADDREF (*_retval = saveFile);
return NS_OK;
}
+ else
+ {
+ return NS_ERROR_FAILURE;
+ }
}
/* void showProgressDialog (in nsIHelperAppLauncher aLauncher, in nsISupports aContext); */