[haiku-commits] haiku: hrev44402 - src/apps/powerstatus

hrev44402 adds 1 changeset to branch 'master'
old head: aacf2782d8022d7178125948daac67533ef3e473
new head: e2c343a22a731d4ec7f6ede64adb36dbf275021e

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

e2c343a: Fixing #6913.
  * Checking and setting a default value if both icon and text are false.

                                      [ Fredrik Modéen <fredrik@xxxxxxxxx> ]

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

Revision:    hrev44402
Commit:      e2c343a22a731d4ec7f6ede64adb36dbf275021e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e2c343a
Author:      Fredrik Modéen <fredrik@xxxxxxxxx>
Date:        Wed Jul 25 00:48:24 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/6913

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

1 file changed, 15 insertions(+), 3 deletions(-)
src/apps/powerstatus/PowerStatusView.cpp |   18 +++++++++++++++---

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

diff --git a/src/apps/powerstatus/PowerStatusView.cpp 
b/src/apps/powerstatus/PowerStatusView.cpp
index f0362e8..647dae5 100644
--- a/src/apps/powerstatus/PowerStatusView.cpp
+++ b/src/apps/powerstatus/PowerStatusView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2010, Haiku, Inc. All Rights Reserved.
+ * Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -419,6 +419,10 @@ PowerStatusView::FromMessage(const BMessage* archive)
                fShowStatusIcon = value;
        if (archive->FindBool("show time", &value) == B_OK)
                fShowTime = value;
+       
+       //Incase we have a bad saving and none are showed..
+       if (!fShowLabel && !fShowStatusIcon)
+               fShowLabel = true;
 
        int32 intValue;
        if (archive->FindInt32("battery id", &intValue) == B_OK)
@@ -539,7 +543,11 @@ PowerStatusReplicant::MessageReceived(BMessage *message)
 {
        switch (message->what) {
                case kMsgToggleLabel:
-                       fShowLabel = !fShowLabel;
+                       if (fShowStatusIcon)
+                               fShowLabel = !fShowLabel;
+                       else
+                               fShowLabel = true;
+                               
                        Update(true);
                        break;
 
@@ -549,7 +557,11 @@ PowerStatusReplicant::MessageReceived(BMessage *message)
                        break;
 
                case kMsgToggleStatusIcon:
-                       fShowStatusIcon = !fShowStatusIcon;
+                       if (fShowLabel)
+                               fShowStatusIcon = !fShowStatusIcon;
+                       else
+                               fShowStatusIcon = true;
+
                        Update(true);
                        break;
 


Other related posts: