aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozDownload.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-02-13 03:13:54 +0800
committerChristian Persch <chpe@src.gnome.org>2004-02-13 03:13:54 +0800
commit4c401b884b4e4529e470346dd9d0e834661b3823 (patch)
treeb2d9cf9be755c67c29d2fed9e4d4d40d6c3a3975 /embed/mozilla/MozDownload.cpp
parent11559ecfcb6420b24b537d9c7b61f60ec20a8cfb (diff)
downloadgsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar.gz
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar.bz2
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar.lz
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar.xz
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.tar.zst
gsoc2013-epiphany-4c401b884b4e4529e470346dd9d0e834661b3823.zip
Fix numerous places where we weren't properly converting between UTF-8 and
2004-02-12 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-popup-control.c: (save_url), (embed_popup_set_image_as_background_cmd): * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get_type), (ephy_favicon_cache_class_init), (favicon_name_build), (favicon_download_completed_cb), (ephy_favicon_cache_get): * embed/mozilla/FilePicker.cpp: * embed/mozilla/MozDownload.cpp: * lib/ephy-file-chooser.c: (ephy_file_chooser_set_persist_key): * lib/ephy-file-helpers.c: (ephy_file_downloads_dir): * src/popup-commands.c: (popup_cmd_set_image_as_background): * src/prefs-dialog.c: (get_download_button_label), (download_path_response_cb): Fix numerous places where we weren't properly converting between UTF-8 and filename encoding. * embed/ephy-favicon-cache.c: Bump favicon cache xml version. * embed/mozilla/EphyHeaderSniffer.cpp: Fix mem leak, and use CONF_STATE_SAVE_DIR instead of the download dir key for directory persistence.
Diffstat (limited to 'embed/mozilla/MozDownload.cpp')
-rw-r--r--embed/mozilla/MozDownload.cpp36
1 files changed, 27 insertions, 9 deletions
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;
}