Rename get_length method to get_sector_length
This rename is to try to reduce future confusion between partition length in sectors versus partition length in bytes.
This commit is contained in:
parent
70448f4fb0
commit
7e2ca14756
|
@ -83,7 +83,7 @@ public:
|
|||
void add_path( const Glib::ustring & path, bool clear_paths = false ) ;
|
||||
void add_paths( const std::vector<Glib::ustring> & paths, bool clear_paths = false ) ;
|
||||
Byte_Value get_byte_length() const ;
|
||||
Sector get_length() const ;
|
||||
Sector get_sector_length() const ;
|
||||
Glib::ustring get_path() const ;
|
||||
std::vector<Glib::ustring> get_paths() const ;
|
||||
void add_mountpoints( const std::vector<Glib::ustring> & mountpoints, bool clear_mountpoints = false ) ;
|
||||
|
|
|
@ -148,7 +148,7 @@ Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
|
|||
|
||||
//set new value of unused..
|
||||
if ( selected_partition .sectors_used != -1 )
|
||||
selected_partition .sectors_unused = selected_partition .get_length() - selected_partition .sectors_used ;
|
||||
selected_partition .sectors_unused = selected_partition .get_sector_length() - selected_partition .sectors_used ;
|
||||
|
||||
//set indicator of whether to use strict sector values, or to round to cylinders
|
||||
selected_partition .strict = ! checkbutton_round_to_cylinders .get_active() ;
|
||||
|
|
|
@ -40,8 +40,8 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
|||
|
||||
//set some widely used values...
|
||||
START = selected_partition .sector_start ;
|
||||
total_length = selected_partition .get_length() ;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
total_length = selected_partition .get_sector_length() ;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_sector_length(), selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
||||
//Determine minimum number of sectors needed in destination (selected) partition and
|
||||
|
|
|
@ -117,7 +117,7 @@ void Dialog_Partition_Info::init_drawingarea()
|
|||
//calculate proportional width of used and unused
|
||||
used = unused = 0 ;
|
||||
used = Utils::round(
|
||||
(400 - BORDER *2) / ( static_cast<double>( partition .get_length() ) / partition .sectors_used ) ) ;
|
||||
(400 - BORDER *2) / ( static_cast<double>( partition .get_sector_length() ) / partition .sectors_used ) ) ;
|
||||
|
||||
unused = 400 - used - BORDER *2 ;
|
||||
|
||||
|
@ -136,7 +136,7 @@ void Dialog_Partition_Info::init_drawingarea()
|
|||
|
||||
//set text of pangolayout
|
||||
pango_layout = drawingarea .create_pango_layout(
|
||||
partition .get_path() + "\n" + Utils::format_size( partition .get_length(), partition .sector_size ) ) ;
|
||||
partition .get_path() + "\n" + Utils::format_size( partition .get_sector_length(), partition .sector_size ) ) ;
|
||||
}
|
||||
|
||||
void Dialog_Partition_Info::Display_Info()
|
||||
|
@ -163,7 +163,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL) ;
|
||||
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_length(), partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sector_length(), partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||
1, 2,
|
||||
top++, bottom++,
|
||||
Gtk::FILL ) ;
|
||||
|
@ -172,7 +172,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
{
|
||||
//calculate relative diskusage
|
||||
int percent_used =
|
||||
Utils::round( partition .sectors_used / static_cast<double>( partition .get_length() ) * 100 ) ;
|
||||
Utils::round( partition .sectors_used / static_cast<double>( partition .get_sector_length() ) * 100 ) ;
|
||||
|
||||
//used
|
||||
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Used:") ) + "</b>" ),
|
||||
|
@ -314,7 +314,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
0, 1,
|
||||
top, bottom,
|
||||
Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .get_length() ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .get_sector_length() ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||
1, 2,
|
||||
top++, bottom++,
|
||||
Gtk::FILL ) ;
|
||||
|
|
|
@ -142,7 +142,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
|
|||
//set some widely used values...
|
||||
START = partition.sector_start ;
|
||||
total_length = partition.sector_end - partition.sector_start ;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), this ->selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_sector_length(), this ->selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
||||
//set first enabled file system
|
||||
|
|
|
@ -94,16 +94,16 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
|||
//also check the partitions file system ( if this is a 'resize-only' then previous should be 0 )
|
||||
if ( t >= 1 && partitions[t -1].type == GParted::TYPE_UNALLOCATED && ! this ->fixed_start )
|
||||
{
|
||||
previous = partitions[t -1] .get_length() ;
|
||||
previous = partitions[t -1] .get_sector_length() ;
|
||||
START = partitions[t -1] .sector_start ;
|
||||
}
|
||||
else
|
||||
START = selected_partition .sector_start ;
|
||||
|
||||
if ( t +1 < partitions .size() && partitions[t +1] .type == GParted::TYPE_UNALLOCATED )
|
||||
next = partitions[t +1] .get_length() ;
|
||||
next = partitions[t +1] .get_sector_length() ;
|
||||
|
||||
total_length = previous + selected_partition .get_length() + next;
|
||||
total_length = previous + selected_partition .get_sector_length() + next;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
@ -111,7 +111,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
|||
//now calculate proportional length of partition
|
||||
frame_resizer_base ->set_x_start( Utils::round( previous / ( total_length / 500.00 ) ) ) ;
|
||||
frame_resizer_base ->set_x_end(
|
||||
Utils::round( selected_partition .get_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ;
|
||||
Utils::round( selected_partition .get_sector_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ;
|
||||
frame_resizer_base ->set_used( Utils::round( selected_partition.sectors_used / ( total_length / 500.00 ) ) ) ;
|
||||
|
||||
//set MIN
|
||||
|
@ -158,7 +158,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
|||
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||
spinbutton_size .set_value(
|
||||
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||
Utils::round( Utils::sector_to_unit( selected_partition .get_sector_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||
|
||||
//set values of spinbutton_after
|
||||
Sector after_min = ( ! fs .grow && ! fs .move ) ? next : 0 ;
|
||||
|
@ -189,7 +189,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
|
|||
//calculate length and start of previous
|
||||
if ( t > 0 && partitions[t -1] .type == GParted::TYPE_UNALLOCATED )
|
||||
{
|
||||
previous = partitions[t -1] .get_length() ;
|
||||
previous = partitions[t -1] .get_sector_length() ;
|
||||
START = partitions[t -1] .sector_start ;
|
||||
}
|
||||
else
|
||||
|
@ -197,16 +197,16 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
|
|||
|
||||
//calculate length of next
|
||||
if ( t +1 < partitions .size() && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||
next = partitions[ t +1 ] .get_length() ;
|
||||
next = partitions[ t +1 ] .get_sector_length() ;
|
||||
|
||||
//now we have enough data to calculate some important values..
|
||||
total_length = previous + selected_partition .get_length() + next;
|
||||
total_length = previous + selected_partition .get_sector_length() + next;
|
||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
||||
//calculate proportional length of partition ( in pixels )
|
||||
frame_resizer_base ->set_x_start( Utils::round( previous / ( total_length / 500.00 ) ) ) ;
|
||||
frame_resizer_base ->set_x_end( Utils::round( selected_partition .get_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ;
|
||||
frame_resizer_base ->set_x_end( Utils::round( selected_partition .get_sector_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ;
|
||||
|
||||
//used is a bit different here... we consider start of first logical to end last logical as used space
|
||||
Sector first =0, used =0 ;
|
||||
|
@ -240,7 +240,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
|
|||
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, selected_partition .sector_size, UNIT_MIB ) ), TOTAL_MB ) ;
|
||||
|
||||
spinbutton_size .set_value(
|
||||
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||
Utils::round( Utils::sector_to_unit( selected_partition .get_sector_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||
|
||||
//set values of spinbutton_after
|
||||
if ( first == 0 ) //no logicals
|
||||
|
|
|
@ -91,24 +91,24 @@ void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & part
|
|||
visual_partitions .push_back( visual_partition() ) ;
|
||||
|
||||
visual_partitions .back() .partition = partitions[ t ] ;
|
||||
visual_partitions .back() .fraction = partitions[ t ] .get_length() / static_cast<double>( length ) ;
|
||||
visual_partitions .back() .fraction = partitions[ t ] .get_sector_length() / static_cast<double>( length ) ;
|
||||
|
||||
if ( partitions[ t ] .type == GParted::TYPE_UNALLOCATED || partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||
visual_partitions .back() .fraction_used = -1 ;
|
||||
else if ( partitions[ t ] .sectors_used > 0 )
|
||||
visual_partitions .back() .fraction_used =
|
||||
partitions[ t ] .sectors_used / static_cast<double>( partitions[ t ] .get_length() ) ;
|
||||
partitions[ t ] .sectors_used / static_cast<double>( partitions[ t ] .get_sector_length() ) ;
|
||||
|
||||
visual_partitions .back() .color = partitions[ t ] .color;
|
||||
get_colormap() ->alloc_color( visual_partitions .back() .color );
|
||||
|
||||
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||
set_static_data( partitions[ t ] .logicals,
|
||||
visual_partitions .back() .logicals,
|
||||
partitions[ t ] .get_length() ) ;
|
||||
set_static_data( partitions[ t ] .logicals,
|
||||
visual_partitions .back() .logicals,
|
||||
partitions[ t ] .get_sector_length() ) ;
|
||||
else
|
||||
visual_partitions .back() .pango_layout = create_pango_layout(
|
||||
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_length(), partitions[ t ] .sector_size ) ) ;
|
||||
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_sector_length(), partitions[ t ] .sector_size ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -414,19 +414,19 @@ bool GParted_Core::snap_to_cylinder( const Device & device, Partition & partitio
|
|||
partition .sector_end = device .length -1 ;
|
||||
|
||||
//ok, do some basic checks on the partition..
|
||||
if ( partition .get_length() <= 0 )
|
||||
if ( partition .get_sector_length() <= 0 )
|
||||
{
|
||||
error = String::ucompose( _("A partition cannot have a length of %1 sectors"),
|
||||
partition .get_length() ) ;
|
||||
partition .get_sector_length() ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
if ( partition .get_length() < partition .sectors_used )
|
||||
if ( partition .get_sector_length() < partition .sectors_used )
|
||||
{
|
||||
error = String::ucompose(
|
||||
_("A partition with used sectors (%1) greater than its length (%2) is not valid"),
|
||||
partition .sectors_used,
|
||||
partition .get_length() ) ;
|
||||
partition .get_sector_length() ) ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ void GParted_Core::LP_set_used_sectors( Partition & partition )
|
|||
constraint = ped_file_system_get_resize_constraint( fs ) ;
|
||||
if ( constraint )
|
||||
{
|
||||
partition .Set_Unused( partition .get_length() - constraint ->min_size ) ;
|
||||
partition .Set_Unused( partition .get_sector_length() - constraint ->min_size ) ;
|
||||
|
||||
ped_constraint_destroy( constraint );
|
||||
}
|
||||
|
@ -1364,7 +1364,7 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
|
|||
{
|
||||
PedGeometry *geom = ped_geometry_new( lp_device,
|
||||
new_partition .sector_start,
|
||||
new_partition .get_length() ) ;
|
||||
new_partition .get_sector_length() ) ;
|
||||
|
||||
if ( geom )
|
||||
constraint = ped_constraint_exact( geom ) ;
|
||||
|
@ -1393,8 +1393,8 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
|
|||
String::ucompose( _("start: %1"), new_partition .sector_start ) + "\n" +
|
||||
String::ucompose( _("end: %1"), new_partition .sector_end ) + "\n" +
|
||||
String::ucompose( _("size: %1 (%2)"),
|
||||
new_partition .get_length(),
|
||||
Utils::format_size( new_partition .get_length(), new_partition .sector_size ) ),
|
||||
new_partition .get_sector_length(),
|
||||
Utils::format_size( new_partition .get_sector_length(), new_partition .sector_size ) ),
|
||||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
}
|
||||
|
@ -1543,22 +1543,22 @@ bool GParted_Core::resize_move( const Device & device,
|
|||
if ( partition_new .sector_start == partition_old .sector_start )
|
||||
return resize( partition_old, partition_new, operationdetail ) ;
|
||||
|
||||
if ( partition_new .get_length() == partition_old .get_length() )
|
||||
if ( partition_new .get_sector_length() == partition_old .get_sector_length() )
|
||||
return move( device, partition_old, partition_new, operationdetail ) ;
|
||||
|
||||
Partition temp ;
|
||||
if ( partition_new .get_length() > partition_old .get_length() )
|
||||
if ( partition_new .get_sector_length() > partition_old .get_sector_length() )
|
||||
{
|
||||
//first move, then grow. Since old.length < new.length and new.start is valid, temp is valid.
|
||||
temp = partition_new ;
|
||||
temp .sector_end = temp .sector_start + partition_old .get_length() -1 ;
|
||||
temp .sector_end = temp .sector_start + partition_old .get_sector_length() -1 ;
|
||||
}
|
||||
|
||||
if ( partition_new .get_length() < partition_old .get_length() )
|
||||
if ( partition_new .get_sector_length() < partition_old .get_sector_length() )
|
||||
{
|
||||
//first shrink, then move. Since new.length < old.length and old.start is valid, temp is valid.
|
||||
temp = partition_old ;
|
||||
temp .sector_end = partition_old .sector_start + partition_new .get_length() -1 ;
|
||||
temp .sector_end = partition_old .sector_start + partition_new .get_sector_length() -1 ;
|
||||
}
|
||||
|
||||
temp .strict = true ;
|
||||
|
@ -1576,7 +1576,7 @@ bool GParted_Core::move( const Device & device,
|
|||
const Partition & partition_new,
|
||||
OperationDetail & operationdetail )
|
||||
{
|
||||
if ( partition_old .get_length() != partition_new .get_length() )
|
||||
if ( partition_old .get_sector_length() != partition_new .get_sector_length() )
|
||||
{
|
||||
operationdetail .add_child( OperationDetail(
|
||||
_("moving requires old and new length to be the same"), STATUS_ERROR, FONT_ITALIC ) ) ;
|
||||
|
@ -1703,7 +1703,7 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
|
|||
|
||||
lp_geom = ped_geometry_new( lp_device,
|
||||
partition_old .sector_start,
|
||||
partition_old .get_length() ) ;
|
||||
partition_old .get_sector_length() ) ;
|
||||
if ( lp_geom )
|
||||
{
|
||||
fs = ped_file_system_open( lp_geom );
|
||||
|
@ -1712,7 +1712,7 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
|
|||
lp_geom = NULL ;
|
||||
lp_geom = ped_geometry_new( lp_device,
|
||||
partition_new .sector_start,
|
||||
partition_new .get_length() ) ;
|
||||
partition_new .get_sector_length() ) ;
|
||||
if ( lp_geom )
|
||||
return_value = ped_file_system_resize( fs, lp_geom, NULL ) && commit() ;
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ bool GParted_Core::resize( const Partition & partition_old,
|
|||
{
|
||||
succes = true ;
|
||||
|
||||
if ( succes && partition_new .get_length() < partition_old .get_length() )
|
||||
if ( succes && partition_new .get_sector_length() < partition_old .get_sector_length() )
|
||||
succes = resize_filesystem( partition_old, partition_new, operationdetail ) ;
|
||||
|
||||
if ( succes )
|
||||
|
@ -1782,9 +1782,9 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
} ;
|
||||
Action action = NONE ;
|
||||
|
||||
if ( partition_new .get_length() > partition_old .get_length() )
|
||||
if ( partition_new .get_sector_length() > partition_old .get_sector_length() )
|
||||
action = GROW ;
|
||||
else if ( partition_new .get_length() < partition_old .get_length() )
|
||||
else if ( partition_new .get_sector_length() < partition_old .get_sector_length() )
|
||||
action = SHRINK ;
|
||||
|
||||
if ( partition_new .sector_start > partition_old .sector_start &&
|
||||
|
@ -1828,8 +1828,8 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
|
||||
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
||||
description = String::ucompose( description,
|
||||
Utils::format_size( partition_old .get_length(), partition_old .sector_size ),
|
||||
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ) ;
|
||||
Utils::format_size( partition_old .get_sector_length(), partition_old .sector_size ),
|
||||
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ) ) ;
|
||||
|
||||
operationdetail .add_child( OperationDetail( description ) ) ;
|
||||
|
||||
|
@ -1850,8 +1850,8 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
String::ucompose( _("old start: %1"), partition_old .sector_start ) + "\n" +
|
||||
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
|
||||
String::ucompose( _("old size: %1 (%2)"),
|
||||
partition_old .get_length(),
|
||||
Utils::format_size( partition_old .get_length(), partition_old .sector_size ) ),
|
||||
partition_old .get_sector_length(),
|
||||
Utils::format_size( partition_old .get_sector_length(), partition_old .sector_size ) ),
|
||||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
|||
if ( partition_new .strict || partition_new .strict_start ) {
|
||||
PedGeometry *geom = ped_geometry_new( lp_device,
|
||||
partition_new .sector_start,
|
||||
partition_new .get_length() ) ;
|
||||
partition_new .get_sector_length() ) ;
|
||||
constraint = ped_constraint_exact( geom ) ;
|
||||
}
|
||||
else
|
||||
|
@ -1944,12 +1944,12 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
|
|||
|
||||
if ( ! fill_partition )
|
||||
{
|
||||
if ( partition_new .get_length() < partition_old .get_length() )
|
||||
if ( partition_new .get_sector_length() < partition_old .get_sector_length() )
|
||||
{
|
||||
operationdetail .add_child( OperationDetail( _("shrink file system") ) ) ;
|
||||
action = get_fs( partition_old .filesystem ) .shrink ;
|
||||
}
|
||||
else if ( partition_new .get_length() > partition_old .get_length() )
|
||||
else if ( partition_new .get_sector_length() > partition_old .get_sector_length() )
|
||||
operationdetail .add_child( OperationDetail( _("grow file system") ) ) ;
|
||||
else
|
||||
{
|
||||
|
@ -2577,8 +2577,8 @@ bool GParted_Core::calibrate_partition( Partition & partition, OperationDetail &
|
|||
String::ucompose( _("start: %1"), partition .sector_start ) + "\n" +
|
||||
String::ucompose( _("end: %1"), partition .sector_end ) + "\n" +
|
||||
String::ucompose( _("size: %1 (%2)"),
|
||||
partition .get_length(),
|
||||
Utils::format_size( partition .get_length(), partition .sector_size ) ),
|
||||
partition .get_sector_length(),
|
||||
Utils::format_size( partition .get_sector_length(), partition .sector_size ) ),
|
||||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
succes = true ;
|
||||
|
@ -2606,8 +2606,8 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
|||
String::ucompose( _("requested start: %1"), partition_new .sector_start ) + "\n" +
|
||||
String::ucompose( _("requested end: %1"), partition_new .sector_end ) + "\n" +
|
||||
String::ucompose( _("requested size: %1 (%2)"),
|
||||
partition_new .get_length(),
|
||||
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ),
|
||||
partition_new .get_sector_length(),
|
||||
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ) ),
|
||||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
|
||||
|
@ -2657,8 +2657,8 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
|||
String::ucompose( _("new start: %1"), partition_new .sector_start ) + "\n" +
|
||||
String::ucompose( _("new end: %1"), partition_new .sector_end ) + "\n" +
|
||||
String::ucompose( _("new size: %1 (%2)"),
|
||||
partition_new .get_length(),
|
||||
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ),
|
||||
partition_new .get_sector_length(),
|
||||
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ) ),
|
||||
STATUS_NONE,
|
||||
FONT_ITALIC ) ) ;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void OperationCreate::create_description()
|
|||
description,
|
||||
partition_new .partition_number,
|
||||
Utils::get_filesystem_string( partition_new .filesystem ),
|
||||
Utils::format_size( partition_new .get_length(), partition_new .sector_size ),
|
||||
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ),
|
||||
device .get_path() ) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ void OperationDelete::create_description()
|
|||
description = String::ucompose( _("Delete %1 (%2, %3) from %4"),
|
||||
description,
|
||||
Utils::get_filesystem_string( partition_original .filesystem ),
|
||||
Utils::format_size( partition_original .get_length(), partition_original .sector_size ),
|
||||
Utils::format_size( partition_original .get_sector_length(), partition_original .sector_size ),
|
||||
partition_original .device_path ) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ void OperationResizeMove::create_description()
|
|||
} ;
|
||||
Action action = NONE ;
|
||||
|
||||
if ( partition_new .get_length() > partition_original .get_length() ) {
|
||||
if ( partition_new .get_sector_length() > partition_original .get_sector_length() ) {
|
||||
//Grow partition
|
||||
action = GROW ;
|
||||
if ( partition_new .sector_start > partition_original .sector_start )
|
||||
action = MOVE_RIGHT_GROW ;
|
||||
if ( partition_new .sector_start < partition_original .sector_start )
|
||||
action = MOVE_LEFT_GROW ;
|
||||
} else if ( partition_new .get_length() < partition_original .get_length() ) {
|
||||
} else if ( partition_new .get_sector_length() < partition_original .get_sector_length() ) {
|
||||
//Shrink partition
|
||||
action = SHRINK ;
|
||||
if ( partition_new .sector_start > partition_original .sector_start )
|
||||
|
@ -117,8 +117,8 @@ void OperationResizeMove::create_description()
|
|||
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
||||
description = String::ucompose( description,
|
||||
partition_original .get_path(),
|
||||
Utils::format_size( partition_original .get_length(), partition_original .sector_size ),
|
||||
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ) ;
|
||||
Utils::format_size( partition_original .get_sector_length(), partition_original .sector_size ),
|
||||
Utils::format_size( partition_new .get_sector_length(), partition_new .sector_size ) ) ;
|
||||
}
|
||||
|
||||
void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & partitions )
|
||||
|
|
|
@ -80,19 +80,19 @@ void Partition::Set( const Glib::ustring & device_path,
|
|||
|
||||
void Partition::Set_Unused( Sector sectors_unused )
|
||||
{
|
||||
if ( sectors_unused < get_length() )
|
||||
if ( sectors_unused < get_sector_length() )
|
||||
{
|
||||
this ->sectors_unused = sectors_unused ;
|
||||
this ->sectors_used = ( sectors_unused == -1 ) ? -1 : get_length() - sectors_unused ;
|
||||
this ->sectors_used = ( sectors_unused == -1 ) ? -1 : get_sector_length() - sectors_unused ;
|
||||
}
|
||||
}
|
||||
|
||||
void Partition::set_used( Sector sectors_used )
|
||||
{
|
||||
if ( sectors_used < get_length() )
|
||||
if ( sectors_used < get_sector_length() )
|
||||
{
|
||||
this ->sectors_used = sectors_used ;
|
||||
this ->sectors_unused = ( sectors_used == -1 ) ? -1 : get_length() - sectors_used ;
|
||||
this ->sectors_unused = ( sectors_used == -1 ) ? -1 : get_sector_length() - sectors_used ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,13 +156,13 @@ void Partition::add_paths( const std::vector<Glib::ustring> & paths, bool clear_
|
|||
|
||||
Byte_Value Partition::get_byte_length() const
|
||||
{
|
||||
if ( get_length() >= 0 )
|
||||
return get_length() * sector_size ;
|
||||
if ( get_sector_length() >= 0 )
|
||||
return get_sector_length() * sector_size ;
|
||||
else
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
Sector Partition::get_length() const
|
||||
Sector Partition::get_sector_length() const
|
||||
{
|
||||
if ( sector_start >= 0 && sector_end >= 0 )
|
||||
return sector_end - sector_start + 1 ;
|
||||
|
|
|
@ -187,7 +187,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
|
|||
treerow[ treeview_detail_columns .label ] = partition .label ;
|
||||
|
||||
//size
|
||||
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length(), partition .sector_size ) ;
|
||||
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_sector_length(), partition .sector_size ) ;
|
||||
|
||||
//used
|
||||
treerow[ treeview_detail_columns .used ] =
|
||||
|
|
|
@ -1582,7 +1582,7 @@ void Win_GParted::activate_delete()
|
|||
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3)"),
|
||||
selected_partition .get_path(),
|
||||
Utils::get_filesystem_string( selected_partition .filesystem ),
|
||||
Utils::format_size( selected_partition .get_length(), selected_partition .sector_size ) ) );
|
||||
Utils::format_size( selected_partition .get_sector_length(), selected_partition .sector_size ) ) );
|
||||
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
|
|||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
|
||||
return ! execute_command( str_temp, operationdetail ) ;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ bool ext3::resize( const Partition & partition_new, OperationDetail & operationd
|
|||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
|
||||
return ! execute_command( str_temp, operationdetail ) ;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ bool ext4::resize( const Partition & partition_new, OperationDetail & operationd
|
|||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||
|
||||
return ! execute_command( str_temp, operationdetail ) ;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
|
|||
{
|
||||
str_temp += " -s " ;
|
||||
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||
partition_new .get_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||
}
|
||||
|
||||
//simulation..
|
||||
|
|
|
@ -125,7 +125,7 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat
|
|||
{
|
||||
str_temp += " -s " ;
|
||||
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||
partition_new .get_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||
partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||
}
|
||||
|
||||
exit_status = execute_command( str_temp, operationdetail ) ;
|
||||
|
|
Loading…
Reference in New Issue