removed all stringstreams from the project (they were possibly responsible

* removed all stringstreams from the project (they were possibly responsible for rare chrashes in certain locales)
This commit is contained in:
Bart Hakvoort 2004-10-02 09:39:16 +00:00
parent d0b49ea63b
commit 72f91cbc39
17 changed files with 216 additions and 203 deletions

View File

@ -1,3 +1,8 @@
2004-10-0i2 Bart Hakvoort <gparted@users.sf.net>
* removed all stringstreams from the project (they were possibly responsible for rare chrashes in certain locales)
Note that i left 1 in include/Partition.h, this one is needed for int-->string conversions and won't pose a thread.
2004-10-01 Bart Hakvoort <gparted@users.sf.net>
* almost all files: cosmetics (mostly tabfixes)

View File

@ -101,7 +101,6 @@ private:
std::vector <PedPartitionFlag> flags;
Glib::ustring temp, error ; //error may contain an errormessage for an specific partition ( see Get_Used_Sectors() )
std::ostringstream os;
Partition partition_temp ;
};

View File

@ -63,7 +63,7 @@ protected:
Partition selected_partition ;
Sector START; //the first sector of the first relevant partition ( this is either current or current -1 ) needed in Get_Resized_Partition()
Sector total_length ; //total amount of sectors ( this can be up to 3 partitions...
Sector total_length ; //total amount of sectors ( this can be up to 3 partitions...)
Gtk::HBox hbox_main ;
Gtk::Label label_minmax ;
@ -78,7 +78,6 @@ protected:
void on_spinbutton_value_changed( SPINBUTTON ) ;
bool fixed_start, GRIP;
std::ostringstream os;
double before_value ;
int x_start, x_end ;
@ -92,7 +91,6 @@ private:
Gtk::Tooltips tooltips;
Gtk::Button button_resize_move ;
Gtk::Image *image_temp ;
};
} //GParted

View File

@ -47,7 +47,7 @@ public:
private:
void init_drawingarea() ;
void Display_Info();
void Find_Status() ;
Glib::ustring Find_Status() ;
//signalhandlers
void drawingarea_on_realize( );
@ -68,7 +68,6 @@ private:
Gdk::Color color_partition, color_used, color_unused, color_text ;
int used,unused ;
std::ostringstream os, os_percent;
};

View File

@ -48,7 +48,6 @@ private:
Gtk::ProgressBar progressbar_all, progressbar_current ;
double fraction;
std::ostringstream os;
int count_operations, current_operation_number;
char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n
};

View File

@ -90,7 +90,7 @@ private:
Gdk::Color color_used, color_unused, color_text;
std::ostringstream os;//for int to string conversions
Glib::ustring str_temp ;
int temp,selected_partition;
Gtk::Entry *entry_temp;
Gtk::Label *label_temp;

View File

@ -159,11 +159,12 @@ private:
//usefull variables which are used by many different functions...
sigc::connection s2,s3;//used for disconnecting and destroying a connection ( see optionmenu_devices_changed() and activate_apply() )
std::ostringstream os;//for int to string conversions
bool any_logic,any_extended;//used in some checks (e.g. see optionmenu_devices_changed()
unsigned short highest_logic_busy,primary_count, new_count;//primary_count checks for max. of 4 pimary partitions,
//new_count keeps track of the new created partitions,
//highest_logic_busy contains the number of the highest logical which is busy ( 0 if none is busy)
unsigned short highest_logic_busy ;//highest_logic_busy contains the number of the highest logical which is busy ( 0 if none is busy)
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
unsigned short new_count;//new_count keeps track of the new created partitions
Glib::ustring str_temp ; //mostly used for constructing dialogmessages
GParted::Device *temp_device;
std::vector <Glib::ustring> str_devices, filesystems;

View File

@ -143,13 +143,15 @@ Device::Device( const Glib::ustring & device_path )
void Device::Read_Disk_Layout()
{
Glib::ustring part_path ;
//clear partitions
this ->device_partitions .clear () ;
c_partition = ped_disk_next_partition ( disk, NULL) ;
while ( c_partition )
{
os << this ->path << c_partition ->num ;
part_path = this ->path + num_to_str( c_partition ->num ) ;
switch( c_partition ->type )
{
@ -159,7 +161,7 @@ void Device::Read_Disk_Layout()
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
partition_temp.Set( os.str(),c_partition ->num , GParted::PRIMARY, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , false, ped_partition_is_busy( c_partition ) );
partition_temp.Set( part_path,c_partition ->num , GParted::PRIMARY, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , part_path ) , false, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
@ -172,7 +174,7 @@ void Device::Read_Disk_Layout()
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
partition_temp.Set( os.str(), c_partition ->num, GParted::LOGICAL, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , true, ped_partition_is_busy( c_partition ) );
partition_temp.Set( part_path, c_partition ->num, GParted::LOGICAL, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , part_path ) , true, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
@ -180,7 +182,7 @@ void Device::Read_Disk_Layout()
break;
//EXTENDED
case 2: partition_temp.Set( os.str(), c_partition ->num, GParted::EXTENDED, "extended", c_partition ->geom .start, c_partition ->geom .end , -1, false, ped_partition_is_busy( c_partition ) );
case 2: partition_temp.Set( part_path, c_partition ->num, GParted::EXTENDED, "extended", c_partition ->geom .start, c_partition ->geom .end , -1, false, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
@ -207,7 +209,7 @@ void Device::Read_Disk_Layout()
}
//reset stuff..
this ->error = ""; error_message = ""; os.str("");
this ->error = error_message = "" ;
//next partition (if any)
c_partition = ped_disk_next_partition ( disk, c_partition ) ;

View File

@ -65,9 +65,9 @@ void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition
spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB() ) ;
//set contents of label_minmax
os << String::ucompose( _("Minimum Size: %1 MB"), copied_partition .Get_Length_MB() +1 ) << "\t\t" ;
os << String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( os.str() ) ; os.str("") ;
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), copied_partition .Get_Length_MB() +1 ) + "\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( str_temp ) ;
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ;

View File

@ -123,8 +123,7 @@ void Dialog_Partition_Info::init_drawingarea()
color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ;
//set text of pangolayout
os << partition .partition <<"\n" << String::ucompose( _("%1 MB"), partition .Get_Length_MB() ) ;
pango_layout = drawingarea .create_pango_layout ( os.str() ) ;os.str("");
pango_layout = drawingarea .create_pango_layout ( partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB() ) ) ;
}
@ -153,14 +152,12 @@ void Dialog_Partition_Info::Display_Info()
//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);
os << percent_used ;
table ->attach( * mk_label( "\t\t\t( " + os.str() + "% )"), 1,2, top++, bottom++,Gtk::FILL); os.str("") ;
table ->attach( * mk_label( "\t\t\t( " + 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);
os << 100 - percent_used ;
table ->attach( * mk_label( "\t\t\t( " + os.str() + "% )"), 1,2, top++, bottom++,Gtk::FILL); os.str("") ;
table ->attach( * mk_label( "\t\t\t( " + num_to_str( 100 - percent_used ) + "% )"), 1,2, top++, bottom++,Gtk::FILL);
}
//flags
@ -191,17 +188,18 @@ void Dialog_Partition_Info::Display_Info()
}
//status
Glib::ustring str_temp ;
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
if ( partition.busy )
Find_Status() ;
str_temp = Find_Status() ;
else if ( partition.type == GParted::EXTENDED )
os << (Glib::ustring) _("Not busy (There are no mounted logical partitions)" ) ;
str_temp = _("Not busy (There are no mounted logical partitions)" ) ;
else if ( partition.filesystem == "linux-swap" )
os << (Glib::ustring) _("Not active" ) ;
str_temp = _("Not active" ) ;
else
os << (Glib::ustring) _("Not mounted" ) ;
str_temp = _("Not mounted" ) ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
table ->attach( * mk_label( str_temp ), 1,2, top++, bottom++,Gtk::FILL);
}
//one blank line
@ -209,35 +207,25 @@ void Dialog_Partition_Info::Display_Info()
//first sector
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "First Sector:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL);
os << partition.sector_start ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
table ->attach( * mk_label( 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);
os << partition.sector_end ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
table ->attach( * mk_label( 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);
os << partition.sector_end - partition.sector_start ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
table ->attach( * mk_label( num_to_str( partition.sector_end - partition.sector_start ) ), 1,2, top++, bottom++,Gtk::FILL);
}
void Dialog_Partition_Info::Find_Status()
Glib::ustring Dialog_Partition_Info::Find_Status()
{
if ( partition.type == GParted::EXTENDED )
{
os << _("Busy (At least one logical partition is mounted)" ) ;
return ;
}
return _("Busy (At least one logical partition is mounted)" ) ;
else if ( partition.filesystem == "linux-swap" )
return _("Active") ;
if ( partition.filesystem == "linux-swap" )
{
os << _("Active") ;
return ;
}
//try to find the mountpoint in /proc/mounts
//get realpath
char real_path[4096] ;
@ -254,9 +242,10 @@ void Dialog_Partition_Info::Find_Status()
if ( partition_real_path == real_path )
{
//this is so cool =)
mountpoint = line.substr( line.find( ' ' ) +1, line .length() ) ;
mountpoint = mountpoint .substr( 0, mountpoint .find( ' ' ) ) ;
os << String::ucompose( _("Mounted on %1"), mountpoint .substr( 0, mountpoint .find( ' ' ) ) ) ;
break ;
}
@ -267,7 +256,10 @@ void Dialog_Partition_Info::Find_Status()
//sometimes rootdevices are not listed as paths. I'll take a guess and just enter / here...( we'll look into this when complaints start coming in :P )
if ( mountpoint .empty() )
os << String::ucompose( _("Mounted on %1"), "/") ;
mountpoint = "/" ;
return String::ucompose( _("Mounted on %1"), mountpoint ) ;
}
Dialog_Partition_Info::~Dialog_Partition_Info()

View File

@ -108,9 +108,9 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
GRIP = false ;
//set contents of label_minmax
os << String::ucompose( _("Minimum Size: %1 MB"), 1 ) << "\t\t" ;
os << String::ucompose( _("Maximum Size: %1 MB"), TOTAL_MB ) ;
label_minmax.set_text( os.str() ) ; os.str("") ;
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), 1 ) +"\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), TOTAL_MB ) ;
label_minmax.set_text( str_temp ) ;
this ->show_all_children() ;
}
@ -137,9 +137,8 @@ Partition Dialog_Partition_New::Get_New_Partition()
if ( new_end > selected_partition.sector_end )
new_end = selected_partition.sector_end ;
os << String::ucompose( _("New Partition #%1"), new_count ) ;
part_temp .status = GParted::STAT_NEW ;
part_temp .Set( os.str(), new_count, part_type , filesystems[ optionmenu_filesystem.get_history() ], new_start, new_end, -1, selected_partition.inside_extended, false) ; os.str("") ;
part_temp .Set( String::ucompose( _("New Partition #%1"), new_count ), new_count, part_type , filesystems[ optionmenu_filesystem.get_history() ], new_start, new_end, -1, selected_partition.inside_extended, false) ;
//grow new partition a bit if freespaces are < 1 MB
if ( (part_temp.sector_start - selected_partition.sector_start) < MEGABYTE )
@ -196,9 +195,9 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
spinbutton_after .set_range( 0, TOTAL_MB - MIN ) ;
//set contents of label_minmax
os << String::ucompose( _("Minimum Size: %1 MB"), MIN ) << "\t\t" ;
os << String::ucompose( _("Maximum Size: %1 MB"), MAX ) ;
label_minmax.set_text( os.str() ) ; os.str("") ;
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), MIN ) + "\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), MAX ) ;
label_minmax.set_text( str_temp ) ;
}

View File

@ -137,9 +137,9 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
//set contents of label_minmax
os << String::ucompose( _("Minimum Size: %1 MB"), LOWER ) << "\t\t" ;
os << String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( os.str() ) ; os.str("") ;
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), LOWER ) + "\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( str_temp ) ;
}
@ -225,9 +225,9 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
//set contents of label_minmax
os << String::ucompose( _("Minimum Size: %1 MB"), Sector_To_MB( used ) +1 ) << "\t\t" ;
os << String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( os.str() ) ; os.str("") ;
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), Sector_To_MB( used ) +1 ) + "\t\t" ;
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
label_minmax.set_text( str_temp ) ;
}

View File

@ -32,12 +32,14 @@ Dialog_Progress::Dialog_Progress( int count_operations, const Glib::ustring & fi
label_temp = manage( new Gtk::Label() ) ;
label_temp ->set_alignment( Gtk::ALIGN_LEFT );
os << "<span weight=\"bold\" size=\"larger\">" << _( "Applying pending operations" ) << "</span>\n\n" ;
os << _("Applying all listed operations.") ;
os << "\n";
os << _("Clicking Cancel will prevent the next operations from being applied.") ;
os << "\n";
label_temp ->set_markup( os.str() ) ; os.str("") ;
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _( "Applying pending operations" ) ;
str_temp += "</span>\n\n" ;
str_temp += _("Applying all listed operations.") ;
str_temp += "\n";
str_temp += _("Clicking Cancel will prevent the next operations from being applied.") ;
str_temp += "\n";
label_temp ->set_markup( str_temp ) ;
this->get_vbox() ->pack_start( *label_temp, Gtk::PACK_SHRINK );
progressbar_current.set_text( _("initializing...") );

View File

@ -53,8 +53,7 @@ void Partition::Set( const Glib::ustring & partition,
void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended )
{
this ->Set( _("Unallocated"), -1, GParted::UNALLOCATED, "unallocated", sector_start, sector_end , -1, inside_extended, false);
this ->error = "" ;
this ->flags = "" ;
this ->error = this ->flags = "" ;
this ->status = GParted::STAT_REAL ;
}
@ -93,10 +92,8 @@ void Partition::Update_Number( int new_number )
{ //of course this fails when we have devicenames with numbers over 99
partition_number >= 10 ? partition = partition.substr( 0, partition.length() -2 ) : partition = partition.substr( 0, partition.length() -1 ) ;
partition_number = new_number;
std::ostringstream os;
os << new_number;
partition += os.str();
this ->partition_number = new_number;
this ->partition += num_to_str( partition_number ) ;
}
long Partition::Get_Length_MB( )

View File

@ -26,8 +26,6 @@ VBox_VisualDisk::VBox_VisualDisk( const std::vector<Partition> & partitions, con
this ->device_length = device_length ;
selected_partition = -1;
//set locale for this stream to standard. this prevent weird locals from f*cking up my conversions :^)
os.imbue(std::locale(""));
//create frame which contains the visual disk
frame_disk_legend = manage( new Gtk::Frame() ) ;
@ -136,8 +134,8 @@ void VBox_VisualDisk::Build_Visual_Disk( int SCREEN_WIDTH )
visual_partitions.back() ->drawingarea ->signal_expose_event().connect( sigc::bind<Visual_Partition *>(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose), visual_partitions.back() ));
//create pangolayout and see if it fits in the visual partition
os << partitions[i].partition << "\n" << String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ;
visual_partitions.back() ->pango_layout = visual_partitions.back() ->drawingarea ->create_pango_layout ( os.str() ) ;os.str("");
str_temp = partitions[i] .partition + "\n" + String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ;
visual_partitions.back() ->pango_layout = visual_partitions.back() ->drawingarea ->create_pango_layout ( str_temp ) ;
visual_partitions.back() ->pango_layout ->get_pixel_size( x, y ) ;
if ( visual_partitions.back() ->length - BORDER * 2 -2 < x )
@ -145,14 +143,18 @@ void VBox_VisualDisk::Build_Visual_Disk( int SCREEN_WIDTH )
//tooltip
if ( partitions[i].type != GParted::UNALLOCATED )
os << partitions[i].filesystem << "\n" ;
str_temp = partitions[i] .filesystem + "\n" ;
os << partitions[i].partition + "\n" + String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ;
tooltips.set_tip( *(visual_partitions.back() ->drawingarea) ,os.str() ) ; os.str("");
str_temp += partitions[i] .partition + "\n" + String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ;
tooltips.set_tip( *(visual_partitions.back() ->drawingarea), str_temp ) ;
partitions[i].inside_extended ? hbox_extended ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) : hbox_disk ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) ;
if ( partitions[i] .inside_extended )
hbox_extended ->pack_start( *(visual_partitions.back() ->drawingarea), Gtk::PACK_SHRINK ) ;
else
hbox_disk ->pack_start( *(visual_partitions.back() ->drawingarea), Gtk::PACK_SHRINK ) ;
}
this ->show_all_children() ;
}

View File

@ -26,7 +26,6 @@ Win_GParted::Win_GParted( )
new_count = 1;
current_device = source_device = 0 ;
vbox_visual_disk = NULL;
os.imbue(std::locale(""));//set locale for this stream to standard
//locate all available devices and store them in devices vector
Find_Devices() ;
@ -542,14 +541,14 @@ bool Win_GParted::Quit_Check_Operations()
{
if ( operations.size() )
{
os << "<span weight=\"bold\" size=\"larger\">" + (Glib::ustring) _( "Quit GParted?" ) + "</span>\n\n" ;
str_temp = "<span weight=\"bold\" size=\"larger\">" + (Glib::ustring) _( "Quit GParted?" ) + "</span>\n\n" ;
if ( operations .size() != 1 )
os << String::ucompose( _("%1 operations are currently pending."), operations .size() ) ;
str_temp += String::ucompose( _("%1 operations are currently pending."), operations .size() ) ;
else
os << _("1 operation is currently pending.");
str_temp += _("1 operation is currently pending.");
Gtk::MessageDialog dialog( *this, os.str() , true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);os.str("");
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);
dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE );
dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
@ -721,8 +720,10 @@ void Win_GParted::menu_view_harddisk_info()
void Win_GParted::menu_help_contents()
{
os << _("Sorry, not yet implemented.") << "\n" << _( "Please visit http://gparted.sf.net for more information and support.") ;
Gtk::MessageDialog dialog( *this,os.str() ,false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); os.str("") ;
str_temp = _("Sorry, not yet implemented.") ;
str_temp += "\n" ;
str_temp += _( "Please visit http://gparted.sf.net for more information and support.") ;
Gtk::MessageDialog dialog( *this, str_temp, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
dialog.run();
}
@ -763,11 +764,13 @@ void Win_GParted::activate_resize()
//show warning when one tries to resize a fat16 filesystem
if ( selected_partition .filesystem == "fat16" )
{
os << "<span weight=\"bold\" size=\"larger\">" ;
os << _( "Are you sure you want to resize/move this partition?" ) << "</span>\n\n" ;
os << _( "Resizing a fat16 partition can be quite tricky! Especially growing such a partition is very error-prone. It is advisable to first convert the filesystem to fat32.") << "\n";
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _( "Are you sure you want to resize/move this partition?" ) ;
str_temp += "</span>\n\n" ;
str_temp += _( "Resizing a fat16 partition can be quite tricky! Especially growing such a partition is very error-prone. It is advisable to first convert the filesystem to fat32.") ;
str_temp += "\n";
Gtk::MessageDialog dialog( *this,os.str(), true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CANCEL, true); os.str("") ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CANCEL, true) ;
//pffff this whole mess only for this f*cked up filesystem :-(
Gtk::Button button_resize_move ;
Gtk::HBox hbox_resize_move;
@ -836,12 +839,12 @@ void Win_GParted::activate_paste()
//Display error if user tries to create more primary partitions than the partition table can hold.
if ( ! selected_partition.inside_extended && primary_count >=devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() )
{
os << "<span weight=\"bold\" size=\"larger\">" ;
os << String::ucompose( _("It is not possible to create more than %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ;
os << "</span>\n\n" ;
os << _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ;
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("It is not possible to create more than %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ;
str_temp += "</span>\n\n" ;
str_temp += _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ;
Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run();
return;
}
@ -863,12 +866,12 @@ void Win_GParted::activate_new()
//Display error if user tries to create more primary partitions than the partition table can hold.
if ( ! selected_partition.inside_extended && primary_count >= devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() )
{
os << "<span weight=\"bold\" size=\"larger\">" ;
os << String::ucompose( _("It is not possible to create more than %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ;
os << "</span>\n\n" ;
os << _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ;
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("It is not possible to create more than %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ;
str_temp += "</span>\n\n" ;
str_temp += _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ;
Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run();
return;
}
@ -879,7 +882,7 @@ void Win_GParted::activate_new()
if ( dialog.run() == Gtk::RESPONSE_OK )
{
dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
dialog.hide() ;//make sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
new_count++;
Add_Operation( GParted::CREATE, dialog.Get_New_Partition() );
}
@ -894,19 +897,25 @@ void Win_GParted::activate_delete()
//it seems best to check for this and prohibit deletion with some explanation to the user.
if ( selected_partition.type == GParted::LOGICAL && selected_partition .status != GParted::STAT_NEW && selected_partition.partition_number < highest_logic_busy )
{
os << "<span weight=\"bold\" size=\"larger\">" << _( "Unable to delete partition!") << "</span>\n\n" ;
os << String::ucompose( _("Please unmount any logical partitions having a number higher than %1"), selected_partition.partition_number ) ;
Gtk::MessageDialog dialog( *this, os .str(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("");
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _( "Unable to delete partition!") ;
str_temp += "</span>\n\n" ;
str_temp += String::ucompose( _("Please unmount any logical partitions having a number higher than %1"), selected_partition.partition_number ) ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run() ;
return;
}
os << "<span weight=\"bold\" size=\"larger\">" << String::ucompose( _( "Are you sure you want to delete %1 ?"), selected_partition.partition ) << "</span>" ;
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _( "Are you sure you want to delete %1 ?"), selected_partition.partition ) + "</span>" ;
if ( selected_partition .partition == copied_partition .partition )
os << "\n\n" << _( "After deletion this partition is no longer available for copying.") ;
{
str_temp += "\n\n" ;
str_temp += _( "After deletion this partition is no longer available for copying.") ;
}
Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); os.str("");
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) */
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);
/*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MB) */
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3 MB)"), selected_partition .partition, selected_partition .filesystem, selected_partition .Get_Length_MB() ) );
dialog.add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
dialog.add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
@ -968,11 +977,11 @@ void Win_GParted::activate_info()
void Win_GParted::activate_convert( const Glib::ustring & new_fs )
{
//standard warning..
os << "<span weight=\"bold\" size=\"larger\">" ;
os << String::ucompose( _("Are you sure you want to convert this filesystem to %1 ?"), new_fs ) << "</span>\n\n" ;
os << String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ;
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("Are you sure you want to convert this filesystem to %1 ?"), new_fs ) + "</span>\n\n" ;
str_temp += String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ;
Gtk::MessageDialog dialog( *this, os.str(), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true); os.str("");
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true);
dialog. add_button( Gtk::Stock::CONVERT, Gtk::RESPONSE_OK ) ;
dialog. show_all_children() ;
@ -985,18 +994,18 @@ void Win_GParted::activate_convert( const Glib::ustring & new_fs )
//check for the FAT limits...
if ( new_fs == "fat16" || new_fs == "fat32" )
{
Glib::ustring message ;
str_temp = "" ;
if ( new_fs == "fat16" && selected_partition.Get_Length_MB() < 32 )
message = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "</span>\n\n" + (Glib::ustring) _( "A fat16 filesystem requires a partition of at least 32 MB.") ;
str_temp = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "</span>\n\n" + (Glib::ustring) _( "A fat16 filesystem requires a partition of at least 32 MB.") ;
else if ( new_fs == "fat16" && selected_partition.Get_Length_MB() > 1023 )
message = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "</span>\n\n" + (Glib::ustring) _( "A partition with a fat16 filesystem has a maximum size of 1023 MB.");
str_temp = (Glib::ustring) _("Can not convert this filesystem to fat16.") + "</span>\n\n" + (Glib::ustring) _( "A partition with a fat16 filesystem has a maximum size of 1023 MB.");
else if ( new_fs == "fat32" && selected_partition.Get_Length_MB() < 256 )
message = (Glib::ustring) _("Can not convert this filesystem to fat32.") + "</span>\n\n" + (Glib::ustring) _( "A fat32 filesystem requires a partition of at least 256 MB.");
str_temp = (Glib::ustring) _("Can not convert this filesystem to fat32.") + "</span>\n\n" + (Glib::ustring) _( "A fat32 filesystem requires a partition of at least 256 MB.");
if ( message != "" )
if ( ! str_temp .empty() )
{
Gtk::MessageDialog dialog( *this, "<span weight=\"bold\" size=\"larger\">" + message ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog dialog( *this, "<span weight=\"bold\" size=\"larger\">" + str_temp ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dialog.run() ;
return ;
}
@ -1047,7 +1056,12 @@ void Win_GParted::activate_undo()
void Win_GParted::activate_apply()
{
Gtk::MessageDialog dialog( *this, "<span weight=\"bold\" size=\"larger\">" + (Glib::ustring) _( "Are you sure you want to apply the pending operations?" ) + "</span>\n\n" + (Glib::ustring) _( "It is recommended to backup valueable data before proceeding.") ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true);
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _( "Are you sure you want to apply the pending operations?" ) ;
str_temp += "</span>\n\n" ;
str_temp += _( "It is recommended to backup valueable data before proceeding.") ;
Gtk::MessageDialog dialog( *this, str_temp,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true);
dialog.set_title( _( "Apply operations to harddisk" ) );
dialog.add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
@ -1083,18 +1097,22 @@ void Win_GParted::activate_apply()
//show warning if necessary
if ( devicenames .size() )
{
os << "<span weight=\"bold\" size=\"larger\">" ;
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
/*TO TRANSLATORS: after the colon (:) a list of devices will be shown */
os << _("The kernel was unable to re-read the partition table on :") << "\n";
str_temp += _("The kernel was unable to re-read the partition table on :") ;
str_temp += "\n";
for (unsigned int t=0; t<devicenames .size(); t++ )
os << "- " << devicenames[ t ] << "\n";
os << "</span>\n\n" << _( "This means Linux won't know anything about the modifications you made until you reboot.") << "\n\n" ;
if ( devicenames .size() > 1 )
os << _( "You should reboot your computer before doing anything with these devices.") ;
else
os << _( "You should reboot your computer before doing anything with this device.") ;
str_temp += "- " + devicenames[ t ] + "\n";
Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); os.str("") ;
str_temp += "</span>\n\n" ;
str_temp += _( "This means Linux won't know anything about the modifications you made until you reboot.") ;
str_temp += "\n\n" ;
if ( devicenames .size() > 1 )
str_temp += _( "You should reboot your computer before doing anything with these devices.") ;
else
str_temp += _( "You should reboot your computer before doing anything with this device.") ;
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
dialog.run() ;
}