aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp4
-rw-r--r--embed/mozilla/FilePicker.cpp3
-rw-r--r--embed/mozilla/MozDownload.cpp36
3 files changed, 32 insertions, 11 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index abf0ba931..a37c9164c 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -216,6 +216,8 @@ filechooser_response_cb (EphyFileChooser *dialog, gint response, EphyHeaderSniff
sniffer->InitiateDownload (destFile);
}
}
+
+ g_free (filename);
}
// FIXME how to inform user of failed save ?
@@ -314,7 +316,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
dialog = ephy_file_chooser_new (title ? title: _("Save"),
GTK_WIDGET (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- key ? key : CONF_STATE_DOWNLOAD_DIR);
+ key ? key : CONF_STATE_SAVE_DIR);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
NS_ConvertUCS2toUTF8 (defaultFileName).get());
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
index 71685c958..ee1dda489 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -202,7 +202,8 @@ NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
if (filename != NULL)
{
converted = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
-
+
+ /* FIXME: when can depend on moz >= 1.6, use CopyUTF8toUCS2 here */
*aDefaultString = ToNewUnicode (NS_ConvertUTF8toUCS2 (converted));
g_free (filename);
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index b8c0f1833..4be00f301 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -540,28 +540,46 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI
static char*
GetFilePath (const char *filename)
{
- char *path, *download_dir, *expanded, *tmp;
+ char *path = NULL;
+ char *download_dir, *converted_dp, *expanded, *tmp;
download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
if (!download_dir)
{
/* Emergency download destination */
- download_dir = g_strdup (g_get_home_dir ());
+ /* FIXME !! prefs-dialog.c::get_download_button_label()
+ * claims that fallback for key == NULL is the
+ * downloads dir, not the home dir !
+ */
+ return g_build_filename (g_get_home_dir (), filename, NULL);
}
- else if (g_utf8_collate (download_dir, "Downloads") == 0)
+
+ if (g_utf8_collate (download_dir, "Downloads") == 0)
{
- tmp = ephy_file_downloads_dir ();
g_free (download_dir);
- download_dir = tmp;
- }
- expanded = gnome_vfs_expand_initial_tilde (download_dir);
- path = g_build_filename (expanded, filename, NULL);
- g_free (expanded);
+ return g_build_filename (ephy_file_downloads_dir (),
+ filename, NULL);
+ }
+ converted_dp = g_filename_from_utf8 (download_dir, -1, NULL, NULL, NULL);
g_free (download_dir);
+ if (converted_dp)
+ {
+ expanded = gnome_vfs_expand_initial_tilde (converted_dp);
+ path = g_build_filename (expanded, filename, NULL);
+
+ g_free (expanded);
+ g_free (converted_dp);
+ }
+ else
+ {
+ /* Fallback, see FIXME above too */
+ path = g_build_filename (g_get_home_dir (), filename, NULL);
+ }
+
return path;
}