replaced the inline Utils functions with static functions. This shaves a
* replaced the inline Utils functions with static functions. This shaves a few kbytes (24 in fact) off the binary and is a bit cleaner code-wise (imho).
This commit is contained in:
parent
a98e9e4c14
commit
808b777019
|
@ -1,3 +1,9 @@
|
|||
2005-12-13 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* replaced the inline Utils functions with static functions.
|
||||
This shaves a few kbytes (24 in fact) off the binary and is a bit
|
||||
cleaner code-wise (imho).
|
||||
|
||||
2005-12-12 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/GParted_Core.cc: don't use wait_for_node() if resizing an
|
||||
|
|
101
include/Utils.h
101
include/Utils.h
|
@ -29,8 +29,7 @@
|
|||
#include <gtkmm/label.h>
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
@ -89,97 +88,17 @@ struct FS
|
|||
};
|
||||
|
||||
|
||||
//globally used convenience functions
|
||||
inline long Round( double double_value )
|
||||
class Utils
|
||||
{
|
||||
return static_cast<long>( double_value + 0.5 ) ;
|
||||
}
|
||||
public:
|
||||
static long Round( double double_value ) ;
|
||||
static long Sector_To_MB( Sector sectors ) ;
|
||||
static Gtk::Label * mk_label( const Glib::ustring & text, bool use_markup = true, bool align_left = true, 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_Filesystem_String( FILESYSTEM filesystem ) ;
|
||||
};
|
||||
|
||||
inline long Sector_To_MB( Sector sectors )
|
||||
{
|
||||
return Round( sectors * 0.000488281250 ) ; // that's what 512/1024/1024 gives you :)
|
||||
}
|
||||
|
||||
inline Gtk::Label * mk_label( const Glib::ustring & text, bool use_markup = true, bool align_left = true, bool wrap = false, const Glib::ustring & text_color = "black" )
|
||||
{
|
||||
Gtk::Label * label = manage( new Gtk::Label( text ) ) ;
|
||||
|
||||
label ->set_use_markup( use_markup ) ;
|
||||
|
||||
if ( align_left )
|
||||
label ->set_alignment( Gtk::ALIGN_LEFT ) ;
|
||||
|
||||
label ->set_line_wrap( wrap ) ;
|
||||
|
||||
if ( text_color != "black" )
|
||||
{
|
||||
Gdk::Color color( text_color ) ;
|
||||
label ->modify_fg( label ->get_state( ), color ) ;
|
||||
}
|
||||
|
||||
return label ;
|
||||
}
|
||||
|
||||
inline Glib::ustring num_to_str( Sector number, bool use_C_locale = false )
|
||||
{
|
||||
std::stringstream ss ;
|
||||
//ss.imbue( std::locale( use_C_locale ? "C" : "" ) ) ; see #157871
|
||||
ss << number ;
|
||||
return ss .str( ) ;
|
||||
}
|
||||
|
||||
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..
|
||||
inline Glib::ustring Get_Color( FILESYSTEM filesystem )
|
||||
{
|
||||
switch( filesystem )
|
||||
{
|
||||
case FS_UNALLOCATED : return "darkgrey" ;
|
||||
case FS_UNKNOWN : return "black" ;
|
||||
case FS_UNFORMATTED : return "black" ;
|
||||
case FS_EXTENDED : return "#7DFCFE" ;
|
||||
case FS_EXT2 : return "#9DB8D2" ;
|
||||
case FS_EXT3 : return "#7590AE" ;
|
||||
case FS_LINUX_SWAP : return "#C1665A" ;
|
||||
case FS_FAT16 : return "green" ;
|
||||
case FS_FAT32 : return "#18D918" ;
|
||||
case FS_NTFS : return "#42E5AC" ;
|
||||
case FS_REISERFS : return "#ADA7C8" ;
|
||||
case FS_REISER4 : return "#887FA3" ;
|
||||
case FS_XFS : return "#EED680" ;
|
||||
case FS_JFS : return "#E0C39E" ;
|
||||
case FS_HFS : return "#E0B6AF" ;
|
||||
case FS_HFSPLUS : return "#C0A39E" ;
|
||||
case FS_UFS : return "#D1940C" ;
|
||||
|
||||
default : return "black" ;
|
||||
}
|
||||
}
|
||||
|
||||
inline Glib::ustring Get_Filesystem_String( FILESYSTEM filesystem )
|
||||
{
|
||||
switch( filesystem )
|
||||
{
|
||||
case FS_UNALLOCATED : return _("unallocated") ;
|
||||
case FS_UNKNOWN : return _("unknown") ;
|
||||
case FS_UNFORMATTED : return _("unformatted") ;
|
||||
case FS_EXTENDED : return "extended" ;
|
||||
case FS_EXT2 : return "ext2" ;
|
||||
case FS_EXT3 : return "ext3" ;
|
||||
case FS_LINUX_SWAP : return "linux-swap" ;
|
||||
case FS_FAT16 : return "fat16" ;
|
||||
case FS_FAT32 : return "fat32" ;
|
||||
case FS_NTFS : return "ntfs" ;
|
||||
case FS_REISERFS : return "reiserfs" ;
|
||||
case FS_REISER4 : return "reiser4" ;
|
||||
case FS_XFS : return "xfs" ;
|
||||
case FS_JFS : return "jfs" ;
|
||||
case FS_HFS : return "hfs" ;
|
||||
case FS_HFSPLUS : return "hfs+" ;
|
||||
case FS_UFS : return "ufs" ;
|
||||
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
}//GParted
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
*.gmo
|
||||
*.mo
|
||||
*.pot
|
||||
*.swp
|
||||
Makefile
|
||||
Makefile.in
|
||||
Makefile.in.in
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# List of source files containing translatable strings.
|
||||
# Please keep this file sorted alphabetically.
|
||||
gparted.desktop.in
|
||||
include/Utils.h
|
||||
src/Dialog_Base_Partition.cc
|
||||
src/Dialog_Disklabel.cc
|
||||
src/Dialog_Filesystems.cc
|
||||
|
@ -14,6 +13,7 @@ src/GParted_Core.cc
|
|||
src/Operation.cc
|
||||
src/Partition.cc
|
||||
src/TreeView_Detail.cc
|
||||
src/Utils.cc
|
||||
src/VBox_VisualDisk.cc
|
||||
src/Win_GParted.cc
|
||||
src/main.cc
|
||||
|
|
|
@ -51,21 +51,21 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
|||
vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK );
|
||||
|
||||
//add spinbutton_before
|
||||
table_resize.attach( * mk_label( (Glib::ustring) _( "Free Space Preceding (MB):") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK );
|
||||
table_resize.attach( * Utils::mk_label( (Glib::ustring) _( "Free Space Preceding (MB):") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK );
|
||||
|
||||
spinbutton_before .set_numeric( true );
|
||||
spinbutton_before .set_increments( 1, 100 );
|
||||
table_resize.attach( spinbutton_before, 1, 2, 0, 1, Gtk::FILL );
|
||||
|
||||
//add spinbutton_size
|
||||
table_resize.attach( * mk_label( _( "New Size (MB):" ) ), 0, 1, 1, 2 );
|
||||
table_resize.attach( * Utils::mk_label( _( "New Size (MB):" ) ), 0, 1, 1, 2 );
|
||||
|
||||
spinbutton_size .set_numeric( true );
|
||||
spinbutton_size .set_increments( 1, 100 );
|
||||
table_resize.attach( spinbutton_size, 1, 2, 1, 2, Gtk::FILL );
|
||||
|
||||
//add spinbutton_after
|
||||
table_resize.attach( * mk_label( _( "Free Space Following (MB):") ), 0, 1, 2, 3 ) ;
|
||||
table_resize.attach( * Utils::mk_label( _( "Free Space Following (MB):") ), 0, 1, 2, 3 ) ;
|
||||
|
||||
spinbutton_after .set_numeric( true );
|
||||
spinbutton_after .set_increments( 1, 100 );
|
||||
|
@ -82,9 +82,9 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
|||
spinbutton_after .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER) ) ;
|
||||
|
||||
//pack warning about small differences in values..
|
||||
this ->get_vbox( ) ->pack_start( * mk_label( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" ), Gtk::PACK_SHRINK );
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" ), Gtk::PACK_SHRINK );
|
||||
|
||||
this ->get_vbox( ) ->pack_start( * mk_label( "" ), Gtk::PACK_SHRINK ); //filler :-P
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( "" ), Gtk::PACK_SHRINK ); //filler :-P
|
||||
|
||||
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||
this ->show_all_children( ) ;
|
||||
|
@ -146,7 +146,7 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
|
|||
break ;
|
||||
case RESIZE_MOVE: image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
|
||||
hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ;
|
||||
hbox_resize_move .pack_start( * mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), Gtk::PACK_EXPAND_PADDING ) ;
|
||||
hbox_resize_move .pack_start( * Utils::mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), Gtk::PACK_EXPAND_PADDING ) ;
|
||||
button_resize_move .add( hbox_resize_move ) ;
|
||||
|
||||
this ->add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ;
|
||||
|
@ -247,9 +247,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( 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 - 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( ) ;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
|
|||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += String::ucompose( _("Set Disklabel on %1"), device_path ) ;
|
||||
str_temp += "</span>\n" ;
|
||||
vbox ->pack_start( * mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
vbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
|
||||
str_temp = _("A disklabel is a piece of data stored at a well known place on the disk, that indicates where each partition begins and how many sectors it occupies.") ;
|
||||
str_temp += "\n" ;
|
||||
|
@ -51,7 +51,7 @@ 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( * mk_label( str_temp, true, true, true ), Gtk::PACK_SHRINK );
|
||||
vbox ->pack_start( * Utils::mk_label( str_temp, true, true, true ), Gtk::PACK_SHRINK );
|
||||
|
||||
//advanced
|
||||
str_temp = "<b>" ;
|
||||
|
@ -65,7 +65,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
|
|||
hbox ->set_border_width( 5 ) ;
|
||||
str_temp = _("Select new labeltype:") ;
|
||||
str_temp += "\t" ;
|
||||
hbox ->pack_start( * mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
expander_advanced .add( *hbox ) ;
|
||||
|
||||
//create and add optionmenu
|
||||
|
@ -82,7 +82,7 @@ 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( * 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 );
|
||||
|
@ -95,6 +95,4 @@ Glib::ustring Dialog_Disklabel::Get_Disklabel( )
|
|||
return labeltypes[ optionmenu_labeltypes .get_history( ) ] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//GParted
|
||||
|
|
|
@ -54,7 +54,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 ] = 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);
|
||||
|
|
|
@ -47,9 +47,9 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
|||
|
||||
//now calculate proportional length of partition
|
||||
frame_resizer_base ->set_x_start( 0 ) ;
|
||||
int x_end = 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( Round( copied_partition .Get_Used_MB( ) / ( TOTAL_MB/500.00) ) ) ;
|
||||
frame_resizer_base ->set_used( Utils::Round( copied_partition .Get_Used_MB( ) / ( TOTAL_MB/500.00) ) ) ;
|
||||
|
||||
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
|
||||
|
||||
|
@ -72,7 +72,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
|||
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
|
||||
GRIP = false ;
|
||||
|
||||
frame_resizer_base ->set_size_limits( Round(fs .MIN / MB_PER_PIXEL), Round(fs .MAX / MB_PER_PIXEL) +1 ) ;
|
||||
frame_resizer_base ->set_size_limits( Utils::Round(fs .MIN / MB_PER_PIXEL), Utils::Round(fs .MAX / MB_PER_PIXEL) +1 ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
||||
|
|
|
@ -44,10 +44,10 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
|
|||
|
||||
hbox = manage( new Gtk::HBox( ) );
|
||||
hbox ->pack_start( *image, Gtk::PACK_SHRINK ) ;
|
||||
hbox ->pack_start( * mk_label( "<b> " + (Glib::ustring) _( "Warning:" ) + " </b>" ), Gtk::PACK_SHRINK ) ;
|
||||
hbox ->pack_start( * Utils::mk_label( "<b> " + (Glib::ustring) _( "Warning:" ) + " </b>" ), Gtk::PACK_SHRINK ) ;
|
||||
|
||||
frame ->set_label_widget( *hbox ) ;
|
||||
frame ->add( * mk_label( "<i>" + partition.error + "</i>", true, true, true ) ) ;
|
||||
frame ->add( * Utils::mk_label( "<i>" + partition.error + "</i>", true, true, true ) ) ;
|
||||
|
||||
this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void Dialog_Partition_Info::init_drawingarea( )
|
|||
|
||||
//calculate proportional width of used and unused
|
||||
used = unused = 0 ;
|
||||
used = Round( (375 - BORDER *2) / ( static_cast<double> (partition .sector_end - partition .sector_start) / partition .sectors_used ) ) ;
|
||||
used = Utils::Round( (375 - BORDER *2) / ( static_cast<double> (partition .sector_end - partition .sector_start) / partition .sectors_used ) ) ;
|
||||
unused = 375 - used - BORDER *2 ;
|
||||
|
||||
//allocate some colors
|
||||
|
@ -129,44 +129,44 @@ void Dialog_Partition_Info::Display_Info( )
|
|||
this ->get_vbox( ) ->pack_start( *table, Gtk::PACK_SHRINK ) ;
|
||||
|
||||
//filesystem
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Filesystem:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
|
||||
table ->attach( * mk_label( Get_Filesystem_String( partition .filesystem ) ), 1, 2, top++, bottom++, Gtk::FILL );
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Filesystem:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
|
||||
table ->attach( * Utils::mk_label( Utils::Get_Filesystem_String( partition .filesystem ) ), 1, 2, top++, bottom++, Gtk::FILL );
|
||||
|
||||
//size
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Size:" ) + "</b>" ), 0,1,top, bottom,Gtk::FILL);
|
||||
table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Length_MB( ) ) ), 1, 2, top++, bottom++,Gtk::FILL );
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Size:" ) + "</b>" ), 0,1,top, bottom,Gtk::FILL);
|
||||
table ->attach( * Utils::mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Length_MB( ) ) ), 1, 2, top++, bottom++,Gtk::FILL );
|
||||
|
||||
if ( partition.sectors_used != -1 )
|
||||
{
|
||||
//calculate relative diskusage
|
||||
int percent_used = Round( static_cast<double>(partition .Get_Used_MB( ) ) / partition .Get_Length_MB( ) *100 ) ;
|
||||
int percent_used = Utils::Round( static_cast<double>(partition .Get_Used_MB( ) ) / partition .Get_Length_MB( ) *100 ) ;
|
||||
|
||||
//used
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Used:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Used_MB( ) ) ), 1, 2, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( "\t\t\t( " + num_to_str( percent_used ) + "% )"), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Used:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Used_MB( ) ) ), 1, 2, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( percent_used ) + "% )"), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
//unused
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Unused:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
|
||||
table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Unused_MB( ) ) ), 1, 2, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( "\t\t\t( " + num_to_str( 100 - percent_used ) + "% )"), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Unused:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
|
||||
table ->attach( * Utils::mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Unused_MB( ) ) ), 1, 2, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "\t\t\t( " + Utils::num_to_str( 100 - percent_used ) + "% )"), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
//flags
|
||||
if ( partition.type != GParted::TYPE_UNALLOCATED )
|
||||
{
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Flags:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( partition .flags ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Flags:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( partition .flags ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
//one blank line
|
||||
table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
|
||||
{
|
||||
//path
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( partition .partition ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( partition .partition ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
//realpath (this sucks)
|
||||
char real_path[4096] ;
|
||||
|
@ -175,13 +175,13 @@ void Dialog_Partition_Info::Display_Info( )
|
|||
//only show realpath if it's diffent from the short path...
|
||||
if ( partition.partition != real_path )
|
||||
{
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( real_path ), 1,2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( real_path ), 1,2, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
//status
|
||||
Glib::ustring str_temp ;
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom, Gtk::FILL) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom, Gtk::FILL) ;
|
||||
if ( partition.busy )
|
||||
{
|
||||
if ( partition .type == GParted::TYPE_EXTENDED )
|
||||
|
@ -198,23 +198,23 @@ void Dialog_Partition_Info::Display_Info( )
|
|||
else
|
||||
str_temp = _("Not mounted" ) ;
|
||||
|
||||
table ->attach( * mk_label( str_temp ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( str_temp ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
//one blank line
|
||||
table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
//first sector
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "First Sector:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( num_to_str( partition.sector_start ) ), 1,2, top++, bottom++,Gtk::FILL);
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "First Sector:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_start ) ), 1,2, top++, bottom++,Gtk::FILL);
|
||||
|
||||
//last sector
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Last Sector:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( num_to_str( partition.sector_end ) ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Last Sector:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_end ) ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
|
||||
//total sectors
|
||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Total Sectors:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * mk_label( num_to_str( partition .sector_end - partition .sector_start ) ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Total Sectors:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .sector_end - partition .sector_start ) ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||
}
|
||||
|
||||
Dialog_Partition_Info::~Dialog_Partition_Info( )
|
||||
|
|
|
@ -50,7 +50,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
|||
hbox_main .pack_start( table_create, Gtk::PACK_SHRINK );
|
||||
|
||||
/*TO TRANSLATORS: used as label for a list of choices. Create as: <optionmenu with choices> */
|
||||
table_create.attach( * mk_label( (Glib::ustring) _("Create as:") + "\t" ), 0, 1, 0, 1, Gtk::FILL);
|
||||
table_create.attach( * Utils::mk_label( (Glib::ustring) _("Create as:") + "\t" ), 0, 1, 0, 1, Gtk::FILL);
|
||||
|
||||
//fill partitiontype menu
|
||||
menu_type .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Primary Partition") ) ) ;
|
||||
|
@ -77,7 +77,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
|||
table_create .attach( optionmenu_type, 1, 2, 0, 1, Gtk::FILL );
|
||||
|
||||
//filesystems to choose from
|
||||
table_create.attach( * mk_label( (Glib::ustring) _("Filesystem:") + "\t" ), 0, 1, 1, 2, Gtk::FILL );
|
||||
table_create.attach( * Utils::mk_label( (Glib::ustring) _("Filesystem:") + "\t" ), 0, 1, 1, 2, Gtk::FILL );
|
||||
|
||||
Build_Filesystems_Menu( only_unformatted ) ;
|
||||
|
||||
|
@ -163,7 +163,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
|||
{
|
||||
if ( optionmenu_type .get_history( ) == GParted::TYPE_EXTENDED && menu_filesystem .items( ) .size( ) < FILESYSTEMS .size( ) )
|
||||
{
|
||||
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( Get_Filesystem_String( GParted::FS_EXTENDED ) ) ) ;
|
||||
menu_filesystem .items( ) .push_back( 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 ) ;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
|||
frame_resizer_base ->override_default_rgb_unused_color( color_temp );
|
||||
|
||||
//partitioncolor..
|
||||
color_temp .set( 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( ) ;
|
||||
|
@ -215,7 +215,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
|||
//fill the filesystem menu with the filesystems (except for extended)
|
||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) -1 ; t++ )
|
||||
{
|
||||
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( Get_Filesystem_String( FILESYSTEMS[ t ] .filesystem ) ) ) ;
|
||||
menu_filesystem .items( ) .push_back( 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_MB() >= FILESYSTEMS[ t ] .MIN ) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,14 +99,14 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
next = partitions[t +1].sector_end - partitions[t +1].sector_start ;
|
||||
|
||||
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
||||
TOTAL_MB = Sector_To_MB( total_length ) ;
|
||||
TOTAL_MB = Utils::Sector_To_MB( total_length ) ;
|
||||
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
||||
//now calculate proportional length of partition
|
||||
frame_resizer_base ->set_x_start( Round( previous / ( total_length / 500.00 ) ) ) ;
|
||||
frame_resizer_base ->set_x_end( Round( (selected_partition .sector_end - selected_partition .sector_start) / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start( ) ) ;
|
||||
frame_resizer_base ->set_used( Round( selected_partition.sectors_used / ( 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 .sector_end - selected_partition .sector_start) / ( 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 )
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
if ( ! fixed_start )
|
||||
{
|
||||
spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ;
|
||||
spinbutton_before .set_value( Sector_To_MB( previous ) ) ;
|
||||
spinbutton_before .set_value( Utils::Sector_To_MB( previous ) ) ;
|
||||
}
|
||||
|
||||
//set values of spinbutton_size
|
||||
|
@ -139,9 +139,9 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
|
||||
//set values of spinbutton_after
|
||||
spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
|
||||
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
|
||||
spinbutton_after .set_value( Utils::Sector_To_MB( next ) ) ;
|
||||
|
||||
frame_resizer_base ->set_size_limits( Round( fs .MIN / MB_PER_PIXEL ), Round( fs .MAX / MB_PER_PIXEL ) +1 ) ;
|
||||
frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / MB_PER_PIXEL ), Utils::Round( fs .MAX / MB_PER_PIXEL ) +1 ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
||||
|
@ -171,12 +171,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
|||
|
||||
//now we have enough data to calculate some important values..
|
||||
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
||||
TOTAL_MB = Sector_To_MB( total_length ) ;
|
||||
TOTAL_MB = Utils::Sector_To_MB( total_length ) ;
|
||||
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||
|
||||
//calculate proportional length of partition ( in pixels )
|
||||
frame_resizer_base ->set_x_start( Round( previous / ( total_length / 500.00 ) ) ) ;
|
||||
frame_resizer_base ->set_x_end( Round( (selected_partition .sector_end - selected_partition .sector_start) / ( 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 .sector_end - selected_partition .sector_start) / ( 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 ;
|
||||
|
@ -191,22 +191,22 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
|||
}
|
||||
}
|
||||
|
||||
frame_resizer_base ->set_used_start( Round( (first - START) / ( total_length / 500.00 ) ) ) ;
|
||||
frame_resizer_base ->set_used( Round( used / ( total_length / 500.00 ) ) ) ;
|
||||
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 values of spinbutton_before (we assume there is no fixed start.)
|
||||
if ( first == 0 ) //no logicals
|
||||
spinbutton_before .set_range( 0, TOTAL_MB - BUF/2 ) ;
|
||||
else
|
||||
spinbutton_before .set_range( 0, Sector_To_MB (first - START) ) ;
|
||||
spinbutton_before .set_range( 0, Utils::Sector_To_MB (first - START) ) ;
|
||||
|
||||
spinbutton_before .set_value( Sector_To_MB ( previous ) ) ;
|
||||
spinbutton_before .set_value( Utils::Sector_To_MB ( previous ) ) ;
|
||||
|
||||
//set values of spinbutton_size
|
||||
if ( first == 0 ) //no logicals
|
||||
spinbutton_size .set_range( BUF/2, TOTAL_MB ) ;
|
||||
else
|
||||
spinbutton_size .set_range( Sector_To_MB( used ), TOTAL_MB ) ;
|
||||
spinbutton_size .set_range( Utils::Sector_To_MB( used ), TOTAL_MB ) ;
|
||||
|
||||
spinbutton_size .set_value( selected_partition .Get_Length_MB( ) ) ;
|
||||
|
||||
|
@ -214,12 +214,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
|||
if ( first == 0 ) //no logicals
|
||||
spinbutton_after .set_range( 0, TOTAL_MB - BUF/2 ) ;
|
||||
else
|
||||
spinbutton_after .set_range( 0, Sector_To_MB( total_length + START - first - used) ) ;
|
||||
spinbutton_after .set_range( 0, Utils::Sector_To_MB( total_length + START - first - used) ) ;
|
||||
|
||||
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
|
||||
spinbutton_after .set_value( Utils::Sector_To_MB( next ) ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Set_MinMax_Text( first == 0 ? BUF/2 : Sector_To_MB( used ), Sector_To_MB( total_length ) ) ;
|
||||
Set_MinMax_Text( first == 0 ? BUF/2 : Utils::Sector_To_MB( used ), Utils::Sector_To_MB( total_length ) ) ;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -37,7 +37,7 @@ Dialog_Progress::Dialog_Progress( int count_operations, Glib::RefPtr<Gtk::TextBu
|
|||
str_temp += "\n";
|
||||
str_temp += _("Clicking Cancel will prevent the next operations from being applied.") ;
|
||||
str_temp += "\n";
|
||||
this ->get_vbox( ) ->pack_start( * mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
|
||||
|
||||
progressbar_current .set_pulse_step( 0.01 ) ;
|
||||
progressbar_current .set_size_request( 500, -1 ) ;
|
||||
|
@ -58,7 +58,7 @@ Dialog_Progress::Dialog_Progress( int count_operations, Glib::RefPtr<Gtk::TextBu
|
|||
scrolledwindow .add( textview_details ) ;
|
||||
|
||||
this ->get_vbox( ) ->pack_start( scrolledwindow, Gtk::PACK_SHRINK );
|
||||
this ->get_vbox( ) ->pack_start( * mk_label( "<b>\n" + static_cast<Glib::ustring>( _( "Completed Operations" ) ) + ":</b>" ), Gtk::PACK_SHRINK );
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( "<b>\n" + static_cast<Glib::ustring>( _( "Completed Operations" ) ) + ":</b>" ), Gtk::PACK_SHRINK );
|
||||
this ->get_vbox( ) ->pack_start( progressbar_all, Gtk::PACK_SHRINK );
|
||||
|
||||
this ->get_vbox( ) ->set_spacing( 5 ) ;
|
||||
|
|
|
@ -108,7 +108,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
|||
temp_device .sectors = lp_device ->bios_geom .sectors ;
|
||||
temp_device .cylinders = lp_device ->bios_geom .cylinders ;
|
||||
temp_device .length = temp_device .heads * temp_device .sectors * temp_device .cylinders ;
|
||||
temp_device .cylsize = Sector_To_MB( temp_device .heads * temp_device .sectors ) ;
|
||||
temp_device .cylsize = Utils::Sector_To_MB( temp_device .heads * temp_device .sectors ) ;
|
||||
|
||||
//make sure cylsize is at least 1 MB
|
||||
if ( temp_device .cylsize < 1 )
|
||||
|
@ -222,7 +222,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
case PED_PARTITION_NORMAL:
|
||||
case PED_PARTITION_LOGICAL:
|
||||
partition_temp .Set( device .path,
|
||||
device .path + num_to_str( lp_partition ->num ),
|
||||
device .path + Utils::num_to_str( lp_partition ->num ),
|
||||
lp_partition ->num,
|
||||
lp_partition ->type == 0 ? GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
|
||||
Get_Filesystem( ), lp_partition ->geom .start,
|
||||
|
@ -239,7 +239,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
|
||||
case PED_PARTITION_EXTENDED:
|
||||
partition_temp.Set( device .path,
|
||||
device .path + num_to_str( lp_partition ->num ),
|
||||
device .path + Utils::num_to_str( lp_partition ->num ),
|
||||
lp_partition ->num ,
|
||||
GParted::TYPE_EXTENDED ,
|
||||
GParted::FS_EXTENDED ,
|
||||
|
@ -882,7 +882,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( Get_Filesystem_String( partition .filesystem ) .c_str() ) ;
|
||||
PedFileSystemType * fs_type = ped_file_system_type_get( Utils::Get_Filesystem_String( partition .filesystem ) .c_str() ) ;
|
||||
|
||||
//default is Linux (83)
|
||||
if ( ! fs_type )
|
||||
|
|
|
@ -30,6 +30,7 @@ gparted_SOURCES = \
|
|||
Operation.cc\
|
||||
Partition.cc\
|
||||
TreeView_Detail.cc\
|
||||
Utils.cc\
|
||||
VBox_VisualDisk.cc\
|
||||
Win_GParted.cc\
|
||||
ext2.cc\
|
||||
|
|
|
@ -51,7 +51,7 @@ Glib::ustring Operation::Get_String( )
|
|||
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */
|
||||
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"),
|
||||
temp,
|
||||
Get_Filesystem_String( partition_original .filesystem ),
|
||||
Utils::Get_Filesystem_String( partition_original .filesystem ),
|
||||
partition_original .Get_Length_MB( ),
|
||||
device .path ) ;
|
||||
|
||||
|
@ -75,7 +75,7 @@ Glib::ustring Operation::Get_String( )
|
|||
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"),
|
||||
temp,
|
||||
partition_new.partition_number,
|
||||
Get_Filesystem_String( partition_new.filesystem ),
|
||||
Utils::Get_Filesystem_String( partition_new.filesystem ),
|
||||
partition_new .Get_Length_MB( ),
|
||||
device .path ) ;
|
||||
|
||||
|
@ -85,9 +85,9 @@ Glib::ustring Operation::Get_String( )
|
|||
if ( diff >= MEGABYTE )
|
||||
{
|
||||
if ( partition_new .sector_start > partition_original .sector_start )
|
||||
temp = String::ucompose( _("Move %1 forward by %2 MB"), partition_new.partition, Sector_To_MB( diff ) ) ;
|
||||
temp = String::ucompose( _("Move %1 forward by %2 MB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ;
|
||||
else
|
||||
temp = String::ucompose( _("Move %1 backward by %2 MB"), partition_new.partition, Sector_To_MB( diff ) ) ;
|
||||
temp = String::ucompose( _("Move %1 backward by %2 MB"), partition_new.partition, Utils::Sector_To_MB( diff ) ) ;
|
||||
}
|
||||
|
||||
//check if size has changed ( we only consider changes >= 1 MB )
|
||||
|
@ -116,15 +116,15 @@ Glib::ustring Operation::Get_String( )
|
|||
/*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */
|
||||
return String::ucompose( _( "Convert %1 from %2 to %3"),
|
||||
partition_original .partition,
|
||||
Get_Filesystem_String( partition_original .filesystem ),
|
||||
Get_Filesystem_String( partition_new .filesystem ) ) ;
|
||||
Utils::Get_Filesystem_String( partition_original .filesystem ),
|
||||
Utils::Get_Filesystem_String( partition_new .filesystem ) ) ;
|
||||
|
||||
case COPY :
|
||||
/*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */
|
||||
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"),
|
||||
partition_new .partition,
|
||||
device .path,
|
||||
Sector_To_MB( partition_new .sector_start ) ) ;
|
||||
Utils::Sector_To_MB( partition_new .sector_start ) ) ;
|
||||
|
||||
default :
|
||||
return "";
|
||||
|
|
|
@ -54,7 +54,7 @@ void Partition::Set( const Glib::ustring & device_path,
|
|||
this ->filesystem = filesystem;
|
||||
this ->sector_start = sector_start;
|
||||
this ->sector_end = sector_end;
|
||||
this ->color.set( Get_Color( filesystem ) );
|
||||
this ->color.set( Utils::Get_Color( filesystem ) );
|
||||
this ->inside_extended = inside_extended;
|
||||
this ->busy = busy;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void Partition::Set_Unused( Sector sectors_unused )
|
|||
|
||||
void Partition::Set_Unallocated( const Glib::ustring & device_path, Sector sector_start, Sector sector_end, bool inside_extended )
|
||||
{
|
||||
this ->Set( device_path, Get_Filesystem_String( GParted::FS_UNALLOCATED ), -1, GParted::TYPE_UNALLOCATED, GParted::FS_UNALLOCATED, sector_start, sector_end, inside_extended, false );
|
||||
this ->Set( device_path, Utils::Get_Filesystem_String( GParted::FS_UNALLOCATED ), -1, GParted::TYPE_UNALLOCATED, GParted::FS_UNALLOCATED, sector_start, sector_end, inside_extended, false );
|
||||
this ->error = this ->flags = "" ;
|
||||
this ->status = GParted::STAT_REAL ;
|
||||
}
|
||||
|
@ -79,17 +79,17 @@ void Partition::Update_Number( int new_number )
|
|||
{ //of course this fails when we have devicenames with numbers over 99
|
||||
partition = partition .substr( 0, partition .length( ) - ( partition_number >= 10 ? 2 : 1 ) ) ;
|
||||
this ->partition_number = new_number;
|
||||
this ->partition += num_to_str( partition_number ) ;
|
||||
this ->partition += Utils::num_to_str( partition_number ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Length_MB( ) const
|
||||
{
|
||||
return Sector_To_MB( sector_end - sector_start ) ;
|
||||
return Utils::Sector_To_MB( sector_end - sector_start ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Used_MB( ) const
|
||||
{
|
||||
return Sector_To_MB( this ->sectors_used ) ;
|
||||
return Utils::Sector_To_MB( this ->sectors_used ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Unused_MB( ) const
|
||||
|
|
|
@ -144,24 +144,24 @@ void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, const Partition
|
|||
treerow[ treeview_detail_columns .status_icon ] = render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON );
|
||||
|
||||
treerow[ treeview_detail_columns .partition ] = partition .partition;
|
||||
treerow[ treeview_detail_columns .color ] = Get_Color( partition .filesystem ) ;
|
||||
treerow[ treeview_detail_columns .color ] = Utils::Get_Color( partition .filesystem ) ;
|
||||
|
||||
treerow[ treeview_detail_columns .text_color ] = ( partition .type == GParted::TYPE_UNALLOCATED ) ? "darkgrey" : "black" ;
|
||||
treerow[ treeview_detail_columns .type ] = Get_Filesystem_String( partition .filesystem ) ;
|
||||
treerow[ treeview_detail_columns .type ] = Utils::Get_Filesystem_String( partition .filesystem ) ;
|
||||
treerow[ treeview_detail_columns .type_square ] = "██" ;
|
||||
|
||||
//size
|
||||
treerow[ treeview_detail_columns .size ] = num_to_str( partition .Get_Length_MB( ) ) ;
|
||||
treerow[ treeview_detail_columns .size ] = Utils::num_to_str( partition .Get_Length_MB( ) ) ;
|
||||
|
||||
//used
|
||||
if ( partition .sectors_used != -1 )
|
||||
treerow[ treeview_detail_columns .used ] = num_to_str( partition .Get_Used_MB( ) ) ;
|
||||
treerow[ treeview_detail_columns .used ] = Utils::num_to_str( partition .Get_Used_MB( ) ) ;
|
||||
else
|
||||
treerow[ treeview_detail_columns .used ] = "---" ;
|
||||
|
||||
//unused
|
||||
if ( partition .sectors_unused != -1 )
|
||||
treerow[ treeview_detail_columns .unused ] = num_to_str( partition .Get_Unused_MB( ) ) ;
|
||||
treerow[ treeview_detail_columns .unused ] = Utils::num_to_str( partition .Get_Unused_MB( ) ) ;
|
||||
else
|
||||
treerow[ treeview_detail_columns .unused ] = "---" ;
|
||||
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/* Copyright (C) 2004 Bart 'plors' Hakvoort
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "../include/Utils.h"
|
||||
|
||||
#include <sstream>
|
||||
//#include <vector>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
long Utils::Round( double double_value )
|
||||
{
|
||||
return static_cast<long>( double_value + 0.5 ) ;
|
||||
}
|
||||
|
||||
long Utils::Sector_To_MB( Sector sectors )
|
||||
{
|
||||
return Round( sectors * 0.000488281250 ) ; // that's what 512/1024/1024 gives you :)
|
||||
}
|
||||
|
||||
Gtk::Label * Utils::mk_label( const Glib::ustring & text, bool use_markup, bool align_left, bool wrap, const Glib::ustring & text_color )
|
||||
{
|
||||
Gtk::Label * label = manage( new Gtk::Label( text ) ) ;
|
||||
|
||||
label ->set_use_markup( use_markup ) ;
|
||||
|
||||
if ( align_left )
|
||||
label ->set_alignment( Gtk::ALIGN_LEFT ) ;
|
||||
|
||||
label ->set_line_wrap( wrap ) ;
|
||||
|
||||
if ( text_color != "black" )
|
||||
{
|
||||
Gdk::Color color( text_color ) ;
|
||||
label ->modify_fg( label ->get_state( ), color ) ;
|
||||
}
|
||||
|
||||
return label ;
|
||||
}
|
||||
|
||||
Glib::ustring Utils::num_to_str( Sector number, bool use_C_locale )
|
||||
{
|
||||
std::stringstream ss ;
|
||||
//ss.imbue( std::locale( use_C_locale ? "C" : "" ) ) ; see #157871
|
||||
ss << number ;
|
||||
return ss .str( ) ;
|
||||
}
|
||||
|
||||
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..
|
||||
Glib::ustring Utils::Get_Color( FILESYSTEM filesystem )
|
||||
{
|
||||
switch( filesystem )
|
||||
{
|
||||
case FS_UNALLOCATED : return "darkgrey" ;
|
||||
case FS_UNKNOWN : return "black" ;
|
||||
case FS_UNFORMATTED : return "black" ;
|
||||
case FS_EXTENDED : return "#7DFCFE" ;
|
||||
case FS_EXT2 : return "#9DB8D2" ;
|
||||
case FS_EXT3 : return "#7590AE" ;
|
||||
case FS_LINUX_SWAP : return "#C1665A" ;
|
||||
case FS_FAT16 : return "green" ;
|
||||
case FS_FAT32 : return "#18D918" ;
|
||||
case FS_NTFS : return "#42E5AC" ;
|
||||
case FS_REISERFS : return "#ADA7C8" ;
|
||||
case FS_REISER4 : return "#887FA3" ;
|
||||
case FS_XFS : return "#EED680" ;
|
||||
case FS_JFS : return "#E0C39E" ;
|
||||
case FS_HFS : return "#E0B6AF" ;
|
||||
case FS_HFSPLUS : return "#C0A39E" ;
|
||||
case FS_UFS : return "#D1940C" ;
|
||||
|
||||
default : return "black" ;
|
||||
}
|
||||
}
|
||||
|
||||
Glib::ustring Utils::Get_Filesystem_String( FILESYSTEM filesystem )
|
||||
{
|
||||
switch( filesystem )
|
||||
{
|
||||
case FS_UNALLOCATED : return _("unallocated") ;
|
||||
case FS_UNKNOWN : return _("unknown") ;
|
||||
case FS_UNFORMATTED : return _("unformatted") ;
|
||||
case FS_EXTENDED : return "extended" ;
|
||||
case FS_EXT2 : return "ext2" ;
|
||||
case FS_EXT3 : return "ext3" ;
|
||||
case FS_LINUX_SWAP : return "linux-swap" ;
|
||||
case FS_FAT16 : return "fat16" ;
|
||||
case FS_FAT32 : return "fat32" ;
|
||||
case FS_NTFS : return "ntfs" ;
|
||||
case FS_REISERFS : return "reiserfs" ;
|
||||
case FS_REISER4 : return "reiser4" ;
|
||||
case FS_XFS : return "xfs" ;
|
||||
case FS_JFS : return "jfs" ;
|
||||
case FS_HFS : return "hfs" ;
|
||||
case FS_HFSPLUS : return "hfs+" ;
|
||||
case FS_UFS : return "ufs" ;
|
||||
|
||||
default : return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
} //GParted..
|
|
@ -46,7 +46,7 @@ VBox_VisualDisk::VBox_VisualDisk( const std::vector<Partition> & partitions, con
|
|||
|
||||
|
||||
//since disksegments have minimal sizes ( unallocated 15 and partitions 20 pixels ) i do some checking to prevent the visual disk from growing to much
|
||||
Sector sectors_per_pixel = Round( device_length / 750.00 ) ;
|
||||
Sector sectors_per_pixel = Utils::Round( device_length / 750.00 ) ;
|
||||
|
||||
double extra_pixels = 0 ;
|
||||
|
||||
|
@ -61,7 +61,7 @@ VBox_VisualDisk::VBox_VisualDisk( const std::vector<Partition> & partitions, con
|
|||
}
|
||||
|
||||
//draw visual disk and its legend
|
||||
this ->SCREEN_WIDTH = 750 - Round( extra_pixels ) ;
|
||||
this ->SCREEN_WIDTH = 750 - Utils::Round( extra_pixels ) ;
|
||||
|
||||
Build_Visual_Disk( ) ;
|
||||
Build_Legend( ) ;
|
||||
|
@ -167,7 +167,7 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
|||
//tooltip
|
||||
str_temp = "" ;
|
||||
if ( partition .type != GParted::TYPE_UNALLOCATED )
|
||||
str_temp = Get_Filesystem_String( partition .filesystem ) + "\n" ;
|
||||
str_temp = Utils::Get_Filesystem_String( partition .filesystem ) + "\n" ;
|
||||
|
||||
str_temp += partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ;
|
||||
tooltips .set_tip( *( visual_partitions.back( ) ->drawingarea ), str_temp ) ;
|
||||
|
@ -206,19 +206,19 @@ void VBox_VisualDisk::Build_Legend( )
|
|||
hide_used_unused = false ;
|
||||
|
||||
if ( t )
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
else
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
|
||||
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, Get_Color( legend[ t ] ) ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( "██ ", false, false, false, Utils::Get_Color( legend[ t ] ) ), Gtk::PACK_SHRINK );
|
||||
|
||||
if ( legend[ t ] == GParted::FS_UNALLOCATED )
|
||||
{
|
||||
str_temp = Get_Filesystem_String( GParted::FS_UNALLOCATED ) ;//_("unallocated") ;
|
||||
hbox_legend ->pack_start( * mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
str_temp = Utils::Get_Filesystem_String( GParted::FS_UNALLOCATED ) ;//_("unallocated") ;
|
||||
hbox_legend ->pack_start( * Utils::mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
}
|
||||
else
|
||||
hbox_legend ->pack_start( * mk_label( Get_Filesystem_String( legend[ t ] ) + " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( Utils::Get_Filesystem_String( legend[ t ] ) + " " ), Gtk::PACK_SHRINK );
|
||||
}
|
||||
|
||||
//if there are any partitions add used/unused
|
||||
|
@ -231,12 +231,12 @@ void VBox_VisualDisk::Build_Legend( )
|
|||
hbox_legend ->set_border_width( 2 ) ;
|
||||
frame_disk_legend ->add( *hbox_legend );
|
||||
|
||||
hbox_legend ->pack_start( * mk_label( " ██ ", false, false, false, "#F8F8BA" ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( " ██ ", false, false, false, "#F8F8BA" ), Gtk::PACK_SHRINK );
|
||||
str_temp = _("used") ;
|
||||
hbox_legend ->pack_start( * mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, "white" ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( "██ ", false, false, false, "white" ), Gtk::PACK_SHRINK );
|
||||
str_temp = _("unused") ;
|
||||
hbox_legend ->pack_start( * mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * Utils::mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ void Win_GParted::init_convert_menu()
|
|||
{
|
||||
for ( unsigned int t=0; t < gparted_core .get_filesystems( ) .size( ) -1 ; t++ )
|
||||
{
|
||||
color .set( Get_Color( gparted_core .get_filesystems( )[ t ] .filesystem ) );
|
||||
color .set( Utils::Get_Color( gparted_core .get_filesystems( )[ t ] .filesystem ) );
|
||||
hbox = manage( new Gtk::HBox( ) );
|
||||
|
||||
//the colored square
|
||||
|
@ -208,7 +208,7 @@ void Win_GParted::init_convert_menu()
|
|||
hbox ->pack_start( *entry, Gtk::PACK_SHRINK );
|
||||
|
||||
//the label...
|
||||
hbox ->pack_start( * mk_label( " " + Get_Filesystem_String( gparted_core .get_filesystems( )[ t ] .filesystem ) ), Gtk::PACK_SHRINK );
|
||||
hbox ->pack_start( * Utils::mk_label( " " + Utils::Get_Filesystem_String( gparted_core .get_filesystems( )[ t ] .filesystem ) ), Gtk::PACK_SHRINK );
|
||||
|
||||
menu_item = manage( new Gtk::MenuItem( *hbox ) ) ;
|
||||
menu_convert.items( ) .push_back( *menu_item );
|
||||
|
@ -224,30 +224,30 @@ void Win_GParted::init_device_info()
|
|||
int top =0, bottom = 1;
|
||||
|
||||
//title
|
||||
vbox_info .pack_start( * mk_label( " <b>" + (Glib::ustring) _( "Harddisk Information" ) + ":</b>" ), Gtk::PACK_SHRINK );
|
||||
vbox_info .pack_start( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Harddisk Information" ) + ":</b>" ), Gtk::PACK_SHRINK );
|
||||
|
||||
//GENERAL DEVICE INFO
|
||||
table = manage( new Gtk::Table() ) ;
|
||||
table ->set_col_spacings( 10 ) ;
|
||||
|
||||
//model
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Model:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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);
|
||||
|
||||
//size
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Size:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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);
|
||||
|
||||
//path
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Path:" ) + "</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);
|
||||
|
||||
//real path
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (Glib::ustring) _( "Real Path:" ) + "</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);
|
||||
|
||||
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
|
||||
|
@ -258,31 +258,31 @@ void Win_GParted::init_device_info()
|
|||
table ->set_col_spacings( 10 ) ;
|
||||
|
||||
//one blank line
|
||||
table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL );
|
||||
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL );
|
||||
|
||||
//disktype
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "DiskLabelType:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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 );
|
||||
|
||||
//heads
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Heads:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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 );
|
||||
|
||||
//sectors/track
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Sectors/Track:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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 );
|
||||
|
||||
//cylinders
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Cylinders:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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 );
|
||||
|
||||
//total sectors
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Total Sectors:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL );
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * Utils::mk_label( " <b>" + (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 );
|
||||
|
||||
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
|
||||
|
@ -365,7 +365,7 @@ void Win_GParted::Refresh_OptionMenu( )
|
|||
hbox ->pack_start( *image, Gtk::PACK_SHRINK );
|
||||
|
||||
//the label...
|
||||
hbox ->pack_start( *mk_label( " " + devices[ i ] .path + "\t(" + String::ucompose( _("%1 MB"), Sector_To_MB( devices[ i ] .length ) ) + ")" ), Gtk::PACK_SHRINK );
|
||||
hbox ->pack_start( *Utils::mk_label( " " + devices[ i ] .path + "\t(" + String::ucompose( _("%1 MB"), Utils::Sector_To_MB( devices[ i ] .length ) ) + ")" ), Gtk::PACK_SHRINK );
|
||||
|
||||
menu_item = manage( new Gtk::MenuItem( *hbox ) ) ;
|
||||
optionmenu_devices .get_menu( ) ->items( ) .push_back( *menu_item );
|
||||
|
@ -422,16 +422,16 @@ void Win_GParted::Fill_Label_Device_Info( bool clear )
|
|||
|
||||
//global info...
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .model ) ;
|
||||
device_info[ t++ ] ->set_text( String::ucompose( _("%1 MB"), Sector_To_MB( devices[ current_device ] .length ) ) ) ;
|
||||
device_info[ t++ ] ->set_text( String::ucompose( _("%1 MB"), Utils::Sector_To_MB( devices[ current_device ] .length ) ) ) ;
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .path ) ;
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .realpath ) ;
|
||||
|
||||
//detailed info
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .disktype ) ;
|
||||
device_info[ t++ ] ->set_text( num_to_str( devices[ current_device ] .heads ) );
|
||||
device_info[ t++ ] ->set_text( num_to_str( devices[ current_device ] .sectors ) );
|
||||
device_info[ t++ ] ->set_text( num_to_str( devices[ current_device ] .cylinders ) );
|
||||
device_info[ t++ ] ->set_text( num_to_str( devices[ current_device ] .length ) );
|
||||
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .heads ) );
|
||||
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .sectors ) );
|
||||
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .cylinders ) );
|
||||
device_info[ t++ ] ->set_text( Utils::num_to_str( devices[ current_device ] .length ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ void Win_GParted::activate_resize( )
|
|||
|
||||
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
|
||||
hbox_resize_move .pack_start( *image, Gtk::PACK_SHRINK ) ;
|
||||
hbox_resize_move .pack_start( * mk_label( _("Resize/Move") ), Gtk::PACK_SHRINK ) ;
|
||||
hbox_resize_move .pack_start( * Utils::mk_label( _("Resize/Move") ), Gtk::PACK_SHRINK ) ;
|
||||
button_resize_move .add( hbox_resize_move ) ;
|
||||
|
||||
dialog .add_action_widget( button_resize_move, Gtk::RESPONSE_OK ) ;
|
||||
|
@ -1120,7 +1120,7 @@ void Win_GParted::activate_convert( GParted::FILESYSTEM new_fs )
|
|||
{
|
||||
//standard warning..
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += String::ucompose( _("Are you sure you want to convert this filesystem to %1?"), Get_Filesystem_String( new_fs ) ) + "</span>\n\n" ;
|
||||
str_temp += String::ucompose( _("Are you sure you want to convert this filesystem to %1?"), Utils::Get_Filesystem_String( new_fs ) ) + "</span>\n\n" ;
|
||||
str_temp += String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ;
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true );
|
||||
|
@ -1139,13 +1139,13 @@ void Win_GParted::activate_convert( GParted::FILESYSTEM new_fs )
|
|||
if ( selected_partition .Get_Length_MB( ) < fs .MIN || ( fs .MAX && selected_partition .Get_Length_MB( ) > fs .MAX ) )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += String::ucompose( _("Can not convert this filesystem to %1."), Get_Filesystem_String( new_fs ) ) ;
|
||||
str_temp += String::ucompose( _("Can not convert this filesystem to %1."), Utils::Get_Filesystem_String( new_fs ) ) ;
|
||||
str_temp += "</span>\n\n" ;
|
||||
|
||||
if ( selected_partition .Get_Length_MB( ) < fs .MIN )
|
||||
str_temp += String::ucompose( _( "A %1 filesystem requires a partition of at least %2 MB."), Get_Filesystem_String( new_fs ), fs .MIN ) ;
|
||||
str_temp += String::ucompose( _( "A %1 filesystem requires a partition of at least %2 MB."), Utils::Get_Filesystem_String( new_fs ), fs .MIN ) ;
|
||||
else
|
||||
str_temp += String::ucompose( _( "A partition with a %1 filesystem has a maximum size of %2 MB."), Get_Filesystem_String( new_fs ), fs .MAX ) ;
|
||||
str_temp += String::ucompose( _( "A partition with a %1 filesystem has a maximum size of %2 MB."), Utils::Get_Filesystem_String( new_fs ), fs .MAX ) ;
|
||||
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
|
||||
|
|
|
@ -88,7 +88,7 @@ bool ext2::Resize( const Partition & partition_new, bool fill_partition )
|
|||
Glib::ustring str_temp = "resize2fs " + partition_new .partition ;
|
||||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
str_temp += " " + Utils::num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
|
||||
return ! Execute_Command( str_temp ) ;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ bool ext3::Resize( const Partition & partition_new, bool fill_partition )
|
|||
Glib::ustring str_temp = "resize2fs " + partition_new .partition ;
|
||||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
str_temp += " " + Utils::num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
|
||||
return ! Execute_Command( str_temp ) ;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
|||
Glib::ustring str_temp = "echo y | ntfsresize -f " + partition_new .partition ;
|
||||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
str_temp += " -s " + Utils::num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
|
||||
return ! Execute_Command( str_temp ) ;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
|||
Glib::ustring str_temp = "echo y | resize_reiserfs " + partition_new .partition ;
|
||||
|
||||
if ( ! fill_partition )
|
||||
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
str_temp += " -s " + Utils::num_to_str( partition_new .Get_Length_MB( ) - cylinder_size, true ) + "M" ;
|
||||
|
||||
return ! Execute_Command( str_temp ) ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue