aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-10-30 05:38:41 +0800
committerChristian Persch <chpe@src.gnome.org>2005-10-30 05:38:41 +0800
commitbc541864b12e85185251765c99a103718b92b994 (patch)
tree698d93b981692c29cfad5f113e0795ad6fca01b4 /embed/mozilla
parentcd07b3ec041e14b8ed23d0457cc8741eaaa1a00d (diff)
downloadgsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar.gz
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar.bz2
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar.lz
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar.xz
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.tar.zst
gsoc2013-epiphany-bc541864b12e85185251765c99a103718b92b994.zip
Add ephy_file_get_downloads_dir() to get the actual downloads directory,
2005-10-29 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/MozDownload.cpp: * lib/ephy-file-chooser.c: (ephy_file_chooser_constructor): * lib/ephy-file-helpers.c: (ephy_file_get_downloads_dir): * lib/ephy-file-helpers.h: * src/prefs-dialog.c: (download_path_changed_cb), (create_download_path_button): Add ephy_file_get_downloads_dir() to get the actual downloads directory, and use it in the prefs dialogue, the filechooser, and the backend.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/MozDownload.cpp45
1 files changed, 8 insertions, 37 deletions
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 3219dc9c5..cf8a4e3e6 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -53,7 +53,6 @@
#include "MozDownload.h"
#include "EphyUtils.h"
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <glib/gi18n.h>
#include <nsIIOService.h>
@@ -773,50 +772,22 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI
static char*
GetFilePath (const char *filename)
{
- char *path = NULL, *download_dir, *expanded;
+ const char *home_dir;
+ char *download_dir, *path;
- download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
+ download_dir = ephy_file_get_downloads_dir ();
- if (download_dir && strcmp (download_dir, "Downloads") == 0)
+ if (ephy_ensure_dir_exists (download_dir))
{
- g_free (download_dir);
- download_dir = ephy_file_downloads_dir ();
+ path = g_build_filename (download_dir, filename, NULL);
}
- else if (download_dir && strcmp (download_dir, "Desktop") == 0)
- {
- g_free (download_dir);
- download_dir = ephy_file_desktop_dir ();
- }
- else if (download_dir)
- {
- char *converted_dp;
-
- converted_dp = g_filename_from_utf8 (download_dir, -1, NULL, NULL, NULL);
- g_free (download_dir);
- download_dir = converted_dp;
- }
-
- if (download_dir == NULL)
- {
- /* Emergency download destination */
- download_dir = g_strdup (g_get_home_dir ());
- }
-
- g_return_val_if_fail (download_dir != NULL, FALSE);
-
- expanded = gnome_vfs_expand_initial_tilde (download_dir);
- if (ephy_ensure_dir_exists (expanded))
+ else
{
- path = g_build_filename (expanded, filename, NULL);
+ home_dir = g_get_home_dir ();
+ path = g_build_filename (home_dir ? home_dir : "/", filename, NULL);
}
- g_free (expanded);
g_free (download_dir);
- if (path == NULL)
- {
- path = g_build_filename (g_get_home_dir (), filename, NULL);
- }
-
return path;
}