Removed the ugly Get_Highest_Logical_Busy() from Device and added a
* include/Device.h, src/Device.cc, src/GParted_Core.cc, src/Win_GParted.cc: Removed the ugly Get_Highest_Logical_Busy() from Device and added a classvariable instead. This one is set in GParted_Core and used wherever needed. I also removed Device::busy, and used the new variable to check if a device is busy.
This commit is contained in:
parent
174f0cff77
commit
e5d2cb0eb7
|
@ -1,3 +1,11 @@
|
|||
2004-12-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Device.h,
|
||||
src/Device.cc,
|
||||
src/GParted_Core.cc,
|
||||
src/Win_GParted.cc: Removed the ugly Get_Highest_Logical_Busy() from Device and added a classvariable instead. This one is set in
|
||||
GParted_Core and used wherever needed. I also removed Device::busy, and used the new variable to check if a device is busy.
|
||||
|
||||
2004-12-27 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* Added cylsize to Device and made Operation contain a Device instead of only the path and lenght.
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
~Device( ) ;
|
||||
|
||||
void Reset( ) ;
|
||||
int Get_Highest_Logical_Busy( ) ;
|
||||
|
||||
std::vector<Partition> device_partitions ;
|
||||
Sector length;
|
||||
|
@ -44,7 +43,7 @@ public:
|
|||
Glib::ustring realpath;
|
||||
Glib::ustring disktype;
|
||||
int max_prims ;
|
||||
bool busy ;
|
||||
int highest_busy ;
|
||||
bool readonly ;
|
||||
|
||||
private:
|
||||
|
|
|
@ -31,25 +31,8 @@ void Device::Reset( )
|
|||
length = 0 ;
|
||||
heads = sectors = cylinders = cylsize = 0 ;
|
||||
model = path = realpath = disktype = "" ;
|
||||
max_prims = 0 ;
|
||||
busy = readonly = false ;
|
||||
}
|
||||
|
||||
int Device::Get_Highest_Logical_Busy( )
|
||||
{
|
||||
int highest_logic_busy = -1 ;
|
||||
|
||||
for ( unsigned int t = 0 ; t < device_partitions .size( ) ; t++ )
|
||||
if ( device_partitions [ t ] .type == GParted::EXTENDED )
|
||||
{
|
||||
for ( unsigned int i = 0 ; i < device_partitions[ t ] .logicals .size( ) ; i++ )
|
||||
if ( device_partitions[ t ] .logicals[ i ] .busy && device_partitions[ t ] .logicals[ i ] .partition_number > highest_logic_busy )
|
||||
highest_logic_busy = device_partitions[ t ] .logicals[ i ] .partition_number ;
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return highest_logic_busy ;
|
||||
max_prims = highest_busy = 0 ;
|
||||
readonly = false ;
|
||||
}
|
||||
|
||||
Device::~Device( )
|
||||
|
|
|
@ -107,7 +107,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
|||
|
||||
set_device_partitions( temp_device ) ;
|
||||
|
||||
if ( temp_device .busy )
|
||||
if ( temp_device .highest_busy )
|
||||
{
|
||||
temp_device .readonly = ! ped_disk_commit_to_os( disk ) ;
|
||||
sleep( 1 ) ;//this sucks, but it seems that after the commit test, the paths are removed and added again (which takes time..)
|
||||
|
@ -184,8 +184,8 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
|
||||
partition_temp .flags = Get_Flags( c_partition ) ;
|
||||
|
||||
if ( partition_temp .busy )
|
||||
device .busy = true ;
|
||||
if ( partition_temp .busy && partition_temp .partition_number > device .highest_busy )
|
||||
device .highest_busy = partition_temp .partition_number ;
|
||||
|
||||
break ;
|
||||
|
||||
|
|
|
@ -948,7 +948,7 @@ void Win_GParted::activate_delete()
|
|||
//it seems best to check for this and prohibit deletion with some explanation to the user.
|
||||
if ( selected_partition .type == GParted::LOGICAL &&
|
||||
selected_partition .status != GParted::STAT_NEW &&
|
||||
selected_partition .partition_number < devices [ current_device ] .Get_Highest_Logical_Busy( ) )
|
||||
selected_partition .partition_number < devices [ current_device ] .highest_busy )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += _( "Unable to delete partition!") ;
|
||||
|
@ -1156,7 +1156,7 @@ void Win_GParted::activate_apply( )
|
|||
//find out if any of the involved devices is busy
|
||||
bool any_busy = false ;
|
||||
for ( unsigned int t = 0; t < devices .size( ) && ! any_busy; t++ )
|
||||
if ( devices[ t ] .busy )
|
||||
if ( devices[ t ] .highest_busy )
|
||||
for (unsigned int i = 0; i < operations .size( ) && ! any_busy; i++ )
|
||||
if ( operations[ i ] .device .path == devices[ t ] .path )
|
||||
any_busy = true ;
|
||||
|
|
Loading…
Reference in New Issue