:Set_Valid_Operations()
* Refined checks for functionality a bit. e.g. even if a filesystem can't be read, it's still possible to grow it (but shrinking gets disabled). Also removed that stupid grow_only flag from Utils.h and reordered Win_GParted::Set_Valid_Operations()
This commit is contained in:
parent
8a0ed3b6ac
commit
d100935b55
|
@ -1,3 +1,8 @@
|
|||
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* Refined checks for functionality a bit. e.g. even if a filesystem can't be read, it's still possible to grow it
|
||||
(but shrinking gets disabled). Also removed that stupid grow_only flag from Utils.h and reordered Win_GParted::Set_Valid_Operations()
|
||||
|
||||
2004-12-14 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* added support for jfs (create, copy, grow) and hfs (create, copy)
|
||||
|
|
|
@ -50,13 +50,12 @@ struct FS
|
|||
bool move ; //startpoint and endpoint
|
||||
bool check ; //some checktool available?
|
||||
bool copy ;
|
||||
bool grow_only ; //xfs,jfs (only used in Parted_Core::set_device_partitions)
|
||||
int MIN ;
|
||||
int MAX ;
|
||||
|
||||
FS( )
|
||||
{
|
||||
read = create = grow = shrink = move = check = copy = grow_only = false ;
|
||||
read = create = grow = shrink = move = check = copy = false ;
|
||||
MIN = 0 ;
|
||||
MAX = 0 ;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
|
|||
void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partition> & partitions )
|
||||
{
|
||||
fs = Get_FS( selected_partition .filesystem, FILESYSTEMS ) ;
|
||||
if ( ! selected_partition .error .empty( ) )
|
||||
fs .shrink = false ;
|
||||
|
||||
//see if we need a fixed_start
|
||||
if ( fs .move )
|
||||
|
|
|
@ -182,20 +182,13 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
|||
if ( partition_temp .sectors_used == -1 && partition_temp .error .empty( ) )
|
||||
{
|
||||
partition_temp .error = _("Unable to read the contents of this filesystem!") ;
|
||||
|
||||
fs = Get_FS( partition_temp .filesystem, FILESYSTEMS ) ;
|
||||
|
||||
if ( ! fs .grow_only )
|
||||
{
|
||||
partition_temp .error += "\n" ;
|
||||
partition_temp .error += ("As a result you won't be able to resize this partition.") ;
|
||||
}
|
||||
partition_temp .error += _("Because of this some operations may be unavailable.") ;
|
||||
}
|
||||
}
|
||||
|
||||
partition_temp .flags = Get_Flags( c_partition ) ;
|
||||
|
||||
|
||||
if ( partition_temp .busy )
|
||||
device .busy = true ;
|
||||
|
||||
|
|
|
@ -603,9 +603,9 @@ void Win_GParted::Set_Valid_Operations()
|
|||
}
|
||||
|
||||
//EXTENDED
|
||||
else if ( selected_partition .type == GParted::EXTENDED )
|
||||
if ( selected_partition .type == GParted::EXTENDED )
|
||||
{
|
||||
if ( ! any_logic ) //deletion is only allowed when there are nog logical partitions inside.
|
||||
if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside.
|
||||
allow_delete( true ) ;
|
||||
|
||||
if ( ! devices[ current_device ] .readonly )
|
||||
|
@ -614,31 +614,11 @@ void Win_GParted::Set_Valid_Operations()
|
|||
return ;
|
||||
}
|
||||
|
||||
//PRIMARY and LOGICAL
|
||||
if ( selected_partition .type == GParted::PRIMARY || selected_partition .type == GParted::LOGICAL )
|
||||
{
|
||||
fs = Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) ;
|
||||
|
||||
//FIXME too much redundacy here (just not in the mood to fix it now :P )
|
||||
//if there was an error reading the filesystem we allow delete and convert ( see also Device::Get_Used_Sectors() )
|
||||
//since growing doesn't affect the space already in use, we allow resinzing of 'grow-only' filesystems
|
||||
if ( ! selected_partition .error .empty( ) )
|
||||
{
|
||||
allow_delete( true ) ;
|
||||
allow_convert( true ) ;
|
||||
|
||||
if ( fs .grow && ! fs .shrink && ! devices[ current_device ] .readonly )
|
||||
{
|
||||
allow_resize( true );
|
||||
|
||||
//only allow copying of real partitions
|
||||
if ( selected_partition .status != GParted::STAT_NEW && selected_partition .status != GParted::STAT_COPY && fs .copy )
|
||||
allow_copy( true ) ;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//PRIMARY and LOGICAL
|
||||
if ( selected_partition .type != GParted::EXTENDED )
|
||||
{
|
||||
allow_delete( true ) ;
|
||||
allow_convert( true ) ;
|
||||
|
||||
|
@ -648,7 +628,7 @@ void Win_GParted::Set_Valid_Operations()
|
|||
allow_resize( true ) ;
|
||||
|
||||
//only allow copying of real partitions
|
||||
if ( selected_partition .status != GParted::STAT_NEW && selected_partition .status != GParted::STAT_COPY && fs .copy )
|
||||
if ( selected_partition .status == GParted::STAT_REAL && fs .copy )
|
||||
allow_copy( true ) ;
|
||||
}
|
||||
|
||||
|
@ -874,7 +854,6 @@ void Win_GParted::activate_resize()
|
|||
|
||||
if ( dialog .run( ) == Gtk::RESPONSE_CANCEL )
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
std::vector <Partition> partitions = devices[ current_device ] .device_partitions ;
|
||||
|
@ -921,7 +900,6 @@ void Win_GParted::activate_resize()
|
|||
}
|
||||
else//normal move/resize on existing partition
|
||||
Add_Operation( GParted::RESIZE_MOVE, dialog .Get_New_Partition( ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
src/ext2.cc
11
src/ext2.cc
|
@ -35,9 +35,14 @@ FS ext2::get_filesystem_support( )
|
|||
if ( ! system( "which e2fsck 1>/dev/null 2>/dev/null" ) )
|
||||
fs .check = true ;
|
||||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .grow = fs .shrink = true ;
|
||||
//resizing is a delicate process ...
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .check )
|
||||
{
|
||||
fs .grow = true ;
|
||||
|
||||
if ( fs .read ) //needed to determine a min filesystemsize..
|
||||
fs .shrink = true ;
|
||||
}
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
fs .copy = true ;
|
||||
|
|
11
src/ext3.cc
11
src/ext3.cc
|
@ -35,9 +35,14 @@ FS ext3::get_filesystem_support( )
|
|||
if ( ! system( "which e2fsck 1>/dev/null 2>/dev/null" ) )
|
||||
fs .check = true ;
|
||||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .grow = fs .shrink = true ;
|
||||
//resizing is a delicate process ...
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .check )
|
||||
{
|
||||
fs .grow = true ;
|
||||
|
||||
if ( fs .read ) //needed to determine a min filesystemsize..
|
||||
fs .shrink = true ;
|
||||
}
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
fs .copy = true ;
|
||||
|
|
|
@ -26,7 +26,6 @@ FS jfs::get_filesystem_support( )
|
|||
FS fs ;
|
||||
|
||||
fs .filesystem = "jfs" ;
|
||||
fs .grow_only = true ;
|
||||
|
||||
// if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) )
|
||||
// fs .read = true ;
|
||||
|
|
11
src/ntfs.cc
11
src/ntfs.cc
|
@ -35,9 +35,14 @@ FS ntfs::get_filesystem_support( )
|
|||
if ( ! system( "which ntfsfix 1>/dev/null 2>/dev/null" ) )
|
||||
fs .check = true ;
|
||||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which ntfsresize 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .grow = fs .shrink = true ;
|
||||
//resizing is a delicate process ...
|
||||
if ( ! system( "which ntfsresize 1>/dev/null 2>/dev/null" ) && fs .check )
|
||||
{
|
||||
fs .grow = true ;
|
||||
|
||||
if ( fs .read ) //needed to determine a min filesystemsize..
|
||||
fs .shrink = true ;
|
||||
}
|
||||
|
||||
//we need ntfsresize to set correct used/unused after cloning
|
||||
if ( ! system( "which ntfsclone 1>/dev/null 2>/dev/null" ) && fs .grow )
|
||||
|
|
|
@ -36,9 +36,14 @@ FS reiserfs::get_filesystem_support( )
|
|||
if ( ! system( "which reiserfsck 1>/dev/null 2>/dev/null" ) )
|
||||
fs .check = true ;
|
||||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize_reiserfs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .grow = fs .shrink = true ;
|
||||
//resizing is a delicate process ...
|
||||
if ( ! system( "which resize_reiserfs 1>/dev/null 2>/dev/null" ) && fs .check )
|
||||
{
|
||||
fs .grow = true ;
|
||||
|
||||
if ( fs .read ) //needed to determine a min filesystemsize..
|
||||
fs .shrink = true ;
|
||||
}
|
||||
|
||||
//we need to call resize_reiserfs after a copy to get proper used/unused
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) && fs .grow )
|
||||
|
|
|
@ -26,7 +26,6 @@ FS xfs::get_filesystem_support( )
|
|||
FS fs ;
|
||||
|
||||
fs .filesystem = "xfs" ;
|
||||
fs .grow_only = true ;
|
||||
|
||||
if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) )
|
||||
fs .read = true ;
|
||||
|
|
Loading…
Reference in New Issue