//www.iec.ch/zone/si/si_bytes.htm

* changed KB/MB/GB/TB to KiB/MiB/GiB/TiB after reading http://www.iec.ch/zone/si/si_bytes.htm
This commit is contained in:
Bart Hakvoort 2006-01-20 23:35:06 +00:00
parent 9da25b136d
commit 2b509a8332
9 changed files with 34 additions and 30 deletions

View File

@ -1,3 +1,7 @@
2006-01-21 Bart Hakvoort <hakvoort@cvs.gnome.org>
* changed KB/MB/GB/TB to KiB/MiB/GiB/TiB after reading http://www.iec.ch/zone/si/si_bytes.htm
2006-01-21 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-01-21 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/main.cc: cleanups * src/main.cc: cleanups

View File

@ -51,21 +51,21 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK ); vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK );
//add spinbutton_before //add spinbutton_before
table_resize.attach( * Utils::mk_label( (Glib::ustring) _( "Free Space Preceding (MB):") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK ); table_resize.attach( * Utils::mk_label( (Glib::ustring) _( "Free Space Preceding (MiB):") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK );
spinbutton_before .set_numeric( true ); spinbutton_before .set_numeric( true );
spinbutton_before .set_increments( 1, 100 ); spinbutton_before .set_increments( 1, 100 );
table_resize.attach( spinbutton_before, 1, 2, 0, 1, Gtk::FILL ); table_resize.attach( spinbutton_before, 1, 2, 0, 1, Gtk::FILL );
//add spinbutton_size //add spinbutton_size
table_resize.attach( * Utils::mk_label( _( "New Size (MB):" ) ), 0, 1, 1, 2 ); table_resize.attach( * Utils::mk_label( _( "New Size (MiB):" ) ), 0, 1, 1, 2 );
spinbutton_size .set_numeric( true ); spinbutton_size .set_numeric( true );
spinbutton_size .set_increments( 1, 100 ); spinbutton_size .set_increments( 1, 100 );
table_resize.attach( spinbutton_size, 1, 2, 1, 2, Gtk::FILL ); table_resize.attach( spinbutton_size, 1, 2, 1, 2, Gtk::FILL );
//add spinbutton_after //add spinbutton_after
table_resize.attach( * Utils::mk_label( _( "Free Space Following (MB):") ), 0, 1, 2, 3 ) ; table_resize.attach( * Utils::mk_label( _( "Free Space Following (MiB):") ), 0, 1, 2, 3 ) ;
spinbutton_after .set_numeric( true ); spinbutton_after .set_numeric( true );
spinbutton_after .set_increments( 1, 100 ); spinbutton_after .set_increments( 1, 100 );
@ -117,7 +117,7 @@ Partition Dialog_Base_Partition::Get_New_Partition( )
if ( ORIG_AFTER != spinbutton_after .get_value_as_int( ) ) if ( ORIG_AFTER != spinbutton_after .get_value_as_int( ) )
selected_partition .sector_end = selected_partition .sector_start + spinbutton_size .get_value_as_int( ) * MEGABYTE ; selected_partition .sector_end = selected_partition .sector_start + spinbutton_size .get_value_as_int( ) * MEGABYTE ;
//due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this. //due to loss of precision during calcs from Sector -> MiB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this.
if ( selected_partition .sector_start < START ) if ( selected_partition .sector_start < START )
selected_partition .sector_start = START ; selected_partition .sector_start = START ;
if ( selected_partition .sector_end > (START + total_length) ) if ( selected_partition .sector_end > (START + total_length) )
@ -164,8 +164,8 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
void Dialog_Base_Partition::Set_MinMax_Text( long min, long max ) void Dialog_Base_Partition::Set_MinMax_Text( long min, long max )
{ {
str_temp = String::ucompose( _("Minimum Size: %1 MB"), min ) + "\t\t" ; str_temp = String::ucompose( _("Minimum Size: %1 MiB"), min ) + "\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), max ) ; str_temp += String::ucompose( _("Maximum Size: %1 MiB"), max ) ;
label_minmax .set_text( str_temp ) ; label_minmax .set_text( str_temp ) ;
} }

View File

@ -117,7 +117,7 @@ void Dialog_Partition_Info::init_drawingarea( )
color_partition = partition .color ; this ->get_colormap( ) ->alloc_color( color_partition ) ; color_partition = partition .color ; this ->get_colormap( ) ->alloc_color( color_partition ) ;
//set text of pangolayout //set text of pangolayout
pango_layout = drawingarea .create_pango_layout ( partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ) ; pango_layout = drawingarea .create_pango_layout ( partition .partition + "\n" + String::ucompose( _("%1 MiB"), partition .Get_Length_MB( ) ) ) ;
} }
void Dialog_Partition_Info::Display_Info( ) void Dialog_Partition_Info::Display_Info( )

View File

@ -133,7 +133,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
new_start = START + (Sector) (spinbutton_before .get_value( ) * MEGABYTE) ; new_start = START + (Sector) (spinbutton_before .get_value( ) * MEGABYTE) ;
new_end = new_start + (Sector) (spinbutton_size .get_value( ) * MEGABYTE) ; new_end = new_start + (Sector) (spinbutton_size .get_value( ) * MEGABYTE) ;
/* due to loss of precision during calcs from Sector -> MB and back, it is possible the new /* due to loss of precision during calcs from Sector -> MiB and back, it is possible the new
* partition thinks it's bigger then it can be. Here we try to solve this.*/ * partition thinks it's bigger then it can be. Here we try to solve this.*/
if ( new_start < selected_partition.sector_start ) if ( new_start < selected_partition.sector_start )
new_start = selected_partition.sector_start ; new_start = selected_partition.sector_start ;
@ -148,7 +148,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
new_start, new_end, new_start, new_end,
selected_partition .inside_extended, false) ; selected_partition .inside_extended, false) ;
//grow new partition a bit if freespaces are < 1 MB //grow new partition a bit if freespaces are < 1 MiB
if ( (part_temp.sector_start - selected_partition.sector_start) < MEGABYTE ) if ( (part_temp.sector_start - selected_partition.sector_start) < MEGABYTE )
part_temp.sector_start = selected_partition.sector_start ; part_temp.sector_start = selected_partition.sector_start ;
if ( (selected_partition.sector_end - part_temp.sector_end) < MEGABYTE ) if ( (selected_partition.sector_end - part_temp.sector_end) < MEGABYTE )

View File

@ -77,7 +77,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
spinbutton_before .set_sensitive( false ) ; spinbutton_before .set_sensitive( false ) ;
} }
//calculate total size in MB's of previous, current and next partition //calculate total size in MiB's of previous, current and next partition
//first find index of partition //first find index of partition
unsigned int t; unsigned int t;
for ( t = 0 ; t < partitions .size( ) ; t++ ) for ( t = 0 ; t < partitions .size( ) ; t++ )
@ -149,7 +149,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
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 )
{ {
//calculate total size in MB's of previous, current and next partition //calculate total size in MiB's of previous, current and next partition
//first find index of partition //first find index of partition
unsigned int t = 0; unsigned int t = 0;
while ( t < partitions .size( ) && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ; while ( t < partitions .size( ) && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ;

View File

@ -116,7 +116,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
temp_device .length = temp_device .heads * temp_device .sectors * temp_device .cylinders ; temp_device .length = temp_device .heads * temp_device .sectors * temp_device .cylinders ;
temp_device .cylsize = Utils::Sector_To_MB( temp_device .heads * temp_device .sectors ) ; temp_device .cylsize = Utils::Sector_To_MB( temp_device .heads * temp_device .sectors ) ;
//make sure cylsize is at least 1 MB //make sure cylsize is at least 1 MiB
if ( temp_device .cylsize < 1 ) if ( temp_device .cylsize < 1 )
temp_device .cylsize = 1 ; temp_device .cylsize = 1 ;

View File

@ -52,8 +52,8 @@ Glib::ustring Operation::Get_String( )
else else
temp = partition_original .partition ; temp = partition_original .partition ;
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */ /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MiB) from /dev/hda */
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), return String::ucompose( _("Delete %1 (%2, %3 MiB) from %4"),
temp, temp,
Utils::Get_Filesystem_String( partition_original .filesystem ), Utils::Get_Filesystem_String( partition_original .filesystem ),
partition_original .Get_Length_MB( ), partition_original .Get_Length_MB( ),
@ -75,8 +75,8 @@ Glib::ustring Operation::Get_String( )
default : default :
break; break;
} }
/*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */ /*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MiB) on /dev/hda */
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), return String::ucompose( _("Create %1 #%2 (%3, %4 MiB) on %5"),
temp, temp,
partition_new.partition_number, partition_new.partition_number,
Utils::Get_Filesystem_String( partition_new.filesystem ), Utils::Get_Filesystem_String( partition_new.filesystem ),
@ -84,28 +84,28 @@ Glib::ustring Operation::Get_String( )
device .path ) ; device .path ) ;
case RESIZE_MOVE: case RESIZE_MOVE:
//if startsector has changed >= 1 MB we consider it a move //if startsector has changed >= 1 MiB we consider it a move
diff = std::abs( partition_new .sector_start - partition_original .sector_start ) ; diff = std::abs( partition_new .sector_start - partition_original .sector_start ) ;
if ( diff >= MEGABYTE ) if ( diff >= MEGABYTE )
{ {
if ( partition_new .sector_start > partition_original .sector_start ) if ( partition_new .sector_start > partition_original .sector_start )
temp = String::ucompose( _("Move %1 forward by %2 MB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ; temp = String::ucompose( _("Move %1 forward by %2 MiB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ;
else else
temp = String::ucompose( _("Move %1 backward by %2 MB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ; temp = String::ucompose( _("Move %1 backward by %2 MiB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ;
} }
//check if size has changed ( we only consider changes >= 1 MB ) //check if size has changed ( we only consider changes >= 1 MiB )
diff = std::abs( (partition_original .sector_end - partition_original .sector_start) - (partition_new .sector_end - partition_new .sector_start) ) ; diff = std::abs( (partition_original .sector_end - partition_original .sector_start) - (partition_new .sector_end - partition_new .sector_start) ) ;
if ( diff >= MEGABYTE ) if ( diff >= MEGABYTE )
{ {
if ( temp .empty( ) ) if ( temp .empty( ) )
temp = String::ucompose( _("Resize %1 from %2 MB to %3 MB"), temp = String::ucompose( _("Resize %1 from %2 MiB to %3 MiB"),
partition_new.partition, partition_new.partition,
partition_original .Get_Length_MB(), partition_original .Get_Length_MB(),
partition_new .Get_Length_MB() ) ; partition_new .Get_Length_MB() ) ;
else else
temp += " " + String::ucompose( _("and Resize %1 from %2 MB to %3 MB"), temp += " " + String::ucompose( _("and Resize %1 from %2 MiB to %3 MiB"),
partition_new.partition, partition_new.partition,
partition_original .Get_Length_MB(), partition_original .Get_Length_MB(),
partition_new .Get_Length_MB() ) ; partition_new .Get_Length_MB() ) ;
@ -123,8 +123,8 @@ Glib::ustring Operation::Get_String( )
Utils::Get_Filesystem_String( partition_new .filesystem ) ) ; Utils::Get_Filesystem_String( partition_new .filesystem ) ) ;
case COPY : case COPY :
/*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */ /*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MiB) */
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), return String::ucompose( _("Copy %1 to %2 (start at %3 MiB)"),
partition_new .partition, partition_new .partition,
device .path, device .path,
Utils::Sector_To_MB( partition_new .sector_start ) ) ; Utils::Sector_To_MB( partition_new .sector_start ) ) ;

View File

@ -249,12 +249,12 @@ Glib::ustring Utils::format_size( Sector size )
if ( size < 1073741824 ) if ( size < 1073741824 )
{ {
ss << static_cast<double>( size / 1048567.0 ) ; ss << static_cast<double>( size / 1048567.0 ) ;
return String::ucompose( _("%1 MB"), ss .str() ) ; return String::ucompose( _("%1 MiB"), ss .str() ) ;
} }
else else
{ {
ss << static_cast<double>( size / 1073741824.0 ) ; ss << static_cast<double>( size / 1073741824.0 ) ;
return String::ucompose( _("%1 GB"), ss .str() ) ; return String::ucompose( _("%1 GiB"), ss .str() ) ;
} }
} }

View File

@ -1137,8 +1137,8 @@ void Win_GParted::activate_delete()
str_temp += _( "After deletion this partition is no longer available for copying.") ; str_temp += _( "After deletion this partition is no longer available for copying.") ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true ); Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true );
/*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MB) */ /*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MiB) */
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3 MB)"), dialog .set_title( String::ucompose( _("Delete %1 (%2, %3 MiB)"),
selected_partition .partition, selected_partition .partition,
selected_partition .filesystem, selected_partition .filesystem,
selected_partition .Get_Length_MB() ) ); selected_partition .Get_Length_MB() ) );
@ -1206,12 +1206,12 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
if ( selected_partition .Get_Length_MB( ) < fs .MIN ) if ( selected_partition .Get_Length_MB( ) < fs .MIN )
str_temp += String::ucompose( str_temp += String::ucompose(
_( "A %1 filesystem requires a partition of at least %2 MB."), _( "A %1 filesystem requires a partition of at least %2 MiB."),
Utils::Get_Filesystem_String( new_fs ), Utils::Get_Filesystem_String( new_fs ),
fs .MIN ) ; fs .MIN ) ;
else else
str_temp += String::ucompose( str_temp += String::ucompose(
_( "A partition with a %1 filesystem has a maximum size of %2 MB."), _( "A partition with a %1 filesystem has a maximum size of %2 MiB."),
Utils::Get_Filesystem_String( new_fs ), Utils::Get_Filesystem_String( new_fs ),
fs .MAX ) ; fs .MAX ) ;