diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index a9e4c78bce..a2d48eb1f5 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -530,11 +530,8 @@ int CBOINCGUIApp::OnExit() { m_pEventLog = NULL; } - // Save Application State - m_pConfig->Write(wxT("AutomaticallyShutdownClient"), m_iShutdownCoreClient); - m_pConfig->Write(wxT("DisplayShutdownClientDialog"), m_iDisplayExitDialog); - m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart); + SaveState(); diagnostics_finish(); @@ -542,6 +539,14 @@ int CBOINCGUIApp::OnExit() { } +void CBOINCGUIApp::SaveState() { + // Save Application State + m_pConfig->Write(wxT("AutomaticallyShutdownClient"), m_iShutdownCoreClient); + m_pConfig->Write(wxT("DisplayShutdownClientDialog"), m_iDisplayExitDialog); + m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart); +} + + /// /// Pass the command line parameters and discriptions to wxWidgets for displaying. /// diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index bdb0be4b2c..05f96bbfba 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -57,7 +57,7 @@ protected: #if (defined(__WXMSW__) && !wxCHECK_VERSION(2, 9, 4)) void OnEndSession(wxCloseEvent& event); #endif - + void OnInitCmdLine(wxCmdLineParser &parser); bool OnCmdLineParsed(wxCmdLineParser &parser); @@ -122,6 +122,7 @@ protected: public: bool OnInit(); + void SaveState(); wxLocale* GetLocale() { return m_pLocale; } CSkinManager* GetSkinManager() { return m_pSkinManager; } diff --git a/clientgui/DlgOptions.cpp b/clientgui/DlgOptions.cpp index 96210d7900..65d52bc4ac 100644 --- a/clientgui/DlgOptions.cpp +++ b/clientgui/DlgOptions.cpp @@ -76,6 +76,21 @@ CDlgOptions::CDlgOptions(wxWindow* parent, wxWindowID id, const wxString& captio Create(parent, id, caption, pos, size, style); } + +CDlgOptions::~CDlgOptions() { + CBOINCBaseFrame* pFrame = wxGetApp().GetFrame(); + + wxASSERT(pDoc); + wxASSERT(pFrame); + wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame)); + + wxGetApp().SaveState(); + pFrame->SaveState(); + + wxConfigBase::Get(FALSE)->Flush(); +} + + /*! * CDlgToolsOptions creator */ diff --git a/clientgui/DlgOptions.h b/clientgui/DlgOptions.h index ac06ac35a1..5a514d7370 100644 --- a/clientgui/DlgOptions.h +++ b/clientgui/DlgOptions.h @@ -105,6 +105,9 @@ public: CDlgOptions( ); CDlgOptions( wxWindow* parent, wxWindowID id = SYMBOL_CDLGOPTIONS_IDNAME, const wxString& caption = SYMBOL_CDLGOPTIONS_TITLE, const wxPoint& pos = SYMBOL_CDLGOPTIONS_POSITION, const wxSize& size = SYMBOL_CDLGOPTIONS_SIZE, long style = SYMBOL_CDLGOPTIONS_STYLE ); + /// Destructor + ~CDlgOptions( ); + /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CDLGOPTIONS_IDNAME, const wxString& caption = SYMBOL_CDLGOPTIONS_TITLE, const wxPoint& pos = SYMBOL_CDLGOPTIONS_POSITION, const wxSize& size = SYMBOL_CDLGOPTIONS_SIZE, long style = SYMBOL_CDLGOPTIONS_STYLE );