deal correctly with the progressdialog's delete_event.

* include/Dialog_Progress.h,
  src/Dialog_Progress.cc,
  src/Win_GParted.cc: deal correctly with the progressdialog's
  delete_event.
This commit is contained in:
Bart Hakvoort 2006-01-26 22:49:37 +00:00
parent 8a2624c3b8
commit e00e9cfa61
4 changed files with 42 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2006-01-26 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Dialog_Progress.h,
src/Dialog_Progress.cc,
src/Win_GParted.cc: deal correctly with the progressdialog's
delete_event.
2006-01-26 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Dialog_Partition_Info.h,

View File

@ -45,8 +45,10 @@ private:
void on_signal_show() ;
void on_expander_changed() ;
static void *static_pthread_apply_operation( void * p_dialog_progress ) ;
void on_cancel() ;
void on_response( int response_id ) ;
bool on_delete_event( GdkEventAny * event ) ;
Gtk::Label label_current ;
Gtk::ProgressBar progressbar_all, progressbar_current ;

View File

@ -252,32 +252,43 @@ void * Dialog_Progress::static_pthread_apply_operation( void * p_dialog_progress
return NULL ;
}
void Dialog_Progress::on_cancel()
{
Gtk::MessageDialog dialog( *this,
_("Are you sure you want to cancel the current operation?"),
false,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_NONE,
true ) ;
dialog .set_secondary_text( _("Canceling an operation may cause SEVERE filesystem damage.") ) ;
dialog .add_button( _("Continue Operation"), Gtk::RESPONSE_NONE ) ;
dialog .add_button( _("Cancel Operation"), Gtk::RESPONSE_CANCEL ) ;
if ( dialog .run() == Gtk::RESPONSE_CANCEL )
{
pthread_cancel( pthread ) ;
cancel = true ;
pulse = false ;
succes = false ;
}
}
void Dialog_Progress::on_response( int response_id )
{
if ( response_id == Gtk::RESPONSE_CANCEL )
{
Gtk::MessageDialog dialog( *this,
_("Are you sure you want to cancel the current operation?"),
false,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_NONE,
true ) ;
dialog .set_secondary_text( _("Canceling an operation may cause SEVERE filesystem damage.") ) ;
dialog .add_button( _("Continue Operation"), Gtk::RESPONSE_NONE ) ;
dialog .add_button( _("Cancel Operation"), Gtk::RESPONSE_CANCEL ) ;
if ( dialog .run() == Gtk::RESPONSE_CANCEL )
{
pthread_cancel( pthread ) ;
cancel = true ;
pulse = false ;
succes = false ;
}
}
on_cancel() ;
}
bool Dialog_Progress::on_delete_event( GdkEventAny * event )
{
//it seems this get only called at runtime
on_cancel() ;
return true ;
}
Dialog_Progress::~Dialog_Progress()
{
}

View File

@ -1394,7 +1394,7 @@ void Win_GParted::activate_apply( )
dialog_progress .signal_apply_operation .connect(
sigc::mem_fun(gparted_core, &GParted_Core::apply_operation_to_disk) ) ;
for ( ; dialog_progress .run() != Gtk::RESPONSE_OK ; ) {}
for ( ; dialog_progress .run() == Gtk::RESPONSE_CANCEL ; ) {}
dialog_progress .hide() ;
//find out if any of the involved devices is busy