added visual feedback when unmounting or deactivating swap. This can be
* include/Win_GParted.h, src/Win_GParted.cc: added visual feedback when unmounting or deactivating swap. This can be usefull when it takes longer then usual.
This commit is contained in:
parent
1e6ad5884a
commit
388ffffff0
|
@ -1,3 +1,10 @@
|
||||||
|
2006-01-08 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* include/Win_GParted.h,
|
||||||
|
src/Win_GParted.cc: added visual feedback when unmounting or
|
||||||
|
deactivating swap. This can be usefull when it takes longer then
|
||||||
|
usual.
|
||||||
|
|
||||||
2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* src/Dialog_Partition_Info.cc: removed separator in accordance to the
|
* src/Dialog_Partition_Info.cc: removed separator in accordance to the
|
||||||
|
|
|
@ -62,7 +62,7 @@ private:
|
||||||
void init_hpaned_main( ) ;
|
void init_hpaned_main( ) ;
|
||||||
|
|
||||||
void refresh_combo_devices() ;
|
void refresh_combo_devices() ;
|
||||||
void Show_Pulsebar( ) ;
|
void show_pulsebar( const Glib::ustring & status_message ) ;
|
||||||
|
|
||||||
//Fill txtview_device_info_buffer with some information about the selected device
|
//Fill txtview_device_info_buffer with some information about the selected device
|
||||||
void Fill_Label_Device_Info( bool clear = false );
|
void Fill_Label_Device_Info( bool clear = false );
|
||||||
|
@ -116,9 +116,10 @@ private:
|
||||||
toolbar_main .get_nth_item( 9 ) ->set_sensitive( b );
|
toolbar_main .get_nth_item( 9 ) ->set_sensitive( b );
|
||||||
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_sensitive( b ) ; }
|
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_sensitive( b ) ; }
|
||||||
|
|
||||||
void find_devices_thread( ) {
|
//threads..
|
||||||
gparted_core .get_devices( devices ) ;
|
void thread_refresh_devices() ;
|
||||||
pulse = false ; }
|
void thread_unmount_partition() ;
|
||||||
|
void thread_deactivate_swap() ;
|
||||||
|
|
||||||
//signal handlers
|
//signal handlers
|
||||||
void open_operationslist( ) ;
|
void open_operationslist( ) ;
|
||||||
|
|
|
@ -413,7 +413,6 @@ void Win_GParted::refresh_combo_devices()
|
||||||
{
|
{
|
||||||
liststore_devices ->clear() ;
|
liststore_devices ->clear() ;
|
||||||
|
|
||||||
//fill combo_devices
|
|
||||||
for ( unsigned int i = 0 ; i < devices .size( ) ; i++ )
|
for ( unsigned int i = 0 ; i < devices .size( ) ; i++ )
|
||||||
{
|
{
|
||||||
treerow = *( liststore_devices ->append() ) ;
|
treerow = *( liststore_devices ->append() ) ;
|
||||||
|
@ -426,10 +425,10 @@ void Win_GParted::refresh_combo_devices()
|
||||||
combo_devices .set_active( current_device ) ;
|
combo_devices .set_active( current_device ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::Show_Pulsebar( )
|
void Win_GParted::show_pulsebar( const Glib::ustring & status_message )
|
||||||
{
|
{
|
||||||
pulsebar .show();
|
pulsebar .show();
|
||||||
statusbar .push( _("Scanning all devices...") ) ;
|
statusbar .push( status_message) ;
|
||||||
|
|
||||||
//disable all input stuff
|
//disable all input stuff
|
||||||
toolbar_main .set_sensitive( false ) ;
|
toolbar_main .set_sensitive( false ) ;
|
||||||
|
@ -749,15 +748,20 @@ void Win_GParted::combo_devices_changed( )
|
||||||
Refresh_Visual( );
|
Refresh_Visual( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Win_GParted::thread_refresh_devices()
|
||||||
|
{
|
||||||
|
gparted_core .get_devices( devices ) ;
|
||||||
|
pulse = false ;
|
||||||
|
}
|
||||||
|
|
||||||
void Win_GParted::menu_gparted_refresh_devices( )
|
void Win_GParted::menu_gparted_refresh_devices( )
|
||||||
{
|
{
|
||||||
//find out if there was any change in available devices (think about flexible media like zipdisks/usbsticks/whatever ;-) )
|
pulse = true ;
|
||||||
pulse = true ;//set to true before creating the thread to prevent _possible_ infinite loop in Show_Pulsebar( )
|
thread = Glib::Thread::create( sigc::mem_fun( *this, &Win_GParted::thread_refresh_devices ), true ) ;
|
||||||
thread = Glib::Thread::create( SigC::slot_class( *this, &Win_GParted::find_devices_thread ), true );
|
|
||||||
|
|
||||||
Show_Pulsebar() ;
|
show_pulsebar( _("Scanning all devices...") ) ;
|
||||||
|
|
||||||
//check if current_device is still available (think about hotpluggable shit like usbdevices)
|
//check if current_device is still available (think about hotpluggable stuff like usbdevices)
|
||||||
if ( current_device >= devices .size() )
|
if ( current_device >= devices .size() )
|
||||||
current_device = 0 ;
|
current_device = 0 ;
|
||||||
|
|
||||||
|
@ -955,8 +959,7 @@ void Win_GParted::on_partition_selected( const Partition & partition, bool src_i
|
||||||
|
|
||||||
void Win_GParted::on_partition_activated()
|
void Win_GParted::on_partition_activated()
|
||||||
{
|
{
|
||||||
if ( ! pulse )
|
activate_info() ;
|
||||||
activate_info() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::on_partition_popup_menu( unsigned int button, unsigned int time )
|
void Win_GParted::on_partition_popup_menu( unsigned int button, unsigned int time )
|
||||||
|
@ -1252,33 +1255,60 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
||||||
Add_Operation( GParted::FORMAT, part_temp ) ;
|
Add_Operation( GParted::FORMAT, part_temp ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Win_GParted::thread_unmount_partition()
|
||||||
|
{
|
||||||
|
if ( Utils::unmount( selected_partition .partition, selected_partition .mountpoint, str_temp ) )
|
||||||
|
str_temp .clear() ;
|
||||||
|
|
||||||
|
pulse = false ;
|
||||||
|
}
|
||||||
|
|
||||||
void Win_GParted::activate_unmount( )
|
void Win_GParted::activate_unmount( )
|
||||||
{
|
{
|
||||||
Glib::ustring error ;
|
pulse = true ;
|
||||||
|
thread = Glib::Thread::create( sigc::mem_fun( *this, &Win_GParted::thread_unmount_partition ), true ) ;
|
||||||
|
|
||||||
if ( ! Utils::unmount( selected_partition .partition, selected_partition .mountpoint, error ) )
|
show_pulsebar( String::ucompose( _("Unmounting %1"), selected_partition .partition ) ) ;
|
||||||
|
|
||||||
|
if ( ! str_temp .empty() )
|
||||||
{
|
{
|
||||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
Gtk::MessageDialog dialog( *this,
|
||||||
str_temp += String::ucompose( _("Could not unmount %1"), selected_partition .partition ) ;
|
"<span weight=\"bold\" size=\"larger\">" +
|
||||||
str_temp += "</span>\n\n" ;
|
String::ucompose( _("Could not unmount %1"), selected_partition .partition ) +
|
||||||
|
"</span>\n\n" + str_temp,
|
||||||
Gtk::MessageDialog dialog( *this, str_temp + error, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
|
true,
|
||||||
dialog.run( ) ;
|
Gtk::MESSAGE_ERROR,
|
||||||
|
Gtk::BUTTONS_OK,
|
||||||
|
true );
|
||||||
|
dialog.run() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_gparted_refresh_devices() ;
|
menu_gparted_refresh_devices() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::activate_disable_swap()
|
void Win_GParted::thread_deactivate_swap()
|
||||||
{
|
{
|
||||||
if ( swapoff( selected_partition .partition .c_str() ) )
|
if ( swapoff( selected_partition .partition .c_str() ) )
|
||||||
{
|
str_temp = Glib::strerror( errno ) ;
|
||||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
else
|
||||||
str_temp += _("Could not deactivate swap") ;
|
str_temp .clear() ;
|
||||||
str_temp += "</span>\n\n" ;
|
|
||||||
|
|
||||||
|
pulse = false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Win_GParted::activate_disable_swap()
|
||||||
|
{
|
||||||
|
pulse = true ;
|
||||||
|
thread = Glib::Thread::create( sigc::mem_fun( *this, &Win_GParted::thread_deactivate_swap ), true ) ;
|
||||||
|
|
||||||
|
show_pulsebar( String::ucompose( _("Deactivating swap on %1"), selected_partition .partition ) ) ;
|
||||||
|
|
||||||
|
if ( ! str_temp .empty() )
|
||||||
|
{
|
||||||
Gtk::MessageDialog dialog( *this,
|
Gtk::MessageDialog dialog( *this,
|
||||||
str_temp + Glib::strerror( errno ),
|
"<span weight=\"bold\" size=\"larger\">" +
|
||||||
|
static_cast<Glib::ustring>( _("Could not deactivate swap") ) +
|
||||||
|
"</span>\n\n" + str_temp,
|
||||||
true,
|
true,
|
||||||
Gtk::MESSAGE_ERROR,
|
Gtk::MESSAGE_ERROR,
|
||||||
Gtk::BUTTONS_OK,
|
Gtk::BUTTONS_OK,
|
||||||
|
|
Loading…
Reference in New Issue