Ticket #9012: 0001-Added-disk-device-s-name.patch

File 0001-Added-disk-device-s-name.patch, 2.0 KB (added by dsjonny, 7 years ago)
  • src/apps/drivesetup/DiskView.cpp

    From 01b0ac581b1eaec3054471507258b294a293e06c Mon Sep 17 00:00:00 2001
    From: Yourself <user@shredder.d-rendszer.hu>
    Date: Thu, 29 Nov 2012 00:57:55 +0100
    Subject: [PATCH] Added disk device's name.
    
    ---
     src/apps/drivesetup/DiskView.cpp      |   21 ++++++++++++++++-----
     src/apps/drivesetup/PartitionList.cpp |    8 +++++++-
     2 files changed, 23 insertions(+), 6 deletions(-)
    
    diff --git a/src/apps/drivesetup/DiskView.cpp b/src/apps/drivesetup/DiskView.cpp
    index 7dd0df5..6ea3aa7 100644
    a b public:  
    202202
    203203    virtual bool Visit(BDiskDevice* device)
    204204    {
    205         PartitionView* view = new PartitionView(B_TRANSLATE("Device"), 1.0,
    206             device->Offset(), 0, device->ID());
    207         fViewMap.Put(device->ID(), view);
    208         fView->GetLayout()->AddView(view);
    209         _AddSpaces(device, view);
     205        if (device->Name() != NULL && device->Name()[0])
     206        {
     207            PartitionView* view = new PartitionView(device->Name(), 1.0,
     208                device->Offset(), 0, device->ID());
     209            fViewMap.Put(device->ID(), view);
     210            fView->GetLayout()->AddView(view);
     211            _AddSpaces(device, view);
     212        }
     213        else
     214        {
     215            PartitionView* view = new PartitionView(B_TRANSLATE("Device"), 1.0,
     216                device->Offset(), 0, device->ID());
     217            fViewMap.Put(device->ID(), view);
     218            fView->GetLayout()->AddView(view);
     219            _AddSpaces(device, view);
     220        }
    210221        return false;
    211222    }
    212223
  • src/apps/drivesetup/PartitionList.cpp

    diff --git a/src/apps/drivesetup/PartitionList.cpp b/src/apps/drivesetup/PartitionList.cpp
    index f711aa3..ae0255e 100644
    a b PartitionListRow::PartitionListRow(BPartition* partition)  
    233233    } else {
    234234        SetField(new BStringField(kUnavailableString), kMountedAtColumn);
    235235    }
    236 
     236   
     237    if (partition->IsDevice())
     238    {
     239        if (partition->Name() != NULL && partition->Name()[0])
     240            SetField(new BStringField(partition->Name()), kVolumeNameColumn);
     241    }
     242   
    237243    char size[1024];
    238244    SetField(new BStringField(string_for_size(partition->Size(), size,
    239245        sizeof(size))), kSizeColumn);