changeset 10536:c047cf7e18ba

[gaim-migrate @ 11888] Patch from Lee Roach to remember the directory to which we last saved a file transfer. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 22 Jan 2005 05:22:48 +0000
parents f175ff63d571
children 74180743304a
files src/gtkrequest.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkrequest.c	Sat Jan 22 04:43:15 2005 +0000
+++ b/src/gtkrequest.c	Sat Jan 22 05:22:48 2005 +0000
@@ -1455,6 +1455,8 @@
 static void
 file_ok_check_if_exists_cb(GtkWidget *widget, gint response, GaimGtkRequestData *data)
 {
+	gchar *current_folder;
+
 	if (response != GTK_RESPONSE_ACCEPT) {
 		if (data->cbs[0] != NULL)
 			((GaimRequestFileCb)data->cbs[0])(data->user_data, NULL);
@@ -1463,6 +1465,13 @@
 	}
 
 	data->u.file.name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data->dialog));
+	if (data->u.file.savedialog) {
+		current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(data->dialog));
+		if (current_folder) {
+			gaim_prefs_set_string("/gaim/gtk/filetransfer/last_folder", current_folder);
+			g_free(current_folder);
+		}
+	}
 #else /* FILECHOOSER */
 static void
 file_ok_check_if_exists_cb(GtkWidget *button, GaimGtkRequestData *data)
@@ -1531,9 +1540,13 @@
 						NULL);
 	gtk_dialog_set_default_response(GTK_DIALOG(filesel), GTK_RESPONSE_ACCEPT);
 	if (filename != NULL) {
-		if (savedialog)
+		if (savedialog) {
+			const gchar *current_folder = gaim_prefs_get_string("/gaim/gtk/filetransfer/last_folder");
 			gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(filesel), filename);
-		else
+			if (current_folder) {
+				gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filesel), current_folder);
+			}
+		} else
 			gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(filesel), filename);
 	}
 	g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(filesel)), "response",