More work on DriveSetup. Will now show all recognized disks/partitions in hierarchical format.
It still looks aweful, partly because of BColumnListView drawing. Please note that the partition-order is wrong, due to funky sorting in BColumnListView. This will be fixed tommorow :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18084 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,6 +4,6 @@ UsePrivateHeaders interface storage shared ;
|
|||||||
|
|
||||||
AddResources DriveSetup : DriveSetup.rdef ;
|
AddResources DriveSetup : DriveSetup.rdef ;
|
||||||
|
|
||||||
Preference DriveSetup : main.cpp MainWindow.cpp PosSettings.cpp ;
|
Preference DriveSetup : main.cpp MainWindow.cpp PartitionList.cpp PosSettings.cpp ;
|
||||||
|
|
||||||
LinkAgainst DriveSetup : be ;
|
LinkAgainst DriveSetup : be ;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include "PartitionList.h"
|
||||||
#include "PosSettings.h"
|
#include "PosSettings.h"
|
||||||
|
|
||||||
#include <interface/MenuItem.h>
|
#include <interface/MenuItem.h>
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <app/Application.h>
|
#include <app/Application.h>
|
||||||
|
|
||||||
#include <storage/DiskDeviceVisitor.h>
|
#include <storage/DiskDeviceVisitor.h>
|
||||||
|
#include <storage/DiskSystem.h>
|
||||||
#include <storage/DiskDevice.h>
|
#include <storage/DiskDevice.h>
|
||||||
#include <storage/Partition.h>
|
#include <storage/Partition.h>
|
||||||
#include <storage/Path.h>
|
#include <storage/Path.h>
|
||||||
@@ -26,12 +27,12 @@
|
|||||||
class DriveVisitor : public BDiskDeviceVisitor
|
class DriveVisitor : public BDiskDeviceVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DriveVisitor(MainWindow* win);
|
DriveVisitor(PartitionListView* list);
|
||||||
|
|
||||||
bool Visit(BDiskDevice *device);
|
bool Visit(BDiskDevice *device);
|
||||||
bool Visit(BPartition *partition, int32 level);
|
bool Visit(BPartition *partition, int32 level);
|
||||||
private:
|
private:
|
||||||
MainWindow* fDSWindow;
|
PartitionListView* fPartitionList;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
@@ -61,24 +62,45 @@ SizeAsString(off_t size, char *string)
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
static void
|
||||||
|
dump_partition_info(BPartition* partition)
|
||||||
|
{
|
||||||
|
char size[1024];
|
||||||
|
printf("\tOffset(): %Ld\n", partition->Offset());
|
||||||
|
printf("\tSize(): %s\n", SizeAsString(partition->Size(),size));
|
||||||
|
printf("\tContentSize(): %s\n", SizeAsString(partition->ContentSize(), size));
|
||||||
|
printf("\tBlockSize(): %ld\n", partition->BlockSize());
|
||||||
|
printf("\tIndex(): %ld\n", partition->Index());
|
||||||
|
printf("\tStatus(): %ld\n\n", partition->Status());
|
||||||
|
printf("\tContainsFileSystem(): %s\n", partition->ContainsFileSystem() ? "true" : "false");
|
||||||
|
printf("\tContainsPartitioningSystem(): %s\n\n", partition->ContainsPartitioningSystem() ? "true" : "false");
|
||||||
|
printf("\tIsDevice(): %s\n", partition->IsDevice() ? "true" : "false");
|
||||||
|
printf("\tIsReadOnly(): %s\n", partition->IsReadOnly() ? "true" : "false");
|
||||||
|
printf("\tIsMounted(): %s\n", partition->IsMounted() ? "true" : "false");
|
||||||
|
printf("\tIsBusy(): %s\n\n", partition->IsBusy() ? "true" : "false");
|
||||||
|
printf("\tFlags(): %lx\n\n", partition->Flags());
|
||||||
|
printf("\tName(): %s\n", partition->Name());
|
||||||
|
printf("\tContentName(): %s\n", partition->ContentName());
|
||||||
|
printf("\tType(): %s\n", partition->Type());
|
||||||
|
printf("\tContentType(): %s\n", partition->ContentType());
|
||||||
|
printf("\tID(): %lx\n\n", partition->ID());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param frame The size to make the window.
|
* @param frame The size to make the window.
|
||||||
*/
|
*/
|
||||||
MainWindow::MainWindow(BRect frame, PosSettings *Settings)
|
MainWindow::MainWindow(BRect frame, PosSettings *Settings)
|
||||||
: BWindow(frame, "DriveSetup", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
: BWindow(frame, "DriveSetup", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
BRect bRect;
|
BMenu *partitionMenu, *initMenu;
|
||||||
BMenu *menu;
|
BMenu *menu;
|
||||||
BMenu *tmpMenu;
|
|
||||||
BMenuItem *emptyItem;
|
|
||||||
|
|
||||||
fSettings = Settings;
|
fSettings = Settings;
|
||||||
|
|
||||||
bRect = Bounds();
|
BMenuBar* rootMenu = new BMenuBar(Bounds(), "root menu");
|
||||||
bRect.bottom = 18.0;
|
|
||||||
|
|
||||||
BMenuBar* rootMenu = new BMenuBar(bRect, "root menu");
|
|
||||||
//Setup Mount menu
|
//Setup Mount menu
|
||||||
menu = new BMenu("Mount");
|
menu = new BMenu("Mount");
|
||||||
menu->AddItem(new BMenuItem("Mount All Partitions", new BMessage(MOUNT_MOUNT_ALL_MSG), 'M'));
|
menu->AddItem(new BMenuItem("Mount All Partitions", new BMessage(MOUNT_MOUNT_ALL_MSG), 'M'));
|
||||||
@@ -87,19 +109,16 @@ MainWindow::MainWindow(BRect frame, PosSettings *Settings)
|
|||||||
|
|
||||||
//Setup Unmount menu
|
//Setup Unmount menu
|
||||||
menu = new BMenu("Unmount");
|
menu = new BMenu("Unmount");
|
||||||
emptyItem = new BMenuItem("<empty>", NULL);
|
|
||||||
emptyItem->SetEnabled(false);
|
|
||||||
menu->AddItem(emptyItem);
|
|
||||||
rootMenu->AddItem(menu);
|
rootMenu->AddItem(menu);
|
||||||
|
|
||||||
//Setup Setup menu
|
//Setup Setup menu
|
||||||
menu = new BMenu("Setup");
|
menu = new BMenu("Setup");
|
||||||
menu->AddItem(new BMenuItem("Format", new BMessage(SETUP_FORMAT_MSG), 'F'));
|
menu->AddItem(new BMenuItem("Format", new BMessage(SETUP_FORMAT_MSG), 'F'));
|
||||||
tmpMenu = new BMenu("Partition");
|
partitionMenu = new BMenu("Partition");
|
||||||
menu->AddItem(tmpMenu);
|
menu->AddItem(partitionMenu);
|
||||||
tmpMenu = new BMenu("Initialize");
|
initMenu = new BMenu("Initialize");
|
||||||
//add menu for formats
|
//add menu for formats
|
||||||
menu->AddItem(tmpMenu);
|
menu->AddItem(initMenu);
|
||||||
rootMenu->AddItem(menu);
|
rootMenu->AddItem(menu);
|
||||||
|
|
||||||
//Setup Options menu
|
//Setup Options menu
|
||||||
@@ -118,18 +137,26 @@ MainWindow::MainWindow(BRect frame, PosSettings *Settings)
|
|||||||
|
|
||||||
BRect r(Bounds());
|
BRect r(Bounds());
|
||||||
r.top = rootMenu->Frame().bottom +1;
|
r.top = rootMenu->Frame().bottom +1;
|
||||||
fListView = new BColumnListView(r, "storagelist", B_FOLLOW_ALL, 0, B_PLAIN_BORDER, true);
|
fListView = new PartitionListView(r);
|
||||||
fListView->AddColumn(new BStringColumn("Device", 100, 500, 50, 0), 1);
|
|
||||||
fListView->AddColumn(new BStringColumn("Map style", 100, 500, 50, 0), 2);
|
|
||||||
fListView->AddColumn(new BStringColumn("Partition Type", 100, 500, 50, 0), 3);
|
|
||||||
fListView->AddColumn(new BStringColumn("Filesystem", 100, 500, 50, 0), 4);
|
|
||||||
fListView->AddColumn(new BStringColumn("Volume Name", 100, 500, 50, 0), 5);
|
|
||||||
fListView->AddColumn(new BStringColumn("Mounted At", 100, 500, 50, 0), 6);
|
|
||||||
fListView->AddColumn(new BStringColumn("Size", 100, 500, 50, 0), 7);
|
|
||||||
AddChild(fListView);
|
AddChild(fListView);
|
||||||
|
|
||||||
|
// Now update filesystem/partition menus with values
|
||||||
|
BDiskSystem diskSystem;
|
||||||
|
fDDRoster.RewindDiskSystems();
|
||||||
|
while(fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
|
||||||
|
if (diskSystem.IsPartitioningSystem()) {
|
||||||
|
BMessage* msg = new BMessage(SETUP_PARTITION_SELECTED_MSG);
|
||||||
|
msg->AddString("bdisksystem:name", diskSystem.Name());
|
||||||
|
partitionMenu->AddItem(new BMenuItem(diskSystem.PrettyName(), msg));
|
||||||
|
} else if (diskSystem.IsFileSystem()) {
|
||||||
|
BMessage* msg = new BMessage(SETUP_INITIALIZE_MSG);
|
||||||
|
msg->AddString("bdisksystem:name", diskSystem.Name());
|
||||||
|
initMenu->AddItem(new BMenuItem(diskSystem.PrettyName(), msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now visit all disks in the system and show their contents
|
// Now visit all disks in the system and show their contents
|
||||||
DriveVisitor driveVisitor(this);
|
DriveVisitor driveVisitor(fListView);
|
||||||
BPartition *partition = NULL;
|
BPartition *partition = NULL;
|
||||||
BDiskDevice device;
|
BDiskDevice device;
|
||||||
fDDRoster.VisitEachPartition(&driveVisitor, &device, &partition);
|
fDDRoster.VisitEachPartition(&driveVisitor, &device, &partition);
|
||||||
@@ -211,95 +238,21 @@ MainWindow::QuitRequested()
|
|||||||
return accepted;
|
return accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
DriveVisitor::DriveVisitor(PartitionListView* list)
|
||||||
dump_partition_info(BPartition* partition)
|
: fPartitionList(list)
|
||||||
{
|
|
||||||
printf("\tOffset(): %Ld\n", partition->Offset());
|
|
||||||
printf("\tSize(): %Ld\n", partition->Size());
|
|
||||||
printf("\tContentSize(): %Ld\n", partition->ContentSize());
|
|
||||||
printf("\tBlockSize(): %ld\n", partition->BlockSize());
|
|
||||||
printf("\tIndex(): %ld\n", partition->Index());
|
|
||||||
printf("\tStatus(): %ld\n\n", partition->Status());
|
|
||||||
printf("\tContainsFileSystem(): %s\n", partition->ContainsFileSystem() ? "true" : "false");
|
|
||||||
printf("\tContainsPartitioningSystem(): %s\n\n", partition->ContainsPartitioningSystem() ? "true" : "false");
|
|
||||||
printf("\tIsDevice(): %s\n", partition->IsDevice() ? "true" : "false");
|
|
||||||
printf("\tIsReadOnly(): %s\n", partition->IsReadOnly() ? "true" : "false");
|
|
||||||
printf("\tIsMounted(): %s\n", partition->IsMounted() ? "true" : "false");
|
|
||||||
printf("\tIsBusy(): %s\n\n", partition->IsBusy() ? "true" : "false");
|
|
||||||
printf("\tFlags(): %lx\n\n", partition->Flags());
|
|
||||||
printf("\tName(): %s\n", partition->Name());
|
|
||||||
printf("\tContentName(): %s\n", partition->ContentName());
|
|
||||||
printf("\tType(): %s\n", partition->Type());
|
|
||||||
printf("\tContentType(): %s\n", partition->ContentType());
|
|
||||||
printf("\tID(): %x\n\n", partition->ID());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::AddDrive(BDiskDevice* device)
|
|
||||||
{
|
|
||||||
printf("AddDrive(%p)\n", device);
|
|
||||||
|
|
||||||
BPath path;
|
|
||||||
if (device->GetPath(&path) == B_OK) {
|
|
||||||
BRow* row = new BRow();
|
|
||||||
row->SetField(new BStringField(path.Path()), 1);
|
|
||||||
|
|
||||||
printf("\tPath=%s\n", path.Path());
|
|
||||||
|
|
||||||
if (device->ContainsPartitioningSystem()) {
|
|
||||||
row->SetField(new BStringField(device->Type()), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
char size[1024];
|
|
||||||
row->SetField(new BStringField(SizeAsString(device->Size(), size)), 7);
|
|
||||||
|
|
||||||
fListView->AddRow(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_partition_info(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::AddPartition(BPartition *partition, int32 level)
|
|
||||||
{
|
|
||||||
printf("AddPartition(%p, %d)\n", partition, level);
|
|
||||||
|
|
||||||
BPath path;
|
|
||||||
if (partition->GetPath(&path) == B_OK) {
|
|
||||||
BRow* row = new BRow();
|
|
||||||
row->SetField(new BStringField(path.Path()), 1);
|
|
||||||
|
|
||||||
printf("\tPath=%s\n", path.Path());
|
|
||||||
|
|
||||||
if (partition->ContainsFileSystem()) {
|
|
||||||
row->SetField(new BStringField(partition->Type()), 3); // Partition Type
|
|
||||||
row->SetField(new BStringField(partition->ContentType()), 4); // Filesystem
|
|
||||||
row->SetField(new BStringField(partition->ContentName()), 5); // Volume Name
|
|
||||||
|
|
||||||
if (partition->GetMountPoint(&path) == B_OK)
|
|
||||||
row->SetField(new BStringField(path.Path()), 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
char size[1024];
|
|
||||||
row->SetField(new BStringField(SizeAsString(partition->Size(), size)), 7);
|
|
||||||
|
|
||||||
fListView->AddRow(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_partition_info(partition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DriveVisitor::DriveVisitor(MainWindow* win)
|
|
||||||
: fDSWindow(win)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DriveVisitor::Visit(BDiskDevice* device)
|
DriveVisitor::Visit(BDiskDevice* device)
|
||||||
{
|
{
|
||||||
if (fDSWindow != NULL)
|
if (fPartitionList != NULL)
|
||||||
fDSWindow->AddDrive(device);
|
fPartitionList->AddPartition(device);
|
||||||
|
|
||||||
|
DEBUG_ONLY(
|
||||||
|
printf("Visit(%p)\n", device);
|
||||||
|
dump_partition_info(device);
|
||||||
|
);
|
||||||
|
|
||||||
return false; // Don't stop yet!
|
return false; // Don't stop yet!
|
||||||
}
|
}
|
||||||
@@ -307,8 +260,13 @@ DriveVisitor::Visit(BDiskDevice* device)
|
|||||||
bool
|
bool
|
||||||
DriveVisitor::Visit(BPartition* partition, int32 level)
|
DriveVisitor::Visit(BPartition* partition, int32 level)
|
||||||
{
|
{
|
||||||
if (fDSWindow != NULL)
|
if (fPartitionList != NULL)
|
||||||
fDSWindow->AddPartition(partition, level);
|
fPartitionList->AddPartition(partition);
|
||||||
|
|
||||||
|
DEBUG_ONLY(
|
||||||
|
printf("Visit(%p, %d)\n", partition, level);
|
||||||
|
dump_partition_info(partition);
|
||||||
|
);
|
||||||
|
|
||||||
return false; // Don't stop yet!
|
return false; // Don't stop yet!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
class PosSettings;
|
class PosSettings;
|
||||||
class BPartition;
|
class BPartition;
|
||||||
class BDiskDevice;
|
class BDiskDevice;
|
||||||
class BColumnListView;
|
class PartitionListView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main window of the app.
|
* The main window of the app.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
private:
|
private:
|
||||||
PosSettings* fSettings;
|
PosSettings* fSettings;
|
||||||
BDiskDeviceRoster fDDRoster;
|
BDiskDeviceRoster fDDRoster;
|
||||||
BColumnListView* fListView;
|
PartitionListView* fListView;
|
||||||
public:
|
public:
|
||||||
MainWindow(BRect frame, PosSettings *fSettings);
|
MainWindow(BRect frame, PosSettings *fSettings);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
#include "PartitionList.h"
|
||||||
|
|
||||||
|
#include <interface/ColumnTypes.h>
|
||||||
|
#include <storage/Path.h>
|
||||||
|
|
||||||
|
extern const char*
|
||||||
|
SizeAsString(off_t size, char *string);; //FIXME: from MainWindow.cpp
|
||||||
|
|
||||||
|
|
||||||
|
PartitionListRow::PartitionListRow(BPartition* partition)
|
||||||
|
: Inherited(),
|
||||||
|
fPartitionID(partition->ID())
|
||||||
|
{
|
||||||
|
BPath path;
|
||||||
|
char size[1024];
|
||||||
|
|
||||||
|
partition->GetPath(&path);
|
||||||
|
|
||||||
|
SetField(new BBitmapField(NULL), 0);
|
||||||
|
|
||||||
|
if (partition->IsDevice()) // Only show device path for actual devices (so only for /dev/disk/..../raw entries)
|
||||||
|
SetField(new BStringField(path.Path()), 1);
|
||||||
|
else
|
||||||
|
SetField(new BStringField(""), 1);
|
||||||
|
|
||||||
|
if (partition->ContainsPartitioningSystem()) {
|
||||||
|
SetField(new BStringField(partition->ContentType()), 2);
|
||||||
|
} else {
|
||||||
|
SetField(new BStringField("n/a"), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For now, Partition type is always empty (as we do not care)
|
||||||
|
SetField(new BStringField(""), 3);
|
||||||
|
|
||||||
|
if (partition->ContainsFileSystem()) {
|
||||||
|
SetField(new BStringField(partition->ContentType()), 4); // Filesystem
|
||||||
|
SetField(new BStringField(partition->ContentName()), 5); // Volume Name
|
||||||
|
} else {
|
||||||
|
SetField(new BStringField(""), 4);
|
||||||
|
SetField(new BStringField(""), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partition->IsMounted() && partition->GetMountPoint(&path) == B_OK) {
|
||||||
|
SetField(new BStringField(path.Path()), 6);
|
||||||
|
} else {
|
||||||
|
SetField(new BStringField(""), 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetField(new BStringField(SizeAsString(partition->Size(), size)), 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
PartitionListView::PartitionListView(const BRect& frame)
|
||||||
|
: Inherited(frame, "storagelist", B_FOLLOW_ALL, 0, B_PLAIN_BORDER, true)
|
||||||
|
{
|
||||||
|
AddColumn(new BBitmapColumn("", 20, 20, 100, B_ALIGN_CENTER), 0);
|
||||||
|
AddColumn(new BStringColumn("Device", 100, 50, 500, B_TRUNCATE_MIDDLE), 1);
|
||||||
|
AddColumn(new BStringColumn("Map style", 100, 50, 500, B_TRUNCATE_MIDDLE), 2);
|
||||||
|
AddColumn(new BStringColumn("Partition Type", 100, 50, 500, B_TRUNCATE_MIDDLE), 3);
|
||||||
|
AddColumn(new BStringColumn("Filesystem", 100, 50, 500, B_TRUNCATE_MIDDLE), 4);
|
||||||
|
AddColumn(new BStringColumn("Volume Name", 100, 50, 500, B_TRUNCATE_MIDDLE), 5);
|
||||||
|
AddColumn(new BStringColumn("Mounted At", 100, 50, 500, B_TRUNCATE_MIDDLE), 6);
|
||||||
|
AddColumn(new BStringColumn("Size", 100, 50, 500, B_TRUNCATE_END), 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
PartitionListRow*
|
||||||
|
PartitionListView::FindRow(partition_id id)
|
||||||
|
{
|
||||||
|
for (int32 idx=0; idx < CountRows(); idx++) {
|
||||||
|
PartitionListRow* item = dynamic_cast<PartitionListRow*>(RowAt(idx));
|
||||||
|
if (item != NULL && item->ID() == id)
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
PartitionListRow*
|
||||||
|
PartitionListView::AddPartition(BPartition* partition)
|
||||||
|
{
|
||||||
|
PartitionListRow* parent = NULL;
|
||||||
|
PartitionListRow* partitionrow = NULL;
|
||||||
|
|
||||||
|
// Forget about it if this partition is already in the listview
|
||||||
|
if ((partitionrow=FindRow(partition->ID())) != NULL)
|
||||||
|
return partitionrow;
|
||||||
|
|
||||||
|
// Create the row for this partition
|
||||||
|
partitionrow = new PartitionListRow(partition);
|
||||||
|
|
||||||
|
// If this partition has a parent...
|
||||||
|
if (partition->Parent() != NULL) {
|
||||||
|
// check if it is in the listview
|
||||||
|
parent = FindRow(partition->Parent()->ID());
|
||||||
|
// If parent of this partition is not yet in the list
|
||||||
|
if (parent == NULL) //add it
|
||||||
|
parent = AddPartition(partition->Parent());
|
||||||
|
// Now it is ok to add this partition under its parent
|
||||||
|
AddRow(partitionrow, parent);
|
||||||
|
} else {
|
||||||
|
// If this partition has no parent, add it in the 'root'
|
||||||
|
AddRow(partitionrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return partitionrow;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef PARTITIONLIST_H
|
||||||
|
#define PARTITIONLIST_H
|
||||||
|
|
||||||
|
class PartitionListRow;
|
||||||
|
class PartitionListView;
|
||||||
|
|
||||||
|
#include <interface/ColumnListView.h>
|
||||||
|
#include <storage/Partition.h>
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class BPartition;
|
||||||
|
|
||||||
|
class PartitionListRow : public BRow
|
||||||
|
{
|
||||||
|
typedef BRow Inherited;
|
||||||
|
public:
|
||||||
|
PartitionListRow(BPartition* partition);
|
||||||
|
|
||||||
|
partition_id ID() { return fPartitionID; }
|
||||||
|
private:
|
||||||
|
partition_id fPartitionID;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PartitionListView : public BColumnListView
|
||||||
|
{
|
||||||
|
typedef BColumnListView Inherited;
|
||||||
|
public:
|
||||||
|
PartitionListView(const BRect& frame);
|
||||||
|
|
||||||
|
PartitionListRow* FindRow(partition_id id);
|
||||||
|
PartitionListRow* AddPartition(BPartition* partition);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* PARTITIONLIST_H */
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*! \file structs.h
|
|
||||||
\brief Holds the structs used.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef STRUCTS_H
|
|
||||||
|
|
||||||
#define STRUCTS_H
|
|
||||||
|
|
||||||
struct partition_info{
|
|
||||||
|
|
||||||
int32 type; /* partition type */
|
|
||||||
/* Maybe get this from the type mapping? */
|
|
||||||
char *fs; /* file system */
|
|
||||||
char *name; /* volume name */
|
|
||||||
char *mount_pt; /* mounted at */
|
|
||||||
double size; /* size (in MB) */
|
|
||||||
bool mounted; /* TRUE if mounted, FALSE if not */
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct dev_info{
|
|
||||||
|
|
||||||
char *device; /* the path to the device */
|
|
||||||
int map; /* 0 for none, 1 for intel, 2 for apple */
|
|
||||||
int numParts; /* number of partitions */
|
|
||||||
partition_info parts[4]; /* information on the partitions on the device */
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user