Remove GParted_Core::p_filesystem (#683149)

Bug #683149 - Cleanup(?): Remove lp_device and lp_disk from GParted_Core
This commit is contained in:
Matthias Gehre 2012-10-30 11:16:27 +01:00 committed by Mike Fleetwood
parent 52af838df2
commit 1f3b11748e
2 changed files with 31 additions and 21 deletions

View file

@ -192,7 +192,7 @@ private:
bool calculate_exact_geom( const Partition & partition_old,
Partition & partition_new,
OperationDetail & operationdetail ) ;
bool set_proper_filesystem( const FILESYSTEM & filesystem ) ;
FileSystem* set_proper_filesystem( const FILESYSTEM & filesystem ) ;
#ifndef HAVE_LIBPARTED_3_0_0_PLUS
bool erase_filesystem_signatures( const Partition & partition ) ;
#endif
@ -212,7 +212,6 @@ private:
std::vector<FS> FILESYSTEMS ;
std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ;
FileSystem * p_filesystem ;
std::vector<PedPartitionFlag> flags;
std::vector<Glib::ustring> device_paths ;
bool probe_devices ;

View file

@ -66,7 +66,6 @@ namespace GParted
GParted_Core::GParted_Core()
{
p_filesystem = NULL ;
thread_status_message = "" ;
ped_exception_set_handler( ped_exception_handler ) ;
@ -1336,10 +1335,12 @@ void GParted_Core::read_label( Partition & partition )
{
if ( partition .type != TYPE_EXTENDED )
{
FileSystem* p_filesystem = NULL ;
switch( get_fs( partition .filesystem ) .read_label )
{
case FS::EXTERNAL:
if ( set_proper_filesystem( partition .filesystem ) )
p_filesystem = set_proper_filesystem( partition .filesystem ) ;
if ( p_filesystem )
p_filesystem ->read_label( partition ) ;
break ;
#ifndef HAVE_LIBPARTED_3_0_0_PLUS
@ -1357,10 +1358,12 @@ void GParted_Core::read_uuid( Partition & partition )
{
if ( partition .type != TYPE_EXTENDED )
{
FileSystem* p_filesystem = NULL ;
switch( get_fs( partition .filesystem ) .read_uuid )
{
case FS::EXTERNAL:
if ( set_proper_filesystem( partition .filesystem ) )
p_filesystem = set_proper_filesystem( partition .filesystem ) ;
if ( p_filesystem )
p_filesystem ->read_uuid( partition ) ;
break ;
@ -1516,12 +1519,14 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions, PedDis
if ( partitions[ t ] .type == GParted::TYPE_PRIMARY ||
partitions[ t ] .type == GParted::TYPE_LOGICAL )
{
FileSystem* p_filesystem = NULL ;
if ( partitions[ t ] .busy )
{
switch( get_fs( partitions[ t ] .filesystem ) .online_read )
{
case FS::EXTERNAL:
if ( set_proper_filesystem( partitions[ t ] .filesystem ) )
p_filesystem = set_proper_filesystem( partitions[ t ] .filesystem ) ;
if ( p_filesystem )
p_filesystem ->set_used_sectors( partitions[ t ] ) ;
break ;
case FS::GPARTED:
@ -1537,7 +1542,8 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions, PedDis
switch( get_fs( partitions[ t ] .filesystem ) .read )
{
case GParted::FS::EXTERNAL :
if ( set_proper_filesystem( partitions[ t ] .filesystem ) )
p_filesystem = set_proper_filesystem( partitions[ t ] .filesystem ) ;
if ( p_filesystem )
p_filesystem ->set_used_sectors( partitions[ t ] ) ;
break ;
#ifdef HAVE_LIBPARTED_FS_RESIZE
@ -1794,6 +1800,7 @@ bool GParted_Core::create_filesystem( const Partition & partition, OperationDeta
Utils::get_filesystem_string( partition .filesystem ) ) ) ) ;
bool succes = false ;
FileSystem* p_filesystem = NULL ;
switch ( get_fs( partition .filesystem ) .create )
{
case GParted::FS::NONE:
@ -1805,7 +1812,7 @@ bool GParted_Core::create_filesystem( const Partition & partition, OperationDeta
break ;
#endif
case GParted::FS::EXTERNAL:
succes = set_proper_filesystem( partition .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition .filesystem ) ) &&
p_filesystem ->create( partition, operationdetail .get_last_child() ) ;
break ;
@ -1876,6 +1883,7 @@ bool GParted_Core::Delete( const Partition & partition, OperationDetail & operat
bool GParted_Core::remove_filesystem( const Partition & partition, OperationDetail & operationdetail )
{
bool success = true ;
FileSystem* p_filesystem = NULL ;
switch ( get_fs( partition .filesystem ) .remove )
{
@ -1886,7 +1894,7 @@ bool GParted_Core::remove_filesystem( const Partition & partition, OperationDeta
operationdetail .add_child( OperationDetail( String::ucompose(
_("delete %1 file system"),
Utils::get_filesystem_string( partition .filesystem ) ) ) ) ;
success = set_proper_filesystem( partition .filesystem ) &&
success = ( p_filesystem = set_proper_filesystem( partition .filesystem ) ) &&
p_filesystem ->remove( partition, operationdetail .get_last_child() ) ;
operationdetail .get_last_child() .set_status( success ? STATUS_SUCCES : STATUS_ERROR ) ;
break ;
@ -1912,12 +1920,13 @@ bool GParted_Core::label_partition( const Partition & partition, OperationDetail
}
bool succes = false ;
FileSystem* p_filesystem = NULL ;
if ( partition .type != TYPE_EXTENDED )
{
switch( get_fs( partition .filesystem ) .write_label )
{
case FS::EXTERNAL:
succes = set_proper_filesystem( partition .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition .filesystem ) ) &&
p_filesystem ->write_label( partition, operationdetail .get_last_child() ) ;
break ;
#ifndef HAVE_LIBPARTED_3_0_0_PLUS
@ -1950,12 +1959,13 @@ bool GParted_Core::change_uuid( const Partition & partition, OperationDetail & o
}
bool succes = false ;
FileSystem* p_filesystem = NULL ;
if ( partition .type != TYPE_EXTENDED )
{
switch( get_fs( partition .filesystem ) .write_uuid )
{
case FS::EXTERNAL:
succes = set_proper_filesystem( partition .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition .filesystem ) ) &&
p_filesystem ->write_uuid( partition, operationdetail .get_last_child() ) ;
break ;
@ -2112,6 +2122,7 @@ bool GParted_Core::move_filesystem( const Partition & partition_old,
}
bool succes = false ;
FileSystem* p_filesystem = NULL ;
switch ( get_fs( partition_old .filesystem ) .move )
{
case GParted::FS::NONE:
@ -2155,7 +2166,7 @@ bool GParted_Core::move_filesystem( const Partition & partition_old,
break ;
#endif
case GParted::FS::EXTERNAL:
succes = set_proper_filesystem( partition_new .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition_new .filesystem ) ) &&
p_filesystem ->move( partition_old
, partition_new
, operationdetail .get_last_child()
@ -2479,6 +2490,7 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
}
bool succes = false ;
FileSystem* p_filesystem = NULL ;
switch ( action )
{
case GParted::FS::NONE:
@ -2493,7 +2505,7 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
break ;
#endif
case GParted::FS::EXTERNAL:
succes = set_proper_filesystem( partition_new .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition_new .filesystem ) ) &&
p_filesystem ->resize( partition_new,
operationdetail .get_last_child(),
fill_partition ) ;
@ -2569,7 +2581,8 @@ bool GParted_Core::copy( const Partition & partition_src,
String::ucompose( _("copy file system of %1 to %2"),
partition_src .get_path(),
partition_dst .get_path() ) ) ) ;
FileSystem* p_filesystem = NULL ;
switch ( get_fs( partition_dst .filesystem ) .copy )
{
case GParted::FS::GPARTED :
@ -2585,7 +2598,7 @@ bool GParted_Core::copy( const Partition & partition_src,
#endif
case GParted::FS::EXTERNAL :
succes = set_proper_filesystem( partition_dst .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition_dst .filesystem ) ) &&
p_filesystem ->copy( partition_src .get_path(),
partition_dst .get_path(),
operationdetail .get_last_child() ) ;
@ -2807,6 +2820,7 @@ bool GParted_Core::check_repair_filesystem( const Partition & partition, Operati
partition .get_path() ) ) ) ;
bool succes = false ;
FileSystem* p_filesystem = NULL ;
switch ( get_fs( partition .filesystem ) .check )
{
case GParted::FS::NONE:
@ -2826,7 +2840,7 @@ bool GParted_Core::check_repair_filesystem( const Partition & partition, Operati
break ;
#endif
case GParted::FS::EXTERNAL:
succes = set_proper_filesystem( partition .filesystem ) &&
succes = ( p_filesystem = set_proper_filesystem( partition .filesystem ) ) &&
p_filesystem ->check_repair( partition, operationdetail .get_last_child() ) ;
break ;
@ -3258,11 +3272,9 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
return succes ;
}
bool GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
FileSystem* GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
{
p_filesystem = get_filesystem_object( filesystem ) ;
return p_filesystem ;
return get_filesystem_object( filesystem ) ;
}
FileSystem * GParted_Core::get_filesystem_object( const FILESYSTEM & filesystem )
@ -3564,7 +3576,6 @@ PedExceptionOption GParted_Core::ped_exception_handler( PedException * e )
GParted_Core::~GParted_Core()
{
delete p_filesystem;
}
Glib::Thread *GParted_Core::mainthread;