disable treeview and graphical partition display at scantime fixed two
* src/Win_GParted.cc: disable treeview and graphical partition display at scantime * src/GParted_Core.cc: fixed two (potential) problems with device detection.
This commit is contained in:
parent
0f29376e99
commit
15604e46c0
|
@ -1,3 +1,8 @@
|
||||||
|
2005-12-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* src/Win_GParted.cc: disable treeview and graphical partition display at scantime
|
||||||
|
* src/GParted_Core.cc: fixed two (potential) problems with device detection.
|
||||||
|
|
||||||
2005-12-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2005-12-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* src/GParted_Core.cc: because lp_partition didn't get initialized the
|
* src/GParted_Core.cc: because lp_partition didn't get initialized the
|
||||||
|
|
|
@ -73,32 +73,35 @@ void GParted_Core::find_supported_filesystems( )
|
||||||
|
|
||||||
void GParted_Core::get_devices( std::vector<Device> & devices )
|
void GParted_Core::get_devices( std::vector<Device> & devices )
|
||||||
{
|
{
|
||||||
devices .clear( ) ;
|
devices .clear() ;
|
||||||
|
|
||||||
//try to find all available devices and put these in a list
|
//try to find all available devices and put these in a list
|
||||||
ped_device_probe_all( );
|
ped_device_probe_all();
|
||||||
|
|
||||||
Device temp_device ;
|
Device temp_device ;
|
||||||
std::vector <Glib::ustring> device_paths ;
|
std::vector<Glib::ustring> device_paths ;
|
||||||
|
|
||||||
lp_device = ped_device_get_next( NULL );
|
lp_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 ( lp_device && strlen( lp_device ->path ) > 6 && static_cast<Glib::ustring>( lp_device ->path ) .is_ascii( ) )
|
while ( lp_device )
|
||||||
{
|
{
|
||||||
if ( open_device( lp_device ->path ) )
|
if ( strlen( lp_device ->path ) > 6 &&
|
||||||
|
static_cast<Glib::ustring>( lp_device ->path ) .is_ascii() &&
|
||||||
|
open_device( lp_device ->path )
|
||||||
|
)
|
||||||
device_paths .push_back( get_short_path( lp_device ->path ) ) ;
|
device_paths .push_back( get_short_path( lp_device ->path ) ) ;
|
||||||
|
|
||||||
lp_device = ped_device_get_next( lp_device ) ;
|
lp_device = ped_device_get_next( lp_device ) ;
|
||||||
}
|
}
|
||||||
close_device_and_disk( ) ;
|
close_device_and_disk() ;
|
||||||
|
|
||||||
for ( unsigned int t = 0 ; t < device_paths .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < device_paths .size() ; t++ )
|
||||||
{
|
{
|
||||||
if ( open_device_and_disk( device_paths[ t ], false ) )
|
if ( open_device_and_disk( device_paths[ t ], false ) )
|
||||||
{
|
{
|
||||||
temp_device .Reset( ) ;
|
temp_device .Reset() ;
|
||||||
|
|
||||||
//device info..
|
//device info..
|
||||||
temp_device .path = device_paths[ t ] ;
|
temp_device .path = device_paths[ t ] ;
|
||||||
|
@ -635,23 +638,24 @@ std::vector<Glib::ustring> GParted_Core::get_disklabeltypes( )
|
||||||
|
|
||||||
Glib::ustring GParted_Core::get_short_path( const Glib::ustring & real_path )
|
Glib::ustring GParted_Core::get_short_path( const Glib::ustring & real_path )
|
||||||
{
|
{
|
||||||
int major, minor ;
|
char c_str[255] ;
|
||||||
char resolved_path[255] ;
|
|
||||||
Glib::ustring short_path = real_path ;
|
|
||||||
|
|
||||||
std::string line ;
|
std::string line ;
|
||||||
std::ifstream input( "/proc/partitions" ) ;
|
|
||||||
|
|
||||||
|
temp = real_path ;
|
||||||
|
|
||||||
|
std::ifstream input( "/proc/partitions" ) ;
|
||||||
if ( input )
|
if ( input )
|
||||||
{
|
{
|
||||||
while ( getline( input, line ) )
|
while ( getline( input, line ) )
|
||||||
{
|
{
|
||||||
if ( sscanf( line .c_str(), "%d %d", &major, &minor ) == 2 && minor == 0 )
|
if ( sscanf( line .c_str(), "%*d %*d %*d %255s", c_str ) == 1 )
|
||||||
{
|
{
|
||||||
line = "/dev/" + line .substr( line .find_last_of( ' ', line .length() ) +1 ) ;
|
line = "/dev/" ;
|
||||||
if ( realpath( line .c_str(), resolved_path ) && real_path == resolved_path )
|
line += c_str ;
|
||||||
|
|
||||||
|
if ( realpath( line .c_str(), c_str ) && real_path == c_str )
|
||||||
{
|
{
|
||||||
short_path = resolved_path ;
|
temp = c_str ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -660,7 +664,7 @@ Glib::ustring GParted_Core::get_short_path( const Glib::ustring & real_path )
|
||||||
input .close() ;
|
input .close() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return short_path ;
|
return temp ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GParted_Core::LP_Set_Used_Sectors( Partition & partition )
|
void GParted_Core::LP_Set_Used_Sectors( Partition & partition )
|
||||||
|
|
|
@ -383,7 +383,7 @@ void Win_GParted::Refresh_OptionMenu( )
|
||||||
|
|
||||||
void Win_GParted::Show_Pulsebar( )
|
void Win_GParted::Show_Pulsebar( )
|
||||||
{
|
{
|
||||||
pulsebar ->show( );
|
pulsebar ->show();
|
||||||
statusbar .push( _("Scanning all devices...") ) ;
|
statusbar .push( _("Scanning all devices...") ) ;
|
||||||
|
|
||||||
//disable all input stuff
|
//disable all input stuff
|
||||||
|
@ -391,28 +391,32 @@ void Win_GParted::Show_Pulsebar( )
|
||||||
menubar_main .set_sensitive( false ) ;
|
menubar_main .set_sensitive( false ) ;
|
||||||
optionmenu_devices .set_sensitive( false ) ;
|
optionmenu_devices .set_sensitive( false ) ;
|
||||||
menu_partition .set_sensitive( false ) ;
|
menu_partition .set_sensitive( false ) ;
|
||||||
|
treeview_detail .set_sensitive( false ) ;
|
||||||
|
vbox_visual_disk .set_sensitive( false ) ;
|
||||||
|
|
||||||
//the actual 'pulsing'
|
//the actual 'pulsing'
|
||||||
while ( pulse )
|
while ( pulse )
|
||||||
{
|
{
|
||||||
pulsebar ->pulse( );
|
pulsebar ->pulse();
|
||||||
while ( Gtk::Main::events_pending( ) )
|
while ( Gtk::Main::events_pending() )
|
||||||
Gtk::Main::iteration( );
|
Gtk::Main::iteration();
|
||||||
|
|
||||||
usleep( 10000 );
|
usleep( 10000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
thread ->join( ) ;
|
thread ->join() ;
|
||||||
conn .disconnect( ) ;
|
conn .disconnect() ;
|
||||||
|
|
||||||
pulsebar ->hide( );
|
pulsebar ->hide();
|
||||||
statusbar .pop( ) ;
|
statusbar .pop() ;
|
||||||
|
|
||||||
//enable all disabled stuff
|
//enable all disabled stuff
|
||||||
toolbar_main .set_sensitive( true ) ;
|
toolbar_main .set_sensitive( true ) ;
|
||||||
menubar_main .set_sensitive( true ) ;
|
menubar_main .set_sensitive( true ) ;
|
||||||
optionmenu_devices .set_sensitive( true ) ;
|
optionmenu_devices .set_sensitive( true ) ;
|
||||||
menu_partition .set_sensitive( true ) ;
|
menu_partition .set_sensitive( true ) ;
|
||||||
|
treeview_detail .set_sensitive( true ) ;
|
||||||
|
vbox_visual_disk .set_sensitive( true ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::Fill_Label_Device_Info( bool clear )
|
void Win_GParted::Fill_Label_Device_Info( bool clear )
|
||||||
|
|
Loading…
Reference in New Issue