From 497d90e04609907bb709828c93f73e75c7f118a2 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 25 Sep 2007 22:59:55 +0000 Subject: Make Epiphany properly remember the last saved location in the FileChooser. Fix for bug #336251. svn path=/trunk/; revision=7494 --- lib/ephy-file-chooser.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/ephy-file-chooser.c b/lib/ephy-file-chooser.c index e5e9b1250..2edfb11bc 100644 --- a/lib/ephy-file-chooser.c +++ b/lib/ephy-file-chooser.c @@ -94,6 +94,29 @@ current_folder_changed_cb (GtkFileChooser *chooser, EphyFileChooser *dialog) } } +static void +file_chooser_response_cb (GtkWidget *widget, + gint response, + EphyFileChooser *dialog) +{ + if (response == GTK_RESPONSE_ACCEPT) + { + if (dialog->priv->persist_key != NULL) + { + char *dir, *filename; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + + dir = g_path_get_dirname (filename); + + eel_gconf_set_path (dialog->priv->persist_key, dir); + + g_free (dir); + g_free (filename); + } + } +} + static void ephy_file_chooser_init (EphyFileChooser *dialog) { @@ -165,6 +188,9 @@ ephy_file_chooser_set_persist_key (EphyFileChooser *dialog, const char *key) g_signal_connect (dialog, "current-folder-changed", G_CALLBACK (current_folder_changed_cb), dialog); + + g_signal_connect (dialog, "response", + G_CALLBACK (file_chooser_response_cb), dialog); } const char * -- cgit v1.2.3