[haiku-commits] haiku: hrev45039 - in src: apps/deskbar kits/tracker

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 21 Dec 2012 02:00:34 +0100 (CET)

hrev45039 adds 2 changesets to branch 'master'
old head: 0eacc85bc2ead51102b894b46a057a57329891a9
new head: ee70bd8b1fefb372682051ff5d0778df99757944
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ee70bd8+%5E0eacc85

----------------------------------------------------------------------------

08c0a78: (Tiny) style fix only

ee70bd8: Hide and show Deskbar preference window
  
  ... instead of destroying and creating it each time.
  
  This is taking another page from Tracker's book. It allows the prefs
  window to maintain it's current state as long as the application
  remains open. Since both Tracker and Deskbar are meant to always be
  open this means that the state is kept all the time unless the app
  crashes, quite useful.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 32 insertions(+), 4 deletions(-)
src/apps/deskbar/BarApp.cpp            | 13 ++++++++++---
src/apps/deskbar/PreferencesWindow.cpp | 20 ++++++++++++++++++++
src/apps/deskbar/PreferencesWindow.h   |  1 +
src/kits/tracker/Tracker.cpp           |  2 +-

############################################################################

Commit:      08c0a78ff4ad3f7eb8cb75f213d42ef59b6a643e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=08c0a78
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Dec 21 00:55:10 2012 UTC

(Tiny) style fix only

----------------------------------------------------------------------------

diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp
index 0ad8f6a..e327762 100644
--- a/src/kits/tracker/Tracker.cpp
+++ b/src/kits/tracker/Tracker.cpp
@@ -1488,7 +1488,7 @@ TTracker::CloseParent(node_ref parent)
 void
 TTracker::ShowSettingsWindow()
 {
-       if (!fSettingsWindow) {
+       if (fSettingsWindow == NULL) {
                fSettingsWindow = new TrackerSettingsWindow();
                fSettingsWindow->Show();
        } else {

############################################################################

Revision:    hrev45039
Commit:      ee70bd8b1fefb372682051ff5d0778df99757944
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ee70bd8
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Dec 21 00:57:13 2012 UTC

Hide and show Deskbar preference window

... instead of destroying and creating it each time.

This is taking another page from Tracker's book. It allows the prefs
window to maintain it's current state as long as the application
remains open. Since both Tracker and Deskbar are meant to always be
open this means that the state is kept all the time unless the app
crashes, quite useful.

----------------------------------------------------------------------------

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 563de4e..5907528 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -887,11 +887,18 @@ TBarApp::IconSize()
 void
 TBarApp::ShowPreferencesWindow()
 {
-       if (fPreferencesWindow)
-               fPreferencesWindow->Activate();
-       else {
+       if (fPreferencesWindow == NULL) {
                fPreferencesWindow = new PreferencesWindow(BRect(0, 0, 320, 
240));
                fPreferencesWindow->Show();
+       } else {
+               if (fPreferencesWindow->Lock()) {
+                       if (fPreferencesWindow->IsHidden())
+                               fPreferencesWindow->Show();
+                       else
+                               fPreferencesWindow->Activate();
+
+                       fPreferencesWindow->Unlock();
+               }
        }
 }
 
diff --git a/src/apps/deskbar/PreferencesWindow.cpp 
b/src/apps/deskbar/PreferencesWindow.cpp
index d922181..41c8259 100644
--- a/src/apps/deskbar/PreferencesWindow.cpp
+++ b/src/apps/deskbar/PreferencesWindow.cpp
@@ -324,6 +324,26 @@ PreferencesWindow::MessageReceived(BMessage* message)
 }
 
 
+bool
+PreferencesWindow::QuitRequested()
+{
+       bool isHidden = false;
+
+       if (Lock()) {
+               isHidden = IsHidden();
+               Unlock();
+       } else
+               return true;
+
+       if (isHidden)
+               return true;
+
+       Hide();
+
+       return false;
+}
+
+
 void
 PreferencesWindow::WindowActivated(bool active)
 {
diff --git a/src/apps/deskbar/PreferencesWindow.h 
b/src/apps/deskbar/PreferencesWindow.h
index 3be45d9..c47b4c8 100644
--- a/src/apps/deskbar/PreferencesWindow.h
+++ b/src/apps/deskbar/PreferencesWindow.h
@@ -39,6 +39,7 @@ public:
                                                        ~PreferencesWindow();
 
                virtual void            MessageReceived(BMessage* message);
+               virtual bool            QuitRequested();
                virtual void            WindowActivated(bool active);
 
                                void            UpdateRecentCounts();


Other related posts: