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> 2006-03-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/TreeView_Detail.h, * include/TreeView_Detail.h,

View File

@ -111,16 +111,17 @@ struct FS
class Utils class Utils
{ {
public: public:
static Sector Round( double double_value ) ; static Sector round( double double_value ) ;
static Gtk::Label * mk_label( const Glib::ustring & text, static Gtk::Label * mk_label( const Glib::ustring & text,
bool use_markup = true, 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, bool wrap = false,
const Glib::ustring & text_color = "black" ) ; const Glib::ustring & text_color = "black" ) ;
static Glib::ustring num_to_str( Sector number, bool use_C_locale = false ) ; 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::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 Glib::ustring format_size( Sector size ) ;
static double sector_to_unit( Sector sectors, SIZE_UNIT size_unit ) ; static double sector_to_unit( Sector sectors, SIZE_UNIT size_unit ) ;
static int execute_command( const Glib::ustring & command, 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... //And apply the changes to the visual view...
if ( ! fixed_start ) 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() ; frame_resizer_base ->Draw_Partition() ;

View File

@ -51,7 +51,8 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
str_temp += "\n\n" ; str_temp += "\n\n" ;
str_temp += _("By default GParted creates an msdos disklabel.") ; str_temp += _("By default GParted creates an msdos disklabel.") ;
str_temp += "\n" ; 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 //advanced
str_temp = "<b>" ; 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 = manage( new Gtk::HBox( false, 5 ) ) ;
hbox ->set_border_width( 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" ; str_temp += "\t" ;
hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK ); hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
expander_advanced .add( *hbox ) ; expander_advanced .add( *hbox ) ;

View File

@ -56,7 +56,7 @@ void Dialog_Filesystems::Load_Filesystems( const std::vector< FS > & FILESYSTEMS
void Dialog_Filesystems::Show_Filesystem( const FS & fs ) void Dialog_Filesystems::Show_Filesystem( const FS & fs )
{ {
treerow = *( liststore_filesystems ->append() ); 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 ] = treerow[ treeview_filesystems_columns .create ] =
render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR); 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... //set some widely used values...
START = selected_partition .sector_start ; START = selected_partition .sector_start ;
total_length = selected_partition .get_length() ; 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 ; 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 //now calculate proportional length of partition
frame_resizer_base ->set_x_start( 0 ) ; 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_x_end( x_end > 500 ? 500 : x_end ) ;
frame_resizer_base ->set_used( 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) ) ) ; 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 ; 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 ; 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, 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 ) ; 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, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::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, 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 ) ; spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
GRIP = false ; GRIP = false ;
frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (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) ) ) ; Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::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 ;

View File

@ -49,7 +49,8 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
Gtk::PACK_SHRINK ) ; Gtk::PACK_SHRINK ) ;
frame ->set_label_widget( *hbox ) ; 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 ) ; 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 //calculate proportional width of used and unused
used = unused = 0 ; used = unused = 0 ;
used = Utils::Round( used = Utils::round(
(400 - BORDER *2) / ( static_cast<double>( partition .get_length() ) / partition .sectors_used ) ) ; (400 - BORDER *2) / ( static_cast<double>( partition .get_length() ) / partition .sectors_used ) ) ;
unused = 400 - used - BORDER *2 ; unused = 400 - used - BORDER *2 ;
@ -140,7 +141,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::Get_Filesystem_String( partition .filesystem ) ), table ->attach( * Utils::mk_label( Utils::get_filesystem_string( partition .filesystem ) ),
1, 2, 1, 2,
top++, bottom++, top++, bottom++,
Gtk::FILL ) ; Gtk::FILL ) ;
@ -159,7 +160,7 @@ void Dialog_Partition_Info::Display_Info()
{ {
//calculate relative diskusage //calculate relative diskusage
int percent_used = 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 //used
table ->attach( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Used:") ) + "</b>" ), 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 ) if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
{ {
//path //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, 0, 1,
top, bottom, top, bottom,
Gtk::FILL ) ; Gtk::FILL ) ;

View File

@ -111,7 +111,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(), 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 ; MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//set first enabled filesystem //set first enabled filesystem
@ -120,7 +120,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, GParted::UNIT_MIB ) ) ) ; spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( fs .MAX, GParted::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)
@ -194,7 +194,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
menu_filesystem .items() .size() < FILESYSTEMS .size() ) menu_filesystem .items() .size() < FILESYSTEMS .size() )
{ {
menu_filesystem .items() .push_back( 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_history( menu_filesystem .items() .size() -1 ) ;
optionmenu_filesystem .set_sensitive( false ) ; 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 = ( fs .MAX && ( fs .MAX - cylinder_size ) < (TOTAL_MB * MEBIBYTE) ) ?
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) ), frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ; Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//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, GParted::UNIT_MIB ) ) ) ; 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( fs .MIN, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_range( spinbutton_size .set_range(
Utils::Round( Utils::sector_to_unit( fs .MIN, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_range( 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 contents of label_minmax
Set_MinMax_Text( Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
} }
//set fitting resizer colors //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 ); frame_resizer_base ->override_default_rgb_unused_color( color_temp );
//partitioncolor.. //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 ->set_rgb_partition_color( color_temp ) ;
frame_resizer_base ->Draw_Partition() ; 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++ ) for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) -1 ; t++ )
{ {
menu_filesystem .items() .push_back( 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( menu_filesystem .items()[ t ] .set_sensitive(
! only_unformatted && FILESYSTEMS[ t ] .create && ! only_unformatted && FILESYSTEMS[ t ] .create &&
this ->selected_partition .get_length() >= FILESYSTEMS[ t ] .MIN ) ; 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() ; 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, GParted::UNIT_MIB ) ) ; TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ; MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//now calculate proportional length of partition //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( frame_resizer_base ->set_x_end(
Utils::Round( selected_partition .get_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ; Utils::round( selected_partition .get_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 ) ) ) ; frame_resizer_base ->set_used( Utils::round( selected_partition.sectors_used / ( total_length / 500.00 ) ) ) ;
if ( fs .shrink ) if ( fs .shrink )
{ {
@ -131,28 +131,28 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
//set values of spinbutton_before //set values of spinbutton_before
if ( ! fixed_start ) if ( ! fixed_start )
{ {
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( 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 //set values of spinbutton_size
spinbutton_size .set_range( spinbutton_size .set_range(
Utils::Round( Utils::sector_to_unit( fs .MIN, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value( 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 //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( Utils::Round( Utils::sector_to_unit( next, 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) ), frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ; Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( Set_MinMax_Text(
Utils::Round( Utils::sector_to_unit( fs .MIN, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( fs .MAX, GParted::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 )
@ -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.. //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, UNIT_MIB ) ) ; TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, 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 )
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_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 //used is a bit different here... we consider start of first logical to end last logical as used space
Sector first =0, used =0 ; 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 ) -> dynamic_cast<Frame_Resizer_Extended *>( frame_resizer_base ) ->
set_used_start( Utils::Round( (first - START) / ( 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 ) ) ) ; frame_resizer_base ->set_used( Utils::round( used / ( total_length / 500.00 ) ) ) ;
//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, GParted::UNIT_MIB ) ) ) ; spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
else 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 //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, GParted::UNIT_MIB ) ), TOTAL_MB ) ; spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
else 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( 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 //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, GParted::UNIT_MIB ) ) ) ; 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
else else
spinbutton_after .set_range( 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 contents of label_minmax
Set_MinMax_Text( Utils::Round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, 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 ) ) ) ; Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ) ;
} }
} //GParted } //GParted

View File

@ -30,10 +30,10 @@ DrawingAreaVisualDisk::DrawingAreaVisualDisk()
selected_vp = NULL ; selected_vp = NULL ;
//set and allocated some standard colors //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 ) ; 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 ) ; get_colormap() ->alloc_color( color_unused ) ;
color_text .set( "black" ); 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++ ) 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 ) if ( visual_partitions[ t ] .logicals .size() > 0 )
visual_partitions[ t ] .length = visual_partitions[ t ] .length =
@ -162,7 +162,7 @@ void DrawingAreaVisualDisk::calc_used_unused( std::vector<visual_partition> & vi
if ( visual_partitions[ t ] .fraction_used ) if ( visual_partitions[ t ] .fraction_used )
visual_partitions[ t ] .used_length = 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 //unused
visual_partitions[ t ] .x_unused_start = 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 ) if ( length < visual_partitions[ t ] .length - (2 * BORDER) - 2 )
{ {
visual_partitions[ t ] .x_text = visual_partitions[ t ] .x_start + 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 + 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 else
visual_partitions[ t ] .x_text = visual_partitions[ t ] .y_text = 0 ; 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() ; 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 ) ) if ( open_device_and_disk( partition .device_path ) )
{ {
PedFileSystemType * fs_type = 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) //default is Linux (83)
if ( ! fs_type ) if ( ! fs_type )

View File

@ -88,7 +88,7 @@ void OperationCreate::create_description()
description = String::ucompose( _("Create %1 #%2 (%3, %4) on %5"), description = String::ucompose( _("Create %1 #%2 (%3, %4) on %5"),
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() ), Utils::format_size( partition_new .get_length() ),
device .get_path() ) ; 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 */ /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 345 MiB) from /dev/hda */
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() ), Utils::format_size( partition_original .get_length() ),
partition_original .device_path ) ; partition_original .device_path ) ;
} }

View File

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

View File

@ -69,7 +69,7 @@ void Partition::Set( const Glib::ustring & device_path,
this ->inside_extended = inside_extended; this ->inside_extended = inside_extended;
this ->busy = busy; this ->busy = busy;
this ->color .set( Utils::Get_Color( filesystem ) ); this ->color .set( Utils::get_color( filesystem ) );
} }
void Partition::Set_Unused( Sector sectors_unused ) void Partition::Set_Unused( Sector sectors_unused )
@ -89,7 +89,7 @@ void Partition::Set_Unallocated( const Glib::ustring & device_path,
Reset() ; Reset() ;
Set( device_path, Set( device_path,
Utils::Get_Filesystem_String( GParted::FS_UNALLOCATED ), Utils::get_filesystem_string( GParted::FS_UNALLOCATED ),
-1, -1,
GParted::TYPE_UNALLOCATED, GParted::TYPE_UNALLOCATED,
GParted::FS_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" ; partition .type == GParted::TYPE_UNALLOCATED ? "darkgrey" : "black" ;
treerow[ treeview_detail_columns .filesystem ] = treerow[ treeview_detail_columns .filesystem ] =
Utils::Get_Filesystem_String( partition .filesystem ) ; Utils::get_filesystem_string( partition .filesystem ) ;
//mountpoint //mountpoint
treerow[ treeview_detail_columns .mount_text_color ] = partition .busy ? "black" : "darkgrey" ; treerow[ treeview_detail_columns .mount_text_color ] = partition .busy ? "black" : "darkgrey" ;

View File

@ -23,18 +23,20 @@
namespace GParted namespace GParted
{ {
Sector Utils::Round( double double_value ) Sector Utils::round( double double_value )
{ {
return static_cast<Sector>( double_value + 0.5 ) ; return static_cast<Sector>( double_value + 0.5 ) ;
} }
Gtk::Label * Utils::mk_label( const Glib::ustring & text, Gtk::Label * Utils::mk_label( const Glib::ustring & text,
bool use_markup, bool use_markup,
Gtk::AlignmentEnum alignment, Gtk::AlignmentEnum x_align,
Gtk::AlignmentEnum y_align,
bool wrap, bool wrap,
const Glib::ustring & text_color ) 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_use_markup( use_markup ) ;
label ->set_line_wrap( wrap ) ; 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.. //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 ) switch( filesystem )
{ {
@ -91,7 +93,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FILESYSTEM filesystem, int
if ( pixbuf ) if ( pixbuf )
{ {
std::stringstream hex( Get_Color( filesystem ) .substr( 1 ) + "00" ) ; std::stringstream hex( get_color( filesystem ) .substr( 1 ) + "00" ) ;
unsigned long dec ; unsigned long dec ;
hex >> std::hex >> dec ; hex >> std::hex >> dec ;
@ -101,7 +103,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FILESYSTEM filesystem, int
return pixbuf ; return pixbuf ;
} }
Glib::ustring Utils::Get_Filesystem_String( FILESYSTEM filesystem ) Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
{ {
switch( filesystem ) switch( filesystem )
{ {

View File

@ -288,7 +288,7 @@ Gtk::Menu * Win_GParted::create_format_menu()
//the label... //the label...
hbox ->pack_start( * Utils::mk_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 ); Gtk::PACK_SHRINK );
menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) ); menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) );
@ -309,24 +309,38 @@ void Win_GParted::init_device_info()
int top = 0, bottom = 1; int top = 0, bottom = 1;
//title //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 //GENERAL DEVICE INFO
table = manage( new Gtk::Table() ) ; table = manage( new Gtk::Table() ) ;
table ->set_col_spacings( 10 ) ; table ->set_col_spacings( 10 ) ;
//model //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( "" ) ) ; 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 //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( "" ) ) ; 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 //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( "" ) ) ; 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 ) ;
@ -341,27 +355,42 @@ void Win_GParted::init_device_info()
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ); table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL );
//disktype //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( "" ) ) ; 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 //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( "" ) ) ; 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 //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( "" ) ) ; 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 //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( "" ) ) ; 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 //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( "" ) ) ; 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 ) ;
@ -1297,7 +1326,7 @@ void Win_GParted::activate_delete()
/*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MiB) */ /*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MiB) */
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() ) ) ); Utils::format_size( selected_partition .get_length() ) ) );
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 );
@ -1357,7 +1386,7 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
{ {
Gtk::MessageDialog dialog( *this, Gtk::MessageDialog dialog( *this,
String::ucompose( _("Cannot format this filesystem to %1."), String::ucompose( _("Cannot format this filesystem to %1."),
Utils::Get_Filesystem_String( new_fs ) ) , Utils::get_filesystem_string( new_fs ) ) ,
false, false,
Gtk::MESSAGE_ERROR, Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK, Gtk::BUTTONS_OK,
@ -1366,12 +1395,12 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
if ( selected_partition .get_length() < fs .MIN ) if ( selected_partition .get_length() < fs .MIN )
dialog .set_secondary_text( String::ucompose( dialog .set_secondary_text( String::ucompose(
_( "A %1 filesystem requires a partition of at least %2."), _( "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 ) ) ); Utils::format_size( fs .MIN ) ) );
else else
dialog .set_secondary_text( String::ucompose( dialog .set_secondary_text( String::ucompose(
_( "A partition with a %1 filesystem has a maximum size of %2."), _( "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 ) ) ); Utils::format_size( fs .MAX ) ) );
dialog .run() ; dialog .run() ;

View File

@ -64,7 +64,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -74,7 +74,7 @@ bool ext2::Create( const Partition & new_partition, std::vector<OperationDetails
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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() ; Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
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() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ; partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) ) 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 ; S = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -75,7 +75,7 @@ bool ext3::Create( const Partition & new_partition, std::vector<OperationDetails
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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() ; Glib::ustring str_temp = "resize2fs " + partition_new .get_path() ;
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() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ; partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) ) 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 ; S = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -78,7 +78,7 @@ bool fat16::Create( const Partition & new_partition, std::vector<OperationDetail
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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 ; S = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -77,7 +77,7 @@ bool fat32::Create( const Partition & new_partition, std::vector<OperationDetail
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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 ; N = -1 ;
if ( S > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -93,7 +93,7 @@ bool jfs::Create( const Partition & new_partition, std::vector<OperationDetails>
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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( operation_details .push_back(
OperationDetails( String::ucompose( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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 ) if ( ! fill_partition )
{ {
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() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ; 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 ; S = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -68,7 +68,7 @@ bool reiser4::Create( const Partition & new_partition, std::vector<OperationDeta
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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 ; N = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -78,7 +78,7 @@ bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDet
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) 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 ) if ( ! fill_partition )
{ {
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() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ; 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 ; N = -1 ;
if ( N > -1 && 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 else
partition .error = error ; partition .error = error ;
@ -95,7 +95,7 @@ bool xfs::Create( const Partition & new_partition, std::vector<OperationDetails>
{ {
operation_details .push_back( OperationDetails( String::ucompose( operation_details .push_back( OperationDetails( String::ucompose(
_("create new %1 filesystem"), _("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 ) ) if ( ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details .back() .sub_details ) )
{ {