Use the descriptive labels also for source menu items. Helps a lot in case
you have three partitions all named "Haiku"... :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31803 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -66,9 +66,6 @@ public:
|
|||||||
virtual bool Visit(BPartition* partition, int32 level);
|
virtual bool Visit(BPartition* partition, int32 level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _MakeLabel(BPartition* partition, char* label, char* menuLabel,
|
|
||||||
bool showContentType);
|
|
||||||
|
|
||||||
BMenu* fMenu;
|
BMenu* fMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -463,6 +460,32 @@ WorkerThread::_SetStatusMessage(const char *status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
make_partition_label(BPartition* partition, char* label, char* menuLabel,
|
||||||
|
bool showContentType)
|
||||||
|
{
|
||||||
|
char size[15];
|
||||||
|
SizeAsString(partition->ContentSize(), size);
|
||||||
|
|
||||||
|
BPath path;
|
||||||
|
partition->GetPath(&path);
|
||||||
|
|
||||||
|
if (showContentType) {
|
||||||
|
const char* type = partition->ContentType();
|
||||||
|
if (type == NULL)
|
||||||
|
type = "Unknown Type";
|
||||||
|
|
||||||
|
sprintf(label, "%s - %s [%s] (%s)", partition->ContentName(), size,
|
||||||
|
path.Path(), type);
|
||||||
|
} else {
|
||||||
|
sprintf(label, "%s - %s [%s]", partition->ContentName(), size,
|
||||||
|
path.Path());
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(menuLabel, "%s - %s", partition->ContentName(), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - SourceVisitor
|
// #pragma mark - SourceVisitor
|
||||||
|
|
||||||
|
|
||||||
@@ -508,9 +531,11 @@ SourceVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
// from your BFS volume containing the music collection?
|
// from your BFS volume containing the music collection?
|
||||||
// TODO: Then the check for BFS could also be removed above.
|
// TODO: Then the check for BFS could also be removed above.
|
||||||
|
|
||||||
PartitionMenuItem *item = new PartitionMenuItem(NULL,
|
char label[255];
|
||||||
partition->ContentName(), NULL, new BMessage(SRC_PARTITION),
|
char menuLabel[255];
|
||||||
partition->ID());
|
make_partition_label(partition, label, menuLabel, false);
|
||||||
|
PartitionMenuItem* item = new PartitionMenuItem(partition->ContentName(),
|
||||||
|
label, NULL, new BMessage(SRC_PARTITION), partition->ID());
|
||||||
item->SetMarked(isBootPartition);
|
item->SetMarked(isBootPartition);
|
||||||
fMenu->AddItem(item);
|
fMenu->AddItem(item);
|
||||||
return false;
|
return false;
|
||||||
@@ -541,7 +566,8 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
BPath path;
|
BPath path;
|
||||||
if (partition->GetPath(&path) == B_OK)
|
if (partition->GetPath(&path) == B_OK)
|
||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->ContentName());
|
printf("TargetVisitor::Visit(BPartition *) : %s\n",
|
||||||
|
partition->ContentName());
|
||||||
|
|
||||||
if (partition->ContentSize() < 20 * 1024 * 1024) {
|
if (partition->ContentSize() < 20 * 1024 * 1024) {
|
||||||
// reject partitions which are too small anyway
|
// reject partitions which are too small anyway
|
||||||
@@ -565,8 +591,9 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
bool isValidTarget = partition->ContentType() != NULL
|
bool isValidTarget = partition->ContentType() != NULL
|
||||||
&& strcmp(partition->ContentType(), kPartitionTypeBFS) == 0;
|
&& strcmp(partition->ContentType(), kPartitionTypeBFS) == 0;
|
||||||
|
|
||||||
char label[255], menuLabel[255];
|
char label[255];
|
||||||
_MakeLabel(partition, label, menuLabel, !isValidTarget);
|
char menuLabel[255];
|
||||||
|
make_partition_label(partition, label, menuLabel, !isValidTarget);
|
||||||
PartitionMenuItem* item = new PartitionMenuItem(partition->ContentName(),
|
PartitionMenuItem* item = new PartitionMenuItem(partition->ContentName(),
|
||||||
label, menuLabel, new BMessage(TARGET_PARTITION), partition->ID());
|
label, menuLabel, new BMessage(TARGET_PARTITION), partition->ID());
|
||||||
|
|
||||||
@@ -577,29 +604,3 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TargetVisitor::_MakeLabel(BPartition* partition, char* label, char* menuLabel,
|
|
||||||
bool showContentType)
|
|
||||||
{
|
|
||||||
char size[15];
|
|
||||||
SizeAsString(partition->ContentSize(), size);
|
|
||||||
|
|
||||||
BPath path;
|
|
||||||
partition->GetPath(&path);
|
|
||||||
|
|
||||||
if (showContentType) {
|
|
||||||
const char* type = partition->ContentType();
|
|
||||||
if (type == NULL)
|
|
||||||
type = "Unknown Type";
|
|
||||||
|
|
||||||
sprintf(label, "%s - %s [%s] (%s)", partition->ContentName(), size,
|
|
||||||
path.Path(), type);
|
|
||||||
} else {
|
|
||||||
sprintf(label, "%s - %s [%s]", partition->ContentName(), size,
|
|
||||||
path.Path());
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(menuLabel, "%s - %s", partition->ContentName(), size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user