mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-08-27 11:40:03 +00:00
added FIXME cleanups (mostly messagebox related) added some more
* include/Utils.h: added FIXME * include/Win_GParted.h, src/Win_GParted.cc: cleanups (mostly messagebox related) * src/GParted_Core.cc: added some more progressfeedback to create and resize
This commit is contained in:
parent
99a87a8c09
commit
f6b01f342f
|
@ -1,3 +1,11 @@
|
|||
2006-02-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Utils.h: added FIXME
|
||||
* include/Win_GParted.h,
|
||||
src/Win_GParted.cc: cleanups (mostly messagebox related)
|
||||
* src/GParted_Core.cc: added some more progressfeedback to create and
|
||||
resize
|
||||
|
||||
2006-02-16 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* configure.in: bumped to gparted-0.2.1
|
||||
|
|
|
@ -96,6 +96,8 @@ struct FS
|
|||
Support move ; //startpoint and endpoint
|
||||
Support check ; //some checktool available?
|
||||
Support copy ;
|
||||
|
||||
//FIXME: these 2 should hold 'Sectors' instead if MiB's
|
||||
int MIN ;
|
||||
int MAX ;
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ private:
|
|||
bool any_extended;//used in some checks
|
||||
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
|
||||
FS fs ;
|
||||
|
||||
GParted_Core gparted_core ;
|
||||
|
|
|
@ -14,3 +14,4 @@ notexist
|
|||
po2tbl.sed
|
||||
po2tbl.sed.in
|
||||
stamp-cat-id
|
||||
stamp-it
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2006-02-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* .cvsignore: silence CVS
|
||||
|
||||
2006-02-16 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* bumped to gparted-0.2.1
|
||||
|
|
|
@ -172,7 +172,7 @@ void Dialog_Progress::on_signal_show()
|
|||
//and start..
|
||||
pulse = true ;
|
||||
pthread_create( & pthread, NULL, Dialog_Progress::static_pthread_apply_operation, this );
|
||||
|
||||
|
||||
while ( pulse )
|
||||
{
|
||||
update_operation_details( treerow, operations[ t ] .operation_details ) ;
|
||||
|
|
|
@ -53,15 +53,15 @@ void GParted_Core::find_supported_filesystems( )
|
|||
linux_swap fs_linux_swap;
|
||||
FILESYSTEMS .push_back( fs_linux_swap .get_filesystem_support( ) ) ;
|
||||
|
||||
ntfs fs_ntfs;
|
||||
FILESYSTEMS .push_back( fs_ntfs .get_filesystem_support( ) ) ;
|
||||
|
||||
reiser4 fs_reiser4;
|
||||
FILESYSTEMS .push_back( fs_reiser4 .get_filesystem_support( ) ) ;
|
||||
|
||||
reiserfs fs_reiserfs;
|
||||
FILESYSTEMS .push_back( fs_reiserfs .get_filesystem_support( ) ) ;
|
||||
|
||||
ntfs fs_ntfs;
|
||||
FILESYSTEMS .push_back( fs_ntfs .get_filesystem_support( ) ) ;
|
||||
|
||||
xfs fs_xfs;
|
||||
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support( ) ) ;
|
||||
|
||||
|
@ -751,7 +751,7 @@ int GParted_Core::create_empty_partition( Partition & new_partition,
|
|||
if ( open_device_and_disk( new_partition .device_path ) )
|
||||
{
|
||||
PedPartitionType type;
|
||||
PedPartition *c_part = NULL ;
|
||||
lp_partition = NULL ;
|
||||
PedConstraint *constraint = NULL ;
|
||||
|
||||
//create new partition
|
||||
|
@ -771,8 +771,8 @@ int GParted_Core::create_empty_partition( Partition & new_partition,
|
|||
type = PED_PARTITION_FREESPACE;
|
||||
}
|
||||
|
||||
c_part = ped_partition_new( lp_disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ;
|
||||
if ( c_part )
|
||||
lp_partition = ped_partition_new( lp_disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ;
|
||||
if ( lp_partition )
|
||||
{
|
||||
if ( new_partition .strict )
|
||||
{
|
||||
|
@ -789,10 +789,23 @@ int GParted_Core::create_empty_partition( Partition & new_partition,
|
|||
if ( copy )
|
||||
constraint ->min_size = new_partition .get_length() ;
|
||||
|
||||
if ( ped_disk_add_partition( lp_disk, c_part, constraint ) && commit() )
|
||||
if ( ped_disk_add_partition( lp_disk, lp_partition, constraint ) && commit() )
|
||||
{
|
||||
new_partition .partition = ped_partition_get_path( c_part ) ;
|
||||
new_partition .partition_number = c_part ->num ;
|
||||
new_partition .partition = ped_partition_get_path( lp_partition ) ;
|
||||
new_partition .partition_number = lp_partition ->num ;
|
||||
|
||||
Sector start = lp_partition ->geom .start ;
|
||||
Sector end = lp_partition ->geom .end ;
|
||||
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetails(
|
||||
"<i>" +
|
||||
String::ucompose( _("path: %1"), new_partition .partition ) + "\n" +
|
||||
String::ucompose( _("start: %1"), start ) + "\n" +
|
||||
String::ucompose( _("end: %1"), end ) + "\n" +
|
||||
String::ucompose( _("size: %1"), Utils::format_size( end - start + 1 ) ) +
|
||||
"</i>",
|
||||
OperationDetails::NONE ) ) ;
|
||||
}
|
||||
|
||||
ped_constraint_destroy( constraint );
|
||||
|
@ -829,6 +842,15 @@ bool GParted_Core::resize_container_partition( const Partition & partition_old,
|
|||
std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
operation_details .push_back( OperationDetails( _("resize partition") ) ) ;
|
||||
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetails(
|
||||
"<i>" +
|
||||
String::ucompose( _("old start: %1"), partition_old .sector_start ) + "\n" +
|
||||
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
|
||||
String::ucompose( _("old size: %1"), Utils::format_size( partition_old .get_length() ) ) +
|
||||
"</i>",
|
||||
OperationDetails::NONE ) ) ;
|
||||
|
||||
bool return_value = false ;
|
||||
|
||||
|
@ -840,15 +862,21 @@ bool GParted_Core::resize_container_partition( const Partition & partition_old,
|
|||
if ( partition_old .type == GParted::TYPE_EXTENDED )
|
||||
lp_partition = ped_disk_extended_partition( lp_disk ) ;
|
||||
else
|
||||
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition_old .sector_end + partition_old .sector_start) / 2 ) ;
|
||||
lp_partition = ped_disk_get_partition_by_sector( lp_disk,
|
||||
(partition_old .sector_end + partition_old .sector_start) / 2 ) ;
|
||||
|
||||
if ( lp_partition )
|
||||
{
|
||||
constraint = ped_constraint_any( lp_device );
|
||||
|
||||
if ( fixed_start && constraint ) //create a constraint which keeps de startpoint intact and rounds the end to a cylinderboundary
|
||||
{
|
||||
ped_disk_set_partition_geom( lp_disk, lp_partition, constraint, partition_new .sector_start, partition_new .sector_end ) ;
|
||||
if ( fixed_start && constraint )
|
||||
{
|
||||
//create a constraint which keeps de startpoint intact and rounds the end to a cylinderboundary
|
||||
ped_disk_set_partition_geom( lp_disk,
|
||||
lp_partition,
|
||||
constraint,
|
||||
partition_new .sector_start,
|
||||
partition_new .sector_end ) ;
|
||||
ped_constraint_destroy( constraint );
|
||||
constraint = NULL ;
|
||||
|
||||
|
@ -858,16 +886,37 @@ bool GParted_Core::resize_container_partition( const Partition & partition_old,
|
|||
|
||||
if ( constraint )
|
||||
{
|
||||
if ( ped_disk_set_partition_geom( lp_disk, lp_partition, constraint, partition_new .sector_start, partition_new .sector_end ) )
|
||||
if ( ped_disk_set_partition_geom( lp_disk,
|
||||
lp_partition,
|
||||
constraint,
|
||||
partition_new .sector_start,
|
||||
partition_new .sector_end ) )
|
||||
return_value = commit() ;
|
||||
|
||||
ped_constraint_destroy( constraint );
|
||||
}
|
||||
}
|
||||
|
||||
close_device_and_disk( ) ;
|
||||
close_device_and_disk() ;
|
||||
}
|
||||
|
||||
|
||||
if ( return_value )
|
||||
{
|
||||
//use start/end vars since lp_partition ->geom loses his values after a functioncall :/
|
||||
//this is actually quite weird, but i don't have time to investigate it more thorough.
|
||||
Sector start = lp_partition ->geom .start ;
|
||||
Sector end = lp_partition ->geom .end ;
|
||||
|
||||
operation_details .back() .sub_details .push_back(
|
||||
OperationDetails(
|
||||
"<i>" +
|
||||
String::ucompose( _("new start: %1"), start ) + "\n" +
|
||||
String::ucompose( _("new end: %1"), end ) + "\n" +
|
||||
String::ucompose( _("new size: %1"), Utils::format_size( end - start + 1 ) ) +
|
||||
"</i>",
|
||||
OperationDetails::NONE ) ) ;
|
||||
}
|
||||
|
||||
if ( partition_old .type == GParted::TYPE_EXTENDED )
|
||||
{
|
||||
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
|
||||
|
@ -899,33 +948,38 @@ bool GParted_Core::resize_normal_using_libparted( const Partition & partition_ol
|
|||
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition_old .sector_end + partition_old .sector_start) / 2 ) ;
|
||||
if ( lp_partition )
|
||||
{
|
||||
fs = ped_file_system_open ( & lp_partition ->geom );
|
||||
fs = ped_file_system_open( & lp_partition ->geom );
|
||||
if ( fs )
|
||||
{
|
||||
constraint = ped_file_system_get_resize_constraint ( fs );
|
||||
constraint = ped_file_system_get_resize_constraint( fs );
|
||||
if ( constraint )
|
||||
{
|
||||
if ( ped_disk_set_partition_geom ( lp_disk, lp_partition, constraint, partition_new .sector_start, partition_new .sector_end ) &&
|
||||
ped_file_system_resize ( fs, & lp_partition ->geom, NULL )
|
||||
if ( ped_disk_set_partition_geom( lp_disk,
|
||||
lp_partition,
|
||||
constraint,
|
||||
partition_new .sector_start,
|
||||
partition_new .sector_end )
|
||||
&&
|
||||
ped_file_system_resize( fs, & lp_partition ->geom, NULL )
|
||||
)
|
||||
return_value = commit( ) ;
|
||||
return_value = commit() ;
|
||||
|
||||
ped_constraint_destroy ( constraint );
|
||||
ped_constraint_destroy( constraint );
|
||||
}
|
||||
|
||||
ped_file_system_close ( fs );
|
||||
ped_file_system_close( fs );
|
||||
}
|
||||
}
|
||||
|
||||
close_device_and_disk( ) ;
|
||||
close_device_and_disk() ;
|
||||
}
|
||||
|
||||
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
|
||||
return return_value ;
|
||||
}
|
||||
|
||||
Glib::ustring GParted_Core::Get_Flags( )
|
||||
{
|
||||
Glib::ustring GParted_Core::Get_Flags()
|
||||
{//FIXME: this is ugly, i guess we'd better use a vector in partition to store the flags..
|
||||
temp = "";
|
||||
|
||||
for ( unsigned short t = 0; t < flags .size( ) ; t++ )
|
||||
|
@ -959,7 +1013,6 @@ void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool GParted_Core::set_partition_type( const Partition & partition,
|
||||
std::vector<OperationDetails> & operation_details )
|
||||
{
|
||||
|
@ -979,11 +1032,11 @@ bool GParted_Core::set_partition_type( const Partition & partition,
|
|||
{
|
||||
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
||||
|
||||
if ( lp_partition && ped_partition_set_system( lp_partition, fs_type ) && commit( ) )
|
||||
if ( lp_partition && ped_partition_set_system( lp_partition, fs_type ) && commit() )
|
||||
return_value = wait_for_node( partition .partition ) ;
|
||||
}
|
||||
|
||||
close_device_and_disk( ) ;
|
||||
close_device_and_disk() ;
|
||||
}
|
||||
|
||||
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
|
||||
|
@ -1027,7 +1080,7 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
|
|||
}
|
||||
}
|
||||
|
||||
close_device_and_disk( ) ;
|
||||
close_device_and_disk() ;
|
||||
}
|
||||
|
||||
return return_value ;
|
||||
|
@ -1035,7 +1088,7 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
|
|||
|
||||
bool GParted_Core::open_device( const Glib::ustring & device_path )
|
||||
{
|
||||
lp_device = ped_device_get( device_path .c_str( ) );
|
||||
lp_device = ped_device_get( device_path .c_str() );
|
||||
|
||||
return lp_device ;
|
||||
}
|
||||
|
@ -1058,7 +1111,7 @@ bool GParted_Core::open_device_and_disk( const Glib::ustring & device_path, bool
|
|||
return true ;
|
||||
}
|
||||
|
||||
void GParted_Core::close_device_and_disk( )
|
||||
void GParted_Core::close_device_and_disk()
|
||||
{
|
||||
if ( lp_device )
|
||||
ped_device_destroy( lp_device ) ;
|
||||
|
@ -1070,7 +1123,7 @@ void GParted_Core::close_device_and_disk( )
|
|||
lp_disk = NULL ;
|
||||
}
|
||||
|
||||
bool GParted_Core::commit( )
|
||||
bool GParted_Core::commit()
|
||||
{
|
||||
bool return_value = ped_disk_commit_to_dev( lp_disk ) ;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ Glib::ustring Utils::format_size( Sector size )
|
|||
std::stringstream ss ;
|
||||
//ss .imbue( std::locale( "" ) ) ; see #157871
|
||||
ss << std::setiosflags( std::ios::fixed ) << std::setprecision( 2 ) ;
|
||||
|
||||
|
||||
if ( size < KIBIBYTE )
|
||||
{
|
||||
ss << sector_to_unit( size, UNIT_BYTE ) ;
|
||||
|
|
|
@ -641,7 +641,7 @@ void Win_GParted::Refresh_Visual( )
|
|||
set_valid_operations() ;
|
||||
}
|
||||
|
||||
bool Win_GParted::Quit_Check_Operations( )
|
||||
bool Win_GParted::Quit_Check_Operations()
|
||||
{
|
||||
if ( operations .size() )
|
||||
{
|
||||
|
@ -653,12 +653,10 @@ bool Win_GParted::Quit_Check_Operations( )
|
|||
true );
|
||||
|
||||
if ( operations .size() != 1 )
|
||||
str_temp = String::ucompose( _("%1 operations are currently pending."), operations .size() ) ;
|
||||
dialog .set_secondary_text( String::ucompose( _("%1 operations are currently pending."), operations .size() ) ) ;
|
||||
else
|
||||
str_temp = _("1 operation is currently pending.");
|
||||
dialog .set_secondary_text( _("1 operation is currently pending.") ) ;
|
||||
|
||||
dialog .set_secondary_text( str_temp ) ;
|
||||
|
||||
dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE );
|
||||
dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
|
||||
|
||||
|
@ -669,7 +667,7 @@ bool Win_GParted::Quit_Check_Operations( )
|
|||
return true; //close GParted
|
||||
}
|
||||
|
||||
void Win_GParted::set_valid_operations( )
|
||||
void Win_GParted::set_valid_operations()
|
||||
{
|
||||
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
|
||||
allow_paste( false ); allow_format( false ); allow_unmount( false ) ; allow_info( false ) ;
|
||||
|
@ -853,29 +851,29 @@ void Win_GParted::menu_gparted_refresh_devices( )
|
|||
|
||||
if ( ! readonly_paths .empty() )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += _("The kernel is unable to re-read the partitiontables on the following devices:") ;
|
||||
str_temp += readonly_paths ;
|
||||
str_temp += "</span>\n\n" ;
|
||||
Gtk::MessageDialog dialog(
|
||||
*this,
|
||||
_("The kernel is unable to re-read the partitiontables on the following devices:") + readonly_paths,
|
||||
false,
|
||||
Gtk::MESSAGE_WARNING,
|
||||
Gtk::BUTTONS_OK,
|
||||
true ) ;
|
||||
|
||||
dialog .set_secondary_text( _("Because of this you will only have limited access to these devices. Unmount all mounted partitions on a device to get full access.") ) ;
|
||||
|
||||
str_temp += _("Because of this you will only have limited access to these devices.") ;
|
||||
str_temp += "\n" ;
|
||||
str_temp += _("Unmount all mounted partitions on a device to get full access.") ;
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true ) ;
|
||||
dialog .run( ) ;
|
||||
dialog .run() ;
|
||||
}
|
||||
|
||||
//see if there are any pending operations on non-existent devices
|
||||
//NOTE that this isn't 100% foolproof since some stuff (e.g. sourcedevice of copy) may slip through.
|
||||
//but anyone who removes the sourcedevice before applying the operations gets what he/she deserves :-)
|
||||
unsigned int i ;
|
||||
for ( unsigned int t = 0 ; t < operations .size( ) ; t++ )
|
||||
for ( unsigned int t = 0 ; t < operations .size() ; t++ )
|
||||
{
|
||||
for ( i = 0 ; i < devices .size( ) && devices[ i ] .path != operations[ t ] .device .path ; i++ ) {}
|
||||
for ( i = 0 ; i < devices .size() && devices[ i ] .path != operations[ t ] .device .path ; i++ ) {}
|
||||
|
||||
if ( i >= devices .size( ) )
|
||||
operations .erase( operations .begin( ) + t-- ) ;//decrease t bij one..
|
||||
if ( i >= devices .size() )
|
||||
operations .erase( operations .begin() + t-- ) ;//decrease t bij one..
|
||||
}
|
||||
|
||||
//if no devices were detected we disable some stuff and show a message in the statusbar
|
||||
|
@ -942,55 +940,60 @@ void Win_GParted::menu_gparted_filesystems( )
|
|||
}
|
||||
}
|
||||
|
||||
void Win_GParted::menu_gparted_quit( )
|
||||
void Win_GParted::menu_gparted_quit()
|
||||
{
|
||||
if ( Quit_Check_Operations( ) )
|
||||
this ->hide( );
|
||||
if ( Quit_Check_Operations() )
|
||||
this ->hide();
|
||||
}
|
||||
|
||||
void Win_GParted::menu_view_harddisk_info( )
|
||||
{
|
||||
if ( ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 0 ] ) ->get_active( ) )
|
||||
{ //open harddisk information
|
||||
hpaned_main .get_child1( ) ->show( ) ;
|
||||
for ( int t = hpaned_main .get_position( ) ; t < 250 ; t +=15 )
|
||||
if ( static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 0 ] ) ->get_active() )
|
||||
{ //open harddisk information
|
||||
hpaned_main .get_child1() ->show() ;
|
||||
for ( int t = hpaned_main .get_position() ; t < 250 ; t += 15 )
|
||||
{
|
||||
hpaned_main .set_position( t );
|
||||
while ( Gtk::Main::events_pending( ) )
|
||||
Gtk::Main::iteration( );
|
||||
while ( Gtk::Main::events_pending() )
|
||||
Gtk::Main::iteration();
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //close harddisk information
|
||||
for ( int t=hpaned_main .get_position( ) ; t > 0 ; t -=15 )
|
||||
for ( int t = hpaned_main .get_position() ; t > 0 ; t -= 15 )
|
||||
{
|
||||
hpaned_main .set_position( t );
|
||||
while ( Gtk::Main::events_pending( ) )
|
||||
Gtk::Main::iteration( );
|
||||
while ( Gtk::Main::events_pending() )
|
||||
Gtk::Main::iteration();
|
||||
}
|
||||
hpaned_main .get_child1( ) ->hide( ) ;
|
||||
hpaned_main .get_child1() ->hide() ;
|
||||
}
|
||||
}
|
||||
|
||||
void Win_GParted::menu_view_operations( )
|
||||
void Win_GParted::menu_view_operations()
|
||||
{
|
||||
if ( ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 1 ] ) ->get_active( ) )
|
||||
open_operationslist( ) ;
|
||||
if ( static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] ) ->get_active() )
|
||||
open_operationslist() ;
|
||||
else
|
||||
close_operationslist( ) ;
|
||||
close_operationslist() ;
|
||||
}
|
||||
|
||||
void Win_GParted::menu_help_contents( )
|
||||
void Win_GParted::menu_help_contents()
|
||||
{
|
||||
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( );
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
_("Sorry, not yet implemented."),
|
||||
false,
|
||||
Gtk::MESSAGE_INFO,
|
||||
Gtk::BUTTONS_OK,
|
||||
true );
|
||||
|
||||
dialog .set_secondary_text( _( "Please visit http://gparted.sf.net for more information and support.") ) ;
|
||||
|
||||
dialog .run();
|
||||
}
|
||||
|
||||
|
||||
void Win_GParted::menu_help_about( )
|
||||
void Win_GParted::menu_help_about()
|
||||
{
|
||||
std::vector<Glib::ustring> strings ;
|
||||
|
||||
|
@ -998,7 +1001,7 @@ void Win_GParted::menu_help_about( )
|
|||
dialog .set_transient_for( *this ) ;
|
||||
|
||||
dialog .set_name( _("GParted") ) ;
|
||||
dialog .set_logo( this ->get_icon( ) ) ;
|
||||
dialog .set_logo( this ->get_icon() ) ;
|
||||
dialog .set_version( VERSION ) ;
|
||||
dialog .set_comments( _( "GNOME Partition Editor" ) ) ;
|
||||
dialog .set_copyright( "Copyright © 2004-2005 Bart Hakvoort" ) ;
|
||||
|
@ -1006,12 +1009,12 @@ void Win_GParted::menu_help_about( )
|
|||
//authors
|
||||
strings .push_back( "Bart Hakvoort <gparted@users.sf.net>" ) ;
|
||||
dialog .set_authors( strings ) ;
|
||||
strings .clear( ) ;
|
||||
strings .clear() ;
|
||||
|
||||
//artists
|
||||
strings .push_back( "http://gparted.sourceforge.net/artwork.php" ) ;
|
||||
dialog .set_artists( strings ) ;
|
||||
strings .clear( ) ;
|
||||
strings .clear() ;
|
||||
|
||||
/*TO TRANSLATORS: your name(s) here please, if there are more translators put newlines (\n) between the names.
|
||||
It's a good idea to provide the url of your translationteam as well. Thanks! */
|
||||
|
@ -1023,7 +1026,7 @@ void Win_GParted::menu_help_about( )
|
|||
//the url is not clickable because this would introduce an new dep (gnome-vfsmm)
|
||||
dialog .set_website( "http://gparted.sourceforge.net" ) ;
|
||||
|
||||
dialog .run( ) ;
|
||||
dialog .run() ;
|
||||
}
|
||||
|
||||
void Win_GParted::on_partition_selected( const Partition & partition, bool src_is_treeview )
|
||||
|
@ -1048,56 +1051,37 @@ void Win_GParted::on_partition_popup_menu( unsigned int button, unsigned int tim
|
|||
menu_partition .popup( button, time );
|
||||
}
|
||||
|
||||
bool Win_GParted::max_amount_prim_reached( )
|
||||
bool Win_GParted::max_amount_prim_reached()
|
||||
{
|
||||
//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 ] .max_prims )
|
||||
{
|
||||
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 ] .max_prims ) ;
|
||||
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, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ) ;
|
||||
dialog .run( ) ;
|
||||
Gtk::MessageDialog dialog(
|
||||
*this,
|
||||
String::ucompose( _("It is not possible to create more than %1 primary partitions"),
|
||||
devices[ current_device ] .max_prims ),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true ) ;
|
||||
|
||||
dialog .set_secondary_text(
|
||||
_( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ) ;
|
||||
|
||||
dialog .run() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_resize( )
|
||||
void Win_GParted::activate_resize()
|
||||
{
|
||||
//show warning when one tries to resize a fat16 filesystem
|
||||
if ( selected_partition .filesystem == GParted::FS_FAT16 )
|
||||
{
|
||||
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, 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;
|
||||
|
||||
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( * 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 ) ;
|
||||
dialog .show_all_children( ) ;
|
||||
|
||||
if ( dialog .run( ) == Gtk::RESPONSE_CANCEL )
|
||||
return ;
|
||||
}
|
||||
|
||||
std::vector <Partition> partitions = devices[ current_device ] .partitions ;
|
||||
|
||||
if ( operations .size( ) )
|
||||
for (unsigned int t = 0 ; t < operations .size( ) ; t++ )
|
||||
if ( operations .size() )
|
||||
for (unsigned int t = 0 ; t < operations .size() ; t++ )
|
||||
if ( operations[ t ] .device .path == devices[ current_device ] .path )
|
||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
|
||||
|
@ -1205,13 +1189,17 @@ void Win_GParted::activate_delete()
|
|||
selected_partition .status != GParted::STAT_NEW &&
|
||||
selected_partition .partition_number < devices[ current_device ] .highest_busy )
|
||||
{
|
||||
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 ) ;
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
String::ucompose( _( "Unable to delete %1!"), selected_partition .partition ),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true ) ;
|
||||
|
||||
dialog .set_secondary_text(
|
||||
String::ucompose( _("Please unmount any logical partitions having a number higher than %1"),
|
||||
selected_partition .partition_number ) ) ;
|
||||
|
||||
dialog .run() ;
|
||||
return;
|
||||
}
|
||||
|
@ -1219,17 +1207,21 @@ void Win_GParted::activate_delete()
|
|||
//if partition is on the clipboard...
|
||||
if ( selected_partition .partition == copied_partition .partition )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += String::ucompose( _( "Are you sure you want to delete %1?"),
|
||||
selected_partition .partition ) + "</span>\n\n" ;
|
||||
str_temp += _( "After deletion this partition is no longer available for copying.") ;
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
String::ucompose( _( "Are you sure you want to delete %1?"),
|
||||
selected_partition .partition ),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_NONE,
|
||||
true ) ;
|
||||
|
||||
dialog .set_secondary_text( _("After deletion this partition is no longer available for copying.") ) ;
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true );
|
||||
/*TO TRANSLATORS: dialogtitle, looks like Delete /dev/hda2 (ntfs, 2345 MiB) */
|
||||
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3 MiB)"),
|
||||
dialog .set_title( String::ucompose( _("Delete %1 (%2, %3)"),
|
||||
selected_partition .partition,
|
||||
selected_partition .filesystem,
|
||||
selected_partition .Get_Length_MB() ) );
|
||||
Utils::Get_Filesystem_String( selected_partition .filesystem ),
|
||||
Utils::format_size( selected_partition .get_length() ) ) );
|
||||
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );
|
||||
|
||||
|
@ -1271,7 +1263,7 @@ void Win_GParted::activate_delete()
|
|||
Add_Operation( GParted::DELETE, selected_partition );
|
||||
}
|
||||
|
||||
void Win_GParted::activate_info( )
|
||||
void Win_GParted::activate_info()
|
||||
{
|
||||
Dialog_Partition_Info dialog( selected_partition );
|
||||
dialog .set_transient_for( *this );
|
||||
|
@ -1286,29 +1278,28 @@ void Win_GParted::activate_format( 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(
|
||||
_("Cannot format 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 MiB."),
|
||||
Utils::Get_Filesystem_String( new_fs ),
|
||||
fs .MIN ) ;
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
String::ucompose( _("Cannot format this filesystem to %1."),
|
||||
Utils::Get_Filesystem_String( new_fs ) ) ,
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true );
|
||||
|
||||
if ( selected_partition .Get_Length_MB() < fs .MIN )
|
||||
dialog .set_secondary_text( String::ucompose( _( "A %1 filesystem requires a partition of at least %2 MiB."),
|
||||
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 MiB."),
|
||||
Utils::Get_Filesystem_String( new_fs ),
|
||||
fs .MAX ) ;
|
||||
dialog .set_secondary_text( String::ucompose( _( "A partition with a %1 filesystem has a maximum size of %2 MiB."),
|
||||
Utils::Get_Filesystem_String( new_fs ),
|
||||
fs .MAX ) );
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
|
||||
dialog .run() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
//ok we made it :P lets create an fitting partition object
|
||||
//ok we made it. lets create an fitting partition object
|
||||
Partition part_temp;
|
||||
part_temp .Set( devices[ current_device ] .path,
|
||||
selected_partition .partition,
|
||||
|
@ -1346,9 +1337,11 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
|||
|
||||
void Win_GParted::thread_unmount_partition( bool * succes, Glib::ustring * error )
|
||||
{
|
||||
Glib::ustring dummy ;
|
||||
|
||||
*succes = true ;
|
||||
for ( unsigned int t = 0 ; t < selected_partition .mountpoints .size() && *succes ; t++ )
|
||||
*succes = ! Utils::execute_command( "umount -v " + selected_partition .mountpoints[ t ], str_temp, *error ) ;
|
||||
*succes = ! Utils::execute_command( "umount -v " + selected_partition .mountpoints[ t ], dummy, *error ) ;
|
||||
|
||||
pulse = false ;
|
||||
}
|
||||
|
@ -1382,11 +1375,13 @@ void Win_GParted::activate_unmount()
|
|||
}
|
||||
|
||||
void Win_GParted::thread_toggle_swap( bool * succes, Glib::ustring * error )
|
||||
{
|
||||
{
|
||||
Glib::ustring dummy ;
|
||||
|
||||
if ( selected_partition .busy )
|
||||
*succes = ! Utils::execute_command( "swapoff -v " + selected_partition .partition + " && sync", str_temp, *error ) ;
|
||||
*succes = ! Utils::execute_command( "swapoff -v " + selected_partition .partition + " && sync", dummy, *error ) ;
|
||||
else
|
||||
*succes = ! Utils::execute_command( "swapon -v " + selected_partition .partition + " && sync", str_temp, *error ) ;
|
||||
*succes = ! Utils::execute_command( "swapon -v " + selected_partition .partition + " && sync", dummy, *error ) ;
|
||||
|
||||
pulse = false ;
|
||||
}
|
||||
|
@ -1423,49 +1418,61 @@ void Win_GParted::activate_toggle_swap()
|
|||
menu_gparted_refresh_devices() ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_disklabel( )
|
||||
void Win_GParted::activate_disklabel()
|
||||
{
|
||||
Dialog_Disklabel dialog( devices[ current_device ] .path, gparted_core .get_disklabeltypes( ) ) ;
|
||||
Dialog_Disklabel dialog( devices[ current_device ] .path, gparted_core .get_disklabeltypes() ) ;
|
||||
dialog .set_transient_for( *this );
|
||||
|
||||
if ( dialog .run( ) == Gtk::RESPONSE_OK )
|
||||
if ( dialog .run() == Gtk::RESPONSE_OK )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += String::ucompose( _("Are you sure you want to create a %1 disklabel on %2?"), dialog .Get_Disklabel( ), devices[ current_device ] .path ) ;
|
||||
str_temp += "</span>\n\n" ;
|
||||
str_temp += String::ucompose( _("This operation will destroy all data on %1"), devices[ current_device ] .path ) ;
|
||||
|
||||
Gtk::MessageDialog m_dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true ) ;
|
||||
Gtk::MessageDialog m_dialog( *this,
|
||||
String::ucompose( _("Are you sure you want to create a %1 disklabel on %2?"),
|
||||
dialog .Get_Disklabel(),
|
||||
devices[ current_device ] .path ),
|
||||
false,
|
||||
Gtk::MESSAGE_QUESTION,
|
||||
Gtk::BUTTONS_CANCEL,
|
||||
true ) ;
|
||||
|
||||
m_dialog .set_secondary_text( String::ucompose( _("This operation will destroy all data on %1!"),
|
||||
devices[ current_device ] .path ) ) ;
|
||||
|
||||
m_dialog .add_button( _("Create"), Gtk::RESPONSE_OK );
|
||||
|
||||
if ( m_dialog .run( ) == Gtk::RESPONSE_OK && ! gparted_core .Set_Disklabel( devices[ current_device ] .path, dialog .Get_Disklabel( ) ) )
|
||||
if ( m_dialog .run() == Gtk::RESPONSE_OK &&
|
||||
! gparted_core .Set_Disklabel( devices[ current_device ] .path, dialog .Get_Disklabel() ) )
|
||||
{
|
||||
Gtk::MessageDialog dialog( *this, _("Error while setting new disklabel"), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ) ;
|
||||
dialog .run( ) ;
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
_("Error while setting new disklabel"),
|
||||
true,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK,
|
||||
true ) ;
|
||||
dialog .run() ;
|
||||
}
|
||||
|
||||
menu_gparted_refresh_devices( ) ;
|
||||
menu_gparted_refresh_devices() ;
|
||||
}
|
||||
}
|
||||
|
||||
void Win_GParted::activate_undo( )
|
||||
void Win_GParted::activate_undo()
|
||||
{
|
||||
//when undoing an creation it's safe to decrease the newcount by one
|
||||
if ( operations .back( ) .operationtype == GParted::CREATE )
|
||||
if ( operations .back() .operationtype == GParted::CREATE )
|
||||
new_count-- ;
|
||||
|
||||
operations.erase( operations .end( ) );
|
||||
operations.erase( operations .end() );
|
||||
|
||||
Refresh_Visual( );
|
||||
Refresh_Visual();
|
||||
|
||||
if ( ! operations .size( ) )
|
||||
close_operationslist( ) ;
|
||||
if ( ! operations .size() )
|
||||
close_operationslist() ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_apply( )
|
||||
void Win_GParted::activate_apply()
|
||||
{
|
||||
Gtk::MessageDialog dialog( *this,
|
||||
_( "Are you sure you want to apply the pending operations?" ),
|
||||
_("Are you sure you want to apply the pending operations?"),
|
||||
false,
|
||||
Gtk::MESSAGE_WARNING,
|
||||
Gtk::BUTTONS_NONE,
|
||||
|
|
Loading…
Reference in a new issue