Update of /cvsroot/sharedaemon/ui-wx/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17893
Modified Files:
MainDlg.cpp
Log Message:
Hide main frame before destroying (makes shutdown seem faster)
Index: MainDlg.cpp
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- MainDlg.cpp 30 Nov 2003 23:07:27 -0000 1.20
+++ MainDlg.cpp 5 Dec 2003 22:20:49 -0000 1.21
@@ -315,10 +315,15 @@
}
/**
- * CloseWindow event function. Actual data deletion is done in destructor.
+ * Normally called when user attempts to close the main frame, this function
+ * checks if we should show confirmation dialog upon closing (by reading the
+ * corresponding value from config object). If so, display a messagebox,
+ * and abort shutdown if No is clicked. Otherwise, if prompt_exit is false
+ * or Yes is clicked in confirmation dialog, hide and destroy the frame.
+ * Hiding is needed to make shutdown process seem faster and avoid any
+ * delays Destroy() call produces.
*/
void CMainDlg::OnCloseWindow( wxCloseEvent &event ){
- /* Read from config if we should ask for permission before closing. */
bool prompt_exit;
m_config->Read(wxT("/General/Prompt on exit"), &prompt_exit, true);
@@ -326,15 +331,14 @@
if (
wxMessageBox(
_("Close ShareDaemon wxInterface?"),
- _("Question"), wxYES_NO|wxCENTRE|wxICON_QUESTION
+ _("Question"),
+ wxYES_NO|wxCENTRE|wxICON_QUESTION
) == wxNO) {
return;
}
}
- /* We reach this line if prompt_exit was false,
- * or Yes was clicked in messagebox
- */
+ Hide();
Destroy();
}
|