Fix yet another oversight for the windows icon file update
[ardour.git] / gtk2_ardour / midi_export_dialog.cc
index 95bb7b658723f520dd05959f5e2c709be4991381..9fd02397d7655d3d6a5b64c6ffd55f3912a500d9 100644 (file)
 
 #include <gtkmm/stock.h>
 
+#include "pbd/compose.h"
+
+#include "ardour/directory_names.h"
 #include "ardour/midi_region.h"
+#include "ardour/session.h"
 
 #include "midi_export_dialog.h"
 
+#include "pbd/i18n.h"
+
 using namespace ARDOUR;
 
 MidiExportDialog::MidiExportDialog (PublicEditor&, boost::shared_ptr<MidiRegion> region)
        : ArdourDialog (string_compose (_("Export MIDI: %1"), region->name()))
        , file_chooser (Gtk::FILE_CHOOSER_ACTION_SAVE)
 {
-       add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+       set_border_width (12);
+
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+       add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+
+       get_vbox()->set_border_width (12);
        get_vbox()->pack_start (file_chooser);
-       file_chooser.set_filename (region->name() + ".mid");
+
+       set_default_response (Gtk::RESPONSE_ACCEPT);
+
+       file_chooser.set_current_name (region->name() + ".mid");
        file_chooser.show ();
+
+       file_chooser.signal_file_activated().connect (sigc::bind (sigc::mem_fun (*this, &MidiExportDialog::response), Gtk::RESPONSE_ACCEPT));
 }
 
 MidiExportDialog::~MidiExportDialog ()
 {
 }
 
+void
+MidiExportDialog::set_session (Session* s)
+{
+       ArdourDialog::set_session (s);
+
+       file_chooser.set_current_folder (Glib::build_filename (Glib::path_get_dirname (s->path()), ARDOUR::export_dir_name));
+}
+
 std::string
 MidiExportDialog::get_path () const
 {
        return file_chooser.get_filename ();
-       
+
 }