Deskbar now uses a BMessage for storing its settings, instead of the old
raw file. Sorry, but You'll have to reconfigure your deskar to accomodate this! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37420 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+75
-72
@@ -180,28 +180,44 @@ TBarApp::SaveSettings()
|
|||||||
{
|
{
|
||||||
if (fSettingsFile->InitCheck() == B_OK) {
|
if (fSettingsFile->InitCheck() == B_OK) {
|
||||||
fSettingsFile->Seek(0, SEEK_SET);
|
fSettingsFile->Seek(0, SEEK_SET);
|
||||||
fSettingsFile->Write(&fSettings.vertical, sizeof(bool));
|
BMessage storedSettings;
|
||||||
fSettingsFile->Write(&fSettings.left, sizeof(bool));
|
storedSettings.AddBool("vertical", fSettings.vertical);
|
||||||
fSettingsFile->Write(&fSettings.top, sizeof(bool));
|
storedSettings.AddBool("left", fSettings.left);
|
||||||
fSettingsFile->Write(&fSettings.ampmMode, sizeof(bool));
|
storedSettings.AddBool("top", fSettings.top);
|
||||||
fSettingsFile->Write(&fSettings.state, sizeof(uint32));
|
storedSettings.AddBool("ampmMode", fSettings.ampmMode);
|
||||||
fSettingsFile->Write(&fSettings.width, sizeof(float));
|
|
||||||
fSettingsFile->Write(&fSettings.showTime, sizeof(bool));
|
storedSettings.AddInt32("state", fSettings.state);
|
||||||
fSettingsFile->Write(&fSettings.switcherLoc, sizeof(BPoint));
|
storedSettings.AddFloat("width", fSettings.width);
|
||||||
fSettingsFile->Write(&fSettings.recentAppsCount, sizeof(int32));
|
storedSettings.AddBool("showTime", fSettings.showTime);
|
||||||
fSettingsFile->Write(&fSettings.recentDocsCount, sizeof(int32));
|
storedSettings.AddPoint("switcherLoc", fSettings.switcherLoc);
|
||||||
fSettingsFile->Write(&fSettings.timeShowSeconds, sizeof(bool));
|
storedSettings.AddInt32("recentAppsCount",
|
||||||
fSettingsFile->Write(&fSettings.recentFoldersCount, sizeof(int32));
|
fSettings.recentAppsCount);
|
||||||
fSettingsFile->Write(&fSettings.alwaysOnTop, sizeof(bool));
|
storedSettings.AddInt32("recentDocsCount",
|
||||||
fSettingsFile->Write(&fSettings.timeFullDate, sizeof(bool));
|
fSettings.recentDocsCount);
|
||||||
fSettingsFile->Write(&fSettings.trackerAlwaysFirst, sizeof(bool));
|
storedSettings.AddBool("timeShowSeconds",
|
||||||
fSettingsFile->Write(&fSettings.sortRunningApps, sizeof(bool));
|
fSettings.timeShowSeconds);
|
||||||
fSettingsFile->Write(&fSettings.superExpando, sizeof(bool));
|
storedSettings.AddInt32("recentFoldersCount",
|
||||||
fSettingsFile->Write(&fSettings.expandNewTeams, sizeof(bool));
|
fSettings.recentFoldersCount);
|
||||||
fSettingsFile->Write(&fSettings.autoRaise, sizeof(bool));
|
storedSettings.AddBool("alwaysOnTop", fSettings.alwaysOnTop);
|
||||||
fSettingsFile->Write(&fSettings.recentAppsEnabled, sizeof(bool));
|
storedSettings.AddBool("timeFullDate", fSettings.timeFullDate);
|
||||||
fSettingsFile->Write(&fSettings.recentDocsEnabled, sizeof(bool));
|
storedSettings.AddBool("trackerAlwaysFirst",
|
||||||
fSettingsFile->Write(&fSettings.recentFoldersEnabled, sizeof(bool));
|
fSettings.trackerAlwaysFirst);
|
||||||
|
storedSettings.AddBool("sortRunningApps",
|
||||||
|
fSettings.sortRunningApps);
|
||||||
|
storedSettings.AddBool("superExpando",
|
||||||
|
fSettings.superExpando);
|
||||||
|
storedSettings.AddBool("expandNewTeams",
|
||||||
|
fSettings.expandNewTeams);
|
||||||
|
storedSettings.AddBool("autoRaise",
|
||||||
|
fSettings.autoRaise);
|
||||||
|
storedSettings.AddBool("recentAppsEnabled",
|
||||||
|
fSettings.recentAppsEnabled);
|
||||||
|
storedSettings.AddBool("recentDocsEnabled",
|
||||||
|
fSettings.recentDocsEnabled);
|
||||||
|
storedSettings.AddBool("recentFoldersEnabled",
|
||||||
|
fSettings.recentFoldersEnabled);
|
||||||
|
|
||||||
|
storedSettings.Flatten(fSettingsFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,57 +265,44 @@ TBarApp::InitSettings()
|
|||||||
theDir.CreateFile(settingsFileName, fSettingsFile);
|
theDir.CreateFile(settingsFileName, fSettingsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fSettingsFile->InitCheck() == B_OK) {
|
BMessage storedSettings;
|
||||||
off_t size = 0;
|
if (fSettingsFile->InitCheck() == B_OK
|
||||||
fSettingsFile->GetSize(&size);
|
&& 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 (size >= kValidSettingsSize1) {
|
storedSettings.FindInt32("state", (int32*)&settings.state);
|
||||||
fSettingsFile->Seek(0, SEEK_SET);
|
storedSettings.FindFloat("width", &settings.width);
|
||||||
fSettingsFile->Read(&settings.vertical, sizeof(bool));
|
storedSettings.FindBool("showTime", &settings.showTime);
|
||||||
fSettingsFile->Read(&settings.left, sizeof(bool));
|
storedSettings.FindPoint("switcherLoc", &settings.switcherLoc);
|
||||||
fSettingsFile->Read(&settings.top, sizeof(bool));
|
storedSettings.FindInt32("recentAppsCount",
|
||||||
fSettingsFile->Read(&settings.ampmMode, sizeof(bool));
|
&settings.recentAppsCount);
|
||||||
fSettingsFile->Read(&settings.state, sizeof(uint32));
|
storedSettings.FindInt32("recentDocsCount",
|
||||||
fSettingsFile->Read(&settings.width, sizeof(float));
|
&settings.recentDocsCount);
|
||||||
fSettingsFile->Read(&settings.showTime, sizeof(bool));
|
storedSettings.FindBool("timeShowSeconds",
|
||||||
}
|
&settings.timeShowSeconds);
|
||||||
if (size >= kValidSettingsSize2)
|
storedSettings.FindInt32("recentFoldersCount",
|
||||||
fSettingsFile->Read(&settings.switcherLoc, sizeof(BPoint));
|
&settings.recentFoldersCount);
|
||||||
if (size >= kValidSettingsSize3) {
|
storedSettings.FindBool("alwaysOnTop", &settings.alwaysOnTop);
|
||||||
fSettingsFile->Read(&settings.recentAppsCount, sizeof(int32));
|
storedSettings.FindBool("timeFullDate", &settings.timeFullDate);
|
||||||
fSettingsFile->Read(&settings.recentDocsCount, sizeof(int32));
|
storedSettings.FindBool("trackerAlwaysFirst",
|
||||||
}
|
&settings.trackerAlwaysFirst);
|
||||||
if (size >= kValidSettingsSize4) {
|
storedSettings.FindBool("sortRunningApps",
|
||||||
fSettingsFile->Read(&settings.timeShowSeconds, sizeof(bool));
|
&settings.sortRunningApps);
|
||||||
}
|
storedSettings.FindBool("superExpando",
|
||||||
if (size >= kValidSettingsSize5)
|
&settings.superExpando);
|
||||||
fSettingsFile->Read(&settings.recentFoldersCount,
|
storedSettings.FindBool("expandNewTeams",
|
||||||
sizeof(int32));
|
&settings.expandNewTeams);
|
||||||
if (size >= kValidSettingsSize6) {
|
storedSettings.FindBool("autoRaise",
|
||||||
fSettingsFile->Read(&settings.alwaysOnTop, sizeof(bool));
|
&settings.autoRaise);
|
||||||
}
|
storedSettings.FindBool("recentAppsEnabled",
|
||||||
if (size >= kValidSettingsSize7)
|
&settings.recentAppsEnabled);
|
||||||
fSettingsFile->Read(&settings.timeFullDate, sizeof(bool));
|
storedSettings.FindBool("recentDocsEnabled",
|
||||||
if (size >= kValidSettingsSize8) {
|
&settings.recentDocsEnabled);
|
||||||
fSettingsFile->Read(&settings.trackerAlwaysFirst, sizeof(bool));
|
storedSettings.FindBool("recentFoldersEnabled",
|
||||||
fSettingsFile->Read(&settings.sortRunningApps, sizeof(bool));
|
&settings.recentFoldersEnabled);
|
||||||
}
|
|
||||||
if (size >= kValidSettingsSize9) {
|
|
||||||
fSettingsFile->Read(&settings.superExpando, sizeof(bool));
|
|
||||||
fSettingsFile->Read(&settings.expandNewTeams, sizeof(bool));
|
|
||||||
}
|
|
||||||
if (size >= kValidSettingsSize10)
|
|
||||||
fSettingsFile->Read(&settings.autoRaise, sizeof(bool));
|
|
||||||
|
|
||||||
if (size >= kValidSettingsSize11) {
|
|
||||||
fSettingsFile->Read(&settings.recentAppsEnabled, sizeof(bool));
|
|
||||||
fSettingsFile->Read(&settings.recentDocsEnabled, sizeof(bool));
|
|
||||||
fSettingsFile->Read(&settings.recentFoldersEnabled, sizeof(bool));
|
|
||||||
} else {
|
|
||||||
settings.recentAppsEnabled = settings.recentAppsCount > 0;
|
|
||||||
settings.recentDocsEnabled = settings.recentDocsCount > 0;
|
|
||||||
settings.recentFoldersEnabled = settings.recentFoldersCount > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-32
@@ -26,9 +26,10 @@ Except as contained in this notice, the name of Be Incorporated shall not be
|
|||||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||||
this Software without prior written authorization from Be Incorporated.
|
this Software without prior written authorization from Be Incorporated.
|
||||||
|
|
||||||
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
|
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
|
||||||
of Be Incorporated in the United States and other countries. Other brand product
|
trademarks of Be Incorporated in the United States and other countries. Other
|
||||||
names are registered trademarks or trademarks of their respective holders.
|
brand product names are registered trademarks or trademarks of their respective
|
||||||
|
holders.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
#ifndef BAR_APP_H
|
#ifndef BAR_APP_H
|
||||||
@@ -89,49 +90,31 @@ const uint32 kSuspendSystem = 304;
|
|||||||
|
|
||||||
/* --------------------------------------------- */
|
/* --------------------------------------------- */
|
||||||
|
|
||||||
// if you want to extend this structure, maintain the
|
|
||||||
// constants below (used in TBarApp::InitSettings())
|
|
||||||
|
|
||||||
struct desk_settings {
|
struct desk_settings {
|
||||||
bool vertical; // version 1
|
bool vertical;
|
||||||
bool left;
|
bool left;
|
||||||
bool top;
|
bool top;
|
||||||
bool ampmMode;
|
bool ampmMode;
|
||||||
bool showTime;
|
bool showTime;
|
||||||
uint32 state;
|
uint32 state;
|
||||||
float width;
|
float width;
|
||||||
BPoint switcherLoc; // version 2
|
BPoint switcherLoc;
|
||||||
int32 recentAppsCount; // version 3
|
int32 recentAppsCount;
|
||||||
int32 recentDocsCount;
|
int32 recentDocsCount;
|
||||||
bool timeShowSeconds; // version 4
|
bool timeShowSeconds;
|
||||||
int32 recentFoldersCount; // version 5
|
int32 recentFoldersCount;
|
||||||
bool alwaysOnTop; // version 6
|
bool alwaysOnTop;
|
||||||
bool timeFullDate; // version 7
|
bool timeFullDate;
|
||||||
bool trackerAlwaysFirst; // version 8
|
bool trackerAlwaysFirst;
|
||||||
bool sortRunningApps;
|
bool sortRunningApps;
|
||||||
bool superExpando; // version 9
|
bool superExpando;
|
||||||
bool expandNewTeams;
|
bool expandNewTeams;
|
||||||
bool autoRaise; // version 10
|
bool autoRaise;
|
||||||
bool recentAppsEnabled; // version 11
|
bool recentAppsEnabled;
|
||||||
bool recentDocsEnabled;
|
bool recentDocsEnabled;
|
||||||
bool recentFoldersEnabled;
|
bool recentFoldersEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
// the following structures are defined to compute
|
|
||||||
// valid sizes for "struct desk_settings"
|
|
||||||
|
|
||||||
const uint32 kValidSettingsSize1 = 5 * sizeof(bool) + sizeof(uint32)
|
|
||||||
+ sizeof(float);
|
|
||||||
const uint32 kValidSettingsSize2 = sizeof(BPoint) + kValidSettingsSize1;
|
|
||||||
const uint32 kValidSettingsSize3 = 2 * sizeof(int32) + kValidSettingsSize2;
|
|
||||||
const uint32 kValidSettingsSize4 = sizeof(bool) + kValidSettingsSize3;
|
|
||||||
const uint32 kValidSettingsSize5 = sizeof(int32) + kValidSettingsSize4;
|
|
||||||
const uint32 kValidSettingsSize6 = sizeof(bool) + kValidSettingsSize5;
|
|
||||||
const uint32 kValidSettingsSize7 = sizeof(bool) + kValidSettingsSize6;
|
|
||||||
const uint32 kValidSettingsSize8 = 2 * sizeof(bool) + kValidSettingsSize7;
|
|
||||||
const uint32 kValidSettingsSize9 = 2 * sizeof(bool) + kValidSettingsSize8;
|
|
||||||
const uint32 kValidSettingsSize10 = sizeof(bool) + kValidSettingsSize9;
|
|
||||||
const uint32 kValidSettingsSize11 = 3 * sizeof(bool) + kValidSettingsSize10;
|
|
||||||
|
|
||||||
class TBarView;
|
class TBarView;
|
||||||
class BFile;
|
class BFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user