fixed issues with copying (see also #335004) cleanups + added FIXME added
* include/GParted_Core.h, src/GParted_Core.cc, src/Win_GParted.cc, src/ext2.cc, src/ext3.cc, src/fat16.cc, src/fat32.cc, src/jfs.cc, src/ntfs.cc, src/reiserfs.cc: fixed issues with copying (see also #335004) * include/Operation.h, src/Operation.cc: cleanups + added FIXME * include/Partition.h, src/Partition.cc: added clear_mountpoints() * src/DrawingAreaVisualDisk.cc: added FIXME
This commit is contained in:
parent
4e57356c34
commit
ad9f2126e7
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2006-03-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
src/GParted_Core.cc,
|
||||
src/Win_GParted.cc,
|
||||
src/ext2.cc,
|
||||
src/ext3.cc,
|
||||
src/fat16.cc,
|
||||
src/fat32.cc,
|
||||
src/jfs.cc,
|
||||
src/ntfs.cc,
|
||||
src/reiserfs.cc: fixed issues with copying (see also #335004)
|
||||
* include/Operation.h,
|
||||
src/Operation.cc: cleanups + added FIXME
|
||||
* include/Partition.h,
|
||||
src/Partition.cc: added clear_mountpoints()
|
||||
* src/DrawingAreaVisualDisk.cc: added FIXME
|
||||
|
||||
2006-03-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/DrawingAreaVisualDisk.h,
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
std::vector<OperationDetails> & operation_detail ) ;
|
||||
bool copy( const Glib::ustring & src_part_path,
|
||||
Partition & partition_dest,
|
||||
Sector min_size,
|
||||
std::vector<OperationDetails> & operation_details ) ;
|
||||
|
||||
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
|
||||
|
@ -88,14 +89,14 @@ private:
|
|||
void set_flags( Partition & partition ) ;
|
||||
int create_empty_partition( Partition & new_partition,
|
||||
std::vector<OperationDetails> & operation_details,
|
||||
bool copy = false ) ;
|
||||
Sector min_size = 0 ) ;
|
||||
bool resize_container_partition( const Partition & partition_old,
|
||||
const Partition & partition_new,
|
||||
bool fixed_start,
|
||||
std::vector<OperationDetails> & operation_details ) ;
|
||||
bool resize_normal_using_libparted( const Partition & partition_old,
|
||||
const Partition & partition_new,
|
||||
std::vector<OperationDetails> & operation_detail ) ;
|
||||
std::vector<OperationDetails> & operation_details ) ;
|
||||
|
||||
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
|
||||
bool set_partition_type( const Partition & partition,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define OPERATION
|
||||
|
||||
#include "../include/Device.h"
|
||||
|
||||
//FIXME: i guess it's better to split Operation in several (sub)classes for increased efficiency/clearity
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
|
@ -64,7 +64,8 @@ public:
|
|||
Operation() ;
|
||||
Operation( const Device & device, const Partition &, const Partition &, OperationType );
|
||||
|
||||
//this one can be a little confusing, it *DOES NOT* change any visual representation. It only applies the operation to the list with partitions.
|
||||
//this one can be a little confusing, it *DOES NOT* change any visual representation.
|
||||
//It only applies the operation to the list with partitions.
|
||||
//this new list can be used to change the visual representation. For real writing to disk, see Apply_To_Disk()
|
||||
void Apply_Operation_To_Visual( std::vector<Partition> & partitions );
|
||||
|
||||
|
@ -75,7 +76,9 @@ public:
|
|||
Partition partition_original; //the original situation
|
||||
Partition partition_new; //the new situation ( can be an whole new partition or simply the old one with a new size or.... )
|
||||
Glib::ustring str_operation ;
|
||||
Glib::ustring copied_partition_path ; //for copy operation..
|
||||
|
||||
//for copy operation..
|
||||
Glib::ustring copied_partition_path ;
|
||||
|
||||
OperationDetails operation_details ;
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
std::vector<Glib::ustring> get_paths() const ;
|
||||
void add_mountpoints( const std::vector<Glib::ustring> & mountpoints, bool clear_mountpoints = false ) ;
|
||||
Glib::ustring get_mountpoint() const ;
|
||||
void clear_mountpoints() ;
|
||||
std::vector<Glib::ustring> get_mountpoints() const ;
|
||||
|
||||
bool operator==( const Partition & partition ) const ;
|
||||
|
|
|
@ -343,7 +343,8 @@ bool DrawingAreaVisualDisk::on_button_press_event( GdkEventButton * event )
|
|||
|
||||
signal_partition_selected .emit( selected_vp .partition, false ) ;
|
||||
|
||||
if ( event ->type == GDK_2BUTTON_PRESS )
|
||||
if ( event ->type == GDK_2BUTTON_PRESS ) //FIXME: only emit the signal if a partition was selected
|
||||
//right now it's possible to 'activate' a seperator.
|
||||
signal_partition_activated .emit() ;
|
||||
else if ( event ->button == 3 )
|
||||
signal_popup_menu .emit( event ->button, event ->time ) ;
|
||||
|
|
|
@ -562,6 +562,7 @@ bool GParted_Core::apply_operation_to_disk( Operation & operation )
|
|||
case COPY:
|
||||
return copy( operation .copied_partition_path,
|
||||
operation .partition_new,
|
||||
operation .partition_new .get_length() - operation .device .cylsize,
|
||||
operation .operation_details .sub_details ) ;
|
||||
}
|
||||
|
||||
|
@ -577,10 +578,7 @@ bool GParted_Core::create( const Device & device,
|
|||
{
|
||||
return create_empty_partition( new_partition, operation_details ) ;
|
||||
}
|
||||
else if ( create_empty_partition(
|
||||
new_partition,
|
||||
operation_details,
|
||||
( new_partition .get_length() - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN * MEBIBYTE ) > 0 )
|
||||
else if ( create_empty_partition( new_partition, operation_details, get_fs( new_partition .filesystem ) .MIN ) )
|
||||
{
|
||||
set_proper_filesystem( new_partition .filesystem ) ;
|
||||
|
||||
|
@ -693,16 +691,19 @@ bool GParted_Core::resize( const Device & device,
|
|||
|
||||
bool GParted_Core::copy( const Glib::ustring & src_part_path,
|
||||
Partition & partition_dest,
|
||||
Sector min_size,
|
||||
std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
set_proper_filesystem( partition_dest .filesystem ) ;
|
||||
Partition src_partition( src_part_path ) ;
|
||||
|
||||
//FIXME: some filesystems (e.g. fat*) can be copied using libparted..
|
||||
return ( p_filesystem &&
|
||||
p_filesystem ->Check_Repair( src_partition, operation_details ) &&
|
||||
create_empty_partition( partition_dest, operation_details, true ) > 0 &&
|
||||
create_empty_partition( partition_dest, operation_details, min_size ) > 0 &&
|
||||
set_partition_type( partition_dest, operation_details ) &&
|
||||
p_filesystem ->Copy( src_part_path, partition_dest .get_path(), operation_details ) &&
|
||||
p_filesystem ->Check_Repair( partition_dest, operation_details ) &&
|
||||
p_filesystem ->Resize( partition_dest, operation_details, true ) &&
|
||||
p_filesystem ->Check_Repair( partition_dest, operation_details ) ) ;
|
||||
}
|
||||
|
||||
|
@ -800,7 +801,7 @@ void GParted_Core::LP_Set_Used_Sectors( Partition & partition )
|
|||
|
||||
int GParted_Core::create_empty_partition( Partition & new_partition,
|
||||
std::vector<OperationDetails> & operation_details,
|
||||
bool copy )
|
||||
Sector min_size )
|
||||
{
|
||||
operation_details .push_back( OperationDetails( _("create empty partition") ) ) ;
|
||||
|
||||
|
@ -852,10 +853,8 @@ int GParted_Core::create_empty_partition( Partition & new_partition,
|
|||
|
||||
if ( constraint )
|
||||
{
|
||||
//FIXME: i should use the length of the copied partition as min_size
|
||||
//maybe we can set the used from new_partition to this size?
|
||||
if ( copy )
|
||||
constraint ->min_size = new_partition .get_length() ;
|
||||
if ( min_size > 0 )
|
||||
constraint ->min_size = min_size ;
|
||||
|
||||
if ( ped_disk_add_partition( lp_disk, lp_partition, constraint ) && commit() )
|
||||
{
|
||||
|
|
|
@ -203,14 +203,16 @@ void Operation::Insert_Unallocated( std::vector<Partition> & partitions, Sector
|
|||
int Operation::Get_Index_Original( std::vector<Partition> & partitions )
|
||||
{
|
||||
for ( int t = 0 ; t < static_cast<int>( partitions .size() ) ; t++ )
|
||||
if ( partition_original .sector_start >= partitions[ t ] .sector_start && partition_original .sector_end <= partitions[ t ] .sector_end )
|
||||
if ( partition_original .sector_start >= partitions[ t ] .sector_start &&
|
||||
partition_original .sector_end <= partitions[ t ] .sector_end )
|
||||
{
|
||||
//remove unallocated space preceding the original partition
|
||||
if ( t -1 >= 0 && partitions[ t -1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||
partitions .erase( partitions .begin() + --t );
|
||||
|
||||
//remove unallocated space following the original partition
|
||||
if ( t +1 < static_cast<int>( partitions .size( ) ) && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||
if ( t +1 < static_cast<int>( partitions .size() ) &&
|
||||
partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||
partitions .erase( partitions .begin() + t +1 );
|
||||
|
||||
return t ;
|
||||
|
|
|
@ -193,6 +193,11 @@ std::vector<Glib::ustring> Partition::get_mountpoints() const
|
|||
return mountpoints ;
|
||||
}
|
||||
|
||||
void Partition::clear_mountpoints()
|
||||
{
|
||||
mountpoints .clear() ;
|
||||
}
|
||||
|
||||
bool Partition::compare_paths( const Glib::ustring & A, const Glib::ustring & B )
|
||||
{
|
||||
return A .length() < B .length() ;
|
||||
|
|
|
@ -1178,8 +1178,9 @@ void Win_GParted::activate_paste()
|
|||
{
|
||||
Dialog_Partition_Copy dialog( gparted_core .get_fs( copied_partition .filesystem ),
|
||||
devices[ current_device ] .cylsize ) ;
|
||||
//we don't need the errors of the source partition.
|
||||
//we don't need the errors/mountpoints of the source partition.
|
||||
copied_partition .error .clear() ;
|
||||
copied_partition .clear_mountpoints() ;
|
||||
dialog .Set_Data( selected_partition, copied_partition ) ;
|
||||
dialog .set_transient_for( *this );
|
||||
|
||||
|
|
|
@ -126,13 +126,14 @@ bool ext2::Copy( const Glib::ustring & src_part_path,
|
|||
operation_details .back() .sub_details ) )
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||
|
||||
return Resize( Partition( dest_part_path ), operation_details, true ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::ERROR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
|
|
@ -127,13 +127,14 @@ bool ext3::Copy( const Glib::ustring & src_part_path,
|
|||
operation_details .back() .sub_details ) )
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||
|
||||
return Resize( Partition( dest_part_path ), operation_details, true ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::ERROR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
|
|
@ -96,8 +96,7 @@ bool fat16::Resize( const Partition & partition_new,
|
|||
std::vector<OperationDetails> & operation_details,
|
||||
bool fill_partition )
|
||||
{
|
||||
//handled in GParted_Core::resize_normal_using_libparted
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool fat16::Copy( const Glib::ustring & src_part_path,
|
||||
|
|
|
@ -95,8 +95,7 @@ bool fat32::Resize( const Partition & partition_new,
|
|||
std::vector<OperationDetails> & operation_details,
|
||||
bool fill_partition )
|
||||
{
|
||||
//handled in GParted_Core::Resize_Normal_Using_Libparted
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool fat32::Copy( const Glib::ustring & src_part_path,
|
||||
|
|
|
@ -210,13 +210,15 @@ bool jfs::Copy( const Glib::ustring & src_part_path,
|
|||
operation_details .back() .sub_details ) )
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||
return true ;
|
||||
|
||||
return Resize( Partition( dest_part_path ), operation_details, true ) ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::ERROR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
|
|
@ -145,13 +145,14 @@ bool ntfs::Copy( const Glib::ustring & src_part_path,
|
|||
operation_details .back() .sub_details ) )
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||
|
||||
return Resize( Partition( dest_part_path ), operation_details, true ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::ERROR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
|
|
@ -133,13 +133,14 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path,
|
|||
operation_details .back() .sub_details ) )
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||
|
||||
return Resize( Partition( dest_part_path ), operation_details, true ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
operation_details .back() .status = OperationDetails::ERROR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue