From 5d5a8b49ca1742cc34161ba73287540f779795a5 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 2 Oct 2004 14:25:00 +0000 Subject: Recognise "Desktop" special downloads directory. Fixes bug #152926. 2004-10-02 Christian Persch * embed/mozilla/MozDownload.cpp: * lib/ephy-file-helpers.c: (ephy_file_downloads_dir), (ephy_file_desktop_dir): * lib/ephy-file-helpers.h: * src/prefs-dialog.c: (get_download_button_label): Recognise "Desktop" special downloads directory. Fixes bug #152926. --- ChangeLog | 10 ++++++++++ embed/mozilla/MozDownload.cpp | 5 +++++ lib/ephy-file-helpers.c | 25 ++++++++++++++++++------- lib/ephy-file-helpers.h | 2 ++ src/prefs-dialog.c | 4 ++++ 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8df73620a..d3687ad50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-10-02 Christian Persch + + * embed/mozilla/MozDownload.cpp: + * lib/ephy-file-helpers.c: (ephy_file_downloads_dir), + (ephy_file_desktop_dir): + * lib/ephy-file-helpers.h: + * src/prefs-dialog.c: (get_download_button_label): + + Recognise "Desktop" special downloads directory. Fixes bug #152926. + 2004-10-02 Christian Persch * Makefile.am: diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index c615f8be1..a70daf0c8 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -600,6 +600,11 @@ GetFilePath (const char *filename) 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; diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 138d8719f..49f4c487d 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -72,8 +72,7 @@ char * ephy_file_downloads_dir (void) { const char *translated_folder; - char *converted, *downloads_dir; - gboolean desktop_is_home; + char *desktop_dir, *converted, *downloads_dir; /* The name of the default downloads folder */ translated_folder = _("Downloads"); @@ -81,21 +80,33 @@ ephy_file_downloads_dir (void) 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; +} + +char * +ephy_file_desktop_dir (void) +{ + char *downloads_dir; + gboolean desktop_is_home; + desktop_is_home = eel_gconf_get_boolean (CONF_DESKTOP_IS_HOME_DIR); if (desktop_is_home) { - downloads_dir = g_build_filename - (g_get_home_dir (), converted, NULL); + downloads_dir = g_strdup (g_get_home_dir ()); } else { downloads_dir = g_build_filename - (g_get_home_dir (), "Desktop", converted, NULL); + (g_get_home_dir (), "Desktop", NULL); } - g_free (converted); - return downloads_dir; } diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h index bfb7e1b6c..6beb2951a 100644 --- a/lib/ephy-file-helpers.h +++ b/lib/ephy-file-helpers.h @@ -35,6 +35,8 @@ void ephy_file_helpers_shutdown (void); char *ephy_file_downloads_dir (void); +char *ephy_file_desktop_dir (void); + const char *ephy_file_tmp_dir (void); char *ephy_file_tmp_filename (const char *base, diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 35155f4e9..abd0d7da6 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1112,6 +1112,10 @@ get_download_button_label () { label = g_strdup (_("Desktop")); } + else if (g_utf8_collate (key, "Desktop") == 0) + { + label = g_strdup (_("Desktop")); + } else { label = g_strdup (key); -- cgit v1.2.3