it shouldn't be possible to remove an extended partition which contains

* include/Win_GParted.h,
  src/Win_GParted.cc: it shouldn't be possible to remove an extended
  partition which contains logicals.
* src/TreeView_Detail.cc: only show mountpoint column when there is
  mountinfo.
This commit is contained in:
Bart Hakvoort 2006-02-09 17:02:40 +00:00
parent 1a46adf114
commit a764f10df7
4 changed files with 37 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2006-02-09 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Win_GParted.h,
src/Win_GParted.cc: it shouldn't be possible to remove an extended
partition which contains logicals.
* src/TreeView_Detail.cc: only show mountpoint column when there is
mountinfo.
2006-02-08 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-02-08 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Win_GParted.h, * include/Win_GParted.h,

View File

@ -219,7 +219,7 @@ private:
treeview_operations_Columns treeview_operations_columns; treeview_operations_Columns treeview_operations_columns;
//usefull variables which are used by many different functions... //usefull variables which are used by many different functions...
bool any_logic,any_extended;//used in some checks bool any_extended;//used in some checks
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
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
Glib::ustring str_temp ; //mostly used for constructing dialogmessages Glib::ustring str_temp ; //mostly used for constructing dialogmessages

View File

@ -75,6 +75,7 @@ TreeView_Detail::TreeView_Detail( )
void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions ) void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions )
{ {
bool mount_info = false ;
treestore_detail ->clear() ; treestore_detail ->clear() ;
for ( unsigned int i = 0 ; i < partitions .size() ; i++ ) for ( unsigned int i = 0 ; i < partitions .size() ; i++ )
@ -88,10 +89,18 @@ void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions
{ {
childrow = *( treestore_detail ->append( row.children() ) ); childrow = *( treestore_detail ->append( row.children() ) );
create_row( childrow, partitions[ i ] .logicals[ t ] ); create_row( childrow, partitions[ i ] .logicals[ t ] );
if ( ! partitions[ i ] .logicals[ t ] .mountpoint .empty() )
mount_info = true ;
} }
} }
if ( ! partitions[ i ] .mountpoint .empty() )
mount_info = true ;
} }
get_column( 2 ) ->set_visible( mount_info ) ;
//show logical partitions ( if any ) //show logical partitions ( if any )
expand_all(); expand_all();

View File

@ -605,8 +605,8 @@ void Win_GParted::Refresh_Visual( )
allow_apply( false ); allow_apply( false );
} }
//count primary's, check for extended and logic and see if any logical is busy //count primary's and check for extended
any_logic = any_extended = false; any_extended = false;
primary_count = 0; primary_count = 0;
for ( unsigned int t = 0 ; t < partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
{ {
@ -622,7 +622,6 @@ void Win_GParted::Refresh_Visual( )
case GParted::TYPE_EXTENDED : case GParted::TYPE_EXTENDED :
any_extended = true; any_extended = true;
primary_count++; primary_count++;
any_logic = partitions[ t ] .logicals .size() -1 ;
break; break;
default : default :
@ -724,7 +723,9 @@ void Win_GParted::set_valid_operations( )
//EXTENDED //EXTENDED
if ( selected_partition .type == GParted::TYPE_EXTENDED ) if ( selected_partition .type == GParted::TYPE_EXTENDED )
{ {
if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside. //deletion is only allowed when there are no logical partitions inside.
if ( selected_partition .logicals .size() == 1 &&
selected_partition .logicals .back() .type == GParted::TYPE_UNALLOCATED )
allow_delete( true ) ; allow_delete( true ) ;
if ( ! devices[ current_device ] .readonly ) if ( ! devices[ current_device ] .readonly )
@ -1159,24 +1160,30 @@ void Win_GParted::activate_paste( )
} }
} }
void Win_GParted::activate_new( ) void Win_GParted::activate_new()
{ {
//if max_prims == -1 the current device has an unrecognised disklabel (see also GParted_Core::get_devices) //if max_prims == -1 the current device has an unrecognised disklabel (see also GParted_Core::get_devices)
if ( devices [ current_device ] .max_prims == -1 ) if ( devices [ current_device ] .max_prims == -1 )
activate_disklabel( ) ; activate_disklabel() ;
else if ( ! max_amount_prim_reached( ) ) else if ( ! max_amount_prim_reached() )
{ {
Dialog_Partition_New dialog; Dialog_Partition_New dialog;
dialog .Set_Data( selected_partition, any_extended, new_count, gparted_core .get_filesystems( ), devices[ current_device ] .readonly, devices[ current_device ] .cylsize ) ; dialog .Set_Data( selected_partition,
any_extended,
new_count,
gparted_core .get_filesystems(),
devices[ current_device ] .readonly,
devices[ current_device ] .cylsize ) ;
dialog .set_transient_for( *this ); dialog .set_transient_for( *this );
if ( dialog .run( ) == Gtk::RESPONSE_OK ) if ( dialog .run() == Gtk::RESPONSE_OK )
{ {
dialog .hide( ) ;//make sure the dialog is gone _before_ operationslist shows up (only matters if first operation) dialog .hide() ;//make sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
new_count++ ; new_count++ ;
Add_Operation( GParted::CREATE, dialog .Get_New_Partition( ) ); Add_Operation( GParted::CREATE, dialog .Get_New_Partition() );
} }
} }
} }