trivial cleanups

* trivial cleanups
This commit is contained in:
Bart Hakvoort 2006-03-28 12:40:29 +00:00
parent 49d85ed09f
commit f96c8dea05
29 changed files with 189 additions and 146 deletions

View File

@ -1,3 +1,7 @@
2006-03-28 Bart Hakvoort <hakvoort@cvs.gnome.org>
* trivial cleanups
2006-03-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/TreeView_Detail.h,

View File

@ -111,16 +111,17 @@ struct FS
class Utils
{
public:
static Sector Round( double double_value ) ;
static Sector round( double double_value ) ;
static Gtk::Label * mk_label( const Glib::ustring & text,
bool use_markup = true,
Gtk::AlignmentEnum alignment = Gtk::ALIGN_LEFT,
Gtk::AlignmentEnum x_align = Gtk::ALIGN_LEFT,
Gtk::AlignmentEnum y_align = Gtk::ALIGN_CENTER,
bool wrap = false,
const Glib::ustring & text_color = "black" ) ;
static Glib::ustring num_to_str( Sector number, bool use_C_locale = false ) ;
static Glib::ustring Get_Color( FILESYSTEM filesystem ) ;
static Glib::ustring get_color( FILESYSTEM filesystem ) ;
static Glib::RefPtr<Gdk::Pixbuf> get_color_as_pixbuf( FILESYSTEM filesystem, int width, int height ) ;
static Glib::ustring Get_Filesystem_String( FILESYSTEM filesystem ) ;
static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ;
static Glib::ustring format_size( Sector size ) ;
static double sector_to_unit( Sector sectors, SIZE_UNIT size_unit ) ;
static int execute_command( const Glib::ustring & command,

View File

@ -265,9 +265,9 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
//And apply the changes to the visual view...
if ( ! fixed_start )
frame_resizer_base ->set_x_start( Utils::Round( spinbutton_before .get_value() / MB_PER_PIXEL ) ) ;
frame_resizer_base ->set_x_start( Utils::round( spinbutton_before .get_value() / MB_PER_PIXEL ) ) ;
frame_resizer_base ->set_x_end( 500 - Utils::Round( spinbutton_after .get_value() / MB_PER_PIXEL ) ) ;
frame_resizer_base ->set_x_end( 500 - Utils::round( spinbutton_after .get_value() / MB_PER_PIXEL ) ) ;
frame_resizer_base ->Draw_Partition() ;

View File

@ -20,23 +20,23 @@
namespace GParted
{
Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std::vector <Glib::ustring> & disklabeltypes )
Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std::vector<Glib::ustring> & disklabeltypes )
{
this ->set_title( String::ucompose( _("Set Disklabel on %1"), device_path ) );
this ->set_has_separator( false ) ;
this ->set_resizable( false );
hbox = manage( new Gtk::HBox( ) ) ;
this ->get_vbox( ) ->pack_start( *hbox, Gtk::PACK_SHRINK );
hbox = manage( new Gtk::HBox() ) ;
this ->get_vbox() ->pack_start( *hbox, Gtk::PACK_SHRINK );
vbox = manage( new Gtk::VBox( ) ) ;
vbox = manage( new Gtk::VBox() ) ;
vbox ->set_border_width( 10 ) ;
hbox ->pack_start( *vbox, Gtk::PACK_SHRINK );
image .set( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG ) ;
vbox ->pack_start( image, Gtk::PACK_SHRINK );
vbox = manage( new Gtk::VBox( ) ) ;
vbox = manage( new Gtk::VBox() ) ;
vbox ->set_border_width( 10 ) ;
hbox ->pack_start( *vbox, Gtk::PACK_SHRINK );
@ -51,7 +51,8 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
str_temp += "\n\n" ;
str_temp += _("By default GParted creates an msdos disklabel.") ;
str_temp += "\n" ;
vbox ->pack_start( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, true ), Gtk::PACK_SHRINK );
vbox ->pack_start( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ),
Gtk::PACK_SHRINK );
//advanced
str_temp = "<b>" ;
@ -63,7 +64,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
hbox = manage( new Gtk::HBox( false, 5 ) ) ;
hbox ->set_border_width( 5 ) ;
str_temp = _("Select new labeltype:") ;//FIXME: this label shouldn't be topaligned..
str_temp = _("Select new labeltype:") ;
str_temp += "\t" ;
hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
expander_advanced .add( *hbox ) ;
@ -71,7 +72,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
//create and add combo with labeltypes
this ->labeltypes = disklabeltypes ;
for ( unsigned int t = 0 ; t < labeltypes .size( ) ; t++ )
for ( unsigned int t = 0 ; t < labeltypes .size() ; t++ )
combo_labeltypes .append_text( labeltypes[ t ] ) ;
combo_labeltypes .set_active( 0 ) ;
@ -82,15 +83,15 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
str_temp += String::ucompose( _("WARNING: Creating a new disklabel will erase all data on %1!"), device_path ) ;
str_temp += "\n</i>";
this ->get_vbox( ) ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
this ->get_vbox() ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this ->add_button( _("Create"), Gtk::RESPONSE_OK );
this ->show_all_children( ) ;
this ->show_all_children() ;
}
Glib::ustring Dialog_Disklabel::Get_Disklabel( )
Glib::ustring Dialog_Disklabel::Get_Disklabel()
{
return labeltypes[ combo_labeltypes .get_active_row_number() ] ;
}

View File

@ -56,7 +56,7 @@ void Dialog_Filesystems::Load_Filesystems( const std::vector< FS > & FILESYSTEMS
void Dialog_Filesystems::Show_Filesystem( const FS & fs )
{
treerow = *( liststore_filesystems ->append() );
treerow[ treeview_filesystems_columns .filesystem ] = Utils::Get_Filesystem_String( fs .filesystem ) ;
treerow[ treeview_filesystems_columns .filesystem ] = Utils::get_filesystem_string( fs .filesystem ) ;
treerow[ treeview_filesystems_columns .create ] =
render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);

View File

@ -40,17 +40,17 @@ 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(), GParted::UNIT_MIB ) ) ;
TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
long COPIED_LENGTH_MB = Utils::Round( Utils::sector_to_unit( copied_partition .get_length(), GParted::UNIT_MIB ) ) ;
long COPIED_LENGTH_MB = Utils::round( Utils::sector_to_unit( copied_partition .get_length(), GParted::UNIT_MIB ) ) ;
//now calculate proportional length of partition
frame_resizer_base ->set_x_start( 0 ) ;
int x_end = Utils::Round( COPIED_LENGTH_MB / ( TOTAL_MB/500.00 ) ) ; //> 500 px only possible with xfs...
int x_end = Utils::round( COPIED_LENGTH_MB / ( TOTAL_MB/500.00 ) ) ; //> 500 px only possible with xfs...
frame_resizer_base ->set_x_end( x_end > 500 ? 500 : x_end ) ;
frame_resizer_base ->set_used(
Utils::Round( Utils::sector_to_unit(
Utils::round( Utils::sector_to_unit(
copied_partition .sectors_used, GParted::UNIT_MIB ) / (TOTAL_MB/500.00) ) ) ;
fs .MAX = ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBIBYTE) ) ? (TOTAL_MB * MEBIBYTE) : fs .MAX -= BUF ;
@ -62,27 +62,27 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
GRIP = true ;
//set values of spinbutton_before
spinbutton_before .set_range( 0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( 0 ) ;
//set values of spinbutton_size
spinbutton_size .set_range(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value( COPIED_LENGTH_MB ) ;
//set values of spinbutton_after
spinbutton_after .set_range( 0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
GRIP = false ;
frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//set contents of label_minmax
Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ;

View File

@ -49,7 +49,8 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
Gtk::PACK_SHRINK ) ;
frame ->set_label_widget( *hbox ) ;
frame ->add( * Utils::mk_label( "<i>" + partition.error + "</i>", true, Gtk::ALIGN_LEFT, true ) ) ;
frame ->add( * Utils::mk_label(
"<i>" + partition .error + "</i>", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ) ) ;
this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ;
}
@ -103,7 +104,7 @@ void Dialog_Partition_Info::init_drawingarea()
//calculate proportional width of used and unused
used = unused = 0 ;
used = Utils::Round(
used = Utils::round(
(400 - BORDER *2) / ( static_cast<double>( partition .get_length() ) / partition .sectors_used ) ) ;
unused = 400 - used - BORDER *2 ;
@ -140,7 +141,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::Get_Filesystem_String( partition .filesystem ) ),
table ->attach( * Utils::mk_label( Utils::get_filesystem_string( partition .filesystem ) ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -159,7 +160,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_length() ) * 100 ) ;
//used
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Used:") ) + "</b>" ),
@ -209,7 +210,10 @@ void Dialog_Partition_Info::Display_Info()
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
{
//path
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>" ),
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>",
true,
Gtk::ALIGN_LEFT,
Gtk::ALIGN_TOP ),
0, 1,
top, bottom,
Gtk::FILL ) ;

View File

@ -111,7 +111,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(), GParted::UNIT_MIB ) ) ;
TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//set first enabled filesystem
@ -120,7 +120,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
//set spinbuttons initial values
spinbutton_after .set_value( 0 ) ;
spinbutton_size .set_value( Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
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)
@ -194,7 +194,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
menu_filesystem .items() .size() < FILESYSTEMS .size() )
{
menu_filesystem .items() .push_back(
Gtk::Menu_Helpers::MenuElem( Utils::Get_Filesystem_String( GParted::FS_EXTENDED ) ) ) ;
Gtk::Menu_Helpers::MenuElem( Utils::get_filesystem_string( GParted::FS_EXTENDED ) ) ) ;
optionmenu_filesystem .set_history( menu_filesystem .items() .size() -1 ) ;
optionmenu_filesystem .set_sensitive( false ) ;
}
@ -226,22 +226,22 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
fs .MAX = ( fs .MAX && ( fs .MAX - cylinder_size ) < (TOTAL_MB * MEBIBYTE) ) ?
fs .MAX - cylinder_size : TOTAL_MB * MEBIBYTE ;
frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//set new spinbutton ranges
spinbutton_before .set_range(
0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_range(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_range(
0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
//set contents of label_minmax
Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
}
//set fitting resizer colors
@ -250,7 +250,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
frame_resizer_base ->override_default_rgb_unused_color( color_temp );
//partitioncolor..
color_temp .set( Utils::Get_Color( fs .filesystem ) ) ;
color_temp .set( Utils::get_color( fs .filesystem ) ) ;
frame_resizer_base ->set_rgb_partition_color( color_temp ) ;
frame_resizer_base ->Draw_Partition() ;
@ -262,7 +262,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) -1 ; t++ )
{
menu_filesystem .items() .push_back(
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()[ t ] .set_sensitive(
! only_unformatted && FILESYSTEMS[ t ] .create &&
this ->selected_partition .get_length() >= FILESYSTEMS[ t ] .MIN ) ;

View File

@ -100,15 +100,15 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
next = partitions[t +1] .get_length() ;
total_length = previous + selected_partition .get_length() + next;
TOTAL_MB = Utils::Round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ;
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//now calculate proportional length of partition
frame_resizer_base ->set_x_start( Utils::Round( previous / ( total_length / 500.00 ) ) ) ;
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_used( Utils::Round( selected_partition.sectors_used / ( total_length / 500.00 ) ) ) ;
Utils::round( selected_partition .get_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 ) ) ) ;
if ( fs .shrink )
{
@ -131,28 +131,28 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
//set values of spinbutton_before
if ( ! fixed_start )
{
spinbutton_before .set_range( 0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( Utils::Round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
}
//set values of spinbutton_size
spinbutton_size .set_range(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value(
Utils::Round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_after
spinbutton_after .set_range( 0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( Utils::Round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//set contents of label_minmax
Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
}
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
@ -179,12 +179,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
//now we have enough data to calculate some important values..
total_length = previous + selected_partition .get_length() + next;
TOTAL_MB = Utils::Round( Utils::sector_to_unit( total_length, UNIT_MIB ) ) ;
TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, 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_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() ) ;
//used is a bit different here... we consider start of first logical to end last logical as used space
Sector first =0, used =0 ;
@ -200,39 +200,39 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
}
dynamic_cast<Frame_Resizer_Extended *>( frame_resizer_base ) ->
set_used_start( Utils::Round( (first - START) / ( total_length / 500.00 ) ) ) ;
frame_resizer_base ->set_used( Utils::Round( used / ( total_length / 500.00 ) ) ) ;
set_used_start( Utils::round( (first - START) / ( total_length / 500.00 ) ) ) ;
frame_resizer_base ->set_used( Utils::round( used / ( total_length / 500.00 ) ) ) ;
//set values of spinbutton_before (we assume there is no fixed start.)
if ( first == 0 ) //no logicals
spinbutton_before .set_range( 0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
else
spinbutton_before .set_range( 0, Utils::Round( Utils::sector_to_unit( first - START, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_range( 0, Utils::round( Utils::sector_to_unit( first - START, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( Utils::Round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_size
if ( first == 0 ) //no logicals
spinbutton_size .set_range( Utils::Round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
else
spinbutton_size .set_range( Utils::Round( Utils::sector_to_unit( used, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
spinbutton_size .set_value(
Utils::Round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_after
if ( first == 0 ) //no logicals
spinbutton_after .set_range(
0, TOTAL_MB - Utils::Round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
else
spinbutton_after .set_range(
0, Utils::Round( Utils::sector_to_unit( total_length + START - first - used, GParted::UNIT_MIB ) ) ) ;
0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( Utils::Round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
//set contents of label_minmax
Set_MinMax_Text( Utils::Round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, GParted::UNIT_MIB ) ),
Utils::Round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ) ;
Set_MinMax_Text( Utils::round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, GParted::UNIT_MIB ) ),
Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ) ;
}
} //GParted

View File

@ -30,10 +30,10 @@ DrawingAreaVisualDisk::DrawingAreaVisualDisk()
selected_vp = NULL ;
//set and allocated some standard colors
color_used .set( Utils::Get_Color( GParted::FS_USED ) );
color_used .set( Utils::get_color( GParted::FS_USED ) );
get_colormap() ->alloc_color( color_used ) ;
color_unused .set( Utils::Get_Color( GParted::FS_UNUSED ) );
color_unused .set( Utils::get_color( GParted::FS_UNUSED ) );
get_colormap() ->alloc_color( color_unused ) ;
color_text .set( "black" );
@ -117,7 +117,7 @@ int DrawingAreaVisualDisk::calc_length( std::vector<visual_partition> & visual_p
for ( int t = 0 ; t < static_cast<int>( visual_partitions .size() ) ; t++ )
{
visual_partitions[ t ] .length = Utils::Round( length_px * visual_partitions[ t ] .fraction ) ;
visual_partitions[ t ] .length = Utils::round( length_px * visual_partitions[ t ] .fraction ) ;
if ( visual_partitions[ t ] .logicals .size() > 0 )
visual_partitions[ t ] .length =
@ -162,7 +162,7 @@ void DrawingAreaVisualDisk::calc_used_unused( std::vector<visual_partition> & vi
if ( visual_partitions[ t ] .fraction_used )
visual_partitions[ t ] .used_length =
Utils::Round( ( visual_partitions[ t ] .length - (2*BORDER) ) * visual_partitions[ t ] .fraction_used ) ;
Utils::round( ( visual_partitions[ t ] .length - (2*BORDER) ) * visual_partitions[ t ] .fraction_used ) ;
//unused
visual_partitions[ t ] .x_unused_start =
@ -193,10 +193,10 @@ void DrawingAreaVisualDisk::calc_text( std::vector<visual_partition> & visual_pa
if ( length < visual_partitions[ t ] .length - (2 * BORDER) - 2 )
{
visual_partitions[ t ] .x_text = visual_partitions[ t ] .x_start +
Utils::Round( (visual_partitions[ t ] .length / 2) - (length / 2) ) ;
Utils::round( (visual_partitions[ t ] .length / 2) - (length / 2) ) ;
visual_partitions[ t ] .y_text = visual_partitions[ t ] .y_start +
Utils::Round( (visual_partitions[ t ] .height / 2) - (height / 2) ) ;
Utils::round( (visual_partitions[ t ] .height / 2) - (height / 2) ) ;
}
else
visual_partitions[ t ] .x_text = visual_partitions[ t ] .y_text = 0 ;

View File

@ -272,6 +272,8 @@ void GParted_Core::init_maps()
}
proc_partitions .close() ;
alternate_paths[ "/dev/hda5" ] = "/dev/bladieblaaaaa" ;
alternate_paths[ "/dev/hda" ] = "/dev/nog_een_testje" ;
}
}
@ -1125,7 +1127,7 @@ bool GParted_Core::set_partition_type( const Partition & partition,
if ( open_device_and_disk( partition .device_path ) )
{
PedFileSystemType * fs_type =
ped_file_system_type_get( Utils::Get_Filesystem_String( partition .filesystem ) .c_str() ) ;
ped_file_system_type_get( Utils::get_filesystem_string( partition .filesystem ) .c_str() ) ;
//default is Linux (83)
if ( ! fs_type )

View File

@ -88,7 +88,7 @@ void OperationCreate::create_description()
description = String::ucompose( _("Create %1 #%2 (%3, %4) on %5"),
description,
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() ),
device .get_path() ) ;
}

View File

@ -81,7 +81,7 @@ void OperationDelete::create_description()
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 345 MiB) from /dev/hda */
description = String::ucompose( _("Delete %1 (%2, %3) from %4"),
description,
Utils::Get_Filesystem_String( partition_original .filesystem ),
Utils::get_filesystem_string( partition_original .filesystem ),
Utils::format_size( partition_original .get_length() ),
partition_original .device_path ) ;
}

View File

@ -59,7 +59,7 @@ void OperationFormat::create_description()
/*TO TRANSLATORS: looks like Format /dev/hda4 as linux-swap */
description = String::ucompose( _("Format %1 as %2"),
partition_original .get_path(),
Utils::Get_Filesystem_String( partition_new .filesystem ) ) ;
Utils::get_filesystem_string( partition_new .filesystem ) ) ;
}
} //GParted

View File

@ -69,7 +69,7 @@ void Partition::Set( const Glib::ustring & device_path,
this ->inside_extended = inside_extended;
this ->busy = busy;
this ->color .set( Utils::Get_Color( filesystem ) );
this ->color .set( Utils::get_color( filesystem ) );
}
void Partition::Set_Unused( Sector sectors_unused )
@ -89,7 +89,7 @@ void Partition::Set_Unallocated( const Glib::ustring & device_path,
Reset() ;
Set( device_path,
Utils::Get_Filesystem_String( GParted::FS_UNALLOCATED ),
Utils::get_filesystem_string( GParted::FS_UNALLOCATED ),
-1,
GParted::TYPE_UNALLOCATED,
GParted::FS_UNALLOCATED,

View File

@ -175,7 +175,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
partition .type == GParted::TYPE_UNALLOCATED ? "darkgrey" : "black" ;
treerow[ treeview_detail_columns .filesystem ] =
Utils::Get_Filesystem_String( partition .filesystem ) ;
Utils::get_filesystem_string( partition .filesystem ) ;
//mountpoint
treerow[ treeview_detail_columns .mount_text_color ] = partition .busy ? "black" : "darkgrey" ;

View File

@ -23,18 +23,20 @@
namespace GParted
{
Sector Utils::Round( double double_value )
Sector Utils::round( double double_value )
{
return static_cast<Sector>( double_value + 0.5 ) ;
}
Gtk::Label * Utils::mk_label( const Glib::ustring & text,
bool use_markup,
Gtk::AlignmentEnum alignment,
Gtk::AlignmentEnum x_align,
Gtk::AlignmentEnum y_align,
bool wrap,
const Glib::ustring & text_color )
{
Gtk::Label * label = manage( new Gtk::Label( text, alignment, Gtk::ALIGN_TOP ) ) ;
Gtk::Label * label = manage( new Gtk::Label( text, x_align, y_align ) ) ;
label ->set_use_markup( use_markup ) ;
label ->set_line_wrap( wrap ) ;
@ -57,7 +59,7 @@ Glib::ustring Utils::num_to_str( Sector number, bool use_C_locale )
}
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..
Glib::ustring Utils::Get_Color( FILESYSTEM filesystem )
Glib::ustring Utils::get_color( FILESYSTEM filesystem )
{
switch( filesystem )
{
@ -91,7 +93,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FILESYSTEM filesystem, int
if ( pixbuf )
{
std::stringstream hex( Get_Color( filesystem ) .substr( 1 ) + "00" ) ;
std::stringstream hex( get_color( filesystem ) .substr( 1 ) + "00" ) ;
unsigned long dec ;
hex >> std::hex >> dec ;
@ -101,7 +103,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FILESYSTEM filesystem, int
return pixbuf ;
}
Glib::ustring Utils::Get_Filesystem_String( FILESYSTEM filesystem )
Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
{
switch( filesystem )
{

View File

@ -288,7 +288,7 @@ Gtk::Menu * Win_GParted::create_format_menu()
//the label...
hbox ->pack_start( * Utils::mk_label(
" " +
Utils::Get_Filesystem_String( gparted_core .get_filesystems()[ t ] .filesystem ) ),
Utils::get_filesystem_string( gparted_core .get_filesystems()[ t ] .filesystem ) ),
Gtk::PACK_SHRINK );
menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) );
@ -306,64 +306,93 @@ Gtk::Menu * Win_GParted::create_format_menu()
void Win_GParted::init_device_info()
{
vbox_info.set_spacing( 5 );
int top =0, bottom = 1;
int top = 0, bottom = 1;
//title
vbox_info .pack_start( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Harddisk Information" ) + ":</b>" ), Gtk::PACK_SHRINK );
vbox_info .pack_start(
* Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Harddisk Information") ) + ":</b>" ),
Gtk::PACK_SHRINK );
//GENERAL DEVICE INFO
table = manage( new Gtk::Table() ) ;
table ->set_col_spacings( 10 ) ;
//model
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Model:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Model:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//size
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Size:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Size:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//path
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>",
true,
Gtk::ALIGN_LEFT,
Gtk::ALIGN_TOP ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
//DETAILED DEVICE INFO
top = 0; bottom = 1;
table = manage( new Gtk::Table( ) ) ;
top = 0 ; bottom = 1;
table = manage( new Gtk::Table() ) ;
table ->set_col_spacings( 10 ) ;
//one blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL );
//disktype
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "DiskLabelType:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("DiskLabelType:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL );
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//heads
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Heads:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Heads:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL );
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//sectors/track
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Sectors/Track:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Sectors/Track:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL );
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL );
//cylinders
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Cylinders:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Cylinders:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL );
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//total sectors
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Total Sectors:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Total Sectors:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "" ) ) ;
table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL );
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
}
@ -1297,7 +1326,7 @@ void Win_GParted::activate_delete()
/*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MiB) */
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3)"),
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() ) ) );
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
@ -1357,7 +1386,7 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
{
Gtk::MessageDialog dialog( *this,
String::ucompose( _("Cannot format this filesystem to %1."),
Utils::Get_Filesystem_String( new_fs ) ) ,
Utils::get_filesystem_string( new_fs ) ) ,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
@ -1366,12 +1395,12 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
if ( selected_partition .get_length() < fs .MIN )
dialog .set_secondary_text( String::ucompose(
_( "A %1 filesystem requires a partition of at least %2."),
Utils::Get_Filesystem_String( new_fs ),
Utils::get_filesystem_string( new_fs ),
Utils::format_size( fs .MIN ) ) );
else
dialog .set_secondary_text( String::ucompose(
_( "A partition with a %1 filesystem has a maximum size of %2."),
Utils::Get_Filesystem_String( new_fs ),
Utils::get_filesystem_string( new_fs ),
Utils::format_size( fs .MAX ) ) );
dialog .run() ;

View File

@ -64,7 +64,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
S = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -74,7 +74,7 @@ bool ext2::Create( const Partition & new_partition, std::vector<OperationDetails
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_EXT2 ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_EXT2 ) ) ) ) ;
if ( ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operation_details .back() .sub_details ) )
{
@ -100,7 +100,7 @@ bool ext2::Resize( const Partition & partition_new,
Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
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() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) )

View File

@ -65,7 +65,7 @@ void ext3::Set_Used_Sectors( Partition & partition )
S = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -75,7 +75,7 @@ bool ext3::Create( const Partition & new_partition, std::vector<OperationDetails
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_EXT3 ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_EXT3 ) ) ) ) ;
if ( ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operation_details .back() .sub_details ) )
{
@ -101,7 +101,7 @@ bool ext3::Resize( const Partition & partition_new,
Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
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() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) )

View File

@ -68,7 +68,7 @@ void fat16::Set_Used_Sectors( Partition & partition )
S = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -78,7 +78,7 @@ bool fat16::Create( const Partition & new_partition, std::vector<OperationDetail
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_FAT16 ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_FAT16 ) ) ) ) ;
if ( ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -67,7 +67,7 @@ void fat32::Set_Used_Sectors( Partition & partition )
S = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -77,7 +77,7 @@ bool fat32::Create( const Partition & new_partition, std::vector<OperationDetail
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_FAT32 ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_FAT32 ) ) ) ) ;
if ( ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -48,7 +48,7 @@ bool hfs::Create( const Partition & new_partition, std::vector<OperationDetails>
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_HFS ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_HFS ) ) ) ) ;
if ( ! execute_command( "hformat " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -83,7 +83,7 @@ void jfs::Set_Used_Sectors( Partition & partition )
N = -1 ;
if ( S > -1 && N > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -93,7 +93,7 @@ bool jfs::Create( const Partition & new_partition, std::vector<OperationDetails>
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_JFS ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_JFS ) ) ) ) ;
if ( ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -49,7 +49,7 @@ bool linux_swap::Create( const Partition & new_partition, std::vector<OperationD
operation_details .push_back(
OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_LINUX_SWAP ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_LINUX_SWAP ) ) ) ) ;
if ( ! execute_command( "mkswap " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -71,7 +71,7 @@ bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetails
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_NTFS ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_NTFS ) ) ) ) ;
if ( ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operation_details .back() .sub_details ) )
{
@ -100,7 +100,7 @@ bool ntfs::Resize( const Partition & partition_new,
if ( ! fill_partition )
{
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() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ;
}

View File

@ -58,7 +58,7 @@ void reiser4::Set_Used_Sectors( Partition & partition )
S = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -68,7 +68,7 @@ bool reiser4::Create( const Partition & new_partition, std::vector<OperationDeta
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_REISER4 ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_REISER4 ) ) ) ) ;
if ( ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operation_details .back() .sub_details ) )
{

View File

@ -68,7 +68,7 @@ void reiserfs::Set_Used_Sectors( Partition & partition )
N = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -78,7 +78,7 @@ bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDet
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_REISERFS ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_REISERFS ) ) ) ) ;
if ( ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operation_details .back() .sub_details ) )
{
@ -106,7 +106,7 @@ bool reiserfs::Resize( const Partition & partition_new,
if ( ! fill_partition )
{
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() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ;
}

View File

@ -85,7 +85,7 @@ void xfs::Set_Used_Sectors( Partition & partition )
N = -1 ;
if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::Round( N * ( S / 512.0 ) ) ) ;
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ;
}
else
partition .error = error ;
@ -95,7 +95,7 @@ bool xfs::Create( const Partition & new_partition, std::vector<OperationDetails>
{
operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"),
Utils::Get_Filesystem_String( GParted::FS_XFS ) ) ) ) ;
Utils::get_filesystem_string( GParted::FS_XFS ) ) ) ) ;
if ( ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details .back() .sub_details ) )
{