from now on each partition has a reference to it's device. make use of new

* include/Partition.h,
  src/Partition.cc: from now on each partition has a reference to it's
  device.
* src/Win_GParted.cc,
  src/Dialog_Partition_New.cc: make use of new Set() from partition
* include/GParted_Core.h,
  src/GParted_Core.cc: since ped_file_system_clobber() ignored reiser4
  i've implemented a custom 'filesystem signature remover'.
  Also made use of the fact a partition now knows on which device it
  lives.
* src/Operation.cc: the get_string() didn't use
  Get_Filesystem_String() and thus returned faulty strings. Also did
  some cleanups.
This commit is contained in:
Bart Hakvoort 2005-12-07 22:44:40 +00:00
parent 702a852d2d
commit 642f0a145b
8 changed files with 151 additions and 73 deletions

View File

@ -1,3 +1,19 @@
2005-12-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Partition.h,
src/Partition.cc: from now on each partition has a reference to it's
device.
* src/Win_GParted.cc,
src/Dialog_Partition_New.cc: make use of new Set() from partition
* include/GParted_Core.h,
src/GParted_Core.cc: since ped_file_system_clobber() ignored reiser4
i've implemented a custom 'filesystem signature remover'.
Also made use of the fact a partition now knows on which device it
lives.
* src/Operation.cc: the get_string() didn't use
Get_Filesystem_String() and thus returned faulty strings. Also did
some cleanups.
2005-12-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: made warning a bit more informative

View File

@ -52,10 +52,10 @@ public:
void Apply_Operation_To_Disk( Operation & operation );
bool Create( const Device & device, Partition & new_partition ) ;
bool Convert_FS( const Glib::ustring & device_path, const Partition & partition ) ;
bool Delete( const Glib::ustring & device_path, const Partition & partition ) ;
bool Convert_FS( const Partition & partition ) ;
bool Delete( const Partition & partition ) ;
bool Resize( const Device & device, const Partition & partition_old, const Partition & partition_new ) ;
bool Copy( const Glib::ustring & dest_device_path, const Glib::ustring & src_part_path, Partition & partition_dest ) ;
bool Copy( const Glib::ustring & src_part_path, Partition & partition_dest ) ;
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
@ -67,19 +67,20 @@ public:
private:
GParted::FILESYSTEM Get_Filesystem( ) ; //temporary function.. asa new checks ripple through in libparted i'll remove it.
void set_device_partitions( Device & device ) ;
void Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
void Insert_Unallocated( const Glib::ustring & device_path, std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
Glib::ustring get_sym_path( const Glib::ustring & real_path ) ;
void Set_Used_Sectors( Partition & partition );
void LP_Set_Used_Sectors( Partition & partition );
Glib::ustring Get_Flags( ) ;
int Create_Empty_Partition( const Glib::ustring & device_path, Partition & new_partition, bool copy = false ) ;
bool Resize_Container_Partition( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new, bool fixed_start ) ;
bool Resize_Normal_Using_Libparted( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new ) ;
int Create_Empty_Partition( Partition & new_partition, bool copy = false ) ;
bool Resize_Container_Partition( const Partition & partition_old, const Partition & partition_new, bool fixed_start ) ;
bool Resize_Normal_Using_Libparted( const Partition & partition_old, const Partition & partition_new ) ;
void Show_Error( Glib::ustring message ) ;
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
bool set_partition_type( const Glib::ustring & device_path, const Partition & partition ) ;
bool set_partition_type( const Partition & partition ) ;
bool wait_for_node( const Glib::ustring & node ) ;
bool erase_filesystem_signatures( const Partition & partition ) ;
bool open_device( const Glib::ustring & device_path ) ;
bool open_device_and_disk( const Glib::ustring & device_path, bool strict = true ) ;

View File

@ -57,7 +57,8 @@ public:
void Reset( ) ;
//simple Set-functions. only for convenience, since most members are public
void Set( const Glib::ustring & partition,
void Set( const Glib::ustring & device_path,
const Glib::ustring & partition,
const int partition_number,
const PartitionType type,
const FILESYSTEM filesystem,
@ -68,7 +69,7 @@ public:
void Set_Unused( Sector sectors_unused ) ;
void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended );
void Set_Unallocated( const Glib::ustring & device_path, Sector sector_start, Sector sector_end, bool inside_extended );
//update partition number (used when a logical partition is deleted)
void Update_Number( int new_number );
@ -79,6 +80,7 @@ public:
//some public members
Glib::ustring partition;//the symbolic path (e.g. /dev/hda1 )
Glib::ustring device_path ;
int partition_number;
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..

View File

@ -132,7 +132,8 @@ Partition Dialog_Partition_New::Get_New_Partition()
new_end = selected_partition.sector_end ;
part_temp .status = GParted::STAT_NEW ;
part_temp .Set( String::ucompose( _("New Partition #%1"), new_count ),
part_temp .Set( selected_partition .device_path,
String::ucompose( _("New Partition #%1"), new_count ),
new_count, part_type,
FILESYSTEMS[ optionmenu_filesystem .get_history( ) ] .filesystem,
new_start, new_end,
@ -148,7 +149,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
if ( part_temp .type == GParted::TYPE_EXTENDED )
{
Partition UNALLOCATED ;
UNALLOCATED .Set_Unallocated( part_temp .sector_start, part_temp .sector_end, true ) ;
UNALLOCATED .Set_Unallocated( part_temp .device_path, part_temp .sector_start, part_temp .sector_end, true ) ;
part_temp .logicals .push_back( UNALLOCATED ) ;
}

View File

@ -130,7 +130,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
temp_device .max_prims = -1 ;
Partition partition_temp ;
partition_temp .Set_Unallocated( 0, temp_device .length, false );
partition_temp .Set_Unallocated( temp_device .path, 0, temp_device .length, false );
temp_device .device_partitions .push_back( partition_temp );
}
@ -214,7 +214,8 @@ void GParted_Core::set_device_partitions( Device & device )
{
case PED_PARTITION_NORMAL:
case PED_PARTITION_LOGICAL:
partition_temp .Set( device .path + num_to_str( lp_partition ->num ),
partition_temp .Set( device .path,
device .path + num_to_str( lp_partition ->num ),
lp_partition ->num,
lp_partition ->type == 0 ? GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
Get_Filesystem( ), lp_partition ->geom .start,
@ -245,7 +246,8 @@ void GParted_Core::set_device_partitions( Device & device )
break ;
case PED_PARTITION_EXTENDED:
partition_temp.Set( device .path + num_to_str( lp_partition ->num ),
partition_temp.Set( device .path,
device .path + num_to_str( lp_partition ->num ),
lp_partition ->num ,
GParted::TYPE_EXTENDED ,
GParted::FS_EXTENDED ,
@ -276,15 +278,15 @@ void GParted_Core::set_device_partitions( Device & device )
}
if ( EXT_INDEX > -1 )
Insert_Unallocated( device .device_partitions[ EXT_INDEX ] .logicals, device .device_partitions[ EXT_INDEX ] .sector_start, device .device_partitions[ EXT_INDEX ] .sector_end, true ) ;
Insert_Unallocated( device .path, device .device_partitions[ EXT_INDEX ] .logicals, device .device_partitions[ EXT_INDEX ] .sector_start, device .device_partitions[ EXT_INDEX ] .sector_end, true ) ;
Insert_Unallocated( device .device_partitions, 0, device .length -1, false ) ;
Insert_Unallocated( device .path, device .device_partitions, 0, device .length -1, false ) ;
}
void GParted_Core::Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended )
void GParted_Core::Insert_Unallocated( const Glib::ustring & device_path, std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended )
{
partition_temp .Reset( ) ;
partition_temp .Set_Unallocated( 0, 0, inside_extended ) ;
partition_temp .Set_Unallocated( device_path, 0, 0, inside_extended ) ;
//if there are no partitions at all..
if ( partitions .empty( ) )
@ -361,7 +363,7 @@ void GParted_Core::Apply_Operation_To_Disk( Operation & operation )
switch ( operation .operationtype )
{
case DELETE:
if ( ! Delete( operation .device .path, operation .partition_original ) )
if ( ! Delete( operation .partition_original ) )
Show_Error( String::ucompose( _("Error while deleting %1"), operation .partition_original .partition ) ) ;
break;
@ -376,12 +378,12 @@ void GParted_Core::Apply_Operation_To_Disk( Operation & operation )
break;
case CONVERT:
if ( ! Convert_FS( operation .device .path, operation .partition_new ) )
if ( ! Convert_FS( operation .partition_new ) )
Show_Error( String::ucompose( _("Error while converting filesystem of %1"), operation .partition_new .partition ) ) ;
break;
case COPY:
if ( ! Copy( operation .device .path, operation .copied_partition_path, operation .partition_new ) )
if ( ! Copy( operation .copied_partition_path, operation .partition_new ) )
Show_Error( String::ucompose( _("Error while copying %1"), operation .partition_new .partition ) ) ;
}
}
@ -389,9 +391,9 @@ void GParted_Core::Apply_Operation_To_Disk( Operation & operation )
bool GParted_Core::Create( const Device & device, Partition & new_partition )
{
if ( new_partition .type == GParted::TYPE_EXTENDED )
return Create_Empty_Partition( device .path, new_partition ) ;
return Create_Empty_Partition( new_partition ) ;
else if ( Create_Empty_Partition( device .path, new_partition, ( new_partition .Get_Length_MB( ) - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
else if ( Create_Empty_Partition( new_partition, ( new_partition .Get_Length_MB( ) - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
{
set_proper_filesystem( new_partition .filesystem ) ;
@ -400,35 +402,27 @@ bool GParted_Core::Create( const Device & device, Partition & new_partition )
if ( ! p_filesystem )
return true ;
return set_partition_type( device .path, new_partition ) && p_filesystem ->Create( new_partition ) ;
return set_partition_type( new_partition ) && p_filesystem ->Create( new_partition ) ;
}
return false ;
}
bool GParted_Core::Convert_FS( const Glib::ustring & device_path, const Partition & partition )
bool GParted_Core::Convert_FS( const Partition & partition )
{
//remove all filesystem signatures...
if ( open_device_and_disk( device_path ) )
{
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
if ( lp_partition )
ped_file_system_clobber ( & lp_partition ->geom ) ;
close_device_and_disk( ) ;
}
erase_filesystem_signatures( partition ) ;
set_proper_filesystem( partition .filesystem ) ;
return set_partition_type( device_path, partition ) && p_filesystem ->Create( partition ) ;
return set_partition_type( partition ) && p_filesystem ->Create( partition ) ;
}
bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition & partition )
bool GParted_Core::Delete( const Partition & partition )
{
bool return_value = false ;
if ( open_device_and_disk( device_path ) )
if ( open_device_and_disk( partition .device_path ) )
{
if ( partition .type == GParted::TYPE_EXTENDED )
lp_partition = ped_disk_extended_partition( lp_disk ) ;
@ -436,8 +430,8 @@ bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition &
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
return_value = ( ped_disk_delete_partition( lp_disk, lp_partition ) && commit( ) ) ;
close_device_and_disk( ) ;
}
return return_value ;
@ -446,11 +440,11 @@ bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition &
bool GParted_Core::Resize( const Device & device, const Partition & partition_old, const Partition & partition_new )
{
if ( partition_old .type == GParted::TYPE_EXTENDED )
return Resize_Container_Partition( device .path, partition_old, partition_new, false ) ;
return Resize_Container_Partition( partition_old, partition_new, false ) ;
//lazy check (only grow). it's possbile one day this should be separated in checks for grow,shrink,move ..
if ( get_fs( partition_old .filesystem ) .grow == GParted::FS::LIBPARTED )
return Resize_Normal_Using_Libparted( device .path, partition_old, partition_new ) ;
return Resize_Normal_Using_Libparted( partition_old, partition_new ) ;
else //use custom resize tools..
{
set_proper_filesystem( partition_new .filesystem ) ;
@ -463,11 +457,11 @@ bool GParted_Core::Resize( const Device & device, const Partition & partition_ol
p_filesystem ->cylinder_size = device .cylsize ;
if ( p_filesystem ->Resize( partition_new ) )
Resize_Container_Partition( device .path, partition_old, partition_new, ! get_fs( partition_new .filesystem ) .move ) ;
Resize_Container_Partition( partition_old, partition_new, ! get_fs( partition_new .filesystem ) .move ) ;
}
//growing/moving
else
Resize_Container_Partition( device .path, partition_old, partition_new, ! get_fs( partition_new .filesystem ) .move ) ;
Resize_Container_Partition( partition_old, partition_new, ! get_fs( partition_new .filesystem ) .move ) ;
p_filesystem ->Check_Repair( partition_new ) ;
@ -481,7 +475,7 @@ bool GParted_Core::Resize( const Device & device, const Partition & partition_ol
return false ;
}
bool GParted_Core::Copy( const Glib::ustring & dest_device_path, const Glib::ustring & src_part_path, Partition & partition_dest )
bool GParted_Core::Copy( const Glib::ustring & src_part_path, Partition & partition_dest )
{
set_proper_filesystem( partition_dest .filesystem ) ;
@ -489,7 +483,7 @@ bool GParted_Core::Copy( const Glib::ustring & dest_device_path, const Glib::ust
src_partition .partition = src_part_path ;
if ( p_filesystem ->Check_Repair( src_partition ) )
if ( Create_Empty_Partition( dest_device_path, partition_dest, true ) > 0 )
if ( Create_Empty_Partition( partition_dest, true ) > 0 )
return p_filesystem ->Copy( src_part_path, partition_dest .partition ) ;
return false ;
@ -643,11 +637,11 @@ void GParted_Core::LP_Set_Used_Sectors( Partition & partition )
}
}
int GParted_Core::Create_Empty_Partition( const Glib::ustring & device_path, Partition & new_partition, bool copy )
int GParted_Core::Create_Empty_Partition( Partition & new_partition, bool copy )
{
new_partition .partition_number = 0 ;
if ( open_device_and_disk( device_path ) )
if ( open_device_and_disk( new_partition .device_path ) )
{
PedPartitionType type;
PedPartition *c_part = NULL ;
@ -682,9 +676,6 @@ int GParted_Core::Create_Empty_Partition( const Glib::ustring & device_path, Par
if ( ped_disk_add_partition( lp_disk, c_part, constraint ) && commit( ) )
{
//remove all filesystem signatures...
ped_file_system_clobber( & c_part ->geom ) ;
new_partition .partition = ped_partition_get_path( c_part ) ;
new_partition .partition_number = c_part ->num ;
@ -699,18 +690,22 @@ int GParted_Core::Create_Empty_Partition( const Glib::ustring & device_path, Par
close_device_and_disk( ) ;
}
//remove all filesystem signatures...
if ( new_partition .partition_number > 0 )
erase_filesystem_signatures( new_partition ) ;
return new_partition .partition_number ;
}
bool GParted_Core::Resize_Container_Partition( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new, bool fixed_start )
bool GParted_Core::Resize_Container_Partition( const Partition & partition_old, const Partition & partition_new, bool fixed_start )
{
bool return_value = false ;
PedConstraint *constraint = NULL ;
lp_partition = NULL ;
if ( open_device_and_disk( device_path ) )
if ( open_device_and_disk( partition_old .device_path ) )
{
if ( partition_old .type == GParted::TYPE_EXTENDED )
lp_partition = ped_disk_extended_partition( lp_disk ) ;
@ -746,7 +741,7 @@ bool GParted_Core::Resize_Container_Partition( const Glib::ustring & device_path
return wait_for_node( partition_new .partition ) && return_value ;
}
bool GParted_Core::Resize_Normal_Using_Libparted( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new )
bool GParted_Core::Resize_Normal_Using_Libparted( const Partition & partition_old, const Partition & partition_new )
{
bool return_value = false ;
@ -754,7 +749,7 @@ bool GParted_Core::Resize_Normal_Using_Libparted( const Glib::ustring & device_p
PedConstraint *constraint = NULL ;
lp_partition = NULL ;
if ( open_device_and_disk( device_path ) )
if ( open_device_and_disk( partition_old .device_path ) )
{
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition_old .sector_end + partition_old .sector_start) / 2 ) ;
if ( lp_partition )
@ -765,7 +760,7 @@ bool GParted_Core::Resize_Normal_Using_Libparted( const Glib::ustring & device_p
constraint = ped_file_system_get_resize_constraint ( fs );
if ( constraint )
{
if ( ped_disk_set_partition_geom ( lp_disk, lp_partition, constraint, partition_new .sector_start, partition_new .sector_end ) &&
if ( ped_disk_set_partition_geom ( lp_disk, lp_partition, constraint, partition_new .sector_start, partition_new .sector_end ) &&
ped_file_system_resize ( fs, & lp_partition ->geom, NULL )
)
return_value = commit( ) ;
@ -833,11 +828,11 @@ void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
}
bool GParted_Core::set_partition_type( const Glib::ustring & device_path, const Partition & partition )
bool GParted_Core::set_partition_type( const Partition & partition )
{
bool return_value = false ;
if ( open_device_and_disk( device_path ) )
if ( open_device_and_disk( partition .device_path ) )
{
PedFileSystemType * fs_type = ped_file_system_type_get( Get_Filesystem_String( partition .filesystem ) .c_str() ) ;
@ -876,6 +871,32 @@ bool GParted_Core::wait_for_node( const Glib::ustring & node )
return false ;
}
bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
{
bool return_value = false ;
if ( open_device_and_disk( partition .device_path ) )
{
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
if ( lp_partition && ped_file_system_clobber( & lp_partition ->geom ) )
{
//filesystems not yet supported by libparted
if ( ped_device_open( lp_device ) )
{
//reiser4 stores "ReIsEr4" at sector 128
return_value = ped_geometry_write( & lp_partition ->geom, "0000000", 128, 1 ) ;
ped_device_close( lp_device ) ;
}
}
close_device_and_disk( ) ;
}
return return_value ;
}
bool GParted_Core::open_device( const Glib::ustring & device_path )
{
lp_device = ped_device_get( device_path .c_str( ) );

View File

@ -49,19 +49,35 @@ Glib::ustring Operation::Get_String( )
temp = partition_original .partition ;
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), temp, partition_original .filesystem, partition_original .Get_Length_MB( ), device .path ) ;
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"),
temp,
Get_Filesystem_String( partition_original .filesystem ),
partition_original .Get_Length_MB( ),
device .path ) ;
case CREATE :
switch( partition_new.type )
{
case GParted::TYPE_PRIMARY : temp = _("Primary Partition"); break;
case GParted::TYPE_LOGICAL : temp = _("Logical Partition") ; break;
case GParted::TYPE_EXTENDED : temp = _("Extended Partition"); break;
case GParted::TYPE_PRIMARY :
temp = _("Primary Partition");
break;
case GParted::TYPE_LOGICAL :
temp = _("Logical Partition") ;
break;
case GParted::TYPE_EXTENDED :
temp = _("Extended Partition");
break;
default : break;
default :
break;
}
/*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), temp, partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB( ), device .path ) ;
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"),
temp,
partition_new.partition_number,
Get_Filesystem_String( partition_new.filesystem ),
partition_new .Get_Length_MB( ),
device .path ) ;
case RESIZE_MOVE:
//if startsector has changed >= 1 MB we consider it a move
@ -80,9 +96,15 @@ Glib::ustring Operation::Get_String( )
if ( diff >= MEGABYTE )
{
if ( temp .empty( ) )
temp = String::ucompose( _("Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ;
temp = String::ucompose( _("Resize %1 from %2 MB to %3 MB"),
partition_new.partition,
partition_original .Get_Length_MB(),
partition_new .Get_Length_MB() ) ;
else
temp += " " + String::ucompose( _("and Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ;
temp += " " + String::ucompose( _("and Resize %1 from %2 MB to %3 MB"),
partition_new.partition,
partition_original .Get_Length_MB(),
partition_new .Get_Length_MB() ) ;
}
if ( temp .empty( ) )
@ -92,11 +114,17 @@ Glib::ustring Operation::Get_String( )
case CONVERT :
/*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */
return String::ucompose( _( "Convert %1 from %2 to %3"), partition_original .partition, partition_original .filesystem, partition_new .filesystem ) ;
return String::ucompose( _( "Convert %1 from %2 to %3"),
partition_original .partition,
Get_Filesystem_String( partition_original .filesystem ),
Get_Filesystem_String( partition_new .filesystem ) ) ;
case COPY :
/*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device .path, Sector_To_MB( partition_new .sector_start ) ) ;
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"),
partition_new .partition,
device .path,
Sector_To_MB( partition_new .sector_start ) ) ;
default :
return "";
@ -119,7 +147,7 @@ void Operation::Apply_Operation_To_Visual( std::vector<Partition> & partitions )
void Operation::Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended )
{
Partition UNALLOCATED ;
UNALLOCATED .Set_Unallocated( 0, 0, inside_extended ) ;
UNALLOCATED .Set_Unallocated( device .path, 0, 0, inside_extended ) ;
//if there are no partitions at all..
if ( partitions .empty( ) )

View File

@ -37,7 +37,8 @@ void Partition::Reset( )
logicals .clear( ) ;
}
void Partition::Set( const Glib::ustring & partition,
void Partition::Set( const Glib::ustring & device_path,
const Glib::ustring & partition,
const int partition_number,
const PartitionType type,
const FILESYSTEM filesystem,
@ -46,6 +47,7 @@ void Partition::Set( const Glib::ustring & partition,
const bool inside_extended,
const bool busy )
{
this ->device_path = device_path ;
this ->partition = partition;
this ->partition_number = partition_number;
this ->type = type;
@ -66,9 +68,9 @@ void Partition::Set_Unused( Sector sectors_unused )
}
}
void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended )
void Partition::Set_Unallocated( const Glib::ustring & device_path, Sector sector_start, Sector sector_end, bool inside_extended )
{
this ->Set( Get_Filesystem_String( GParted::FS_UNALLOCATED ), -1, GParted::TYPE_UNALLOCATED, GParted::FS_UNALLOCATED, sector_start, sector_end, inside_extended, false );
this ->Set( device_path, Get_Filesystem_String( GParted::FS_UNALLOCATED ), -1, GParted::TYPE_UNALLOCATED, GParted::FS_UNALLOCATED, sector_start, sector_end, inside_extended, false );
this ->error = this ->flags = "" ;
this ->status = GParted::STAT_REAL ;
}

View File

@ -1155,7 +1155,14 @@ void Win_GParted::activate_convert( GParted::FILESYSTEM new_fs )
//ok we made it :P lets create an fitting partition object
Partition part_temp;
part_temp .Set( selected_partition .partition, selected_partition .partition_number, selected_partition .type, new_fs, selected_partition .sector_start, selected_partition .sector_end, selected_partition .inside_extended, false ) ;
part_temp .Set( devices[ current_device ] .path,
selected_partition .partition,
selected_partition .partition_number,
selected_partition .type, new_fs,
selected_partition .sector_start,
selected_partition .sector_end,
selected_partition .inside_extended,
false ) ;
//if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new filesystem