mfleetwo / rpms / gparted

Forked from rpms/gparted 3 years ago
Clone
Blob Blame History Raw
--- include/Win_GParted.h	2006-11-25 09:56:30.000000000 -0500
+++ include/Win_GParted.h.new	2007-10-30 00:37:29.000000000 -0400
@@ -233,6 +233,7 @@
 	unsigned short new_count;//new_count keeps track of the new created partitions
 	FS fs ;
 	bool OPERATIONSLIST_OPEN ;
+	sigc::connection combo_devices_signal_changed_id ;
 									
 	GParted_Core gparted_core ;
 	std::vector<Gtk::Label *> device_info ;
--- src/Win_GParted.cc	2008-02-04 09:35:47.000000000 -0500
+++ src/Win_GParted.cc.new	2008-02-07 15:34:30.000000000 -0500
@@ -260,7 +260,8 @@
 	combo_devices .pack_start( treeview_devices_columns .device ) ;
 	combo_devices .pack_start( treeview_devices_columns .size, false ) ;
 	
-	combo_devices .signal_changed() .connect( sigc::mem_fun(*this, &Win_GParted::combo_devices_changed) );
+	combo_devices_signal_changed_id =
+		combo_devices .signal_changed() .connect( sigc::mem_fun(*this, &Win_GParted::combo_devices_changed) );
 
 	hbox_toolbar .pack_start( combo_devices, Gtk::PACK_SHRINK ) ;
 }
@@ -502,6 +503,7 @@
 
 void Win_GParted::refresh_combo_devices()
 {
+	combo_devices_signal_changed_id .block() ;
 	liststore_devices ->clear() ;
 	
 	menu = manage( new Gtk::Menu() ) ;
@@ -538,6 +540,7 @@
 		menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_submenu( *menu ) ;
 	}
 	
+	combo_devices_signal_changed_id .unblock() ;
 	combo_devices .set_active( current_device ) ;
 }
 
@@ -916,13 +919,8 @@
 
 void Win_GParted::combo_devices_changed()
 {
-	unsigned int old_current_device = current_device;
 	//set new current device
 	current_device = combo_devices .get_active_row_number() ;
-	if ( current_device == (unsigned int) -1 )
-		current_device = old_current_device;
-	if ( current_device >= devices .size() )
-		current_device = 0 ;
 	set_title( String::ucompose( _("%1 - GParted"), devices[ current_device ] .get_path() ) );
 	
 	//refresh label_device_info