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>
|
||||
|
||||
* src/GParted_Core.cc: because lp_partition didn't get initialized the
|
||||
|
|
|
@ -85,9 +85,12 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
|||
|
||||
//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 ( 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 ) ) ;
|
||||
|
||||
lp_device = ped_device_get_next( lp_device ) ;
|
||||
|
@ -635,23 +638,24 @@ std::vector<Glib::ustring> GParted_Core::get_disklabeltypes( )
|
|||
|
||||
Glib::ustring GParted_Core::get_short_path( const Glib::ustring & real_path )
|
||||
{
|
||||
int major, minor ;
|
||||
char resolved_path[255] ;
|
||||
Glib::ustring short_path = real_path ;
|
||||
|
||||
char c_str[255] ;
|
||||
std::string line ;
|
||||
std::ifstream input( "/proc/partitions" ) ;
|
||||
|
||||
temp = real_path ;
|
||||
|
||||
std::ifstream input( "/proc/partitions" ) ;
|
||||
if ( input )
|
||||
{
|
||||
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 ) ;
|
||||
if ( realpath( line .c_str(), resolved_path ) && real_path == resolved_path )
|
||||
line = "/dev/" ;
|
||||
line += c_str ;
|
||||
|
||||
if ( realpath( line .c_str(), c_str ) && real_path == c_str )
|
||||
{
|
||||
short_path = resolved_path ;
|
||||
temp = c_str ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +664,7 @@ Glib::ustring GParted_Core::get_short_path( const Glib::ustring & real_path )
|
|||
input .close() ;
|
||||
}
|
||||
|
||||
return short_path ;
|
||||
return temp ;
|
||||
}
|
||||
|
||||
void GParted_Core::LP_Set_Used_Sectors( Partition & partition )
|
||||
|
|
|
@ -391,6 +391,8 @@ void Win_GParted::Show_Pulsebar( )
|
|||
menubar_main .set_sensitive( false ) ;
|
||||
optionmenu_devices .set_sensitive( false ) ;
|
||||
menu_partition .set_sensitive( false ) ;
|
||||
treeview_detail .set_sensitive( false ) ;
|
||||
vbox_visual_disk .set_sensitive( false ) ;
|
||||
|
||||
//the actual 'pulsing'
|
||||
while ( pulse )
|
||||
|
@ -413,6 +415,8 @@ void Win_GParted::Show_Pulsebar( )
|
|||
menubar_main .set_sensitive( true ) ;
|
||||
optionmenu_devices .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 )
|
||||
|
|
Loading…
Reference in New Issue