[gparted] Refactor some logic into separate settle_device method



commit 301bd77312917934a9f195b527daee7d389413a5
Author: Curtis Gedak <gedakc gmail com>
Date:   Sat May 2 10:49:49 2009 -0600

    Refactor some logic into separate settle_device method
---
 include/GParted_Core.h |    1 +
 src/GParted_Core.cc    |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/GParted_Core.h b/include/GParted_Core.h
index 5265d34..ead5f75 100644
--- a/include/GParted_Core.h
+++ b/include/GParted_Core.h
@@ -179,6 +179,7 @@ private:
 	void close_device_and_disk() ;
 	bool commit() ;
 	bool commit_to_os( std::time_t timeout ) ;
+	void settle_device( std::time_t timeout ) ;
 
 	static PedExceptionOption ped_exception_handler( PedException * e ) ;
 
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index f9d26f6..0b48741 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2666,16 +2666,21 @@ bool GParted_Core::commit_to_os( std::time_t timeout )
 	else
 		succes = ped_disk_commit_to_os( lp_disk ) ;
 
+	settle_device( timeout ) ;
+
+	return succes ;
+}
+
+void GParted_Core::settle_device( std::time_t timeout )
+{
 	if ( ! Glib::find_program_in_path( "udevsettle" ) .empty() )
 		Utils::execute_command( "udevsettle --timeout=" + Utils::num_to_str( timeout ) ) ;
 	else if ( ! Glib::find_program_in_path( "udevadm" ) .empty() )
 		Utils::execute_command( "udevadm settle --timeout=" + Utils::num_to_str( timeout ) ) ;
 	else
 		sleep( timeout ) ;
-
-	return succes ;
 }
-	
+
 PedExceptionOption GParted_Core::ped_exception_handler( PedException * e ) 
 {
         std::cout << e ->message << std::endl ;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]