[haiku-commits] haiku: hrev43974 - src/apps/deskbar

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 8 Apr 2012 03:24:40 +0200 (CEST)

hrev43974 adds 2 changesets to branch 'master'
old head: 363a49a64e0c4a009b2b9549c117782f2080e39c
new head: c7bb0d08da9d923d4a2020ab36727230d1e00edf

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

e73a037: Fixes a bug in Deskbar not using default icon size
  
  My recent changes to Deskbar to support different icon sizes
  checks your settings file for an icon size setting and resizes
  to that. Unfortunately if your existing settings file doesn't
  have that setting it sets the icon size to 0. I followed the example
  of other integer settings when I wrote the code, unfortunately
  they were broken too so I copied an error. I have fixed that setting
  and a couple others to use the reset back to default if the setting
  is not found in your settings file.

c7bb0d0: Fix the rest of the settings

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

1 files changed, 86 insertions(+), 35 deletions(-)
src/apps/deskbar/BarApp.cpp |  121 +++++++++++++++++++++++++++-----------

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

Commit:      e73a037077ef815bb35249dae6ba80e3e822ae58
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e73a037
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sun Apr  8 01:01:57 2012 UTC

Fixes a bug in Deskbar not using default icon size

My recent changes to Deskbar to support different icon sizes
checks your settings file for an icon size setting and resizes
to that. Unfortunately if your existing settings file doesn't
have that setting it sets the icon size to 0. I followed the example
of other integer settings when I wrote the code, unfortunately
they were broken too so I copied an error. I have fixed that setting
and a couple others to use the reset back to default if the setting
is not found in your settings file.

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

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 9d45a35..d0881da 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -284,10 +284,16 @@ TBarApp::InitSettings()
                        storedSettings.FindBool("top", &settings.top);
                        storedSettings.FindBool("ampmMode", &settings.ampmMode);
 
-                       storedSettings.FindInt32("state", 
(int32*)&settings.state);
+                       if (storedSettings.FindInt32("state", 
(int32*)&settings.state)
+                               < B_OK) {
+                               settings.state = kExpandoState;
+                       }
                        storedSettings.FindFloat("width", &settings.width);
                        storedSettings.FindBool("showTime", &settings.showTime);
-                       storedSettings.FindPoint("switcherLoc", 
&settings.switcherLoc);
+                       if (storedSettings.FindPoint("switcherLoc", 
&settings.switcherLoc)
+                               < B_OK) {
+                               settings.switcherLoc = BPoint(5000, 5000);
+                       }
                        storedSettings.FindInt32("recentAppsCount",
                                &settings.recentAppsCount);
                        storedSettings.FindInt32("recentDocsCount",
@@ -305,6 +311,10 @@ TBarApp::InitSettings()
                        storedSettings.FindBool("superExpando", 
&settings.superExpando);
                        storedSettings.FindBool("expandNewTeams", 
&settings.expandNewTeams);
                        storedSettings.FindBool("hideLabels", 
&settings.hideLabels);
+                       if (storedSettings.FindInt32("iconSize", 
(int32*)&settings.iconSize)
+                               < B_OK) {
+                               settings.iconSize = kMinimumIconSize;
+                       }
                        storedSettings.FindInt32("iconSize", 
(int32*)&settings.iconSize);
                        storedSettings.FindBool("autoRaise", 
&settings.autoRaise);
                        storedSettings.FindBool("autoHide", &settings.autoHide);

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

Revision:    hrev43974
Commit:      c7bb0d08da9d923d4a2020ab36727230d1e00edf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c7bb0d0
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Sun Apr  8 01:23:39 2012 UTC

Fix the rest of the settings

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

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index d0881da..ff5e7b1 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -279,51 +279,92 @@ TBarApp::InitSettings()
                BMessage storedSettings;
                if (fSettingsFile->InitCheck() == B_OK
                        && storedSettings.Unflatten(fSettingsFile) == B_OK) {
-                       storedSettings.FindBool("vertical", &settings.vertical);
-                       storedSettings.FindBool("left", &settings.left);
-                       storedSettings.FindBool("top", &settings.top);
-                       storedSettings.FindBool("ampmMode", &settings.ampmMode);
-
+                       if (storedSettings.FindBool("vertical", 
&settings.vertical) < B_OK)
+                               settings.vertical = true;
+                       if (storedSettings.FindBool("left", &settings.left) < 
B_OK)
+                               settings.left = false;
+                       if (storedSettings.FindBool("top", &settings.top) < 
B_OK)
+                               settings.top = true;
+                       if (storedSettings.FindBool("ampmMode", 
&settings.ampmMode) < B_OK)
+                               settings.ampmMode = true;
                        if (storedSettings.FindInt32("state", 
(int32*)&settings.state)
                                < B_OK) {
                                settings.state = kExpandoState;
                        }
-                       storedSettings.FindFloat("width", &settings.width);
-                       storedSettings.FindBool("showTime", &settings.showTime);
+                       if (storedSettings.FindFloat("width", &settings.width) 
< B_OK)
+                               settings.width = 0;
+                       if (storedSettings.FindBool("showTime", 
&settings.showTime) < B_OK)
+                               settings.showTime = true;
                        if (storedSettings.FindPoint("switcherLoc", 
&settings.switcherLoc)
                                < B_OK) {
                                settings.switcherLoc = BPoint(5000, 5000);
                        }
-                       storedSettings.FindInt32("recentAppsCount",
-                               &settings.recentAppsCount);
-                       storedSettings.FindInt32("recentDocsCount",
-                               &settings.recentDocsCount);
-                       storedSettings.FindBool("timeShowSeconds",
-                               &settings.timeShowSeconds);
-                       storedSettings.FindInt32("recentFoldersCount",
-                               &settings.recentFoldersCount);
-                       storedSettings.FindBool("alwaysOnTop", 
&settings.alwaysOnTop);
-                       storedSettings.FindBool("timeFullDate", 
&settings.timeFullDate);
-                       storedSettings.FindBool("trackerAlwaysFirst",
-                               &settings.trackerAlwaysFirst);
-                       storedSettings.FindBool("sortRunningApps",
-                               &settings.sortRunningApps);
-                       storedSettings.FindBool("superExpando", 
&settings.superExpando);
-                       storedSettings.FindBool("expandNewTeams", 
&settings.expandNewTeams);
-                       storedSettings.FindBool("hideLabels", 
&settings.hideLabels);
+                       if (storedSettings.FindInt32("recentAppsCount",
+                               &settings.recentAppsCount) < B_OK) {
+                               settings.recentAppsCount = 10;
+                       }
+                       if (storedSettings.FindInt32("recentDocsCount",
+                               &settings.recentDocsCount) < B_OK) {
+                               settings.recentDocsCount = 10;
+                       }
+                       if (storedSettings.FindBool("timeShowSeconds",
+                               &settings.timeShowSeconds) < B_OK) {
+                               settings.timeShowSeconds = false;
+                       }
+                       if (storedSettings.FindInt32("recentFoldersCount",
+                               &settings.recentFoldersCount) < B_OK) {
+                               settings.recentFoldersCount = 10;
+                       }
+                       if (storedSettings.FindBool("alwaysOnTop", 
&settings.alwaysOnTop)
+                               < B_OK) {
+                               settings.alwaysOnTop = false;
+                       }
+                       if (storedSettings.FindBool("timeFullDate", 
&settings.timeFullDate)
+                               < B_OK) {
+                               settings.timeFullDate = false;
+                       }
+                       if (storedSettings.FindBool("trackerAlwaysFirst",
+                               &settings.trackerAlwaysFirst) < B_OK) {
+                               settings.trackerAlwaysFirst = false;
+                       }
+                       if (storedSettings.FindBool("sortRunningApps",
+                               &settings.sortRunningApps) < B_OK) {
+                               settings.sortRunningApps = false;
+                       }
+                       if (storedSettings.FindBool("superExpando", 
&settings.superExpando)
+                               < B_OK) {
+                               settings.superExpando = false;
+                       }
+                       if (storedSettings.FindBool("expandNewTeams",
+                               &settings.expandNewTeams) < B_OK) {
+                               settings.expandNewTeams = false;
+                       }
+                       if (storedSettings.FindBool("hideLabels", 
&settings.hideLabels)
+                               < B_OK) {
+                               settings.hideLabels = false;
+                       }
                        if (storedSettings.FindInt32("iconSize", 
(int32*)&settings.iconSize)
                                < B_OK) {
                                settings.iconSize = kMinimumIconSize;
                        }
-                       storedSettings.FindInt32("iconSize", 
(int32*)&settings.iconSize);
-                       storedSettings.FindBool("autoRaise", 
&settings.autoRaise);
-                       storedSettings.FindBool("autoHide", &settings.autoHide);
-                       storedSettings.FindBool("recentAppsEnabled",
-                               &settings.recentAppsEnabled);
-                       storedSettings.FindBool("recentDocsEnabled",
-                               &settings.recentDocsEnabled);
-                       storedSettings.FindBool("recentFoldersEnabled",
-                               &settings.recentFoldersEnabled);
+                       if (storedSettings.FindBool("autoRaise", 
&settings.autoRaise)
+                               < B_OK) {
+                               settings.autoRaise = false;
+                       }
+                       if (storedSettings.FindBool("autoHide", 
&settings.autoHide) < B_OK)
+                               settings.autoHide = false;
+                       if (storedSettings.FindBool("recentAppsEnabled",
+                               &settings.recentAppsEnabled) < B_OK) {
+                               settings.recentAppsEnabled = true;
+                       }
+                       if (storedSettings.FindBool("recentDocsEnabled",
+                               &settings.recentDocsEnabled) < B_OK) {
+                               settings.recentDocsEnabled = true;
+                       }
+                       if (storedSettings.FindBool("recentFoldersEnabled",
+                               &settings.recentFoldersEnabled) < B_OK) {
+                               settings.recentFoldersEnabled = true;
+                       }
                }
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev43974 - src/apps/deskbar - jscipione