diff --git a/Station.cpp b/Station.cpp
index 0ca766e..4a60bcc 100644
--- a/Station.cpp
+++ b/Station.cpp
@@ -89,9 +89,7 @@ status_t Station::InitCheck() {
Station* Station::LoadFromPlsFile(BString Name) {
BEntry stationEntry;
- BDirectory* stationDir = StationDirectory();
- stationEntry.SetTo(stationDir, Name);
- delete stationDir;
+ stationEntry.SetTo(StationDirectory(), Name);
Station* station = Load(Name, &stationEntry);
if (station) station->unsaved = false;
return station;
@@ -514,19 +512,23 @@ void Station::checkFlags() {
fFlags |= STATION_HAS_META;
}
+BDirectory* Station::fStationsDirectory = NULL;
+
BDirectory* Station::StationDirectory() {
+ if (fStationsDirectory)
+ return fStationsDirectory;
+
status_t status;
BPath configPath;
BDirectory configDir;
- BDirectory* stationDir;
status = find_directory(B_USER_SETTINGS_DIRECTORY, &configPath);
configDir.SetTo(configPath.Path());
if (configDir.Contains(SubDirStations, B_DIRECTORY_NODE)) {
- stationDir = new BDirectory(&configDir, SubDirStations);
+ fStationsDirectory = new BDirectory(&configDir, SubDirStations);
} else {
- stationDir = new BDirectory();
- configDir.CreateDirectory(SubDirStations, stationDir);
+ fStationsDirectory = new BDirectory();
+ configDir.CreateDirectory(SubDirStations, fStationsDirectory);
BAlert* alert = new BAlert("Stations directory created",
"A directory for saving stations has been created in your "
"settings folder. Link this directory to your deskbar menu "
@@ -534,5 +536,6 @@ BDirectory* Station::StationDirectory() {
"Ok");
alert->Go();
}
- return stationDir;
+
+ return fStationsDirectory;
}
\ No newline at end of file
diff --git a/Station.h b/Station.h
index 4ec7b3c..e707c19 100644
--- a/Station.h
+++ b/Station.h
@@ -93,6 +93,7 @@ class Station {
uint32 fEncoding;
uint32 fMetaInterval;
uint32 fFlags;
+ static BDirectory* fStationsDirectory;
};
#endif /* STATION_H */
diff --git a/StationFinder.cpp b/StationFinder.cpp
index eaff7ac..1360021 100644
--- a/StationFinder.cpp
+++ b/StationFinder.cpp
@@ -214,7 +214,7 @@ bool StationFinderWindow::QuitRequested() {
void StationFinderWindow::MessageReceived(BMessage* msg) {
switch (msg->what) {
case MSG_BNSEARCH : {
- if (txSearch->LayoutContext()) {
+ if (txSearch->IsEnabled()) {
if (txSearch->Text()[0]) {
DoSearch(txSearch->Text());
resultView->MakeFocus(true);
@@ -331,10 +331,14 @@ void StationFinderWindow::SelectCapability(int index) {
searchGrid->RemoveView(txSearch);
searchGrid->AddView(kwSearch, 1, 2);
+ kwSearch->SetEnabled(true);
+ txSearch->SetEnabled(false);
Layout(true);
} else {
searchGrid->RemoveView(kwSearch);
searchGrid->AddView(txSearch, 1, 2);
+ kwSearch->SetEnabled(false);
+ txSearch->SetEnabled(true);
Layout(true);
}
}
diff --git a/nbproject/private/configurations.xml b/nbproject/private/configurations.xml
index 9aaa4e0..4489b4d 100644
--- a/nbproject/private/configurations.xml
+++ b/nbproject/private/configurations.xml
@@ -6,9 +6,7 @@
-
-
-
+
About.cpp
About.h