When ( ! deep_scan ) now only one device is scanned (first found one).

* 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.
This commit is contained in:
Bart Hakvoort 2004-12-03 10:53:01 +00:00
parent 4040901610
commit f18885aa04
3 changed files with 22 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2004-12-03 Bart Hakvoort <gparted@users.sf.net>
* 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 <gparted@users.sf.net> 2004-12-02 Bart Hakvoort <gparted@users.sf.net>
* src/Win_GParted.cc, * src/Win_GParted.cc,

View File

@ -57,20 +57,26 @@ void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
Device temp_device ; Device temp_device ;
std::vector <Glib::ustring> device_paths ; std::vector <Glib::ustring> 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 //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) //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 ) ) if ( open_device( device ->path, device ) )
{
device_paths .push_back( get_sym_path( device ->path ) ) ; 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 ) ; 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( ) ) ; sort( device_paths .begin( ), device_paths .end( ) ) ;

View File

@ -347,16 +347,16 @@ void Win_GParted::Find_Devices( bool deep_scan )
{ {
gparted_core .get_devices( devices, deep_scan ) ; gparted_core .get_devices( devices, deep_scan ) ;
//paranoia check.. :) <---NOT threadsave.. //paranoia check.. :)
if ( devices .empty( ) ) if ( devices .empty( ) )
{ {
str_temp = "<span weight=\"bold\" size=\"larger\">" ; str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += _("No devices were detected") ; str_temp += _("No devices were detected") ;
str_temp += "</span>\n\n" ; str_temp += "</span>\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 ) ; Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ) ;
dialog .run( ) ; dialog .run( ) ; //<---NOT threadsave..
exit( 0 ) ; exit( 0 ) ;
} }
@ -382,6 +382,8 @@ void Win_GParted::Refresh_OptionMenu( )
} }
menu_devices .show_all_children(); menu_devices .show_all_children();
optionmenu_devices .set_history( current_device ) ;
} }
void Win_GParted::Show_Pulsebar( ) void Win_GParted::Show_Pulsebar( )
@ -710,17 +712,11 @@ void Win_GParted::menu_gparted_refresh_devices()
Show_Pulsebar( ) ; Show_Pulsebar( ) ;
Refresh_OptionMenu( ) ;
//check if current_device is still available (think about hotpluggable shit like usbdevices) //check if current_device is still available (think about hotpluggable shit like usbdevices)
if ( current_device >= devices .size( ) ) if ( current_device >= devices .size( ) )
current_device = 0 ; current_device = 0 ;
//rebuild visualdisk and treeview
Refresh_Visual( );
//and refresh the device info... Refresh_OptionMenu( ) ;
Fill_Label_Device_Info( ) ;
//show read-only warning if necessary //show read-only warning if necessary
Glib::ustring readonly_paths ; Glib::ustring readonly_paths ;
@ -740,7 +736,6 @@ void Win_GParted::menu_gparted_refresh_devices()
str_temp += "\n" ; str_temp += "\n" ;
str_temp += _("Unmount all mounted partitions on a device to get full access.") ; 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 ) ; Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true ) ;
dialog.run( ) ; dialog.run( ) ;
} }