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
|
||||||
|
|
|
@ -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
|
//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 ) ;
|
||||||
|
@ -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 )
|
||||||
|
|
|
@ -391,6 +391,8 @@ 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 )
|
||||||
|
@ -413,6 +415,8 @@ void Win_GParted::Show_Pulsebar( )
|
||||||
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