From 8f7f96387b1f9c47b89b836f79088fba705af657 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Tue, 21 Sep 2004 18:04:48 +0000 Subject: [PATCH] fixed bug with 'device is busy' dialog --- ChangeLog | 1 + src/Win_GParted.cc | 39 +++++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5356bbbe..ee33024a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ - when performing operations on just copied partitions, there was a chance the operation would be executed on another partition. fixed. - fixed a rare bug that caused incorrect partitiontable display after an operation went wrong. - some errormessages were not entirely threadsafe, fixed (hopefully :P ) +- fixed annoying bug with warningdialog which pops up after performing an operation on a busy device -------------------------------------------------------------------------- diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index dbf11f40..68a77d40 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -999,6 +999,32 @@ void Win_GParted::activate_apply() s3.disconnect(); delete ( dialog_progress ) ; thread_operations->join() ; + + //make list of involved devices which have at least one busy partition.. + std::vector devicenames ; + for (unsigned int t=0; tGet_Path() ) == devicenames .end() && + operations[ t ] .device ->Get_any_busy() + ) + devicenames .push_back( operations[ t ] .device ->Get_Path() ) ; + + //show warning if necessary + if ( devicenames .size() ) + { + os << "" ; + os << _("The kernel was unable to re-read the partition table on :") << "\n"; + for (unsigned int t=0; t\n\n" << _( "This means Linux won't know anything about the modifications you made until you reboot.") << "\n\n" ; + if ( devicenames .size() > 1 ) + os << _( "You should reboot your computer before doing anything with these devices.") ; + else + os << _( "You should reboot your computer before doing anything with this device.") ; + + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); os.str("") ; + dialog.run() ; + } + //wipe operations... operations.clear(); @@ -1009,18 +1035,7 @@ void Win_GParted::activate_apply() //then clean up the rest new_count = 1; close_operationslist() ; - - //show warning is necesarry - if ( devices[ current_device ] ->Get_any_busy() ) - { - os << "" ; - os << _("The kernel was unable to re-read the partition table on") << " " << devices[ current_device ] ->Get_Path() ; - os << "\n\n" << _( "This means Linux won't know anything about the modifications you made until you reboot.") << "\n\n" ; - os << _( "You should reboot your computer before doing anything with") << " " << devices[ current_device ] ->Get_Path() ; - Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); os.str("") ; - dialog.run() ; - } - + } }