diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/mail/em-utils.c evolution-2.7.91/mail/em-utils.c
--- evolution-2.7.91.orig/mail/em-utils.c	2006-05-31 23:29:48.000000000 -0400
+++ evolution-2.7.91/mail/em-utils.c	2006-08-23 10:07:39.000000000 -0400
@@ -379,11 +379,9 @@
 emu_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action)
 {
 	GtkWidget *filesel;
-	const char *dir;
-	char *realname, *gdir;
+	char *realname, *uri;
 	GConfClient *gconf;
 
-#ifdef USE_GTKFILECHOOSER
 	filesel = gtk_file_chooser_dialog_new (title,
 					       NULL,
 					       action,
@@ -392,21 +390,16 @@
 					       NULL);
 	gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
 	gtk_file_chooser_set_local_only (filesel, FALSE);
-#else
-	char *filename;
-
-	filesel = gtk_file_selection_new (title);
-#endif
 	
 	if (parent)
 		e_dialog_set_transient_for((GtkWindow *)filesel, parent);
 
 	gconf = gconf_client_get_default();
-	dir = gdir = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+	uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
 	g_object_unref(gconf);
 
-	if (dir == NULL)
-		dir = g_get_home_dir();
+	if (uri == NULL)
+		uri = gnome_vfs_get_uri_from_local_path(g_get_home_dir());
 
 	if (name && name[0]) {
 		realname = g_strdup (name);
@@ -415,79 +408,87 @@
 		realname = NULL;
 	}
 
-#ifdef USE_GTKFILECHOOSER
-	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), dir);
+	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (filesel), uri);
 	
 	if (realname)
 		gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), realname);
-#else
-	filename = g_build_filename (dir, G_DIR_SEPARATOR_S, realname, NULL);
-	gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), filename);
-	g_free (filename);
-#endif
 	
 	g_free (realname);
-	g_free (gdir);
+	g_free (uri);
 
 	return filesel;
 }
 
+/*
+ * Save the save_dir path for evolution.  Expects to get a URI, that it frees
+ * when done.  Genearally, this should be called with the output of
+ * gtk_file_chooser_get_current_folder_uri()  The URI must be a path URI, not a
+ * file URI.
+ */
 static void
-emu_update_save_path(const char *filename, gboolean path)
+emu_update_save_path(char *uri)
 {
-	char *dir = path ? (char *)filename : g_path_get_dirname(filename);
 	GConfClient *gconf = gconf_client_get_default();
 
-	gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", dir, NULL);
+	gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, NULL);
 	g_object_unref(gconf);
-	if (!path)
-		g_free(dir);
+	g_free(uri);
 }
 
 static gboolean
-emu_can_save(GtkWindow *parent, const char *path)
+emu_can_save(GtkWindow *parent, const char *uri)
 {
 	struct stat st;
+	char *path;
+	int res;
 	
-	if (!path || path[0] == 0)
+	if (!uri || uri[0] == 0)
+		return FALSE;
+
+	path = gnome_vfs_get_local_path_from_uri(uri);
+	if (!path)
 		return FALSE;
 
 	/* make sure we can actually save to it... */
-	if (g_stat (path, &st) != -1 && !S_ISREG (st.st_mode))
+	if (g_stat (path, &st) != -1 && !S_ISREG (st.st_mode)) {
+		g_free(path);
 		return FALSE;
+	}
 	
+	res = TRUE;
 	if (g_access (path, F_OK) == 0) {
 		if (g_access (path, W_OK) != 0) {
 			e_error_run(parent, "mail:no-save-path", path, g_strerror(errno), NULL);
+			g_free(path);
 			return FALSE;
 		}
 		
-		return e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, path, NULL) == GTK_RESPONSE_OK;
+		res = e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, path, NULL) == GTK_RESPONSE_OK;
+
 	}
 	
-	return TRUE;
+	g_free(path);
+	return res;
 }
 
 static void
 emu_save_part_response(GtkWidget *filesel, int response, CamelMimePart *part)
 {
-	const char *path;
-	const char *uri;
+	char *uri;
 	
 	if (response == GTK_RESPONSE_OK) {
-#ifdef USE_GTKFILECHOOSER
 		uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
-		path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel));
-#else
-		path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
-#endif
 
-		if (emu_file_check_local(uri) && !emu_can_save((GtkWindow *)filesel, path))
+		if (emu_file_check_local(uri) && !emu_can_save((GtkWindow *)filesel, uri)) {
+			g_free(uri);
 			return;
+		}
 
-		emu_update_save_path(path, FALSE);
+		emu_update_save_path(gtk_file_chooser_get_current_folder_uri(
+					GTK_FILE_CHOOSER(filesel)));
 		/* FIXME: popup error if it fails? */
 		mail_save_part(part, uri, NULL, NULL, FALSE);
+		g_free(uri);
 	}
 
 	gtk_widget_destroy((GtkWidget *)filesel);
@@ -528,16 +529,14 @@
 static void
 emu_save_parts_response (GtkWidget *filesel, int response, GSList *parts)
 {
-        char *path = NULL;
         GSList *selected;
+		char *uri = NULL;
+		char *path = NULL;
         if (response == GTK_RESPONSE_OK) {
-#ifdef USE_GTKFILECHOOSER
-                path = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (filesel));
-#else
-                path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
-#endif
-
-                emu_update_save_path(path, TRUE);
+				uri = gtk_file_chooser_get_current_folder_uri (
+							GTK_FILE_CHOOSER (filesel));
+				path = gnome_vfs_get_local_path_from_uri(uri);
+                emu_update_save_path(uri);
 
                 for ( selected = parts; selected != NULL; selected = selected->next) {
                         const char *file_name;
@@ -643,21 +642,21 @@
 static void
 emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messages_data *data)
 {
-	const char *path;
+	char *uri;
 	
 	if (response == GTK_RESPONSE_OK) {
-#ifdef USE_GTKFILECHOOSER
-		path = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
-#else
-		path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
-#endif
+		uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
 
-		if (!emu_can_save((GtkWindow *)filesel, path))
+		if (emu_file_check_local(uri) && !emu_can_save((GtkWindow *)filesel, uri)) {
+			g_free(uri);
 			return;
+		}
 
-		emu_update_save_path(path, FALSE);
-		mail_save_messages(data->folder, data->uids, path, NULL, NULL);
+		emu_update_save_path(gtk_file_chooser_get_current_folder_uri(
+					GTK_FILE_CHOOSER (filesel)));
+		mail_save_messages(data->folder, data->uids, uri, NULL, NULL);
 		data->uids = NULL;
+		g_free(uri);
 	}
 
 	camel_object_unref(data->folder);
