--- ~pan.cc	2006-10-02 16:45:44.000000000 -0400
+++ pan.cc	2006-12-31 22:38:54.000000000 -0500
@@ -116,6 +116,35 @@
     return true;
   }
 
+ std::string get_save_attachments_path_from_user ()
+   {
+    static std::string prev_path;
+   if (prev_path.empty())
+    prev_path = g_get_current_dir ();
+   GtkWidget * w = gtk_file_chooser_dialog_new (_("Save Attachments"),NULL,
+                                                GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+                                                GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
+                                                GTK_STOCK_SAVE,GTK_RESPONSE_ACCEPT,
+                                                NULL);
+   gtk_dialog_set_default_response (GTK_DIALOG(w), GTK_RESPONSE_ACCEPT);
+   gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(w),prev_path.c_str());
+   const int response (gtk_dialog_run (GTK_DIALOG(w)));
+   std::string path;
+   if (response == GTK_RESPONSE_ACCEPT) {
+     char * tmp = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
+     prev_path = path = tmp;
+     g_free (tmp);
+   }
+
+   gtk_widget_destroy(w);
+   return path;
+ }
+
+  GtkWindow* get_window (GtkWidget* w)
+  {
+    return GTK_WINDOW (gtk_widget_get_toplevel (w));
+  }
+
   void run_pan_in_window (ArticleCache  & cache,
                           Data          & data,
                           Queue         & queue,
@@ -192,9 +221,8 @@
   typedef std::vector<std::string> strings_t;
   strings_t nzb_files;
 
-  char * pch = g_get_current_dir ();
+  std::string pch = get_save_attachments_path_from_user ();
   std::string nzb_output_path = pch;
-  g_free (pch);
 
   for (int i=1; i<argc; ++i)
   {
