Localise checking for an extended partition into activate_new()
As previous commit, display_partitions is now a Win_GParted member variable so checking for the existence of an extended partition can be localised where it is used. Remove index_extended member variable and localise the same checking in activate_new().
This commit is contained in:
parent
3b5471516c
commit
26dc3dffa7
|
@ -255,7 +255,6 @@ private:
|
||||||
TOOLBAR_APPLY ;
|
TOOLBAR_APPLY ;
|
||||||
|
|
||||||
//usefull variables which are used by many different functions...
|
//usefull variables which are used by many different functions...
|
||||||
int index_extended ; //position of the extended partition (-1 means there isn't one)
|
|
||||||
unsigned short new_count;//new_count keeps track of the new created partitions
|
unsigned short new_count;//new_count keeps track of the new created partitions
|
||||||
FS fs ;
|
FS fs ;
|
||||||
bool OPERATIONSLIST_OPEN ;
|
bool OPERATIONSLIST_OPEN ;
|
||||||
|
|
|
@ -929,10 +929,8 @@ void Win_GParted::Refresh_Visual()
|
||||||
if ( ! operations .size() )
|
if ( ! operations .size() )
|
||||||
allow_undo_clear_apply( false ) ;
|
allow_undo_clear_apply( false ) ;
|
||||||
|
|
||||||
// Check for an extended partition, refresh copy partition source as necessary and
|
// Refresh copy partition source as necessary and select the largest unallocated
|
||||||
// select the largest unallocated partition if there is one.
|
// partition if there is one.
|
||||||
index_extended = -1 ;
|
|
||||||
|
|
||||||
selected_partition_ptr = NULL;
|
selected_partition_ptr = NULL;
|
||||||
Sector largest_unalloc_size = -1 ;
|
Sector largest_unalloc_size = -1 ;
|
||||||
Sector current_size ;
|
Sector current_size ;
|
||||||
|
@ -945,8 +943,6 @@ void Win_GParted::Refresh_Visual()
|
||||||
switch ( display_partitions[t].type )
|
switch ( display_partitions[t].type )
|
||||||
{
|
{
|
||||||
case TYPE_EXTENDED:
|
case TYPE_EXTENDED:
|
||||||
index_extended = t ;
|
|
||||||
|
|
||||||
for ( unsigned int u = 0 ; u < display_partitions[t].logicals.size() ; u ++ )
|
for ( unsigned int u = 0 ; u < display_partitions[t].logicals.size() ; u ++ )
|
||||||
{
|
{
|
||||||
if ( display_partitions[t].logicals[u].get_path() == copied_partition.get_path() )
|
if ( display_partitions[t].logicals[u].get_path() == copied_partition.get_path() )
|
||||||
|
@ -1953,9 +1949,21 @@ void Win_GParted::activate_new()
|
||||||
}
|
}
|
||||||
else if ( ! max_amount_prim_reached() )
|
else if ( ! max_amount_prim_reached() )
|
||||||
{
|
{
|
||||||
|
// Check if an extended partition already exist; so that the dialog can
|
||||||
|
// decide whether to allow the creation of the only extended partition
|
||||||
|
// type or not.
|
||||||
|
bool any_extended = false;
|
||||||
|
for ( unsigned int i = 0 ; i < display_partitions.size() ; i ++ )
|
||||||
|
{
|
||||||
|
if ( display_partitions[i].type == TYPE_EXTENDED )
|
||||||
|
{
|
||||||
|
any_extended = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
Dialog_Partition_New dialog( devices[current_device],
|
Dialog_Partition_New dialog( devices[current_device],
|
||||||
*selected_partition_ptr,
|
*selected_partition_ptr,
|
||||||
index_extended > -1,
|
any_extended,
|
||||||
new_count,
|
new_count,
|
||||||
gparted_core.get_filesystems() );
|
gparted_core.get_filesystems() );
|
||||||
dialog .set_transient_for( *this );
|
dialog .set_transient_for( *this );
|
||||||
|
|
Loading…
Reference in New Issue