aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-file-helpers.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-11-01 16:47:54 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2011-03-08 04:34:52 +0800
commitfdafabde40eced013ffdcb49e4f080542fbbc402 (patch)
treeeffe78b5b8c9c9a9fb785d74bbdac0ecc66afc79 /lib/ephy-file-helpers.c
parent07202bf4e9b6f7809b58b0c3e13af0a6de593e28 (diff)
downloadgsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar.gz
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar.bz2
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar.lz
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar.xz
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.tar.zst
gsoc2013-epiphany-fdafabde40eced013ffdcb49e4f080542fbbc402.zip
ephy-file-helpers: only one downloads_dir function
Remove all the ambiguity, we always throw downloads to the same place or the Desktop. Bug #618443
Diffstat (limited to 'lib/ephy-file-helpers.c')
-rw-r--r--lib/ephy-file-helpers.c71
1 files changed, 4 insertions, 67 deletions
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index aa4627ec6..5a6bc335b 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -106,41 +106,6 @@ ephy_file_tmp_dir (void)
}
/**
- * ephy_file_downloads_dir:
- *
- * Gets the basename for Epiphany's Downloads dir. This depends on the current
- * locale. For the full path to the downloads directory see
- * ephy_file_get_downloads_dir().
- *
- * Returns: a newly-allocated string containing the downloads dir basename.
- **/
-char *
-ephy_file_downloads_dir (void)
-{
- const char *translated_folder;
- const char *xdg_download_dir;
- char *desktop_dir, *converted, *downloads_dir;
-
- xdg_download_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
- if (xdg_download_dir != NULL)
- return g_strdup (xdg_download_dir);
-
- /* The name of the default downloads folder */
- translated_folder = _("Downloads");
-
- converted = g_filename_from_utf8 (translated_folder, -1, NULL,
- NULL, NULL);
-
- desktop_dir = ephy_file_desktop_dir ();
- downloads_dir = g_build_filename (desktop_dir, converted, NULL);
-
- g_free (desktop_dir);
- g_free (converted);
-
- return downloads_dir;
-}
-
-/**
* ephy_file_get_downloads_dir:
*
* Gets the full path to the downloads dir. This uses ephy_file_downloads_dir()
@@ -152,44 +117,16 @@ ephy_file_downloads_dir (void)
char *
ephy_file_get_downloads_dir (void)
{
- char *download_dir, *expanded;
+ char *download_dir;
download_dir = g_settings_get_string (EPHY_SETTINGS_STATE,
EPHY_PREFS_STATE_DOWNLOAD_DIR);
- if (download_dir && strcmp (download_dir, _("Downloads")) == 0)
- {
- g_free (download_dir);
- download_dir = ephy_file_downloads_dir ();
- }
- 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;
- }
-
/* Emergency download destination */
- if (download_dir == NULL)
- {
- const char *home_dir;
- home_dir = g_get_home_dir ();
- download_dir = g_strdup (home_dir != NULL ? home_dir : "/");
- }
-
- g_return_val_if_fail (download_dir != NULL, NULL);
-
- expanded = ephy_string_expand_initial_tilde (download_dir);
- g_free (download_dir);
+ if (g_path_is_absolute (download_dir) != TRUE)
+ download_dir = ephy_file_desktop_dir ();
- return expanded;
+ return download_dir;
}
/**