removed separator in accordance to the HIG it's now possible to deactivate

* src/Dialog_Partition_Info.cc: removed separator in accordance to the
  HIG
* include/Win_GParted.h,
  src/Win_GParted.cc: it's now possible to deactivate swap from within
  gparted.
* src/GParted_Core.cc: sleep one second after deletion of a partition to
  give the kernel some time to reread the partitiontable.
This commit is contained in:
Bart Hakvoort 2006-01-07 21:23:09 +00:00
parent f9ab3cdd3c
commit 1e6ad5884a
5 changed files with 78 additions and 30 deletions

View File

@ -1,3 +1,13 @@
2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Dialog_Partition_Info.cc: removed separator in accordance to the
HIG
* include/Win_GParted.h,
src/Win_GParted.cc: it's now possible to deactivate swap from within
gparted.
* src/GParted_Core.cc: sleep one second after deletion of a partition to
give the kernel some time to reread the partitiontable.
2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Utils.cc: commented 'ss .imbue( std::locale( "" ) )' (#157871) * src/Utils.cc: commented 'ss .imbue( std::locale( "" ) )' (#157871)

View File

@ -102,8 +102,11 @@ private:
void allow_unmount( bool b ) { void allow_unmount( bool b ) {
menu_partition .items( )[ 10 ] .set_sensitive( b ); } menu_partition .items( )[ 10 ] .set_sensitive( b ); }
void allow_disable_swap( bool b ) {
menu_partition .items( )[ 11 ] .set_sensitive( b ); }
void allow_info( bool b ) { void allow_info( bool b ) {
menu_partition .items( )[ 12 ] .set_sensitive( b ); } menu_partition .items( )[ 13 ] .set_sensitive( b ); }
void allow_undo( bool b ) { void allow_undo( bool b ) {
toolbar_main .get_nth_item( 8 ) ->set_sensitive( b ); toolbar_main .get_nth_item( 8 ) ->set_sensitive( b );
@ -137,15 +140,16 @@ private:
bool max_amount_prim_reached( ) ; bool max_amount_prim_reached( ) ;
void activate_resize( ); void activate_resize();
void activate_copy( ); void activate_copy();
void activate_paste( ); void activate_paste();
void activate_new( ); void activate_new();
void activate_delete( ); void activate_delete();
void activate_info( ); void activate_info();
void activate_format( GParted::FILESYSTEM new_fs ); void activate_format( GParted::FILESYSTEM new_fs );
void activate_unmount( ) ; void activate_unmount() ;
void activate_disklabel( ) ; void activate_disable_swap() ;
void activate_disklabel() ;
void activate_undo( ); void activate_undo( );
void activate_apply( ); void activate_apply( );
@ -175,7 +179,7 @@ private:
Gtk::Button *button; Gtk::Button *button;
Gtk::Table *table ; Gtk::Table *table ;
Gtk::MenuItem *menu_item; Gtk::MenuItem *menu_item;
Gtk::ProgressBar *pulsebar ; Gtk::ProgressBar pulsebar ;
Gtk::TreeRow treerow; Gtk::TreeRow treerow;
VBox_VisualDisk vbox_visual_disk; VBox_VisualDisk vbox_visual_disk;

View File

@ -24,7 +24,8 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
{ {
this ->partition = partition ; this ->partition = partition ;
this ->set_resizable( false ); this ->set_resizable( false ) ;
this ->set_has_separator( false ) ;
/*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */ /*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */
this ->set_title( String::ucompose( _( "Information about %1"), partition .partition ) ); this ->set_title( String::ucompose( _( "Information about %1"), partition .partition ) );

View File

@ -570,9 +570,10 @@ bool GParted_Core::Delete( const Partition & partition )
else else
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ; lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
return_value = ( ped_disk_delete_partition( lp_disk, lp_partition ) && commit( ) ) ; return_value = ( ped_disk_delete_partition( lp_disk, lp_partition ) && commit() ) ;
sleep( 1 ) ; //give the kernel some time to reread the partitiontable
close_device_and_disk( ) ; close_device_and_disk() ;
} }
return return_value ; return return_value ;

View File

@ -19,6 +19,9 @@
#include <gtkmm/aboutdialog.h> #include <gtkmm/aboutdialog.h>
#include <cerrno>
#include <sys/swap.h>
namespace GParted namespace GParted
{ {
@ -75,9 +78,8 @@ Win_GParted::Win_GParted( )
vpaned_main .pack2( hbox_operations, true, true ) ; vpaned_main .pack2( hbox_operations, true, true ) ;
//statusbar... //statusbar...
pulsebar = manage( new Gtk::ProgressBar( ) ); pulsebar .set_pulse_step( 0.01 );
pulsebar ->set_pulse_step( 0.01 ); statusbar .add( pulsebar );
statusbar .add( *pulsebar );
vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK ); vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK );
this ->show_all_children( ); this ->show_all_children( );
@ -87,7 +89,7 @@ Win_GParted::Win_GParted( )
close_operationslist( ) ; close_operationslist( ) ;
conn = dispatcher .connect( sigc::mem_fun( *this, &Win_GParted::menu_gparted_refresh_devices ) ); conn = dispatcher .connect( sigc::mem_fun( *this, &Win_GParted::menu_gparted_refresh_devices ) );
dispatcher( ) ; dispatcher() ;
} }
void Win_GParted::init_menubar( ) void Win_GParted::init_menubar( )
@ -227,6 +229,10 @@ void Win_GParted::init_partition_menu( )
Gtk::Menu_Helpers::MenuElem( _("Unmount"), Gtk::Menu_Helpers::MenuElem( _("Unmount"),
sigc::mem_fun( *this, &Win_GParted::activate_unmount ) ) ); sigc::mem_fun( *this, &Win_GParted::activate_unmount ) ) );
menu_partition .items() .push_back(
Gtk::Menu_Helpers::MenuElem( _("Deactivate"),
sigc::mem_fun( *this, &Win_GParted::activate_disable_swap ) ) );
menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() );
menu_partition .items() .push_back( menu_partition .items() .push_back(
@ -422,7 +428,7 @@ void Win_GParted::refresh_combo_devices()
void Win_GParted::Show_Pulsebar( ) void Win_GParted::Show_Pulsebar( )
{ {
pulsebar ->show(); pulsebar .show();
statusbar .push( _("Scanning all devices...") ) ; statusbar .push( _("Scanning all devices...") ) ;
//disable all input stuff //disable all input stuff
@ -436,7 +442,7 @@ void Win_GParted::Show_Pulsebar( )
//the actual 'pulsing' //the actual 'pulsing'
while ( pulse ) while ( pulse )
{ {
pulsebar ->pulse(); pulsebar .pulse();
while ( Gtk::Main::events_pending() ) while ( Gtk::Main::events_pending() )
Gtk::Main::iteration(); Gtk::Main::iteration();
@ -446,7 +452,7 @@ void Win_GParted::Show_Pulsebar( )
thread ->join() ; thread ->join() ;
conn .disconnect() ; conn .disconnect() ;
pulsebar ->hide(); pulsebar .hide();
statusbar .pop() ; statusbar .pop() ;
//enable all disabled stuff //enable all disabled stuff
@ -622,9 +628,10 @@ void Win_GParted::Set_Valid_Operations( )
{ {
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false ); allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
allow_paste( false ); allow_format( false ); allow_unmount( false ) ; allow_info( false ) ; allow_paste( false ); allow_format( false ); allow_unmount( false ) ; allow_info( false ) ;
allow_disable_swap( false ) ;
//no partition selected... //no partition selected...
if ( selected_partition .partition .empty( ) ) if ( selected_partition .partition .empty() )
return ; return ;
//if there's something, there's some info ;) //if there's something, there's some info ;)
@ -633,8 +640,13 @@ void Win_GParted::Set_Valid_Operations( )
//only unmount is allowed //only unmount is allowed
if ( selected_partition .busy ) if ( selected_partition .busy )
{ {
if ( selected_partition .filesystem != GParted::FS_LINUX_SWAP && selected_partition .type != GParted::TYPE_EXTENDED ) if ( selected_partition .type != GParted::TYPE_EXTENDED )
allow_unmount( true ) ; {
if ( selected_partition .filesystem == GParted::FS_LINUX_SWAP )
allow_disable_swap( true ) ;
else
allow_unmount( true ) ;
}
return; return;
} }
@ -645,10 +657,10 @@ void Win_GParted::Set_Valid_Operations( )
allow_new( true ); allow_new( true );
//find out if there is a copied partition and if it fits inside this unallocated space //find out if there is a copied partition and if it fits inside this unallocated space
if ( ! copied_partition .partition .empty( ) && ! devices[ current_device ] .readonly ) if ( ! copied_partition .partition .empty() && ! devices[ current_device ] .readonly )
{ {
if ( (copied_partition .Get_Length_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) || if ( (copied_partition .Get_Length_MB() + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB() ||
(copied_partition .filesystem == GParted::FS_XFS && (copied_partition .Get_Used_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) ) (copied_partition .filesystem == GParted::FS_XFS && (copied_partition .Get_Used_MB() + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB() )
) )
allow_paste( true ) ; allow_paste( true ) ;
} }
@ -659,7 +671,7 @@ void Win_GParted::Set_Valid_Operations( )
//EXTENDED //EXTENDED
if ( selected_partition .type == GParted::TYPE_EXTENDED ) if ( selected_partition .type == GParted::TYPE_EXTENDED )
{ {
if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside. if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside.
allow_delete( true ) ; allow_delete( true ) ;
if ( ! devices[ current_device ] .readonly ) if ( ! devices[ current_device ] .readonly )
@ -1253,8 +1265,28 @@ void Win_GParted::activate_unmount( )
Gtk::MessageDialog dialog( *this, str_temp + error, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ); Gtk::MessageDialog dialog( *this, str_temp + error, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
dialog.run( ) ; dialog.run( ) ;
} }
else
menu_gparted_refresh_devices( ) ; menu_gparted_refresh_devices() ;
}
void Win_GParted::activate_disable_swap()
{
if ( swapoff( selected_partition .partition .c_str() ) )
{
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _("Could not deactivate swap") ;
str_temp += "</span>\n\n" ;
Gtk::MessageDialog dialog( *this,
str_temp + Glib::strerror( errno ),
true,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true );
dialog.run() ;
}
menu_gparted_refresh_devices() ;
} }
void Win_GParted::activate_disklabel( ) void Win_GParted::activate_disklabel( )