From f7be5f2113a67ae741146181bc163e63f027297d Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 25 Jan 2004 00:38:47 +0000 Subject: Add a way to get the downloads dir with a comment for translators. Use dir 2004-01-25 Marco Pesenti Gritti * lib/ephy-file-helpers.c: (ephy_file_tmp_dir), (ephy_file_downloads_dir): * lib/ephy-file-helpers.h: Add a way to get the downloads dir with a comment for translators. Use dir instead of directory consistently with the other functions. * embed/mozilla/MozDownload.cpp: * src/prefs-dialog.c: (get_download_button_label): * src/window-commands.c: (save_temp_source): Use the helper. --- ChangeLog | 17 +++++++++++++++++ embed/mozilla/MozDownload.cpp | 4 ++-- lib/ephy-file-helpers.c | 14 +++++++++++++- lib/ephy-file-helpers.h | 5 ++++- src/prefs-dialog.c | 16 +++++++--------- src/window-commands.c | 3 ++- 6 files changed, 45 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 208ac73f1..44b5a939d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2004-01-25 Marco Pesenti Gritti + + * lib/ephy-file-helpers.c: (ephy_file_tmp_dir), + (ephy_file_downloads_dir): + * lib/ephy-file-helpers.h: + + Add a way to get the downloads dir with a comment + for translators. + Use dir instead of directory consistently with + the other functions. + + * embed/mozilla/MozDownload.cpp: + * src/prefs-dialog.c: (get_download_button_label): + * src/window-commands.c: (save_temp_source): + + Use the helper. + 2004-01-24 Christian Persch * src/window-commands.c: (window_cmd_help_about): diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index d6f278940..904bcd501 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -49,6 +49,7 @@ #include "mozilla-download.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" +#include "ephy-file-helpers.h" #include #include @@ -549,8 +550,7 @@ GetFilePath (const char *filename) } else if (g_utf8_collate (download_dir, "Downloads") == 0) { - tmp = g_build_filename (g_get_home_dir (), "Desktop", - _("Downloads"), NULL); + tmp = ephy_file_downloads_dir (); g_free (download_dir); download_dir = tmp; } diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index f58ac40e0..7bb1fbeae 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -39,7 +39,7 @@ static char *tmp_dir = NULL; static GList *del_on_exit = NULL; const char * -ephy_file_tmp_directory (void) +ephy_file_tmp_dir (void) { if (tmp_dir == NULL) { @@ -59,6 +59,18 @@ ephy_file_tmp_directory (void) return tmp_dir; } +char * +ephy_file_downloads_dir (void) +{ + const char *translated_folder; + + /* The name of the default downloads folder */ + translated_folder = _("Downloads"); + + return g_build_filename (g_get_home_dir (), "Desktop", + translated_folder, NULL); +} + char * ephy_file_tmp_filename (const char *base, const char *extension) diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h index 2785b6cfa..63ab458de 100644 --- a/lib/ephy-file-helpers.h +++ b/lib/ephy-file-helpers.h @@ -34,7 +34,10 @@ void ephy_file_helpers_init (void); void ephy_file_helpers_shutdown (void); -const char *ephy_file_tmp_directory (void); +char *ephy_file_downloads_dir (void); + +const char *ephy_file_tmp_dir (void); + char *ephy_file_tmp_filename (const char *base, const char *extension); diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 18d4dd1c4..f92910b07 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1087,40 +1087,38 @@ get_download_button_label () char *key, *label, *downloads_path; key = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR); - downloads_path = g_build_path (g_get_home_dir (), "Desktop", - _("Downloads"), NULL); + downloads_path = ephy_file_downloads_dir (); - /* fallback to Home directory */ + /* fallback to default downloads directory */ if (key == NULL) { - key = g_strdup ("~"); + key = ephy_file_downloads_dir (); } if (g_utf8_collate (key, "~/Desktop") == 0) { - g_free (key); label = g_strdup (_("Desktop")); } else if (g_utf8_collate (key, "~") == 0) { - g_free (key); /* Note that this does NOT refer to the home page but to a * user's home folder. It should be translated by the same * term as GTK+'s "Home" string to be consistent with the * filechooser */ label = g_strdup (_("Home")); } - else if (g_utf8_collate (key, downloads_path) == 0) + else if (g_utf8_collate (key, downloads_path) == 0 || + g_utf8_collate (key, "Downloads") == 0) { - g_free (key); label = g_strdup (_("Downloads")); } else { - label = key; + label = g_strdup (key); } g_free (downloads_path); + g_free (key); return label; } diff --git a/src/window-commands.c b/src/window-commands.c index 4714edfcb..8ab797c55 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -739,11 +739,12 @@ save_temp_source (EphyEmbed *embed) const char *static_temp_dir; - static_temp_dir = ephy_file_tmp_directory (); + static_temp_dir = ephy_file_tmp_dir (); if (static_temp_dir == NULL) { return; } + base = g_build_filename (static_temp_dir, "viewsourceXXXXXX", NULL); tmp = ephy_file_tmp_filename (base, "html"); g_free (base); -- cgit v1.2.3