From 7652d57839e8e61f1abf24b60ef44bead54ec263 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 4 Nov 2008 16:51:31 +0000 Subject: [PATCH] - MGR: Bug fixes for the new Exit dialog. clientgui/ BOINCBaseFrame.cpp BOINCClientManager.h BOINCGUIApp.cpp, .h BOINCTaskBar.cpp screensaver_win.cpp svn path=/trunk/boinc/; revision=16414 --- checkin_notes | 10 ++++++++++ clientgui/BOINCBaseFrame.cpp | 12 +++++++++++- clientgui/BOINCClientManager.h | 2 ++ clientgui/BOINCGUIApp.cpp | 16 +++++++++++++--- clientgui/BOINCGUIApp.h | 2 ++ clientgui/BOINCTaskBar.cpp | 10 ++++++++++ clientscr/screensaver_win.cpp | 1 - 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index 663ec2ee08..9d376fd5bc 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9136,3 +9136,13 @@ Rom 4 Nov 2008 clientgui DlgExitMessage.cpp DlgGenericMessage.cpp + +Rom 4 Nov 2008 + - MGR: Bug fixes for the new Exit dialog. + + clientgui/ + BOINCBaseFrame.cpp + BOINCClientManager.h + BOINCGUIApp.cpp, .h + BOINCTaskBar.cpp + screensaver_win.cpp diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index 95427f9a34..ef03139bc2 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -332,7 +332,17 @@ void CBOINCBaseFrame::OnCloseWindow(wxCommandEvent& WXUNUSED(event)) { void CBOINCBaseFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnExit - Function Begin")); + CMainDocument* pDoc = wxGetApp().GetDocument(); + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + if (wxGetApp().ConfirmExit()) { + + if (!wxGetApp().ShouldShutdownCoreClient()) { + pDoc->m_pClientManager->DisableBOINCStartedByManager(); + } + // Under wxWidgets 2.8.0, the task bar icons must be deleted for app to exit its main loop #ifdef __WXMAC__ CMacSystemMenu* pMSM = wxGetApp().GetMacSystemMenu(); @@ -348,8 +358,8 @@ void CBOINCBaseFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { } #endif Close(true); - } + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnExit - Function End")); } diff --git a/clientgui/BOINCClientManager.h b/clientgui/BOINCClientManager.h index fe6b5bef27..914e13934b 100644 --- a/clientgui/BOINCClientManager.h +++ b/clientgui/BOINCClientManager.h @@ -34,6 +34,8 @@ public: bool IsSystemBooting(); int IsBOINCConfiguredAsDaemon(); + + void DisableBOINCStartedByManager() { m_bBOINCStartedByManager = false; }; bool WasBOINCStartedByManager() { return m_bBOINCStartedByManager; }; bool IsBOINCCoreRunning(); diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 0465db7aba..64ae5cfaad 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -840,9 +840,11 @@ int CBOINCGUIApp::ConfirmExit() { if (m_iShutdownCoreClient && !m_iDisplayExitDialog) return 1; // User doesn't want to display the dialog and wants to shutdown the client. +#ifdef __WXMAC__ // Don't run confirmation dialog if logging out or shutting down if (s_bSkipExitConfirmation) return 1; +#endif bWasVisible = IsApplicationVisible(); ShowApplication(true); @@ -853,17 +855,25 @@ int CBOINCGUIApp::ConfirmExit() { dlg.m_DialogExitMessage->SetLabel(pSkinAdvanced->GetExitMessage()); } - dlg.m_DialogShutdownCoreClient->SetValue(1 == m_iShutdownCoreClient); - dlg.m_DialogDisplay->SetValue(1 == m_iDisplayExitDialog); + if (m_iShutdownCoreClient) { + dlg.m_DialogShutdownCoreClient->SetValue(TRUE); + } + + if (m_iDisplayExitDialog) { + dlg.m_DialogDisplay->SetValue(FALSE); + } + dlg.Fit(); dlg.Centre(); if (wxID_OK == dlg.ShowModal()) { m_iShutdownCoreClient = dlg.m_DialogShutdownCoreClient->GetValue(); m_iDisplayExitDialog = dlg.m_DialogDisplay->GetValue(); - retval = m_iShutdownCoreClient; + retval = true; +#ifdef __WXMAC__ s_bSkipExitConfirmation = true; // Don't ask twice (only affects Mac) +#endif } if (!bWasVisible) { diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index b979e650ec..d5184478cb 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -132,6 +132,8 @@ public: CMacSystemMenu* GetMacSystemMenu() { return m_pMacSystemMenu; } #endif + int ShouldShutdownCoreClient() + { return m_iShutdownCoreClient; } int GetBOINCMGRDisableAutoStart() { return m_iBOINCMGRDisableAutoStart; } void SetBOINCMGRDisableAutoStart(int iDisableAutoStart) diff --git a/clientgui/BOINCTaskBar.cpp b/clientgui/BOINCTaskBar.cpp index 9e82bda856..20336a9084 100644 --- a/clientgui/BOINCTaskBar.cpp +++ b/clientgui/BOINCTaskBar.cpp @@ -30,6 +30,7 @@ #include "MainDocument.h" #include "BOINCTaskBar.h" #include "BOINCBaseFrame.h" +#include "BOINCClientManager.h" #include "DlgAbout.h" #include "Events.h" @@ -250,10 +251,19 @@ void CTaskBarIcon::OnAbout(wxCommandEvent& WXUNUSED(event)) { void CTaskBarIcon::OnExit(wxCommandEvent& event) { wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnExit - Function Begin")); + CMainDocument* pDoc = wxGetApp().GetDocument(); + + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + #ifndef __WXMAC__ if (wxGetApp().ConfirmExit()) #endif { + if (!wxGetApp().ShouldShutdownCoreClient()) { + pDoc->m_pClientManager->DisableBOINCStartedByManager(); + } + wxCloseEvent eventClose; OnClose(eventClose); if (eventClose.GetSkipped()) event.Skip(); diff --git a/clientscr/screensaver_win.cpp b/clientscr/screensaver_win.cpp index 3575a14d58..4b970d331f 100644 --- a/clientscr/screensaver_win.cpp +++ b/clientscr/screensaver_win.cpp @@ -842,7 +842,6 @@ BOOL CScreensaver::GetTextForError( E_FAIL, IDS_ERR_GENERIC, E_OUTOFMEMORY, IDS_ERR_OUTOFMEMORY, SCRAPPERR_BOINCNOTDETECTED, IDS_ERR_BOINCNOTDETECTED, - SCRAPPERR_BOINCNOTDETECTEDSTARTUP, IDS_ERR_BOINCNOTDETECTEDSTARTUP, SCRAPPERR_BOINCSUSPENDED, IDS_ERR_BOINCSUSPENDED, SCRAPPERR_BOINCNOAPPSEXECUTING, IDS_ERR_BOINCNOAPPSEXECUTING, SCRAPPERR_BOINCNOPROJECTSDETECTED, IDS_ERR_BOINCNOAPPSEXECUTINGNOPROJECTSDETECTED,