Name partitions as required when creating a new partition (#746214)

When the partition is named in the Create New Partition dialog, set the
partition name as part of the create partition operation.  Currently
this is only supported for GPTs.  See
Utils::get_max_partition_name_length() for details.

Bug 746214 - Partition naming enhancements
This commit is contained in:
Mike Fleetwood 2015-03-17 21:57:12 +00:00 committed by Curtis Gedak
parent 5fd7c92671
commit 8d005aff1a
1 changed files with 26 additions and 13 deletions

View File

@ -1961,23 +1961,36 @@ void GParted_Core::set_flags( Partition & partition, PedPartition* lp_partition
bool GParted_Core::create( Partition & new_partition, OperationDetail & operationdetail )
{
if ( new_partition .type == GParted::TYPE_EXTENDED )
bool success;
if ( new_partition.type == TYPE_EXTENDED )
{
return create_partition( new_partition, operationdetail ) ;
success = create_partition( new_partition, operationdetail );
}
else if ( create_partition( new_partition, operationdetail, (get_fs( new_partition .filesystem ) .MIN / new_partition .sector_size) ) )
else
{
if ( new_partition .filesystem == GParted::FS_UNFORMATTED )
return true ;
else if ( new_partition .filesystem == FS_CLEARED )
return erase_filesystem_signatures( new_partition, operationdetail ) ;
else
return erase_filesystem_signatures( new_partition, operationdetail )
&& set_partition_type( new_partition, operationdetail )
&& create_filesystem( new_partition, operationdetail ) ;
success = create_partition( new_partition, operationdetail,
get_fs( new_partition.filesystem ).MIN / new_partition.sector_size );
}
return false ;
if ( ! success )
return false;
if ( ! new_partition.name.empty() )
{
if ( ! name_partition( new_partition, operationdetail ) )
return false;
}
if ( new_partition.type == TYPE_EXTENDED ||
new_partition.filesystem == FS_UNFORMATTED )
return true;
else if ( new_partition.filesystem == FS_CLEARED )
return erase_filesystem_signatures( new_partition, operationdetail );
else
return erase_filesystem_signatures( new_partition, operationdetail )
&& set_partition_type( new_partition, operationdetail )
&& create_filesystem( new_partition, operationdetail );
return false;
}
bool GParted_Core::create_partition( Partition & new_partition, OperationDetail & operationdetail, Sector min_size )