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> 2006-01-26 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Dialog_Partition_Info.h, * include/Dialog_Partition_Info.h,

View File

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

View File

@ -252,9 +252,7 @@ void * Dialog_Progress::static_pthread_apply_operation( void * p_dialog_progress
return NULL ; return NULL ;
} }
void Dialog_Progress::on_response( int response_id ) void Dialog_Progress::on_cancel()
{
if ( response_id == Gtk::RESPONSE_CANCEL )
{ {
Gtk::MessageDialog dialog( *this, Gtk::MessageDialog dialog( *this,
_("Are you sure you want to cancel the current operation?"), _("Are you sure you want to cancel the current operation?"),
@ -276,8 +274,21 @@ void Dialog_Progress::on_response( int response_id )
succes = false ; succes = false ;
} }
} }
void Dialog_Progress::on_response( int response_id )
{
if ( response_id == Gtk::RESPONSE_CANCEL )
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() Dialog_Progress::~Dialog_Progress()
{ {
} }

View File

@ -1394,7 +1394,7 @@ void Win_GParted::activate_apply( )
dialog_progress .signal_apply_operation .connect( dialog_progress .signal_apply_operation .connect(
sigc::mem_fun(gparted_core, &GParted_Core::apply_operation_to_disk) ) ; 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() ; dialog_progress .hide() ;
//find out if any of the involved devices is busy //find out if any of the involved devices is busy