aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-display.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-04-02 02:23:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-04-02 02:23:57 +0800
commit138b676757ffa2bfcfe8146d73af519fb77aaaed (patch)
tree22ddf75372b778b622f6bc5733eac645fce539b5 /mail/mail-display.c
parentd10e8990d806eabaf8720b1532d33f335486df43 (diff)
downloadgsoc2013-evolution-138b676757ffa2bfcfe8146d73af519fb77aaaed.tar.gz
gsoc2013-evolution-138b676757ffa2bfcfe8146d73af519fb77aaaed.tar.zst
gsoc2013-evolution-138b676757ffa2bfcfe8146d73af519fb77aaaed.zip
Don't allow the 'prefix' argument to make_safe_filename() be NULL. If we
2003-04-01 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (save_part): Don't allow the 'prefix' argument to make_safe_filename() be NULL. If we don't yet have a save_dir in gconf, use $HOME, etc. Fixes bug #40608. svn path=/trunk/; revision=20621
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r--mail/mail-display.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 657275df98..ec847e84c6 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -211,7 +211,7 @@ write_data_to_file (CamelMimePart *part, const char *name, gboolean unique)
}
static char *
-make_safe_filename (const char *prefix,CamelMimePart *part)
+make_safe_filename (const char *prefix, CamelMimePart *part)
{
const char *name;
char *safe, *p;
@@ -318,19 +318,19 @@ on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md)
static void
save_part (CamelMimePart *part)
{
+ char *filename, *dir, *home, *base;
GtkFileSelection *file_select;
- char *filename, *dir, *base;
GConfClient *gconf;
camel_object_ref (part);
+ home = getenv ("HOME");
gconf = gconf_client_get_default ();
dir = gconf_client_get_string (gconf, "/apps/evolution/mail/save_dir", NULL);
- filename = make_safe_filename (dir, part);
+ filename = make_safe_filename (dir ? dir : (home ? home : ""), part);
g_free (dir);
- file_select = GTK_FILE_SELECTION (
- gtk_file_selection_new (_("Save Attachment")));
+ file_select = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save Attachment")));
gtk_file_selection_set_filename (file_select, filename);
/* set the GtkEntry with the locale filename by breaking abstraction */
base = g_path_get_basename (filename);