Added cylsize to Device and made Operation contain a Device instead of
* Added cylsize to Device and made Operation contain a Device instead of only the path and lenght. This way i was able to dump Get_Cyl_Size in the Core. Besides that, i used cylsize in WinGparted and made a lot of cosmetic changes. Most of them were pretty useless, but hey, i'm bored ;)
This commit is contained in:
parent
2ed3e0e8c4
commit
174f0cff77
|
@ -1,3 +1,9 @@
|
|||
2004-12-27 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* Added cylsize to Device and made Operation contain a Device instead of only the path and lenght.
|
||||
This way i was able to dump Get_Cyl_Size in the Core. Besides that, i used cylsize in WinGparted and made a lot of
|
||||
cosmetic changes. Most of them were pretty useless, but hey, i'm bored ;)
|
||||
|
||||
2004-12-25 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* src/GParted_Core.cc,
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
long heads ;
|
||||
long sectors ;
|
||||
long cylinders ;
|
||||
long cylsize ;
|
||||
Glib::ustring model;
|
||||
Glib::ustring path;
|
||||
Glib::ustring realpath;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace GParted
|
|||
class Dialog_Partition_Copy : public Dialog_Base_Partition
|
||||
{
|
||||
public:
|
||||
Dialog_Partition_Copy( const FS & fs, Sector cylinder_size ) ;
|
||||
Dialog_Partition_Copy( const FS & fs, long cylinder_size ) ;
|
||||
void Set_Data( const Partition & selected_partition, const Partition & copied_partition );
|
||||
Partition Get_New_Partition( ) ;
|
||||
|
||||
|
|
|
@ -26,13 +26,12 @@ namespace GParted
|
|||
class Dialog_Partition_Resize_Move : public Dialog_Base_Partition
|
||||
{
|
||||
public:
|
||||
Dialog_Partition_Resize_Move( const FS & fs, Sector cylinder_size ) ;
|
||||
Dialog_Partition_Resize_Move( const FS & fs, long cylinder_size ) ;
|
||||
void Set_Data( const Partition & selected_partition, const std::vector <Partition> & partitions ) ;
|
||||
|
||||
private:
|
||||
void Resize_Move_Normal( const std::vector <Partition> & partitions ) ;
|
||||
void Resize_Move_Extended( const std::vector <Partition> & partitions ) ;
|
||||
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -49,10 +49,10 @@ public:
|
|||
|
||||
void Apply_Operation_To_Disk( Operation & operation );
|
||||
|
||||
bool Create( const Glib::ustring & device_path, Partition & new_partition ) ;
|
||||
bool Create( const Device & device, Partition & new_partition ) ;
|
||||
bool Convert_FS( const Glib::ustring & device_path, const Partition & partition ) ;
|
||||
bool Delete( const Glib::ustring & device_path, const Partition & partition ) ;
|
||||
bool Resize( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new ) ;
|
||||
bool Resize( const Device & device, const Partition & partition_old, const Partition & partition_new ) ;
|
||||
bool Copy( const Glib::ustring & dest_device_path, const Glib::ustring & src_part_path, Partition & partition_dest ) ;
|
||||
|
||||
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
|
||||
|
@ -73,7 +73,6 @@ private:
|
|||
|
||||
void Show_Error( Glib::ustring message ) ;
|
||||
void set_proper_filesystem( const Glib::ustring & filesystem ) ;
|
||||
long Get_Cylinder_Size( const Glib::ustring & device_path ) ;
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> textbuffer;
|
||||
|
||||
|
|
|
@ -39,15 +39,14 @@ class Operation
|
|||
{
|
||||
|
||||
public:
|
||||
Operation( const Glib::ustring device_path, Sector device_length, const Partition &, const Partition &, OperationType );
|
||||
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 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 );
|
||||
|
||||
//public variables
|
||||
Glib::ustring device_path ;
|
||||
Sector device_length ;
|
||||
Device device ;
|
||||
OperationType operationtype;
|
||||
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.... )
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include <gtkmm/radiobutton.h>
|
||||
#include <gtkmm/liststore.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h> //should be included by gtkmm headers. but decided to include it anyway after getting some bugreports..
|
||||
|
||||
namespace GParted
|
||||
|
@ -78,7 +77,6 @@ private:
|
|||
void Set_Valid_Operations( ) ; //determines which operations are allowed on selected_partition
|
||||
void Set_Valid_Convert_Filesystems( ) ; //determines to which filesystems a partition can be converted
|
||||
|
||||
|
||||
//convenience functions
|
||||
void allow_new( bool b ) { menu_popup .items( )[ 0 ] .set_sensitive( b ); toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
|
||||
void allow_delete( bool b ) { menu_popup .items( )[ 1 ] .set_sensitive( b ); toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
|
||||
|
@ -98,7 +96,6 @@ private:
|
|||
void clear_operationslist( ) ;
|
||||
void optionmenu_devices_changed( );
|
||||
|
||||
|
||||
void menu_gparted_refresh_devices( );
|
||||
void menu_gparted_filesystems( );
|
||||
void menu_gparted_quit( );
|
||||
|
@ -170,7 +167,6 @@ private:
|
|||
};
|
||||
treeview_operations_Columns treeview_operations_columns;
|
||||
|
||||
|
||||
//usefull variables which are used by many different functions...
|
||||
bool any_logic,any_extended;//used in some checks (e.g. see optionmenu_devices_changed()
|
||||
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
|
||||
|
@ -188,7 +184,6 @@ private:
|
|||
Glib::Dispatcher dispatcher;
|
||||
sigc::connection conn ;
|
||||
bool apply, pulse ;
|
||||
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -29,7 +29,7 @@ void Device::Reset( )
|
|||
{
|
||||
device_partitions .clear( ) ;
|
||||
length = 0 ;
|
||||
heads = sectors = cylinders = 0 ;
|
||||
heads = sectors = cylinders = cylsize = 0 ;
|
||||
model = path = realpath = disktype = "" ;
|
||||
max_prims = 0 ;
|
||||
busy = readonly = false ;
|
||||
|
|
|
@ -20,15 +20,11 @@
|
|||
namespace GParted
|
||||
{
|
||||
|
||||
Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs, Sector cylinder_size )
|
||||
Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs, long cylinder_size )
|
||||
{
|
||||
this ->fs = fs ;
|
||||
|
||||
//some disk have a small cylindersize, for safetyreasons i keep this size at >=1
|
||||
if ( cylinder_size < 2048 )
|
||||
cylinder_size = 2048 ;
|
||||
|
||||
BUF = Sector_To_MB( cylinder_size ) ;
|
||||
BUF = cylinder_size ;
|
||||
|
||||
Set_Resizer( false ) ;
|
||||
Set_Confirm_Button( PASTE ) ;
|
||||
|
|
|
@ -20,15 +20,11 @@
|
|||
namespace GParted
|
||||
{
|
||||
|
||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, Sector cylinder_size )
|
||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, long cylinder_size )
|
||||
{
|
||||
this ->fs = fs ;
|
||||
|
||||
//some disk have a small cylindersize, for safetyreasons i keep this size at >=1
|
||||
if ( cylinder_size < 2048 )
|
||||
cylinder_size = 2048 ;
|
||||
|
||||
BUF = Sector_To_MB( cylinder_size ) *2 ;
|
||||
BUF = cylinder_size *2 ;
|
||||
}
|
||||
|
||||
void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partition, const std::vector <Partition> & partitions )
|
||||
|
|
|
@ -13,7 +13,7 @@ GParted_Core::GParted_Core( )
|
|||
textbuffer = Gtk::TextBuffer::create( ) ;
|
||||
|
||||
//get valid flags ...
|
||||
for ( PedPartitionFlag flag = ped_partition_flag_next ( (PedPartitionFlag) 0 ) ; flag ; flag = ped_partition_flag_next ( flag ) )
|
||||
for ( PedPartitionFlag flag = ped_partition_flag_next( (PedPartitionFlag) NULL ) ; flag ; flag = ped_partition_flag_next( flag ) )
|
||||
flags .push_back( flag ) ;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,11 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
|||
temp_device .sectors = device ->bios_geom .sectors ;
|
||||
temp_device .cylinders = device ->bios_geom .cylinders ;
|
||||
temp_device .length = temp_device .heads * temp_device .sectors * temp_device .cylinders ;
|
||||
temp_device .cylsize = Sector_To_MB( temp_device .heads * temp_device .sectors ) ;
|
||||
|
||||
//make sure cylsize is at least 1 MB
|
||||
if ( temp_device .cylsize < 1 )
|
||||
temp_device .cylsize = 1 ;
|
||||
|
||||
//normal harddisk
|
||||
if ( disk )
|
||||
|
@ -300,37 +305,37 @@ void GParted_Core::Apply_Operation_To_Disk( Operation & operation )
|
|||
switch ( operation .operationtype )
|
||||
{
|
||||
case DELETE:
|
||||
if ( ! Delete( operation .device_path, operation .partition_original ) )
|
||||
if ( ! Delete( operation .device .path, operation .partition_original ) )
|
||||
Show_Error( String::ucompose( _("Error while deleting %1"), operation .partition_original .partition ) ) ;
|
||||
|
||||
break;
|
||||
case CREATE:
|
||||
if ( ! Create( operation .device_path, operation .partition_new ) )
|
||||
if ( ! Create( operation .device, operation .partition_new ) )
|
||||
Show_Error( String::ucompose( _("Error while creating %1"), operation .partition_new .partition ) );
|
||||
|
||||
break;
|
||||
case RESIZE_MOVE:
|
||||
if ( ! Resize( operation .device_path, operation .partition_original, operation .partition_new ) )
|
||||
if ( ! Resize( operation .device, operation .partition_original, operation .partition_new ) )
|
||||
Show_Error( String::ucompose( _("Error while resizing/moving %1"), operation .partition_new .partition ) ) ;
|
||||
|
||||
break;
|
||||
case CONVERT:
|
||||
if ( ! Convert_FS( operation .device_path, operation .partition_new ) )
|
||||
if ( ! Convert_FS( operation .device .path, operation .partition_new ) )
|
||||
Show_Error( String::ucompose( _("Error while converting filesystem of %1"), operation .partition_new .partition ) ) ;
|
||||
|
||||
break;
|
||||
case COPY:
|
||||
if ( ! Copy( operation .device_path, operation .copied_partition_path, operation .partition_new ) )
|
||||
if ( ! Copy( operation .device .path, operation .copied_partition_path, operation .partition_new ) )
|
||||
Show_Error( String::ucompose( _("Error while copying %1"), operation .partition_new .partition ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
bool GParted_Core::Create( const Glib::ustring & device_path, Partition & new_partition )
|
||||
bool GParted_Core::Create( const Device & device, Partition & new_partition )
|
||||
{
|
||||
if ( new_partition .type == GParted::EXTENDED )
|
||||
return Create_Empty_Partition( device_path, new_partition ) ;
|
||||
return Create_Empty_Partition( device .path, new_partition ) ;
|
||||
|
||||
else if ( Create_Empty_Partition( device_path, new_partition, ( new_partition .Get_Length_MB( ) - Get_Cylinder_Size( device_path ) ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
|
||||
else if ( Create_Empty_Partition( device .path, new_partition, ( new_partition .Get_Length_MB( ) - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
|
||||
{
|
||||
set_proper_filesystem( new_partition .filesystem ) ;
|
||||
|
||||
|
@ -338,7 +343,7 @@ bool GParted_Core::Create( const Glib::ustring & device_path, Partition & new_pa
|
|||
if ( ! p_filesystem )
|
||||
return true ;
|
||||
|
||||
return p_filesystem ->Create( device_path, new_partition ) ;
|
||||
return p_filesystem ->Create( device .path, new_partition ) ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
|
@ -382,17 +387,17 @@ bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition &
|
|||
return return_value ;
|
||||
}
|
||||
|
||||
bool GParted_Core::Resize( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new )
|
||||
bool GParted_Core::Resize( const Device & device, const Partition & partition_old, const Partition & partition_new )
|
||||
{
|
||||
if ( partition_old .type == GParted::EXTENDED )
|
||||
return Resize_Container_Partition( device_path, partition_old, partition_new, false ) ;
|
||||
return Resize_Container_Partition( device .path, partition_old, partition_new, false ) ;
|
||||
|
||||
//these 3 still use libparted's resizer.
|
||||
else if ( partition_old .filesystem == "linux-swap" ||
|
||||
partition_old .filesystem == "fat16" ||
|
||||
partition_old .filesystem == "fat32"
|
||||
)
|
||||
return Resize_Normal_Using_Libparted( device_path, partition_old, partition_new ) ;
|
||||
return Resize_Normal_Using_Libparted( device .path, partition_old, partition_new ) ;
|
||||
|
||||
//use custom resize tools..(afaik only resize, no moves)
|
||||
else
|
||||
|
@ -404,15 +409,15 @@ bool GParted_Core::Resize( const Glib::ustring & device_path, const Partition &
|
|||
//shrinking
|
||||
if ( partition_new .sector_end < partition_old .sector_end )
|
||||
{
|
||||
p_filesystem ->cylinder_size = Get_Cylinder_Size( device_path ) ;
|
||||
p_filesystem ->cylinder_size = device .cylsize ;
|
||||
|
||||
if ( p_filesystem ->Resize( partition_new ) )
|
||||
Resize_Container_Partition( device_path, partition_old, partition_new ) ;
|
||||
Resize_Container_Partition( device .path, partition_old, partition_new ) ;
|
||||
}
|
||||
|
||||
//growing
|
||||
if ( partition_new .sector_end > partition_old .sector_end )
|
||||
Resize_Container_Partition( device_path, partition_old, partition_new ) ;
|
||||
Resize_Container_Partition( device .path, partition_old, partition_new ) ;
|
||||
|
||||
|
||||
p_filesystem ->Check_Repair( partition_new ) ;
|
||||
|
@ -729,18 +734,4 @@ void GParted_Core::set_proper_filesystem( const Glib::ustring & filesystem )
|
|||
p_filesystem ->textbuffer = textbuffer ;
|
||||
}
|
||||
|
||||
long GParted_Core::Get_Cylinder_Size( const Glib::ustring & device_path )
|
||||
{
|
||||
long cylinder_size = 0 ;
|
||||
|
||||
if ( open_device( device_path, device ) )
|
||||
{
|
||||
cylinder_size = Sector_To_MB( device ->bios_geom .heads * device ->bios_geom .sectors ) ;
|
||||
|
||||
close_device_and_disk( device, disk ) ;
|
||||
}
|
||||
|
||||
return cylinder_size ;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -19,11 +19,9 @@
|
|||
namespace GParted
|
||||
{
|
||||
|
||||
Operation::Operation( const Glib::ustring device_path, Sector device_length, const Partition & partition_original, const Partition & partition_new, OperationType operationtype )
|
||||
Operation::Operation( const Device & device, const Partition & partition_original, const Partition & partition_new, OperationType operationtype )
|
||||
{
|
||||
this ->device_path = device_path ;
|
||||
this ->device_length = device_length ;
|
||||
|
||||
this ->device = device ;
|
||||
this ->partition_original = partition_original;
|
||||
this ->partition_new = partition_new;
|
||||
this ->operationtype = operationtype;
|
||||
|
@ -51,7 +49,7 @@ Glib::ustring Operation::Get_String( )
|
|||
temp = partition_original .partition ;
|
||||
|
||||
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */
|
||||
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), temp, partition_original .filesystem, partition_original .Get_Length_MB( ), device_path ) ;
|
||||
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), temp, partition_original .filesystem, partition_original .Get_Length_MB( ), device .path ) ;
|
||||
|
||||
case CREATE : switch( partition_new.type )
|
||||
{
|
||||
|
@ -61,7 +59,7 @@ Glib::ustring Operation::Get_String( )
|
|||
default : break;
|
||||
}
|
||||
/*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */
|
||||
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), temp, partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB( ), device_path ) ;
|
||||
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), temp, partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB( ), device .path ) ;
|
||||
case RESIZE_MOVE: //if startsector has changed >= 1 MB we consider it a move
|
||||
diff = Abs( partition_new .sector_start - partition_original .sector_start ) ;
|
||||
if ( diff >= MEGABYTE )
|
||||
|
@ -89,7 +87,7 @@ Glib::ustring Operation::Get_String( )
|
|||
case CONVERT : /*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */
|
||||
return String::ucompose( _( "Convert %1 from %2 to %3"), partition_original .partition, partition_original .filesystem, partition_new .filesystem ) ;
|
||||
case COPY : /*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */
|
||||
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device_path, Sector_To_MB( partition_new .sector_start ) ) ;
|
||||
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device .path, Sector_To_MB( partition_new .sector_start ) ) ;
|
||||
default : return "";
|
||||
}
|
||||
|
||||
|
@ -178,7 +176,7 @@ void Operation::Apply_Delete_To_Visual( std::vector<Partition> & partitions )
|
|||
{
|
||||
partitions .erase( partitions .begin( ) + Get_Index_Original( partitions ) );
|
||||
|
||||
Insert_Unallocated( partitions, 0, device_length -1, false ) ;
|
||||
Insert_Unallocated( partitions, 0, device .length -1, false ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -204,7 +202,7 @@ void Operation::Apply_Create_To_Visual( std::vector<Partition> & partitions )
|
|||
{
|
||||
partitions[ Get_Index_Original( partitions ) ] = partition_new ;
|
||||
|
||||
Insert_Unallocated( partitions, 0, device_length -1, false ) ;
|
||||
Insert_Unallocated( partitions, 0, device .length -1, false ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -231,7 +229,7 @@ void Operation::Apply_Resize_Move_Extended_To_Visual( std::vector<Partition> & p
|
|||
partitions[ ext ] .sector_start = partition_new .sector_start ;
|
||||
partitions[ ext ] .sector_end = partition_new .sector_end ;
|
||||
|
||||
Insert_Unallocated( partitions, 0, device_length -1, false ) ;
|
||||
Insert_Unallocated( partitions, 0, device .length -1, false ) ;
|
||||
|
||||
//stuff INSIDE extended partition
|
||||
ext = 0 ;
|
||||
|
|
|
@ -419,7 +419,7 @@ bool Win_GParted::on_delete_event(GdkEventAny *event)
|
|||
|
||||
void Win_GParted::Add_Operation( OperationType operationtype, const Partition & new_partition)
|
||||
{
|
||||
Operation operation( devices[ current_device ] .path, devices[ current_device ] .length, selected_partition, new_partition, operationtype );
|
||||
Operation operation( devices[ current_device ], selected_partition, new_partition, operationtype );
|
||||
|
||||
operations.push_back( operation );
|
||||
|
||||
|
@ -445,7 +445,7 @@ void Win_GParted::Refresh_Visual( )
|
|||
//make all operations visible
|
||||
for ( unsigned int t = 0 ; t < operations .size( ); t++ )
|
||||
{
|
||||
if ( operations[ t ] .device_path == devices[ current_device ] .path )
|
||||
if ( operations[ t ] .device .path == devices[ current_device ] .path )
|
||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
|
||||
treerow = *( liststore_operations ->append( ) );
|
||||
|
@ -562,13 +562,8 @@ void Win_GParted::Set_Valid_Operations()
|
|||
//find out if there is a copied partition and if it fits inside this unallocated space
|
||||
if ( copied_partition .partition != "NONE" && ! devices[ current_device ] .readonly )
|
||||
{
|
||||
//calculate cylindersize
|
||||
long cylinder_size = Sector_To_MB( devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||
if ( cylinder_size < 1 )
|
||||
cylinder_size = 1 ;
|
||||
|
||||
if ( (copied_partition .Get_Length_MB( ) + cylinder_size) < selected_partition .Get_Length_MB( ) ||
|
||||
(copied_partition .filesystem == "xfs" && (copied_partition .Get_Used_MB( ) + cylinder_size) < selected_partition .Get_Length_MB( ) )
|
||||
if ( (copied_partition .Get_Length_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) ||
|
||||
(copied_partition .filesystem == "xfs" && (copied_partition .Get_Used_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) )
|
||||
)
|
||||
allow_paste( true ) ;
|
||||
}
|
||||
|
@ -845,10 +840,10 @@ void Win_GParted::activate_resize()
|
|||
|
||||
if ( operations .size( ) )
|
||||
for (unsigned int t = 0 ; t < operations .size( ) ; t++ )
|
||||
if ( operations[ t ] .device_path == devices[ current_device ] .path )
|
||||
if ( operations[ t ] .device .path == devices[ current_device ] .path )
|
||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
|
||||
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( selected_partition .filesystem ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( selected_partition .filesystem ), devices[ current_device ] .cylsize ) ;
|
||||
|
||||
if ( selected_partition .type == GParted::LOGICAL )
|
||||
{
|
||||
|
@ -896,7 +891,7 @@ void Win_GParted::activate_paste()
|
|||
{
|
||||
if ( ! max_amount_prim_reached( ) )
|
||||
{
|
||||
Dialog_Partition_Copy dialog( gparted_core .get_fs( selected_partition .filesystem ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||
Dialog_Partition_Copy dialog( gparted_core .get_fs( copied_partition .filesystem ), devices[ current_device ] .cylsize ) ;
|
||||
copied_partition .error .clear( ) ; //we don't need the errors of the source partition.
|
||||
dialog .Set_Data( selected_partition, copied_partition ) ;
|
||||
dialog .set_transient_for( *this );
|
||||
|
@ -933,12 +928,7 @@ void Win_GParted::activate_new()
|
|||
{
|
||||
Dialog_Partition_New dialog;
|
||||
|
||||
//calculate cylindersize
|
||||
long cylinder_size = Sector_To_MB( devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||
if ( cylinder_size < 1 )
|
||||
cylinder_size = 1 ;
|
||||
|
||||
dialog .Set_Data( selected_partition, any_extended, new_count, gparted_core .get_filesystems( ), devices [ current_device ] .readonly, cylinder_size ) ;
|
||||
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 );
|
||||
|
||||
if ( dialog .run( ) == Gtk::RESPONSE_OK )
|
||||
|
@ -997,15 +987,9 @@ void Win_GParted::activate_delete()
|
|||
if ( selected_partition .status == GParted::STAT_NEW )
|
||||
{
|
||||
//remove all operations done on this new partition (this includes creation)
|
||||
for ( int t=0;t<(int) operations.size() ; t++ ) //i removed the unsigned 'cause t will be negative at times...
|
||||
{
|
||||
for ( int t = 0 ; t < (int) operations .size( ) ; t++ ) //I removed the unsigned because t will be negative at times...
|
||||
if ( operations[ t ] .partition_new .partition == selected_partition .partition )
|
||||
{
|
||||
operations.erase( operations .begin( ) + t ) ;
|
||||
t-- ;
|
||||
}
|
||||
}
|
||||
|
||||
operations.erase( operations .begin( ) + t-- ) ;
|
||||
|
||||
//determine lowest possible new_count
|
||||
new_count = 0 ;
|
||||
|
@ -1133,7 +1117,6 @@ void Win_GParted::activate_undo()
|
|||
|
||||
if ( ! operations .size( ) )
|
||||
close_operationslist( ) ;
|
||||
|
||||
}
|
||||
|
||||
void Win_GParted::activate_apply( )
|
||||
|
@ -1175,7 +1158,7 @@ void Win_GParted::activate_apply()
|
|||
for ( unsigned int t = 0; t < devices .size( ) && ! any_busy; t++ )
|
||||
if ( devices[ t ] .busy )
|
||||
for (unsigned int i = 0; i < operations .size( ) && ! any_busy; i++ )
|
||||
if ( operations[ i ] .device_path == devices[ t ] .path )
|
||||
if ( operations[ i ] .device .path == devices[ t ] .path )
|
||||
any_busy = true ;
|
||||
|
||||
//show warning if necessary
|
||||
|
|
Loading…
Reference in New Issue