Replace default sector size with appropriate sector size
This change is in preparation for supporting sectors sizes > 512 bytes.
This commit is contained in:
parent
896dab7192
commit
5d2bf2ec5d
|
@ -103,11 +103,11 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
copied_partition .sectors_used, copied_partition .sector_size, UNIT_MIB ) / (TOTAL_MB/500.00) ) ) ;
|
copied_partition .sectors_used, copied_partition .sector_size, UNIT_MIB ) / (TOTAL_MB/500.00) ) ) ;
|
||||||
|
|
||||||
if ( fs .grow )
|
if ( fs .grow )
|
||||||
fs .MAX = ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBI_FACTOR) ) ? (TOTAL_MB * MEBI_FACTOR) : fs .MAX - (BUF * DEFAULT_SECTOR_SIZE) ;
|
fs .MAX = ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBI_FACTOR) ) ? (TOTAL_MB * MEBI_FACTOR) : fs .MAX - (BUF * selected_partition .sector_size) ;
|
||||||
else
|
else
|
||||||
fs .MAX = copied_partition .get_length() * copied_partition .sector_size ;
|
fs .MAX = copied_partition .get_length() * copied_partition .sector_size ;
|
||||||
|
|
||||||
|
//TODO: Since BUF is the cylinder size of the current device, the cylinder size of the copied device could differ for small disks
|
||||||
if ( fs .filesystem == GParted::FS_XFS ) //bit hackisch, but most effective, since it's a unique situation
|
if ( fs .filesystem == GParted::FS_XFS ) //bit hackisch, but most effective, since it's a unique situation
|
||||||
fs .MIN = ( copied_partition .sectors_used + (BUF * 2) ) * copied_partition .sector_size;
|
fs .MIN = ( copied_partition .sectors_used + (BUF * 2) ) * copied_partition .sector_size;
|
||||||
else
|
else
|
||||||
|
@ -115,17 +115,17 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
|
|
||||||
GRIP = true ;
|
GRIP = true ;
|
||||||
//set values of spinbutton_before
|
//set values of spinbutton_before
|
||||||
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_before .set_value( 0 ) ;
|
spinbutton_before .set_value( 0 ) ;
|
||||||
|
|
||||||
//set values of spinbutton_size
|
//set values of spinbutton_size
|
||||||
spinbutton_size .set_range(
|
spinbutton_size .set_range(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_size .set_value( COPIED_LENGTH_MB ) ;
|
spinbutton_size .set_value( COPIED_LENGTH_MB ) ;
|
||||||
|
|
||||||
//set values of spinbutton_after
|
//set values of spinbutton_after
|
||||||
spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
|
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
|
||||||
GRIP = false ;
|
GRIP = false ;
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text(
|
Set_MinMax_Text(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
|
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
|
||||||
this ->selected_partition = copied_partition ;
|
this ->selected_partition = copied_partition ;
|
||||||
|
|
|
@ -136,7 +136,7 @@ void Dialog_Partition_Info::init_drawingarea()
|
||||||
|
|
||||||
//set text of pangolayout
|
//set text of pangolayout
|
||||||
pango_layout = drawingarea .create_pango_layout(
|
pango_layout = drawingarea .create_pango_layout(
|
||||||
partition .get_path() + "\n" + Utils::format_size( partition .get_length(), DEFAULT_SECTOR_SIZE ) ) ;
|
partition .get_path() + "\n" + Utils::format_size( partition .get_length(), partition .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog_Partition_Info::Display_Info()
|
void Dialog_Partition_Info::Display_Info()
|
||||||
|
@ -163,7 +163,7 @@ void Dialog_Partition_Info::Display_Info()
|
||||||
0, 1,
|
0, 1,
|
||||||
top, bottom,
|
top, bottom,
|
||||||
Gtk::FILL) ;
|
Gtk::FILL) ;
|
||||||
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_length(), DEFAULT_SECTOR_SIZE ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_length(), partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||||
1, 2,
|
1, 2,
|
||||||
top++, bottom++,
|
top++, bottom++,
|
||||||
Gtk::FILL ) ;
|
Gtk::FILL ) ;
|
||||||
|
@ -179,7 +179,7 @@ void Dialog_Partition_Info::Display_Info()
|
||||||
0, 1,
|
0, 1,
|
||||||
top, bottom,
|
top, bottom,
|
||||||
Gtk::FILL ) ;
|
Gtk::FILL ) ;
|
||||||
table ->attach( * Utils::mk_label( Utils::format_size( partition .sectors_used, DEFAULT_SECTOR_SIZE ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
table ->attach( * Utils::mk_label( Utils::format_size( partition .sectors_used, partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||||
1, 2,
|
1, 2,
|
||||||
top, bottom,
|
top, bottom,
|
||||||
Gtk::FILL ) ;
|
Gtk::FILL ) ;
|
||||||
|
@ -193,7 +193,7 @@ void Dialog_Partition_Info::Display_Info()
|
||||||
0, 1,
|
0, 1,
|
||||||
top, bottom,
|
top, bottom,
|
||||||
Gtk::FILL ) ;
|
Gtk::FILL ) ;
|
||||||
table ->attach( * Utils::mk_label( Utils::format_size( partition .sectors_unused, DEFAULT_SECTOR_SIZE ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
table ->attach( * Utils::mk_label( Utils::format_size( partition .sectors_unused, partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
|
||||||
1, 2,
|
1, 2,
|
||||||
top, bottom,
|
top, bottom,
|
||||||
Gtk::FILL ) ;
|
Gtk::FILL ) ;
|
||||||
|
|
|
@ -142,7 +142,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
|
||||||
//set some widely used values...
|
//set some widely used values...
|
||||||
START = partition.sector_start ;
|
START = partition.sector_start ;
|
||||||
total_length = partition.sector_end - partition.sector_start ;
|
total_length = partition.sector_end - partition.sector_start ;
|
||||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ;
|
TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), this ->selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
//set first enabled file system
|
//set first enabled file system
|
||||||
|
@ -151,7 +151,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
|
||||||
|
|
||||||
//set spinbuttons initial values
|
//set spinbuttons initial values
|
||||||
spinbutton_after .set_value( 0 ) ;
|
spinbutton_after .set_value( 0 ) ;
|
||||||
spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_before .set_value( 0 ) ;
|
spinbutton_before .set_value( 0 ) ;
|
||||||
|
|
||||||
//euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager)
|
//euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager)
|
||||||
|
@ -253,14 +253,14 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
||||||
|
|
||||||
if ( checkbutton_round_to_cylinders .get_active() )
|
if ( checkbutton_round_to_cylinders .get_active() )
|
||||||
{
|
{
|
||||||
if ( (fs .MIN / DEFAULT_SECTOR_SIZE) < cylinder_size )
|
if ( (fs .MIN / selected_partition .sector_size) < cylinder_size )
|
||||||
fs .MIN = cylinder_size * DEFAULT_SECTOR_SIZE ;
|
fs .MIN = cylinder_size * selected_partition .sector_size ;
|
||||||
}
|
}
|
||||||
else if ( (fs .MIN / DEFAULT_SECTOR_SIZE) < MEBIBYTE )
|
else if ( fs .MIN < MEBI_FACTOR )
|
||||||
fs .MIN = MEBI_FACTOR ;
|
fs .MIN = MEBI_FACTOR ;
|
||||||
|
|
||||||
if ( selected_partition .get_length() < (fs .MIN /DEFAULT_SECTOR_SIZE) )
|
if ( selected_partition .get_length() < (fs .MIN / selected_partition .sector_size) )
|
||||||
fs .MIN = selected_partition .get_length() * DEFAULT_SECTOR_SIZE ;
|
fs .MIN = selected_partition .get_length() * selected_partition .sector_size ;
|
||||||
|
|
||||||
fs .MAX = ( fs .MAX && ( fs .MAX < (TOTAL_MB * MEBI_FACTOR) ) ) ? fs .MAX : (TOTAL_MB * MEBI_FACTOR) ;
|
fs .MAX = ( fs .MAX && ( fs .MAX < (TOTAL_MB * MEBI_FACTOR) ) ) ? fs .MAX : (TOTAL_MB * MEBI_FACTOR) ;
|
||||||
|
|
||||||
|
@ -269,17 +269,17 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
||||||
|
|
||||||
//set new spinbutton ranges
|
//set new spinbutton ranges
|
||||||
spinbutton_before .set_range(
|
spinbutton_before .set_range(
|
||||||
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_size .set_range(
|
spinbutton_size .set_range(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_after .set_range(
|
spinbutton_after .set_range(
|
||||||
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text(
|
Set_MinMax_Text(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set fitting resizer colors
|
//set fitting resizer colors
|
||||||
|
@ -306,7 +306,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
||||||
Gtk::Menu_Helpers::MenuElem( Utils::get_filesystem_string( FILESYSTEMS[ t ] .filesystem ) ) ) ;
|
Gtk::Menu_Helpers::MenuElem( Utils::get_filesystem_string( FILESYSTEMS[ t ] .filesystem ) ) ) ;
|
||||||
menu_filesystem .items() .back() .set_sensitive(
|
menu_filesystem .items() .back() .set_sensitive(
|
||||||
! only_unformatted && FILESYSTEMS[ t ] .create &&
|
! only_unformatted && FILESYSTEMS[ t ] .create &&
|
||||||
this ->selected_partition .get_length() >= (FILESYSTEMS[ t ] .MIN / DEFAULT_SECTOR_SIZE) ) ;
|
this ->selected_partition .get_length() >= (FILESYSTEMS[ t ] .MIN / this ->selected_partition .sector_size) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unformatted is always available
|
//unformatted is always available
|
||||||
|
|
|
@ -104,7 +104,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
||||||
next = partitions[t +1] .get_length() ;
|
next = partitions[t +1] .get_length() ;
|
||||||
|
|
||||||
total_length = previous + selected_partition .get_length() + next;
|
total_length = previous + selected_partition .get_length() + next;
|
||||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ;
|
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||||
|
|
||||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
|
@ -118,29 +118,29 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
||||||
if ( fs .shrink )
|
if ( fs .shrink )
|
||||||
{
|
{
|
||||||
//since some file systems have lower limits we need to check for this
|
//since some file systems have lower limits we need to check for this
|
||||||
if ( selected_partition .sectors_used > (fs .MIN / DEFAULT_SECTOR_SIZE) )
|
if ( selected_partition .sectors_used > (fs .MIN / selected_partition .sector_size) )
|
||||||
fs .MIN = selected_partition .sectors_used * DEFAULT_SECTOR_SIZE ;
|
fs .MIN = selected_partition .sectors_used * selected_partition .sector_size ;
|
||||||
|
|
||||||
//if fs. MIN is 0 here (means used == 0 as well) it's safe to have BUF / 2
|
//if fs. MIN is 0 here (means used == 0 as well) it's safe to have BUF / 2
|
||||||
fs .MIN += fs .MIN ? (BUF * DEFAULT_SECTOR_SIZE) : (BUF/2 * DEFAULT_SECTOR_SIZE) ;
|
fs .MIN += fs .MIN ? (BUF * selected_partition .sector_size) : (BUF/2 * selected_partition .sector_size) ;
|
||||||
|
|
||||||
//in certain (rare) cases fs .MIN is (now) larger than 'selected_partition'..
|
//in certain (rare) cases fs .MIN is (now) larger than 'selected_partition'..
|
||||||
if ( (fs .MIN / DEFAULT_SECTOR_SIZE) > selected_partition .get_length() )
|
if ( (fs .MIN / selected_partition .sector_size) > selected_partition .get_length() )
|
||||||
fs .MIN = selected_partition .get_length() * DEFAULT_SECTOR_SIZE ;
|
fs .MIN = selected_partition .get_length() * selected_partition .sector_size ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fs .MIN = selected_partition .get_length() * DEFAULT_SECTOR_SIZE ;
|
fs .MIN = selected_partition .get_length() * selected_partition .sector_size ;
|
||||||
|
|
||||||
//set MAX
|
//set MAX
|
||||||
if ( fs .grow )
|
if ( fs .grow )
|
||||||
{
|
{
|
||||||
if ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBI_FACTOR) )
|
if ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBI_FACTOR) )
|
||||||
fs .MAX = TOTAL_MB * MEBI_FACTOR ;
|
fs .MAX = TOTAL_MB * MEBI_FACTOR ;
|
||||||
else
|
else
|
||||||
fs .MAX -= (BUF/2 * DEFAULT_SECTOR_SIZE) ;
|
fs .MAX -= (BUF/2 * selected_partition .sector_size) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fs .MAX = selected_partition .get_length() * DEFAULT_SECTOR_SIZE ;
|
fs .MAX = selected_partition .get_length() * selected_partition .sector_size ;
|
||||||
|
|
||||||
|
|
||||||
//set values of spinbutton_before
|
//set values of spinbutton_before
|
||||||
|
@ -148,33 +148,33 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
|
||||||
{
|
{
|
||||||
spinbutton_before .set_range(
|
spinbutton_before .set_range(
|
||||||
0,
|
0,
|
||||||
TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_before .set_value(
|
spinbutton_before .set_value(
|
||||||
Utils::round( Utils::sector_to_unit( previous, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( previous, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set values of spinbutton_size
|
//set values of spinbutton_size
|
||||||
spinbutton_size .set_range(
|
spinbutton_size .set_range(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_size .set_value(
|
spinbutton_size .set_value(
|
||||||
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set values of spinbutton_after
|
//set values of spinbutton_after
|
||||||
Sector after_min = ( ! fs .grow && ! fs .move ) ? next : 0 ;
|
Sector after_min = ( ! fs .grow && ! fs .move ) ? next : 0 ;
|
||||||
spinbutton_after .set_range(
|
spinbutton_after .set_range(
|
||||||
Utils::round( Utils::sector_to_unit( after_min, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( after_min, selected_partition .sector_size, UNIT_MIB ) ),
|
||||||
TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
spinbutton_after .set_value(
|
spinbutton_after .set_value(
|
||||||
Utils::round( Utils::sector_to_unit( next, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( next, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBI_FACTOR) ),
|
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBI_FACTOR) ),
|
||||||
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBI_FACTOR) ) ) ;
|
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBI_FACTOR) ) ) ;
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text(
|
Set_MinMax_Text(
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Utils::round( Utils::sector_to_unit( fs .MIN, 1 /* Byte */, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( fs .MAX, 1 /* Byte */, UNIT_MIB ) ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
|
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
|
||||||
|
@ -201,7 +201,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
|
||||||
|
|
||||||
//now we have enough data to calculate some important values..
|
//now we have enough data to calculate some important values..
|
||||||
total_length = previous + selected_partition .get_length() + next;
|
total_length = previous + selected_partition .get_length() + next;
|
||||||
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ;
|
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ;
|
||||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
//calculate proportional length of partition ( in pixels )
|
//calculate proportional length of partition ( in pixels )
|
||||||
|
@ -227,34 +227,34 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
|
||||||
|
|
||||||
//set values of spinbutton_before (we assume there is no fixed start.)
|
//set values of spinbutton_before (we assume there is no fixed start.)
|
||||||
if ( first == 0 ) //no logicals
|
if ( first == 0 ) //no logicals
|
||||||
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
else
|
else
|
||||||
spinbutton_before .set_range( 0, Utils::round( Utils::sector_to_unit( first - START, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_before .set_range( 0, Utils::round( Utils::sector_to_unit( first - START, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set values of spinbutton_size
|
//set values of spinbutton_size
|
||||||
if ( first == 0 ) //no logicals
|
if ( first == 0 ) //no logicals
|
||||||
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ), TOTAL_MB ) ;
|
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, selected_partition .sector_size, UNIT_MIB ) ), TOTAL_MB ) ;
|
||||||
else
|
else
|
||||||
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ), TOTAL_MB ) ;
|
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, selected_partition .sector_size, UNIT_MIB ) ), TOTAL_MB ) ;
|
||||||
|
|
||||||
spinbutton_size .set_value(
|
spinbutton_size .set_value(
|
||||||
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set values of spinbutton_after
|
//set values of spinbutton_after
|
||||||
if ( first == 0 ) //no logicals
|
if ( first == 0 ) //no logicals
|
||||||
spinbutton_after .set_range(
|
spinbutton_after .set_range(
|
||||||
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
else
|
else
|
||||||
spinbutton_after .set_range(
|
spinbutton_after .set_range(
|
||||||
0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text( Utils::round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ),
|
Set_MinMax_Text( Utils::round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, selected_partition .sector_size, UNIT_MIB ) ),
|
||||||
Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ) ;
|
Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, UNIT_MIB ) ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -108,7 +108,7 @@ void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & part
|
||||||
partitions[ t ] .get_length() ) ;
|
partitions[ t ] .get_length() ) ;
|
||||||
else
|
else
|
||||||
visual_partitions .back() .pango_layout = create_pango_layout(
|
visual_partitions .back() .pango_layout = create_pango_layout(
|
||||||
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_length(), DEFAULT_SECTOR_SIZE ) ) ;
|
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_length(), partitions[ t ] .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
|
||||||
|
|
||||||
copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
|
copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
|
||||||
operation ->partition_new,
|
operation ->partition_new,
|
||||||
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length() * DEFAULT_SECTOR_SIZE,
|
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length() * static_cast<OperationCopy*>( operation ) ->partition_copied .sector_size,
|
||||||
operation ->operation_detail ) ;
|
operation ->operation_detail ) ;
|
||||||
break ;
|
break ;
|
||||||
case OPERATION_LABEL_PARTITION:
|
case OPERATION_LABEL_PARTITION:
|
||||||
|
@ -1307,7 +1307,7 @@ bool GParted_Core::create( const Device & device, Partition & new_partition, Ope
|
||||||
{
|
{
|
||||||
return create_partition( new_partition, operationdetail ) ;
|
return create_partition( new_partition, operationdetail ) ;
|
||||||
}
|
}
|
||||||
else if ( create_partition( new_partition, operationdetail, (get_fs( new_partition .filesystem ) .MIN / DEFAULT_SECTOR_SIZE) ) )
|
else if ( create_partition( new_partition, operationdetail, (get_fs( new_partition .filesystem ) .MIN / new_partition .sector_size) ) )
|
||||||
{
|
{
|
||||||
if ( new_partition .filesystem == GParted::FS_UNFORMATTED )
|
if ( new_partition .filesystem == GParted::FS_UNFORMATTED )
|
||||||
return true ;
|
return true ;
|
||||||
|
@ -1394,7 +1394,7 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
|
||||||
String::ucompose( _("end: %1"), new_partition .sector_end ) + "\n" +
|
String::ucompose( _("end: %1"), new_partition .sector_end ) + "\n" +
|
||||||
String::ucompose( _("size: %1 (%2)"),
|
String::ucompose( _("size: %1 (%2)"),
|
||||||
new_partition .get_length(),
|
new_partition .get_length(),
|
||||||
Utils::format_size( new_partition .get_length(), DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( new_partition .get_length(), new_partition .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
}
|
}
|
||||||
|
@ -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 )
|
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
||||||
description = String::ucompose( description,
|
description = String::ucompose( description,
|
||||||
Utils::format_size( partition_old .get_length(), DEFAULT_SECTOR_SIZE ),
|
Utils::format_size( partition_old .get_length(), partition_old .sector_size ),
|
||||||
Utils::format_size( partition_new .get_length(), DEFAULT_SECTOR_SIZE ) ) ;
|
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ) ;
|
||||||
|
|
||||||
operationdetail .add_child( OperationDetail( description ) ) ;
|
operationdetail .add_child( OperationDetail( description ) ) ;
|
||||||
|
|
||||||
|
@ -1851,7 +1851,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
||||||
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
|
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
|
||||||
String::ucompose( _("old size: %1 (%2)"),
|
String::ucompose( _("old size: %1 (%2)"),
|
||||||
partition_old .get_length(),
|
partition_old .get_length(),
|
||||||
Utils::format_size( partition_old .get_length(), DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( partition_old .get_length(), partition_old .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
|
|
||||||
|
@ -1912,7 +1912,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
|
||||||
String::ucompose( _("new end: %1"), new_end ) + "\n" +
|
String::ucompose( _("new end: %1"), new_end ) + "\n" +
|
||||||
String::ucompose( _("new size: %1 (%2)"),
|
String::ucompose( _("new size: %1 (%2)"),
|
||||||
new_end - new_start + 1,
|
new_end - new_start + 1,
|
||||||
Utils::format_size( new_end - new_start + 1, DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( new_end - new_start + 1, partition_new .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
|
|
||||||
|
@ -2026,7 +2026,7 @@ bool GParted_Core::copy( const Partition & partition_src,
|
||||||
if ( partition_dst .status == GParted::STAT_COPY )
|
if ( partition_dst .status == GParted::STAT_COPY )
|
||||||
{
|
{
|
||||||
/* Handle situation where src sector size is smaller than dst sector size and an additional partial dst sector is required. */
|
/* Handle situation where src sector size is smaller than dst sector size and an additional partial dst sector is required. */
|
||||||
succes = create_partition( partition_dst, operationdetail, ( (min_size + (DEFAULT_SECTOR_SIZE - 1)) / DEFAULT_SECTOR_SIZE ) ) ;
|
succes = create_partition( partition_dst, operationdetail, ( (min_size + (partition_dst .sector_size - 1)) / partition_dst .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( succes && set_partition_type( partition_dst, operationdetail ) )
|
if ( succes && set_partition_type( partition_dst, operationdetail ) )
|
||||||
|
@ -2096,7 +2096,7 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
|
||||||
partition_dst .sector_start,
|
partition_dst .sector_start,
|
||||||
partition_src .sector_size,
|
partition_src .sector_size,
|
||||||
partition_dst .sector_size,
|
partition_dst .sector_size,
|
||||||
partition_src .get_length() * DEFAULT_SECTOR_SIZE,
|
partition_src .get_length() * partition_src .sector_size,
|
||||||
operationdetail,
|
operationdetail,
|
||||||
readonly,
|
readonly,
|
||||||
dummy ) ;
|
dummy ) ;
|
||||||
|
@ -2113,7 +2113,7 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
|
||||||
partition_dst .sector_start,
|
partition_dst .sector_start,
|
||||||
partition_src .sector_size,
|
partition_src .sector_size,
|
||||||
partition_dst .sector_size,
|
partition_dst .sector_size,
|
||||||
partition_src .get_length() * DEFAULT_SECTOR_SIZE,
|
partition_src .get_length() * partition_src .sector_size,
|
||||||
operationdetail,
|
operationdetail,
|
||||||
false,
|
false,
|
||||||
total_done ) ;
|
total_done ) ;
|
||||||
|
@ -2239,13 +2239,13 @@ void GParted_Core::rollback_transaction( const Partition & partition_src,
|
||||||
|
|
||||||
if ( partition_dst .sector_start > partition_src .sector_start )
|
if ( partition_dst .sector_start > partition_src .sector_start )
|
||||||
{
|
{
|
||||||
temp_src .sector_start = temp_src .sector_end - ( (total_done / DEFAULT_SECTOR_SIZE) - 1 ) ;
|
temp_src .sector_start = temp_src .sector_end - ( (total_done / temp_src .sector_size) - 1 ) ;
|
||||||
temp_dst .sector_start = temp_dst .sector_end - ( (total_done / DEFAULT_SECTOR_SIZE) - 1 ) ;
|
temp_dst .sector_start = temp_dst .sector_end - ( (total_done / temp_dst .sector_size) - 1 ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp_src .sector_end = temp_src .sector_start + ( (total_done / DEFAULT_SECTOR_SIZE) - 1 ) ;
|
temp_src .sector_end = temp_src .sector_start + ( (total_done / temp_src .sector_size) - 1 ) ;
|
||||||
temp_dst .sector_end = temp_dst .sector_start + ( (total_done / DEFAULT_SECTOR_SIZE) - 1 ) ;
|
temp_dst .sector_end = temp_dst .sector_start + ( (total_done / temp_dst .sector_size) - 1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//and copy it back (NOTE the reversed dst and src)
|
//and copy it back (NOTE the reversed dst and src)
|
||||||
|
@ -2578,7 +2578,7 @@ bool GParted_Core::calibrate_partition( Partition & partition, OperationDetail &
|
||||||
String::ucompose( _("end: %1"), partition .sector_end ) + "\n" +
|
String::ucompose( _("end: %1"), partition .sector_end ) + "\n" +
|
||||||
String::ucompose( _("size: %1 (%2)"),
|
String::ucompose( _("size: %1 (%2)"),
|
||||||
partition .get_length(),
|
partition .get_length(),
|
||||||
Utils::format_size( partition .get_length(), DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( partition .get_length(), partition .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
succes = true ;
|
succes = true ;
|
||||||
|
@ -2607,7 +2607,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
||||||
String::ucompose( _("requested end: %1"), partition_new .sector_end ) + "\n" +
|
String::ucompose( _("requested end: %1"), partition_new .sector_end ) + "\n" +
|
||||||
String::ucompose( _("requested size: %1 (%2)"),
|
String::ucompose( _("requested size: %1 (%2)"),
|
||||||
partition_new .get_length(),
|
partition_new .get_length(),
|
||||||
Utils::format_size( partition_new .get_length(), DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
|
|
||||||
|
@ -2658,7 +2658,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
|
||||||
String::ucompose( _("new end: %1"), partition_new .sector_end ) + "\n" +
|
String::ucompose( _("new end: %1"), partition_new .sector_end ) + "\n" +
|
||||||
String::ucompose( _("new size: %1 (%2)"),
|
String::ucompose( _("new size: %1 (%2)"),
|
||||||
partition_new .get_length(),
|
partition_new .get_length(),
|
||||||
Utils::format_size( partition_new .get_length(), DEFAULT_SECTOR_SIZE ) ),
|
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ),
|
||||||
STATUS_NONE,
|
STATUS_NONE,
|
||||||
FONT_ITALIC ) ) ;
|
FONT_ITALIC ) ) ;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ void OperationCopy::create_description()
|
||||||
description = String::ucompose( _("Copy %1 to %2 (start at %3)"),
|
description = String::ucompose( _("Copy %1 to %2 (start at %3)"),
|
||||||
partition_copied .get_path(),
|
partition_copied .get_path(),
|
||||||
device .get_path(),
|
device .get_path(),
|
||||||
Utils::format_size( partition_new .sector_start, DEFAULT_SECTOR_SIZE ) ) ;
|
Utils::format_size( partition_new .sector_start, partition_new .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,7 @@ void OperationCreate::create_description()
|
||||||
description,
|
description,
|
||||||
partition_new .partition_number,
|
partition_new .partition_number,
|
||||||
Utils::get_filesystem_string( partition_new .filesystem ),
|
Utils::get_filesystem_string( partition_new .filesystem ),
|
||||||
Utils::format_size( partition_new .get_length(), DEFAULT_SECTOR_SIZE ),
|
Utils::format_size( partition_new .get_length(), partition_new .sector_size ),
|
||||||
device .get_path() ) ;
|
device .get_path() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void OperationDelete::create_description()
|
||||||
description = String::ucompose( _("Delete %1 (%2, %3) from %4"),
|
description = String::ucompose( _("Delete %1 (%2, %3) from %4"),
|
||||||
description,
|
description,
|
||||||
Utils::get_filesystem_string( partition_original .filesystem ),
|
Utils::get_filesystem_string( partition_original .filesystem ),
|
||||||
Utils::format_size( partition_original .get_length(), DEFAULT_SECTOR_SIZE ),
|
Utils::format_size( partition_original .get_length(), partition_original .sector_size ),
|
||||||
partition_original .device_path ) ;
|
partition_original .device_path ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,8 @@ void OperationResizeMove::create_description()
|
||||||
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
||||||
description = String::ucompose( description,
|
description = String::ucompose( description,
|
||||||
partition_original .get_path(),
|
partition_original .get_path(),
|
||||||
Utils::format_size( partition_original .get_length(), DEFAULT_SECTOR_SIZE ),
|
Utils::format_size( partition_original .get_length(), partition_original .sector_size ),
|
||||||
Utils::format_size( partition_new .get_length(), DEFAULT_SECTOR_SIZE ) ) ;
|
Utils::format_size( partition_new .get_length(), partition_new .sector_size ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & partitions )
|
void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & partitions )
|
||||||
|
|
|
@ -187,15 +187,15 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
|
||||||
treerow[ treeview_detail_columns .label ] = partition .label ;
|
treerow[ treeview_detail_columns .label ] = partition .label ;
|
||||||
|
|
||||||
//size
|
//size
|
||||||
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length(), DEFAULT_SECTOR_SIZE ) ;
|
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length(), partition .sector_size ) ;
|
||||||
|
|
||||||
//used
|
//used
|
||||||
treerow[ treeview_detail_columns .used ] =
|
treerow[ treeview_detail_columns .used ] =
|
||||||
partition .sectors_used == -1 ? "---" : Utils::format_size( partition .sectors_used, DEFAULT_SECTOR_SIZE ) ;
|
partition .sectors_used == -1 ? "---" : Utils::format_size( partition .sectors_used, partition .sector_size ) ;
|
||||||
|
|
||||||
//unused
|
//unused
|
||||||
treerow[ treeview_detail_columns .unused ] =
|
treerow[ treeview_detail_columns .unused ] =
|
||||||
partition .sectors_unused == -1 ? "---" : Utils::format_size( partition .sectors_unused, DEFAULT_SECTOR_SIZE ) ;
|
partition .sectors_unused == -1 ? "---" : Utils::format_size( partition .sectors_unused, partition .sector_size ) ;
|
||||||
|
|
||||||
//flags
|
//flags
|
||||||
treerow[ treeview_detail_columns .flags ] =
|
treerow[ treeview_detail_columns .flags ] =
|
||||||
|
|
|
@ -565,12 +565,12 @@ void Win_GParted::refresh_combo_devices()
|
||||||
treerow[ treeview_devices_columns .icon ] =
|
treerow[ treeview_devices_columns .icon ] =
|
||||||
render_icon( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
render_icon( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ;
|
||||||
treerow[ treeview_devices_columns .device ] = devices[ i ] .get_path() ;
|
treerow[ treeview_devices_columns .device ] = devices[ i ] .get_path() ;
|
||||||
treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length, DEFAULT_SECTOR_SIZE ) + ")" ;
|
treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ;
|
||||||
|
|
||||||
//devices submenu....
|
//devices submenu....
|
||||||
hbox = manage( new Gtk::HBox() ) ;
|
hbox = manage( new Gtk::HBox() ) ;
|
||||||
hbox ->pack_start( * Utils::mk_label( devices[ i ] .get_path() ), Gtk::PACK_SHRINK ) ;
|
hbox ->pack_start( * Utils::mk_label( devices[ i ] .get_path() ), Gtk::PACK_SHRINK ) ;
|
||||||
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, DEFAULT_SECTOR_SIZE ) + ")",
|
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")",
|
||||||
true,
|
true,
|
||||||
Gtk::ALIGN_RIGHT ),
|
Gtk::ALIGN_RIGHT ),
|
||||||
Gtk::PACK_EXPAND_WIDGET ) ;
|
Gtk::PACK_EXPAND_WIDGET ) ;
|
||||||
|
@ -645,7 +645,7 @@ void Win_GParted::Fill_Label_Device_Info( bool clear )
|
||||||
|
|
||||||
//global info...
|
//global info...
|
||||||
device_info[ t++ ] ->set_text( devices[ current_device ] .model ) ;
|
device_info[ t++ ] ->set_text( devices[ current_device ] .model ) ;
|
||||||
device_info[ t++ ] ->set_text( Utils::format_size( devices[ current_device ] .length, DEFAULT_SECTOR_SIZE ) ) ;
|
device_info[ t++ ] ->set_text( Utils::format_size( devices[ current_device ] .length, devices[ current_device ] .sector_size ) ) ;
|
||||||
device_info[ t++ ] ->set_text( Glib::build_path( "\n", devices[ current_device ] .get_paths() ) ) ;
|
device_info[ t++ ] ->set_text( Glib::build_path( "\n", devices[ current_device ] .get_paths() ) ) ;
|
||||||
|
|
||||||
//detailed info
|
//detailed info
|
||||||
|
@ -1582,7 +1582,7 @@ void Win_GParted::activate_delete()
|
||||||
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3)"),
|
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3)"),
|
||||||
selected_partition .get_path(),
|
selected_partition .get_path(),
|
||||||
Utils::get_filesystem_string( selected_partition .filesystem ),
|
Utils::get_filesystem_string( selected_partition .filesystem ),
|
||||||
Utils::format_size( selected_partition .get_length(), DEFAULT_SECTOR_SIZE ) ) );
|
Utils::format_size( selected_partition .get_length(), selected_partition .sector_size ) ) );
|
||||||
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||||
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
|
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
|
||||||
|
|
||||||
|
@ -1641,8 +1641,8 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
||||||
//check for some limits...
|
//check for some limits...
|
||||||
fs = gparted_core .get_fs( new_fs ) ;
|
fs = gparted_core .get_fs( new_fs ) ;
|
||||||
|
|
||||||
if ( ( selected_partition .get_length() < (fs .MIN / DEFAULT_SECTOR_SIZE) ) ||
|
if ( ( selected_partition .get_length() < (fs .MIN / selected_partition .sector_size) ) ||
|
||||||
( fs .MAX && selected_partition .get_length() > (fs .MAX / DEFAULT_SECTOR_SIZE) ) )
|
( fs .MAX && selected_partition .get_length() > (fs .MAX / selected_partition .sector_size) ) )
|
||||||
{
|
{
|
||||||
Gtk::MessageDialog dialog( *this,
|
Gtk::MessageDialog dialog( *this,
|
||||||
String::ucompose( _("Cannot format this file system to %1."),
|
String::ucompose( _("Cannot format this file system to %1."),
|
||||||
|
@ -1652,16 +1652,16 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
||||||
Gtk::BUTTONS_OK,
|
Gtk::BUTTONS_OK,
|
||||||
true );
|
true );
|
||||||
|
|
||||||
if ( selected_partition .get_length() < (fs .MIN / DEFAULT_SECTOR_SIZE) )
|
if ( selected_partition .get_length() < (fs .MIN / selected_partition .sector_size) )
|
||||||
dialog .set_secondary_text( String::ucompose(
|
dialog .set_secondary_text( String::ucompose(
|
||||||
_( "A %1 file system requires a partition of at least %2."),
|
_( "A %1 file system requires a partition of at least %2."),
|
||||||
Utils::get_filesystem_string( new_fs ),
|
Utils::get_filesystem_string( new_fs ),
|
||||||
Utils::format_size( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE ) ) );
|
Utils::format_size( fs .MIN, 1 /* Byte */ ) ) );
|
||||||
else
|
else
|
||||||
dialog .set_secondary_text( String::ucompose(
|
dialog .set_secondary_text( String::ucompose(
|
||||||
_( "A partition with a %1 file system has a maximum size of %2."),
|
_( "A partition with a %1 file system has a maximum size of %2."),
|
||||||
Utils::get_filesystem_string( new_fs ),
|
Utils::get_filesystem_string( new_fs ),
|
||||||
Utils::format_size( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE ) ) );
|
Utils::format_size( fs .MAX, 1 /* Byte */ ) ) );
|
||||||
|
|
||||||
dialog .run() ;
|
dialog .run() ;
|
||||||
return ;
|
return ;
|
||||||
|
|
|
@ -116,7 +116,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_KIB ) ) -1 ) + "K" ;
|
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||||
|
|
||||||
return ! execute_command( str_temp, operationdetail ) ;
|
return ! execute_command( str_temp, operationdetail ) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool ext3::resize( const Partition & partition_new, OperationDetail & operationd
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_KIB ) ) -1 ) + "K" ;
|
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||||
|
|
||||||
return ! execute_command( str_temp, operationdetail ) ;
|
return ! execute_command( str_temp, operationdetail ) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool ext4::resize( const Partition & partition_new, OperationDetail & operationd
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_KIB ) ) -1 ) + "K" ;
|
partition_new .get_length(), partition_new .sector_size, UNIT_KIB ) ) -1 ) + "K" ;
|
||||||
|
|
||||||
return ! execute_command( str_temp, operationdetail ) ;
|
return ! execute_command( str_temp, operationdetail ) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
|
||||||
{
|
{
|
||||||
str_temp += " -s " ;
|
str_temp += " -s " ;
|
||||||
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_BYTE ) ) -1 ) ;
|
partition_new .get_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//simulation..
|
//simulation..
|
||||||
|
|
|
@ -125,7 +125,7 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat
|
||||||
{
|
{
|
||||||
str_temp += " -s " ;
|
str_temp += " -s " ;
|
||||||
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_BYTE ) ) -1 ) ;
|
partition_new .get_length(), partition_new .sector_size, UNIT_BYTE ) ) -1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_status = execute_command( str_temp, operationdetail ) ;
|
exit_status = execute_command( str_temp, operationdetail ) ;
|
||||||
|
|
Loading…
Reference in New Issue