MGR: Handle EVT_END_SESSION event to call SaveState() on Windows logout or shutdown

svn path=/trunk/boinc/; revision=17592
This commit is contained in:
Charlie Fenton 2009-03-12 09:25:31 +00:00
parent 3bb5c03d3f
commit debbaa64c9
6 changed files with 23 additions and 4 deletions

View File

@ -2999,9 +2999,12 @@ Charlie 12 Mar 2009
- MGR: Simplify the fixes for saving and restoring window sizes and other
settings; eliminate unnecessary new events EVT_FRAME_RESTORESTATE and
EVT_FRAME_SAVESTATE, etc; call SaveState() and RestoreState() directly.
- MGR: Handle EVT_END_SESSION event to call SaveState() on Windows logout
or shutdown; this fixes a long-standing problem where current settings
were not being saved.
clientgui/
AdvancedFrame.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCGUIApp.cpp
BOINCGUIApp.cpp, .h
sg_BoincSimpleGUI.cpp, .h

View File

@ -101,6 +101,8 @@ public:
void ResetReminderTimers();
bool SaveState();
wxTimer* m_pRefreshStateTimer;
wxTimer* m_pFrameRenderTimer;
@ -131,7 +133,6 @@ private:
bool CreateStatusbar();
bool DeleteStatusbar();
bool SaveState();
bool RestoreState();
void SaveWindowDimensions();

View File

@ -93,6 +93,8 @@ public:
bool Show( bool bShow = true );
virtual bool SaveState();
protected:
CBOINCDialUpManager* m_pDialupManager;
@ -112,7 +114,6 @@ protected:
virtual int _GetCurrentViewPage();
virtual bool SaveState();
virtual bool RestoreState();
DECLARE_EVENT_TABLE()

View File

@ -68,6 +68,7 @@ IMPLEMENT_DYNAMIC_CLASS(CBOINCGUIApp, wxApp)
BEGIN_EVENT_TABLE (CBOINCGUIApp, wxApp)
EVT_RPC_FINISHED(CBOINCGUIApp::OnRPCFinished)
EVT_END_SESSION(CBOINCGUIApp::OnSystemShutDown)
END_EVENT_TABLE ()
@ -734,6 +735,17 @@ void CBOINCGUIApp::OnRPCFinished( CRPCFinishedEvent& event ) {
}
// Ensure our settings are saved on Windows logout or shutdown
// This is never called on the Mac.
void CBOINCGUIApp::OnSystemShutDown( wxCloseEvent& event ) {
if (m_pFrame) {
m_pFrame->SaveState();
}
event.Skip();
}
int CBOINCGUIApp::UpdateSystemIdleDetection() {
#ifdef __WXMSW__
return BOINCGetIdleTickCount();

View File

@ -164,6 +164,7 @@ public:
bool ShowCurrentGUI() { return SetActiveGUI(m_iGUISelected, true); }
void OnRPCFinished( CRPCFinishedEvent& event );
void OnSystemShutDown( wxCloseEvent &event );
int ConfirmExit();

View File

@ -122,6 +122,8 @@ public:
void SetMsgsDlgOpen(CDlgMessages* newDlgPtr) { dlgMsgsPtr = newDlgPtr; }
bool isMessagesDlgOpen() { return (dlgMsgsPtr != NULL); }
bool SaveState();
protected:
virtual int _GetCurrentViewPage();
@ -135,7 +137,6 @@ protected:
#endif
private:
bool SaveState();
CDlgMessages* dlgMsgsPtr;
DECLARE_EVENT_TABLE()