Fix #8640.
- Automatic whitespace cleanup. - Remove no longer exposed show/hide time setting. The methodology for saving it on exit was broken anyways, since it relied on the current show/hide state of the time view, which would be hidden if the deskbar was currently in Autohide mode.
This commit is contained in:
@@ -204,7 +204,6 @@ TBarApp::SaveSettings()
|
|||||||
storedSettings.AddInt32("state", fSettings.state);
|
storedSettings.AddInt32("state", fSettings.state);
|
||||||
storedSettings.AddFloat("width", fSettings.width);
|
storedSettings.AddFloat("width", fSettings.width);
|
||||||
|
|
||||||
storedSettings.AddBool("showTime", fSettings.showTime);
|
|
||||||
storedSettings.AddBool("showSeconds", fSettings.showSeconds);
|
storedSettings.AddBool("showSeconds", fSettings.showSeconds);
|
||||||
storedSettings.AddBool("showDayOfWeek", fSettings.showDayOfWeek);
|
storedSettings.AddBool("showDayOfWeek", fSettings.showDayOfWeek);
|
||||||
|
|
||||||
@@ -244,7 +243,6 @@ TBarApp::InitSettings()
|
|||||||
settings.vertical = true;
|
settings.vertical = true;
|
||||||
settings.left = false;
|
settings.left = false;
|
||||||
settings.top = true;
|
settings.top = true;
|
||||||
settings.showTime = true;
|
|
||||||
settings.showSeconds = false;
|
settings.showSeconds = false;
|
||||||
settings.showDayOfWeek = false;
|
settings.showDayOfWeek = false;
|
||||||
settings.state = kExpandoState;
|
settings.state = kExpandoState;
|
||||||
@@ -301,10 +299,6 @@ TBarApp::InitSettings()
|
|||||||
}
|
}
|
||||||
if (storedSettings.FindFloat("width", &settings.width) != B_OK)
|
if (storedSettings.FindFloat("width", &settings.width) != B_OK)
|
||||||
settings.width = 0;
|
settings.width = 0;
|
||||||
if (storedSettings.FindBool("showTime", &settings.showTime)
|
|
||||||
!= B_OK) {
|
|
||||||
settings.showTime = true;
|
|
||||||
}
|
|
||||||
if (storedSettings.FindBool("showSeconds", &settings.showSeconds)
|
if (storedSettings.FindBool("showSeconds", &settings.showSeconds)
|
||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
settings.showSeconds = false;
|
settings.showSeconds = false;
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ struct desk_settings {
|
|||||||
bool vertical;
|
bool vertical;
|
||||||
bool left;
|
bool left;
|
||||||
bool top;
|
bool top;
|
||||||
bool showTime;
|
|
||||||
bool showSeconds;
|
bool showSeconds;
|
||||||
bool showDayOfWeek;
|
bool showDayOfWeek;
|
||||||
uint32 state;
|
uint32 state;
|
||||||
|
|||||||
@@ -181,11 +181,6 @@ TReplicantTray::AttachedToWindow()
|
|||||||
|
|
||||||
AddChild(fTime);
|
AddChild(fTime);
|
||||||
fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - 1, 2);
|
fTime->MoveTo(Bounds().right - fTime->Bounds().Width() - 1, 2);
|
||||||
if (!((TBarApp*)be_app)->Settings()->showTime) {
|
|
||||||
fTime->Hide();
|
|
||||||
RealignReplicants();
|
|
||||||
AdjustPlacement();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DB_ADDONS
|
#ifdef DB_ADDONS
|
||||||
// load addons and rehydrate archives
|
// load addons and rehydrate archives
|
||||||
@@ -438,13 +433,13 @@ TReplicantTray::InitAddOnSupport()
|
|||||||
int32 id;
|
int32 id;
|
||||||
BString path;
|
BString path;
|
||||||
if (fAddOnSettings.Unflatten(&file) == B_OK) {
|
if (fAddOnSettings.Unflatten(&file) == B_OK) {
|
||||||
for (int32 i = 0; fAddOnSettings.FindString(kReplicantPathField,
|
for (int32 i = 0; fAddOnSettings.FindString(kReplicantPathField,
|
||||||
i, &path) == B_OK; i++) {
|
i, &path) == B_OK; i++) {
|
||||||
if (entry.SetTo(path.String()) == B_OK && entry.Exists()) {
|
if (entry.SetTo(path.String()) == B_OK && entry.Exists()) {
|
||||||
result = LoadAddOn(&entry, &id, false);
|
result = LoadAddOn(&entry, &id, false);
|
||||||
} else
|
} else
|
||||||
result = B_ENTRY_NOT_FOUND;
|
result = B_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
fAddOnSettings.RemoveData(kReplicantPathField, i);
|
fAddOnSettings.RemoveData(kReplicantPathField, i);
|
||||||
--i;
|
--i;
|
||||||
@@ -460,7 +455,7 @@ void
|
|||||||
TReplicantTray::DeleteAddOnSupport()
|
TReplicantTray::DeleteAddOnSupport()
|
||||||
{
|
{
|
||||||
_SaveSettings();
|
_SaveSettings();
|
||||||
|
|
||||||
for (int32 i = fItemList->CountItems(); i-- > 0 ;) {
|
for (int32 i = fItemList->CountItems(); i-- > 0 ;) {
|
||||||
DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->RemoveItem(i);
|
DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->RemoveItem(i);
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -641,7 +636,7 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool addToSettings)
|
|||||||
fAddOnSettings.AddString(kReplicantPathField, path.Path());
|
fAddOnSettings.AddString(kReplicantPathField, path.Path());
|
||||||
_SaveSettings();
|
_SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +706,7 @@ TReplicantTray::RemoveItem(int32 id)
|
|||||||
if (item->isAddOn) {
|
if (item->isAddOn) {
|
||||||
BPath path(&item->entryRef);
|
BPath path(&item->entryRef);
|
||||||
BString storedPath;
|
BString storedPath;
|
||||||
for (int32 i = 0;
|
for (int32 i = 0;
|
||||||
fAddOnSettings.FindString(kReplicantPathField, i, &storedPath)
|
fAddOnSettings.FindString(kReplicantPathField, i, &storedPath)
|
||||||
== B_OK; i++) {
|
== B_OK; i++) {
|
||||||
if (storedPath == path.Path()) {
|
if (storedPath == path.Path()) {
|
||||||
@@ -720,7 +715,7 @@ TReplicantTray::RemoveItem(int32 id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_SaveSettings();
|
_SaveSettings();
|
||||||
|
|
||||||
BNode node(&item->entryRef);
|
BNode node(&item->entryRef);
|
||||||
watch_node(&item->nodeRef, B_STOP_WATCHING, this, Window());
|
watch_node(&item->nodeRef, B_STOP_WATCHING, this, Window());
|
||||||
}
|
}
|
||||||
@@ -1225,7 +1220,7 @@ TReplicantTray::_SaveSettings()
|
|||||||
path.Append(kReplicantSettingsFile);
|
path.Append(kReplicantSettingsFile);
|
||||||
|
|
||||||
BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
if ((result = file.InitCheck()) == B_OK)
|
if ((result = file.InitCheck()) == B_OK)
|
||||||
result = fAddOnSettings.Flatten(&file);
|
result = fAddOnSettings.Flatten(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,7 +1235,6 @@ TReplicantTray::SaveTimeSettings()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
desk_settings* settings = ((TBarApp*)be_app)->Settings();
|
||||||
settings->showTime = !fTime->IsHidden();
|
|
||||||
settings->showSeconds = fTime->ShowSeconds();
|
settings->showSeconds = fTime->ShowSeconds();
|
||||||
settings->showDayOfWeek = fTime->ShowDayOfWeek();
|
settings->showDayOfWeek = fTime->ShowDayOfWeek();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user