Patch by sil2100:

* Avoid showing read-only volumes as possible installation targets.
 * Mark the menu item for the first suitable volume that was found.
 * Removed no more needed debug output.

Fixes #5231. Thanks a lot!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36596 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-05-03 15:47:53 +00:00
parent c4697c01a9
commit 1edc8258ef
2 changed files with 14 additions and 11 deletions
@@ -213,7 +213,6 @@ InstalledPackageInfo::Uninstall()
// Try to remove all entries that are present in the list // Try to remove all entries that are present in the list
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
iter = static_cast<BString *>(fInstalledItems.ItemAt(count - i - 1)); iter = static_cast<BString *>(fInstalledItems.ItemAt(count - i - 1));
fprintf(stderr, "Removing: %s (%ld/%ld)\n", iter->String(), i, count);
ret = entry.SetTo(iter->String()); ret = entry.SetTo(iter->String());
if (ret == B_BUSY) { if (ret == B_BUSY) {
// The entry's directory is locked - wait a few cycles for it to // The entry's directory is locked - wait a few cycles for it to
@@ -235,10 +234,7 @@ InstalledPackageInfo::Uninstall()
return fStatus; return fStatus;
} }
fprintf(stderr, "...we continue\n");
if (entry.Exists() && entry.Remove() != B_OK) { if (entry.Exists() && entry.Remove() != B_OK) {
fprintf(stderr, "\n%s\n", strerror(ret));
fStatus = B_ERROR; fStatus = B_ERROR;
return fStatus; return fStatus;
} }
+14 -7
View File
@@ -589,7 +589,7 @@ PackageView::_GroupChanged(int32 index)
} }
} }
if (item) { if (item != NULL) {
item->SetMarked(true); item->SetMarked(true);
fCurrentPath.SetTo(path.Path()); fCurrentPath.SetTo(path.Path());
} }
@@ -600,17 +600,18 @@ PackageView::_GroupChanged(int32 index)
fDestination->AddItem(item); fDestination->AddItem(item);
fDestField->SetEnabled(true); fDestField->SetEnabled(true);
} } else if (prof->path_type == P_USER_PATH) {
else if (prof->path_type == P_USER_PATH) {
BString name; BString name;
bool defaultPathSet = false;
char sizeString[32], volumeName[B_FILE_NAME_LENGTH]; char sizeString[32], volumeName[B_FILE_NAME_LENGTH];
BVolumeRoster roster; BVolumeRoster roster;
BDirectory mountPoint; BDirectory mountPoint;
while (roster.GetNextVolume(&volume) != B_BAD_VALUE) { while (roster.GetNextVolume(&volume) != B_BAD_VALUE) {
if (volume.IsReadOnly() || if (volume.IsReadOnly() || !volume.IsPersistent()
volume.GetRootDirectory(&mountPoint) != B_OK) || volume.GetRootDirectory(&mountPoint) != B_OK) {
continue; continue;
}
if (path.SetTo(&mountPoint, NULL) != B_OK) if (path.SetTo(&mountPoint, NULL) != B_OK)
continue; continue;
@@ -625,11 +626,17 @@ PackageView::_GroupChanged(int32 index)
item = new BMenuItem(name.String(), temp); item = new BMenuItem(name.String(), temp);
item->SetTarget(this); item->SetTarget(this);
fDestination->AddItem(item); fDestination->AddItem(item);
// The first volume becomes the default element
if (!defaultPathSet) {
item->SetMarked(true);
fCurrentPath.SetTo(path.Path());
defaultPathSet = true;
}
} }
fDestField->SetEnabled(true); fDestField->SetEnabled(true);
} } else
else
fDestField->SetEnabled(false); fDestField->SetEnabled(false);
} }