Keep track of the directory to put new films in across uses of the dialog (#143).
authorCarl Hetherington <cth@carlh.net>
Thu, 30 May 2013 13:12:36 +0000 (14:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 30 May 2013 13:12:36 +0000 (14:12 +0100)
src/wx/new_film_dialog.cc
src/wx/new_film_dialog.h

index 90c2d727ef27defab61568d07025d7ec1408af76..737b07fbb58a591e62887cc12af75bb4075cead0 100644 (file)
@@ -29,6 +29,8 @@
 using namespace std;
 using namespace boost;
 
+string NewFilmDialog::_directory = Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir()));
+
 NewFilmDialog::NewFilmDialog (wxWindow* parent)
        : wxDialog (parent, wxID_ANY, _("New Film"))
 {
@@ -49,7 +51,7 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
 #else  
        _folder = new wxDirPickerCtrl (this, wxDD_DIR_MUST_EXIST);
 #endif
-       _folder->SetPath (std_to_wx (Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir()))));
+       _folder->SetPath (std_to_wx (_directory));
        table->Add (_folder, 1, wxEXPAND);
 
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
@@ -61,6 +63,11 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
        overall_sizer->SetSizeHints (this);
 }
 
+NewFilmDialog::~NewFilmDialog ()
+{
+       _directory = wx_to_std (_folder->GetPath ());
+}
+
 string
 NewFilmDialog::get_path () const
 {
index 3d1253ecc7d3cbae849afc61ca20ad3195aca67a..715f71f516f309d9db14b9761c40ef9b348f7591 100644 (file)
@@ -26,6 +26,7 @@ class NewFilmDialog : public wxDialog
 {
 public:
        NewFilmDialog (wxWindow *);
+       ~NewFilmDialog ();
 
        std::string get_path () const;
 
@@ -35,5 +36,6 @@ private:
        DirPickerCtrl* _folder;
 #else
        wxDirPickerCtrl* _folder;
-#endif 
+#endif
+       static std::string _directory;
 };