[evolution-patches] Fix to Save All Attachments to save the path



Hi,

This fixes a bug, where in if you save all the attachments, next time
you save, it shows the parent dir of where you saved previously.

The simple patch could be just to check if what is getting saved is
directory or if file get its directory. I didnt know, which api could
help me out there. So i have used a boolean variable and passing the
type explicitly, since we knew it.

-Srini
Index: em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.62
diff -u -p -r1.62 em-utils.c
--- em-utils.c	25 Jul 2005 04:23:41 -0000	1.62
+++ em-utils.c	1 Aug 2005 04:09:18 -0000
@@ -356,14 +356,15 @@ emu_get_save_filesel (GtkWidget *parent,
 }
 
 static void
-emu_update_save_path(const char *filename)
+emu_update_save_path(const char *filename, gboolean path)
 {
-	char *dir = g_path_get_dirname(filename);
+	char *dir = path ? filename : g_path_get_dirname(filename);
 	GConfClient *gconf = gconf_client_get_default();
 
 	gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", dir, NULL);
 	g_object_unref(gconf);
-	g_free(dir);
+	if (!path)
+		g_free(dir);
 }
 
 static gboolean
@@ -405,7 +406,7 @@ emu_save_part_response(GtkWidget *filese
 		if (!emu_can_save((GtkWindow *)filesel, path))
 			return;
 
-		emu_update_save_path(path);
+		emu_update_save_path(path, FALSE);
 		/* FIXME: popup error if it fails? */
 		mail_save_part(part, path, NULL, NULL);
 	}
@@ -457,7 +458,7 @@ emu_save_parts_response (GtkWidget *file
                 path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
 #endif
 
-                emu_update_save_path(path);
+                emu_update_save_path(path, TRUE);
 
                 for ( selected = parts; selected != NULL; selected = selected->next) {
                         const char *file_name;
@@ -575,7 +576,7 @@ emu_save_messages_response(GtkWidget *fi
 		if (!emu_can_save((GtkWindow *)filesel, path))
 			return;
 
-		emu_update_save_path(path);
+		emu_update_save_path(path, FALSE);
 		mail_save_messages(data->folder, data->uids, path, NULL, NULL);
 		data->uids = NULL;
 	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]