now uses real partitions for menus
annoyingly app_server crashes now at every launch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14529 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "CopyEngine.h"
|
#include "CopyEngine.h"
|
||||||
#include "InstallerWindow.h"
|
#include "InstallerWindow.h"
|
||||||
|
#include "PartitionMenuItem.h"
|
||||||
#include <DiskDeviceVisitor.h>
|
#include <DiskDeviceVisitor.h>
|
||||||
#include <DiskDeviceTypes.h>
|
#include <DiskDeviceTypes.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
@@ -98,11 +99,12 @@ SourceVisitor::SourceVisitor(BMenu *menu)
|
|||||||
bool
|
bool
|
||||||
SourceVisitor::Visit(BDiskDevice *device)
|
SourceVisitor::Visit(BDiskDevice *device)
|
||||||
{
|
{
|
||||||
if (!device->Type() || strcmp(device->Type(), kPartitionTypeBFS)!=0)
|
if (!device->ContentType() || strcmp(device->ContentType(), kPartitionTypeBFS)!=0)
|
||||||
return false;
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (device->GetPath(&path)==B_OK)
|
if (device->GetPath(&path)==B_OK)
|
||||||
printf("SourceVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
printf("SourceVisitor::Visit(BDiskDevice *) : %s type:%s, contentType:%s\n", path.Path(), device->Type(), device->ContentType());
|
||||||
|
fMenu->AddItem(new PartitionMenuItem(device->Name(), new BMessage(SRC_PARTITION), device->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +112,13 @@ SourceVisitor::Visit(BDiskDevice *device)
|
|||||||
bool
|
bool
|
||||||
SourceVisitor::Visit(BPartition *partition, int32 level)
|
SourceVisitor::Visit(BPartition *partition, int32 level)
|
||||||
{
|
{
|
||||||
if (!partition->Type() || strcmp(partition->Type(), kPartitionTypeBFS)!=0)
|
if (!partition->ContentType() || strcmp(partition->ContentType(), kPartitionTypeBFS)!=0)
|
||||||
return false;
|
return false;
|
||||||
BPath path;
|
BPath path;
|
||||||
if (partition->GetPath(&path)==B_OK)
|
if (partition->GetPath(&path)==B_OK)
|
||||||
printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path());
|
||||||
printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
|
fMenu->AddItem(new PartitionMenuItem(partition->Name(), new BMessage(SRC_PARTITION), partition->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +137,7 @@ TargetVisitor::Visit(BDiskDevice *device)
|
|||||||
BPath path;
|
BPath path;
|
||||||
if (device->GetPath(&path)==B_OK)
|
if (device->GetPath(&path)==B_OK)
|
||||||
printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path());
|
||||||
|
fMenu->AddItem(new PartitionMenuItem(device->Name(), new BMessage(TARGET_PARTITION), device->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,5 +151,6 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
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->Name());
|
printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->Name());
|
||||||
|
fMenu->AddItem(new PartitionMenuItem(partition->Name(), new BMessage(TARGET_PARTITION), partition->ID()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ const uint32 BEGIN_MESSAGE = 'iBGN';
|
|||||||
const uint32 SHOW_BOTTOM_MESSAGE = 'iSBT';
|
const uint32 SHOW_BOTTOM_MESSAGE = 'iSBT';
|
||||||
const uint32 SETUP_MESSAGE = 'iSEP';
|
const uint32 SETUP_MESSAGE = 'iSEP';
|
||||||
const uint32 START_SCAN = 'iSSC';
|
const uint32 START_SCAN = 'iSSC';
|
||||||
const uint32 SRC_PARTITION = 'iSPT';
|
|
||||||
const uint32 DST_PARTITION = 'iDPT';
|
|
||||||
const uint32 PACKAGE_CHECKBOX = 'iPCB';
|
const uint32 PACKAGE_CHECKBOX = 'iPCB';
|
||||||
|
|
||||||
class LogoView : public BBox {
|
class LogoView : public BBox {
|
||||||
@@ -273,9 +271,9 @@ InstallerWindow::StartScan()
|
|||||||
|
|
||||||
fCopyEngine.ScanDisksPartitions(fSrcMenu, fDestMenu);
|
fCopyEngine.ScanDisksPartitions(fSrcMenu, fDestMenu);
|
||||||
|
|
||||||
fSrcMenu->AddItem(new PartitionMenuItem("BeOS 5 PE Max Edition V3.1 beta",
|
/*fSrcMenu->AddItem(new PartitionMenuItem("BeOS 5 PE Max Edition V3.1 beta",
|
||||||
new BMessage(SRC_PARTITION), "/BeOS 5 PE Max Edition V3.1 beta"));
|
new BMessage(SRC_PARTITION), "/BeOS 5 PE Max Edition V3.1 beta"));
|
||||||
|
*/
|
||||||
if (fSrcMenu->ItemAt(0)) {
|
if (fSrcMenu->ItemAt(0)) {
|
||||||
fSrcMenu->ItemAt(0)->SetMarked(true);
|
fSrcMenu->ItemAt(0)->SetMarked(true);
|
||||||
PublishPackages();
|
PublishPackages();
|
||||||
@@ -292,7 +290,19 @@ InstallerWindow::PublishPackages()
|
|||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BPath directory(item->Path());
|
BPath directory;
|
||||||
|
BDiskDeviceRoster roster;
|
||||||
|
BDiskDevice device;
|
||||||
|
BPartition *partition;
|
||||||
|
if (roster.GetPartitionWithID(item->ID(), &device, &partition) == B_OK) {
|
||||||
|
if (partition->GetPath(&directory)!=B_OK)
|
||||||
|
return;
|
||||||
|
} else if (roster.GetDeviceWithID(item->ID(), &device) == B_OK) {
|
||||||
|
if (device.GetPath(&directory)!=B_OK)
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
return; // shouldn't happen
|
||||||
|
|
||||||
directory.Append("_packages_");
|
directory.Append("_packages_");
|
||||||
BDirectory dir(directory.Path());
|
BDirectory dir(directory.Path());
|
||||||
if (dir.InitCheck()!=B_OK)
|
if (dir.InitCheck()!=B_OK)
|
||||||
|
|||||||
@@ -9,15 +9,14 @@
|
|||||||
|
|
||||||
#include "PartitionMenuItem.h"
|
#include "PartitionMenuItem.h"
|
||||||
|
|
||||||
PartitionMenuItem::PartitionMenuItem(const char *label, BMessage *msg, const char* path)
|
PartitionMenuItem::PartitionMenuItem(const char *label, BMessage *msg, partition_id id)
|
||||||
: BMenuItem(label, msg)
|
: BMenuItem(label, msg)
|
||||||
{
|
{
|
||||||
fPath = strdup(path);
|
fID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PartitionMenuItem::~PartitionMenuItem()
|
PartitionMenuItem::~PartitionMenuItem()
|
||||||
{
|
{
|
||||||
free(fPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,19 @@
|
|||||||
#ifndef __PARTITIONMENUITEM_H_
|
#ifndef __PARTITIONMENUITEM_H_
|
||||||
#define __PARTITIONMENUITEM_H_
|
#define __PARTITIONMENUITEM_H_
|
||||||
|
|
||||||
|
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <Partition.h>
|
||||||
|
|
||||||
|
const uint32 SRC_PARTITION = 'iSPT';
|
||||||
|
const uint32 TARGET_PARTITION = 'iTPT';
|
||||||
|
|
||||||
class PartitionMenuItem : public BMenuItem {
|
class PartitionMenuItem : public BMenuItem {
|
||||||
public:
|
public:
|
||||||
PartitionMenuItem(const char *label, BMessage *msg, const char* path);
|
PartitionMenuItem(const char *label, BMessage *msg, partition_id id);
|
||||||
~PartitionMenuItem();
|
~PartitionMenuItem();
|
||||||
const char* Path() { return fPath; };
|
partition_id ID() const { return fID; };
|
||||||
private:
|
private:
|
||||||
char *fPath;
|
partition_id fID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __PARTITIONMENUITEM_H_ */
|
#endif /* __PARTITIONMENUITEM_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user