[haiku-commits] r39449 - haiku/trunk/src/apps/terminal

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 16 Nov 2010 17:26:28 +0100 (CET)

Author: bonefish
Date: 2010-11-16 17:26:28 +0100 (Tue, 16 Nov 2010)
New Revision: 39449
Changeset: http://dev.haiku-os.org/changeset/39449

Modified:
   haiku/trunk/src/apps/terminal/TermApp.cpp
   haiku/trunk/src/apps/terminal/TermApp.h
Log:
Override BApplication::QuitRequested(), so that when the system is shutting
down, we can skip the checks for running processes. At least I found the
alerts seriously annoying in this case.


Modified: haiku/trunk/src/apps/terminal/TermApp.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermApp.cpp   2010-11-16 16:03:52 UTC (rev 
39448)
+++ haiku/trunk/src/apps/terminal/TermApp.cpp   2010-11-16 16:26:28 UTC (rev 
39449)
@@ -138,6 +138,25 @@
 }
 
 
+bool
+TermApp::QuitRequested()
+{
+       // check whether the system is shutting down
+       BMessage* message = CurrentMessage();
+       bool shutdown;
+       if (message != NULL && message->FindBool("_shutdown_", &shutdown) == 
B_OK
+               && shutdown) {
+               // The system is shutting down. Quit the window synchronously. 
This
+               // skips the checks for running processes and the "Are you 
sure..."
+               // alert.
+               if (fTermWindow->Lock())
+                       fTermWindow->Quit();
+       }
+
+       return BApplication::QuitRequested();
+}
+
+
 void
 TermApp::Quit()
 {

Modified: haiku/trunk/src/apps/terminal/TermApp.h
===================================================================
--- haiku/trunk/src/apps/terminal/TermApp.h     2010-11-16 16:03:52 UTC (rev 
39448)
+++ haiku/trunk/src/apps/terminal/TermApp.h     2010-11-16 16:26:28 UTC (rev 
39449)
@@ -49,12 +49,13 @@
        virtual                                         ~TermApp();
 
 protected:
-                       void                            ReadyToRun();
-                       void                            Quit();
-                       void                            AboutRequested();
-                       void                            
MessageReceived(BMessage* message);
-                       void                            RefsReceived(BMessage* 
message);
-                       void                            ArgvReceived(int32 
argc, char** argv);
+       virtual void                            ReadyToRun();
+       virtual bool                            QuitRequested();
+       virtual void                            Quit();
+       virtual void                            AboutRequested();
+       virtual void                            MessageReceived(BMessage* 
message);
+       virtual void                            RefsReceived(BMessage* message);
+       virtual void                            ArgvReceived(int32 argc, char** 
argv);
 
 private:
                        status_t                        _MakeTermWindow(BRect& 
frame,


Other related posts: