diff --git a/ChangeLog b/ChangeLog index 7b1107ed..4a49d729 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-03 Bart Hakvoort + + * src/GParted_Core.cc: When ( ! deep_scan ) now only one device is scanned (first found one). Shaves off a couple of millisec from startuptime |-) + * src/Win_GParted.cc: Fixed small bug with removable devices and the devicemenu. Also fixed redundant calling of 2 functions. + 2004-12-02 Bart Hakvoort * src/Win_GParted.cc, diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 9de2dc7f..da38886c 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -57,20 +57,26 @@ void GParted_Core::get_devices( std::vector & devices, bool deep_scan ) Device temp_device ; std::vector device_paths ; - device = ped_device_get_next ( NULL ); + device = ped_device_get_next( NULL ); //in certain cases (e.g. when there's a cd in the cdrom-drive) ped_device_probe_all will find a 'ghost' device that has no name or contains //random garbage. Those 2 checks try to prevent such a ghostdevice from being initialized.. (tested over a 1000 times with and without cd) - while ( device && strlen( device ->path ) > 6 && ( (Glib::ustring) device ->path ). is_ascii( ) ) + while ( device && strlen( device ->path ) > 6 && ( (Glib::ustring) device ->path ) .is_ascii( ) ) { if ( open_device( device ->path, device ) ) + { device_paths .push_back( get_sym_path( device ->path ) ) ; + + if ( ! deep_scan ) + break ; + } + - device = ped_device_get_next ( device ) ; + device = ped_device_get_next( device ) ; } close_device_and_disk( device, disk ) ; - //and sort the devices on name.. (this prevents some very weird errors ;) ) + //and sort the devices by name.. (this prevents some very weird errors ;) ) sort( device_paths .begin( ), device_paths .end( ) ) ; diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 851ab0f8..36e76eb1 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -347,16 +347,16 @@ void Win_GParted::Find_Devices( bool deep_scan ) { gparted_core .get_devices( devices, deep_scan ) ; - //paranoia check.. :) <---NOT threadsave.. + //paranoia check.. :) if ( devices .empty( ) ) { str_temp = "" ; str_temp += _("No devices were detected") ; str_temp += "\n\n" ; - str_temp += _( "You have probably encountered a bug. GParted will quit now.") ; + str_temp += _("You have probably encountered a bug. GParted will quit now.") ; Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ) ; - dialog .run( ) ; + dialog .run( ) ; //<---NOT threadsave.. exit( 0 ) ; } @@ -382,6 +382,8 @@ void Win_GParted::Refresh_OptionMenu( ) } menu_devices .show_all_children(); + + optionmenu_devices .set_history( current_device ) ; } void Win_GParted::Show_Pulsebar( ) @@ -710,17 +712,11 @@ void Win_GParted::menu_gparted_refresh_devices() Show_Pulsebar( ) ; - Refresh_OptionMenu( ) ; - //check if current_device is still available (think about hotpluggable shit like usbdevices) if ( current_device >= devices .size( ) ) - current_device = 0 ; - - //rebuild visualdisk and treeview - Refresh_Visual( ); + current_device = 0 ; - //and refresh the device info... - Fill_Label_Device_Info( ) ; + Refresh_OptionMenu( ) ; //show read-only warning if necessary Glib::ustring readonly_paths ; @@ -740,7 +736,6 @@ void Win_GParted::menu_gparted_refresh_devices() str_temp += "\n" ; str_temp += _("Unmount all mounted partitions on a device to get full access.") ; - Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true ) ; dialog.run( ) ; }